diff --git a/.editorconfig b/.editorconfig index 0deca3d2ab..af1c2ff314 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,7 @@ root = true [*] -end_of_line = crlf +end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = space @@ -10,4 +10,3 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false - diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..3c59efe684 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto +*.png binary +*.jpg binary +*.paa binary diff --git a/.gitignore b/.gitignore index 3f43985cfe..8955ebd8c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ @ace/* +release/* +tools/temp *.cache *.pbo texHeaders.bin diff --git a/AUTHORS.txt b/AUTHORS.txt index 42923c77e5..f9e55823b1 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -88,6 +88,7 @@ Kllrt legman Legolasindar "Viper" licht-im-Norden87 +looter Macusercom MarcBook meat @@ -108,6 +109,7 @@ Riccardo Petricca Robert Boklahánics ruPaladin simon84 +Skengman2 Sniperwolf572 System98 SzwedzikPL diff --git a/README.md b/README.md index 37b5f2a626..99c739980c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

- ACE3 Version + ACE3 Version ACE3 Issues diff --git a/ace_advanced_ballistics.dll b/ace_advanced_ballistics.dll index 0a3d2366f1..705a90b2ef 100644 Binary files a/ace_advanced_ballistics.dll and b/ace_advanced_ballistics.dll differ diff --git a/ace_break_line.dll b/ace_break_line.dll index 812455aa6b..8fc92175fe 100644 Binary files a/ace_break_line.dll and b/ace_break_line.dll differ diff --git a/ace_clipboard.dll b/ace_clipboard.dll index a21c2da4ab..8cf6744964 100644 Binary files a/ace_clipboard.dll and b/ace_clipboard.dll differ diff --git a/ace_fcs.dll b/ace_fcs.dll index f732a8ca03..9c2a871b3d 100644 Binary files a/ace_fcs.dll and b/ace_fcs.dll differ diff --git a/ace_medical.dll b/ace_medical.dll index 0091bc67bd..f85f1bc974 100644 Binary files a/ace_medical.dll and b/ace_medical.dll differ diff --git a/ace_parse_imagepath.dll b/ace_parse_imagepath.dll index 2235393dd4..f252410bcd 100644 Binary files a/ace_parse_imagepath.dll and b/ace_parse_imagepath.dll differ diff --git a/addons/advanced_ballistics/CfgVehicles.hpp b/addons/advanced_ballistics/CfgVehicles.hpp index 27ccb2377b..804a6e9236 100644 --- a/addons/advanced_ballistics/CfgVehicles.hpp +++ b/addons/advanced_ballistics/CfgVehicles.hpp @@ -3,7 +3,7 @@ class CfgVehicles { class GVAR(ModuleSettings): ACE_Module { scope = 2; displayName = CSTRING(DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Wind_ca.paa); category = "ACE"; function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 2a9f6c3eb6..96aef4a93d 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -5,7 +5,7 @@ GVAR(currentbulletID) = -1; GVAR(Protractor) = false; -GVAR(ProtractorStart) = ACE_time; +GVAR(ProtractorStart) = CBA_missionTime; GVAR(allBullets) = []; GVAR(currentGrid) = 0; @@ -24,7 +24,7 @@ if (!GVAR(extensionAvailable)) exitWith { if (!hasInterface) exitWith {}; -["SettingsInitialized", { +["ace_settingsInitialized", { //If not enabled, dont't add PFEH if (!GVAR(enabled)) exitWith {}; @@ -32,8 +32,8 @@ if (!hasInterface) exitWith {}; [] call FUNC(initializeTerrainExtension); // Register fire event handler - ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); - ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerNonLocal", DFUNC(handleFired)] call CBA_fnc_addEventHandler; //Add warnings for missing compat PBOs (only if AB is on) { @@ -50,7 +50,7 @@ if (!hasInterface) exitWith {}; ["iansky_opt","ace_compat_sma3_iansky"], ["R3F_Armes","ace_compat_r3f"] ]; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; #ifdef DEBUG_MODE_FULL call FUNC(diagnoseWeapons); diff --git a/addons/advanced_ballistics/config.cpp b/addons/advanced_ballistics/config.cpp index 3f974b18df..488b812fc6 100644 --- a/addons/advanced_ballistics/config.cpp +++ b/addons/advanced_ballistics/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_ballistics", "ace_weather"}; - author[] = {"Ruthberg"}; - authorUrl = "https://github.com/ulteq"; + author = ECSTRING(common,ACETeam); + authors[] = {"Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 8ff21e60cc..528b3e2e97 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -3,10 +3,10 @@ * * Displays a protractor in the top left corner of the screen * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Public: No @@ -43,13 +43,13 @@ GVAR(Protractor) = true; __ctrl1 ctrlSetScale 1; __ctrl1 ctrlCommit 0; - __ctrl1 ctrlSetText QUOTE(PATHTOF(UI\protractor.paa)); + __ctrl1 ctrlSetText QPATHTOF(UI\protractor.paa); __ctrl1 ctrlSetTextColor [1, 1, 1, 1]; __ctrl2 ctrlSetScale 1; __ctrl2 ctrlSetPosition [SafeZoneX + 0.001, SafeZoneY - 0.001 - 0.1074 * (-0.86 max ((ACE_player weaponDirection currentWeapon ACE_player) select 2) min 0.86), 0.2, 0.2 * 4/3]; __ctrl2 ctrlCommit 0; - __ctrl2 ctrlSetText QUOTE(PATHTOF(UI\protractor_marker.paa)); + __ctrl2 ctrlSetText QPATHTOF(UI\protractor_marker.paa); __ctrl2 ctrlSetTextColor [1, 1, 1, 1]; }, 0.1, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf index fc8dc1b8a2..6bc6e234ae 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -private _aceTimeSecond = floor ACE_time; +private _aceTimeSecond = floor CBA_missionTime; { private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"]; @@ -31,7 +31,7 @@ private _aceTimeSecond = floor ACE_time; drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""]; }; - call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]); + call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, CBA_missionTime - _aceTimeSecond]); }; nil } count +GVAR(allBullets); diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 7844e8a53a..7085224771 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -110,8 +110,8 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; -_aceTimeSecond = floor ACE_time; -"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; +_aceTimeSecond = floor CBA_missionTime; +"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, CBA_missionTime - _aceTimeSecond]; GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 25562a71d0..9fed872a6b 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -18,7 +18,7 @@ if (!GVAR(extensionAvailable)) exitWith {}; private ["_initStartTime", "_mapSize", "_mapGrids", "_gridCells", "_x", "_y", "_gridCenter", "_gridHeight", "_gridNumObjects", "_gridSurfaceIsWater"]; -_initStartTime = ACE_time; +_initStartTime = CBA_missionTime; _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize"); if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { @@ -38,7 +38,7 @@ GVAR(currentGrid) = 0; if (GVAR(currentGrid) >= _gridCells) exitWith { #ifdef DEBUG_MODE_FULL - systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(ACE_time - _initStartTime)]; + systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", ceil(CBA_missionTime - _initStartTime)]; #endif [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index 47af939863..bc8baa3121 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT advanced_ballistics +#define COMPONENT_BEAUTIFIED Advanced Ballistics #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml index 718057a5b4..b3399357c3 100644 --- a/addons/advanced_ballistics/stringtable.xml +++ b/addons/advanced_ballistics/stringtable.xml @@ -68,7 +68,7 @@ Für Scharfschützen aktiviert Povoleno pro odstřelovače Ativar para caçadores - Activer pour les snipers + Activé pour les snipers Mesterlövészeknek engedélyezve Включена для снайперов Abilita per Tiratori Scelti @@ -92,7 +92,7 @@ Für Gruppenmitglieder aktiviert Povoleno pro členy skupiny Ativada para membros do grupo - Activer pour les membres du groupe + Activé pour les membres groupés Csoporttagoknak engedélyezve Включена для группы Abilita per Membri del Gruppo @@ -116,7 +116,7 @@ Für jeden aktiviert Povoleno pro všechny Ativada para todos - Activer pour tout le monde + Activé pour tout le monde Mindenkinek engedélyezve Включена для всех Abilita per tutti @@ -164,7 +164,7 @@ Beim vollautomatischen Feuern deaktiviert Zakázáno v automatickém režimu střelby Desabilitar no modo automático - Désactiver en mode rafale libre + Désactiver en mode automatique Automata módban letiltva Выкл. для автомат. режима Disabilita in modalità di fuoco automatico @@ -176,7 +176,7 @@ Deaktiviert die erweiterte Ballistik beim vollautomatischen Feuern Zákáže pokročilou balistiku během střelby v režimu automat Desabilitar a balística avançada durante fogo automático - Désactive la balistique avancée pour les tirs en rafale libre + Désactive la balistique avancée pour les tirs en automatique Letiltja a fejlett ballisztikát automata tüzelés folyamán Выключает продвинутую баллистику при стрельбе в полностью автоматическом режиме Disabilita Balistica Avanzata durante fuoco automatico @@ -188,7 +188,7 @@ Simulation der Munitionstemperatur aktivieren Povolit simulaci teploty munice Ativar simulação de temperatura de munição - Activer la simulation de la température + Active la simulation de la température Lőszer-hő szimuláció engedélyezése Симуляция температуры для боеприпасов Abilita simulazione della temperatura delle munizioni @@ -236,7 +236,7 @@ Geschossspureffekt aktivieren Povolit efekt trasírek Ativa efeito traçante de projétil - Activer l'effet traçante + Activer l'effet balle traçante Nyomkövető-effekt engedélyezése Следы пуль Abilita effetto di tracciatura dei proiettili @@ -307,11 +307,11 @@ Moduł ten pozwala aktywować zaawansowaną balistykę biorącą przy obliczeniach trajektorii lotu pocisku pod uwagę takie rzeczy jak temperatura powietrza, ciśnienie atmosferyczne, wilgotność powietrza, siły Coriolisa i Eotvosa, grawitację a także broń z jakiej wykonywany jest strzał oraz rodzaj amunicji. Wszystko to sprowadza się na bardzo dokładne odwzorowanie balistyki. Tento modul umožňuje aktivovat pokročilou balistiku, která vypočítává trajektorii kulky a bere do úvahy věci jako je teplota vzduchu, atmosférický tlak, vlhkost vzduchu, gravitaci, typ munice a zbraň, ze které je náboj vystřelen. To vše přispívá k velmi přesné balistice. Este módulo permite que você ative cálculos de balística avançada, fazendo a trajetória do projétil levar em consideração coisas como temperatura do ar, pressão atmosférica, umidade, força de Coriolis, a gravidade, o modelo da arma no qual o disparo é realizado e o tipo de munição. Tudo isso acrescenta-se a um balística muito precisa. - Ce module active la simulation de balistique avancée - ie les projectiles sont influencés par des varibles comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelle ils sont tirés. + Ce module active la simulation de balistique avancée - les projectiles sont influencés par des variables comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelles ils sont tirés. Ez a modul engedélyezi a fejlett ballisztikai szimulációt - a lövedékek röppályáját befolyásolni fogja a levegő hőmérséklete, légnyomás, páratartalom, gravitáció, a lövedék fajtája, valamint a fegyver, amiből kilőtték a lövedéket. Этот модуль включает симуляцию продвинутой баллистики - при этом на траекторию полета снаряда влияют различные параметры, такие как температура воздуха, атмосферное давление, влажность, гравитация, тип боеприпаса и оружия, из которого произвели выстрел. Este módulo permite la simulación balística avanzada - es decir, la trayectoria de los proyectiles está influenciada por variables como la temperatura del aire, la presión atmosférica, la humedad, la gravedad, el tipo de municiones y el arma desde el que fue disparada. Questo modulo abilita la simulazione della Balistica Avanzata - cioè la traiettoria dei proiettili è influenzata da variabili come la temperatura dell'aria, pressione atmosferica, umidità, gravità, il tipo di munizione e l'arma da cui è sparata - + \ No newline at end of file diff --git a/addons/ai/config.cpp b/addons/ai/config.cpp index fdcb6afe9d..60bf7184a4 100644 --- a/addons/ai/config.cpp +++ b/addons/ai/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","commy2"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/ai/script_component.hpp b/addons/ai/script_component.hpp index 0910bf6472..08d24079ba 100644 --- a/addons/ai/script_component.hpp +++ b/addons/ai/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT ai +#define COMPONENT_BEAUTIFIED AI #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_AI #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/aircraft/Heli_Attack_01_base_F.hpp b/addons/aircraft/Heli_Attack_01_base_F.hpp index a6868033e6..f56cda1fd8 100644 --- a/addons/aircraft/Heli_Attack_01_base_F.hpp +++ b/addons/aircraft/Heli_Attack_01_base_F.hpp @@ -1,997 +1,997 @@ -class Heli_Attack_01_base_F: Helicopter_Base_F { - lockDetectionSystem = 12; - incomingMissileDetectionSystem = 16; - driverCanEject = 1; - - class MFD - { - class AirplaneHUD - { - class Bones{}; - class Draw{}; - topLeft = "HUD_top_left"; - topRight = "HUD_top_right"; - bottomLeft = "HUD_bottom_left"; - borderLeft = 0; - borderRight = 0; - borderTop = 0; - borderBottom = 0; - color[] = {0.15,1,0.15,1}; - enableParallax = 0; - helmetMountedDisplay = 1; - helmetPosition[] = {0,0,0}; - helmetRight[] = {0,0,0}; - helmetDown[] = {0,0,0}; - }; - class ACE_HUD_1 - { - topLeft = "HUD_top_left"; - topRight = "HUD_top_right"; - bottomLeft = "HUD_bottom_left"; - borderLeft = 0; - borderRight = 0; - borderTop = 0; - borderBottom = 0; - color[] = {0.15,1,0.15,1}; - enableParallax = 0; - class Bones - { - class GunnerAim - { - type = "vector"; - source = "weapon"; - pos0[] = {0.5,"0.9 - 0.04 + 0.012"}; - pos10[] = {"0.5 + 0.0111","0.9 - 0.04 + 0.012 + 0.0133"}; - }; - class Target - { - source = "target"; - type = "vector"; - pos0[] = {0.5,0.5}; - pos10[] = {0.85,0.85}; - }; - class Velocity - { - type = "vector"; - source = "velocity"; - pos0[] = {0.5,0.5}; - pos10[] = {0.65,0.65}; - }; - class Velocity_slip - { - type = "vector"; - source = "velocity"; - pos0[] = {0.5,0.845}; - pos10[] = {0.53,0.845}; - }; - class VspeedBone - { - type = "linear"; - source = "vspeed"; - sourceScale = 1; - min = -10; - max = 10; - minPos[] = {0.93,0.2}; - maxPos[] = {0.93,0.8}; - }; - class RadarAltitudeBone - { - type = "linear"; - source = "altitudeAGL"; - sourceScale = 1; - min = 0; - max = 60; - minPos[] = {0.965,0.2}; - maxPos[] = {0.965,0.8}; - }; - class HorizonBankRot - { - type = "rotational"; - source = "horizonBank"; - center[] = {0.5,0.5}; - min = -3.1416; - max = 3.1416; - minAngle = -180; - maxAngle = 180; - aspectRatio = 1; - }; - class ForwardVec - { - type = "vector"; - source = "forward"; - pos0[] = {0,0}; - pos10[] = {0.25,0.25}; - }; - class WeaponAim - { - type = "vector"; - source = "weapon"; - pos0[] = {0.5,0.5}; - pos10[] = {0.75,0.75}; - }; - class Level0 - { - type = "horizon"; - pos0[] = {0.5,0.5}; - pos10[] = {0.78,0.78}; - angle = 0; - }; - class LevelP5: Level0 - { - angle = 5; - }; - class LevelM5: Level0 - { - angle = -5; - }; - class LevelP10: Level0 - { - angle = 10; - }; - class LevelM10: Level0 - { - angle = -10; - }; - class LevelP15: Level0 - { - angle = 15; - }; - class LevelM15: Level0 - { - angle = -15; - }; - class LevelP20: Level0 - { - angle = 20; - }; - class LevelM20: Level0 - { - angle = -20; - }; - class LevelP25: Level0 - { - angle = 25; - }; - class LevelM25: Level0 - { - angle = -25; - }; - class LevelP30: Level0 - { - angle = 30; - }; - class LevelM30: Level0 - { - angle = -30; - }; - class LevelP35: Level0 - { - angle = 35; - }; - class LevelM35: Level0 - { - angle = -35; - }; - class LevelP40: Level0 - { - angle = 40; - }; - class LevelM40: Level0 - { - angle = -40; - }; - class LevelP45: Level0 - { - angle = 45; - }; - class LevelM45: Level0 - { - angle = -45; - }; - class LevelP50: Level0 - { - angle = 50; - }; - class LevelM50: Level0 - { - angle = -50; - }; - }; - class Draw - { - color[] = {0.18,1,0.18}; - alpha = 1; - condition = "on"; - class Horizont - { - clipTL[] = {0.15,0.15}; - clipBR[] = {0.85,0.85}; - class Dimmed - { - class Level0 - { - type = "line"; - points[] = {{ "Level0",{ -0.42,0 },1 },{ "Level0",{ -0.38,0 },1 },{ },{ "Level0",{ -0.37,0 },1 },{ "Level0",{ -0.33,0 },1 },{ },{ "Level0",{ -0.32,0 },1 },{ "Level0",{ -0.28,0 },1 },{ },{ "Level0",{ -0.27,0 },1 },{ "Level0",{ -0.23,0 },1 },{ },{ "Level0",{ -0.22,0 },1 },{ "Level0",{ -0.18,0 },1 },{ },{ "Level0",{ -0.17,0 },1 },{ "Level0",{ -0.13,0 },1 },{ },{ "Level0",{ -0.12,0 },1 },{ "Level0",{ -0.08,0 },1 },{ },{ "Level0",{ 0.42,0 },1 },{ "Level0",{ 0.38,0 },1 },{ },{ "Level0",{ 0.37,0 },1 },{ "Level0",{ 0.33,0 },1 },{ },{ "Level0",{ 0.32,0 },1 },{ "Level0",{ 0.28,0 },1 },{ },{ "Level0",{ 0.27,0 },1 },{ "Level0",{ 0.23,0 },1 },{ },{ "Level0",{ 0.22,0 },1 },{ "Level0",{ 0.18,0 },1 },{ },{ "Level0",{ 0.17,0 },1 },{ "Level0",{ 0.13,0 },1 },{ },{ "Level0",{ 0.12,0 },1 },{ "Level0",{ 0.08,0 },1 }}; - }; - }; - }; - class HorizonBankRot - { - type = "line"; - width = 3; - points[] = {{ "HorizonBankRot",{ 0,0.25 },1 },{ "HorizonBankRot",{ -0.01,0.23 },1 },{ "HorizonBankRot",{ 0.01,0.23 },1 },{ "HorizonBankRot",{ 0,0.25 },1 }}; - }; - class Static_HAD_BOX - { - clipTL[] = {0,1}; - clipBR[] = {1,0}; - type = "line"; - width = 5; - points[] = {{ { "0.5-0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9-0.04" },1 },{ },{ { "0.5-0.1","0.9-0.04+0.012" },1 },{ { "0.5-0.092","0.9-0.04+0.012" },1 },{ },{ { "0.5+0.1","0.9-0.04+0.012" },1 },{ { "0.5+0.092","0.9-0.04+0.012" },1 },{ },{ { 0.5,"0.9-0.04" },1 },{ { 0.5,"0.9-0.032" },1 },{ },{ { 0.5,"0.9+0.04" },1 },{ { 0.5,"0.9+0.032" },1 },{ }}; - }; - class Gunner_HAD - { - type = "line"; - width = 6; - points[] = {{ "GunnerAim",{ -0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,0.008 },1 },{ "GunnerAim",{ 0.015,0.008 },1 },{ "GunnerAim",{ 0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,-0.008 },1 }}; - }; - class Slip_ball_group - { - class Slip_bars - { - type = "line"; - width = 4; - points[] = {{ { "0.5-0.018","0.9-0.04" },1 },{ { "0.5-0.018","0.9-0.075" },1 },{ },{ { "0.5+0.018","0.9-0.04" },1 },{ { "0.5+0.018","0.9-0.075" },1 }}; - }; - class Slip_ball - { - type = "line"; - width = 6; - points[] = {{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 }}; - }; - }; - class Centerline - { - type = "line"; - width = 5; - points[] = {{ { 0.5,0.48 },1 },{ { 0.5,0.45 },1 },{ },{ { 0.5,0.52 },1 },{ { 0.5,0.55 },1 },{ },{ { 0.48,0.5 },1 },{ { 0.45,0.5 },1 },{ },{ { 0.52,0.5 },1 },{ { 0.55,0.5 },1 },{ }}; - }; - class WeaponName - { - type = "text"; - source = "weapon"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.86 },1}; - right[] = {{ 0.65,0.86 },1}; - down[] = {{ 0.61,0.9 },1}; - }; - class Ammo_GUN - { - type = "group"; - condition = "mgun"; - class Ammo_count_GUN - { - type = "text"; - source = "ammo"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.89 },1}; - right[] = {{ 0.65,0.89 },1}; - down[] = {{ 0.61,0.93 },1}; - }; - }; - class Ammo_RKT - { - type = "group"; - condition = "rocket"; - class Ammo_count_RKT - { - type = "text"; - source = "ammo"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.89 },1}; - right[] = {{ 0.65,0.89 },1}; - down[] = {{ 0.61,0.93 },1}; - }; - }; - class Ammo_AGM - { - type = "group"; - condition = "AAmissile"; - class Ammo_count_AGM - { - type = "text"; - source = "ammo"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.89 },1}; - right[] = {{ 0.65,0.89 },1}; - down[] = {{ 0.61,0.93 },1}; - }; - }; - class Ammo_AAM - { - type = "group"; - condition = "ATmissile"; - class Ammo_count_AAM - { - type = "text"; - source = "ammo"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.89 },1}; - right[] = {{ 0.65,0.89 },1}; - down[] = {{ 0.61,0.93 },1}; - }; - }; - class Ammo_Bomb - { - type = "group"; - condition = "Bomb"; - class Ammo_count_Bomb - { - type = "text"; - source = "ammo"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.61,0.89 },1}; - right[] = {{ 0.65,0.89 },1}; - down[] = {{ 0.61,0.93 },1}; - }; - }; - class LightsGroup - { - type = "group"; - condition = "lights"; - class LightsText - { - type = "text"; - source = "static"; - text = "LIGHTS"; - align = "right"; - scale = 1; - pos[] = {{ 0.03,"0.53 + 0.055" },1}; - right[] = {{ 0.07,"0.53 + 0.055" },1}; - down[] = {{ 0.03,"0.53 + 0.095" },1}; - }; - }; - class CollisionLightsGroup - { - type = "group"; - condition = "collisionlights"; - class CollisionLightsText - { - type = "text"; - source = "static"; - text = "A-COL"; - align = "right"; - scale = 1; - pos[] = {{ 0.03,"0.53 + 0.105" },1}; - right[] = {{ 0.07,"0.53 + 0.105" },1}; - down[] = {{ 0.03,"0.53 + 0.145" },1}; - }; - }; - class GearGroup - { - type = "group"; - condition = "ils"; - class GearText - { - type = "text"; - source = "static"; - text = "GEAR"; - align = "right"; - scale = 1; - pos[] = {{ 0.03,"0.53 + 0.155" },1}; - right[] = {{ 0.07,"0.53 + 0.155" },1}; - down[] = {{ 0.03,"0.53 + 0.195" },1}; - }; - }; - class ATMissileTOFGroup - { - condition = "ATmissile"; - type = "group"; - class TOFtext - { - type = "text"; - align = "right"; - source = "static"; - text = "TOF="; - scale = 1; - pos[] = {{ 0.61,0.92 },1}; - right[] = {{ 0.65,0.92 },1}; - down[] = {{ 0.61,0.96 },1}; - }; - class TOFnumber - { - type = "text"; - source = "targetDist"; - sourcescale = 0.0025; - align = "right"; - scale = 1; - pos[] = {{ 0.69,0.92 },1}; - right[] = {{ 0.73,0.92 },1}; - down[] = {{ 0.69,0.96 },1}; - }; - }; - class LaserTOFGroup - { - condition = "Bomb"; - type = "group"; - class TOFtext - { - type = "text"; - align = "right"; - source = "static"; - text = "TOF="; - scale = 1; - pos[] = {{ 0.61,0.92 },1}; - right[] = {{ 0.65,0.92 },1}; - down[] = {{ 0.61,0.96 },1}; - }; - class TOFnumber - { - type = "text"; - source = "targetDist"; - sourcescale = 0.0025; - align = "right"; - scale = 1; - pos[] = {{ 0.69,0.92 },1}; - right[] = {{ 0.73,0.92 },1}; - down[] = {{ 0.69,0.96 },1}; - }; - }; - class RocketTOFGroup - { - condition = "Rocket"; - type = "group"; - class TOFtext - { - type = "text"; - align = "right"; - source = "static"; - text = "TOF="; - scale = 1; - pos[] = {{ 0.61,0.92 },1}; - right[] = {{ 0.65,0.92 },1}; - down[] = {{ 0.61,0.96 },1}; - }; - class TOFnumber - { - type = "text"; - source = "targetDist"; - sourcescale = 0.0025; - align = "right"; - scale = 1; - pos[] = {{ 0.69,0.92 },1}; - right[] = {{ 0.73,0.92 },1}; - down[] = {{ 0.69,0.96 },1}; - }; - }; - class RangeNumber - { - type = "text"; - source = "targetDist"; - sourceScale = 1; - align = "left"; - scale = 1; - pos[] = {{ 0.39,0.89 },1}; - right[] = {{ 0.43,0.89 },1}; - down[] = {{ 0.39,0.93 },1}; - }; - class RangeText - { - type = "text"; - source = "static"; - text = "RNG"; - align = "left"; - scale = 1; - pos[] = {{ 0.39,0.86 },1}; - right[] = {{ 0.43,0.86 },1}; - down[] = {{ 0.39,0.9 },1}; - }; - class SpeedNumber - { - type = "text"; - align = "right"; - scale = 1; - source = "speed"; - sourceScale = 3.6; - pos[] = {{ 0.03,0.475 },1}; - right[] = {{ 0.08,0.475 },1}; - down[] = {{ 0.03,0.525 },1}; - }; - class TorqueNumber - { - condition = "simulRTD"; - class Torque_number - { - type = "text"; - align = "left"; - scale = 1; - source = "rtdRotorTorque"; - sourceScale = 290; - pos[] = {{ 0.065,0.175 },1}; - right[] = {{ 0.115,0.175 },1}; - down[] = {{ 0.065,0.225 },1}; - }; - class Torquetext - { - type = "text"; - source = "static"; - text = "%"; - align = "right"; - scale = 1; - pos[] = {{ 0.07,0.175 },1}; - right[] = {{ 0.12,0.175 },1}; - down[] = {{ 0.07,0.225 },1}; - }; - }; - class AltNumber: SpeedNumber - { - align = "right"; - source = "altitudeAGL"; - sourceScale = 1; - pos[] = {{ 0.83,0.475 },1}; - right[] = {{ 0.88,0.475 },1}; - down[] = {{ 0.83,0.525 },1}; - }; - class ASLNumber - { - type = "text"; - source = "altitudeASL"; - sourceScale = 1; - align = "right"; - scale = 1; - pos[] = {{ 0.835,0.18 },1}; - right[] = {{ 0.875,0.18 },1}; - down[] = {{ 0.835,0.22 },1}; - }; - class VspeedScalePosta - { - type = "line"; - width = 5; - points[] = {{ { 0.98,0.2 },1 },{ { 1,0.2 },1 },{ },{ { 0.93,0.2 },1 },{ { 0.95,0.2 },1 },{ },{ { 0.98,0.35 },1 },{ { 1,0.35 },1 },{ },{ { 0.93,0.35 },1 },{ { 0.95,0.35 },1 },{ },{ { 0.94,0.38 },1 },{ { 0.95,0.38 },1 },{ },{ { 0.94,0.41 },1 },{ { 0.95,0.41 },1 },{ },{ { 0.94,0.44 },1 },{ { 0.95,0.44 },1 },{ },{ { 0.94,0.47 },1 },{ { 0.95,0.47 },1 },{ },{ { 0.98,0.5 },1 },{ { 1,0.5 },1 },{ },{ { 0.93,0.5 },1 },{ { 0.95,0.5 },1 },{ },{ { 0.94,0.53 },1 },{ { 0.95,0.53 },1 },{ },{ { 0.94,0.56 },1 },{ { 0.95,0.56 },1 },{ },{ { 0.94,0.59 },1 },{ { 0.95,0.59 },1 },{ },{ { 0.94,0.62 },1 },{ { 0.95,0.62 },1 },{ },{ { 0.98,0.65 },1 },{ { 1,0.65 },1 },{ },{ { 0.93,0.65 },1 },{ { 0.95,0.65 },1 },{ },{ { 0.99,0.68 },1 },{ { 0.98,0.68 },1 },{ },{ { 0.99,0.71 },1 },{ { 0.98,0.71 },1 },{ },{ { 0.99,0.74 },1 },{ { 0.98,0.74 },1 },{ },{ { 0.99,0.77 },1 },{ { 0.98,0.77 },1 },{ },{ { 0.98,0.8 },1 },{ { 1,0.8 },1 },{ },{ { 0.93,0.8 },1 },{ { 0.95,0.8 },1 },{ }}; - }; - class RadarAltitudeBand - { - clipTL[] = {0,0.2}; - clipBR[] = {1,0.8}; - hideValue = 201; - class radarbanda - { - type = "line"; - width = 17; - points[] = {{ "RadarAltitudeBone",{ 0,0 },1 },{ "RadarAltitudeBone",{ 0,0.6 },1 }}; - }; - }; - class VspeedBand - { - type = "line"; - width = 3; - points[] = {{ "VspeedBone",{ -0.01,0 },1 },{ "VspeedBone",{ -0.025,-0.015 },1 },{ "VspeedBone",{ -0.025,0.015 },1 },{ "VspeedBone",{ -0.01,0 },1 },{ }}; - }; - class HeadingNumber: SpeedNumber - { - source = "heading"; - sourceScale = 1; - align = "center"; - pos[] = {{ 0.5,0.045 },1}; - right[] = {{ 0.56,0.045 },1}; - down[] = {{ 0.5,"0.045 + 0.06" },1}; - }; - class Center_box - { - type = "line"; - width = 1.5; - points[] = {{ { 0.45,"0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085 - 0.06" },1 }}; - }; - class HeadingArrow - { - type = "line"; - width = 7; - points[] = {{ { "0.5","0.128 + 0.03" },1 },{ { 0.5,0.128 },1 }}; - }; - class HeadingScale_LEFT - { - clipTL[] = {0,0}; - clipBR[] = {0.45,1}; - class Heading_group - { - type = "scale"; - horizontal = 1; - source = "heading"; - sourceScale = 1; - width = 5; - top = 0.12; - center = 0.5; - bottom = 0.88; - lineXleft = "0.03 + 0.085"; - lineYright = "0.02 + 0.085"; - lineXleftMajor = "0.04 + 0.085"; - lineYrightMajor = "0.02 + 0.085"; - majorLineEach = 3; - numberEach = 3; - step = 10; - stepSize = "0.05"; - align = "center"; - scale = 1; - pos[] = {0.12,"0.0 + 0.065"}; - right[] = {0.16,"0.0 + 0.065"}; - down[] = {0.12,"0.04 + 0.065"}; - }; - }; - class HeadingScale_RIGHT - { - clipTL[] = {0.55,0}; - clipBR[] = {1,1}; - class Heading_group - { - type = "scale"; - horizontal = 1; - source = "heading"; - sourceScale = 1; - width = 5; - top = 0.12; - center = 0.5; - bottom = 0.88; - lineXleft = "0.03 + 0.085"; - lineYright = "0.02 + 0.085"; - lineXleftMajor = "0.04 + 0.085"; - lineYrightMajor = "0.02 + 0.085"; - majorLineEach = 3; - numberEach = 3; - step = 10; - stepSize = "0.05"; - align = "center"; - scale = 1; - pos[] = {0.12,"0.0 + 0.065"}; - right[] = {0.16,"0.0 + 0.065"}; - down[] = {0.12,"0.04 + 0.065"}; - }; - }; - class HeadingScale_BOTTOM - { - clipTL[] = {0.45,"0.02 + 0.085"}; - clipBR[] = {"0.45 + 0.10",1}; - class Heading_group - { - type = "scale"; - horizontal = 1; - source = "heading"; - sourceScale = 1; - width = 5; - top = 0.12; - center = 0.5; - bottom = 0.88; - lineXleft = "0.03 + 0.085"; - lineYright = "0.02 + 0.085"; - lineXleftMajor = "0.04 + 0.085"; - lineYrightMajor = "0.02 + 0.085"; - majorLineEach = 3; - numberEach = 3; - step = 10; - stepSize = "0.05"; - align = "center"; - scale = 1; - pos[] = {0.12,"0.0 + 0.065"}; - right[] = {0.16,"0.0 + 0.065"}; - down[] = {0.12,"0.04 + 0.065"}; - }; - }; - class Fuel_Text - { - type = "text"; - source = "static"; - text = "Fuel"; - align = "right"; - scale = 1; - pos[] = {{ 0.03,0.9 },1}; - right[] = {{ 0.07,0.9 },1}; - down[] = {{ 0.03,0.94 },1}; - }; - class Fuel_Number - { - type = "text"; - source = "fuel"; - sourceScale = 100; - align = "right"; - scale = 1; - pos[] = {{ 0.1,0.9 },1}; - right[] = {{ 0.14,0.9 },1}; - down[] = {{ 0.1,0.94 },1}; - }; - }; - helmetMountedDisplay = 1; - helmetPosition[] = {-0.04,0.04,0.1}; - helmetRight[] = {0.08,0,0}; - helmetDown[] = {0,-0.08,0}; - }; - class ACE_HUD_2 - { - topLeft = "HUD_top_left"; - topRight = "HUD_top_right"; - bottomLeft = "HUD_bottom_left"; - borderLeft = 0; - borderRight = 0; - borderTop = 0; - borderBottom = 0; - color[] = {0.15,1,0.15,1}; - enableParallax = 0; - class Bones - { - class Velocity - { - type = "vector"; - source = "velocity"; - pos0[] = {0.5,0.5}; - pos10[] = {0.75,0.75}; - }; - class ForwardVec1 - { - type = "vector"; - source = "forward"; - pos0[] = {0,0}; - pos10[] = {0.25,0.25}; - }; - class ForwardVec - { - type = "vector"; - source = "forward"; - pos0[] = {0,0}; - pos10[] = {0.253,0.253}; - }; - class WeaponAim - { - type = "vector"; - source = "weapon"; - pos0[] = {0.5,0.5}; - pos10[] = {0.753,0.753}; - }; - class WeaponAim1 - { - type = "vector"; - source = "weapon"; - pos0[] = {0,0}; - pos10[] = {0.253,0.23}; - }; - class Target - { - type = "vector"; - source = "target"; - pos0[] = {0.5,0.5}; - pos10[] = {0.753,0.753}; - }; - class RadarContact - { - type = "fixed"; - pos[] = {0,0}; - }; - }; - class Draw - { - color[] = {0.18,1,0.18}; - alpha = 1; - condition = "on"; - class PlaneMovementCrosshair - { - type = "line"; - width = 7; - points[] = {{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ -0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.04 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 }}; - }; - class Gunner_AIM - { - type = "group"; - class Circle - { - type = "line"; - width = 6; - points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.0475,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.0475,0 },1 }}; - }; - }; - class GunCross - { - condition = "mgun"; - class Circle - { - type = "line"; - width = 9; - points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.05 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.05 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0 },1 },{ }}; - }; - }; - class RocketCross - { - condition = "rocket"; - width = 6; - class Circle - { - type = "line"; - width = 6; - points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.05,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,-0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0.08 },1 },{ }}; - }; - }; - class AT_Aim - { - condition = "ATmissile"; - width = 2; - class Circle - { - type = "line"; - width = 2; - points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 }}; - }; - }; - class AA_aim - { - condition = "AAmissile"; - class Circle - { - type = "line"; - width = 2.5; - points[] = {{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 }}; - }; - }; - class TargetACQ - { - type = "line"; - width = 2; - points[] = {{ "ForwardVec",1,"target",{ 0,-0.06 },1 },{ "ForwardVec",1,"target",{ 0,-0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.05 },1 },{ "ForwardVec",1,"target",{ 0,-0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.04 },1 },{ "ForwardVec",1,"target",{ 0,-0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.03 },1 },{ "ForwardVec",1,"target",{ 0,-0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.02 },1 },{ "ForwardVec",1,"target",{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.01 },1 },{ "ForwardVec",1,"target",{ 0,-0.005 },1 },{ },{ "ForwardVec",1,"target",{ 0,0 },1 },{ "ForwardVec",1,"target",{ 0,0 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.06 },1 },{ "ForwardVec",1,"target",{ 0,0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.05 },1 },{ "ForwardVec",1,"target",{ 0,0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.04 },1 },{ "ForwardVec",1,"target",{ 0,0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.03 },1 },{ "ForwardVec",1,"target",{ 0,0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.02 },1 },{ "ForwardVec",1,"target",{ 0,0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.01 },1 },{ "ForwardVec",1,"target",{ 0,0.005 },1 },{ },{ "ForwardVec",1,"target",{ -0.06,0 },1 },{ "ForwardVec",1,"target",{ -0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.05,0 },1 },{ "ForwardVec",1,"target",{ -0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.04,0 },1 },{ "ForwardVec",1,"target",{ -0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.03,0 },1 },{ "ForwardVec",1,"target",{ -0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.02,0 },1 },{ "ForwardVec",1,"target",{ -0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.01,0 },1 },{ "ForwardVec",1,"target",{ -0.005,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.06,0 },1 },{ "ForwardVec",1,"target",{ 0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.05,0 },1 },{ "ForwardVec",1,"target",{ 0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.04,0 },1 },{ "ForwardVec",1,"target",{ 0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.03,0 },1 },{ "ForwardVec",1,"target",{ 0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.02,0 },1 },{ "ForwardVec",1,"target",{ 0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.01,0 },1 },{ "ForwardVec",1,"target",{ 0.005,0 },1 },{ }}; - }; - class RadarTargets - { - type = "radar"; - pos0[] = {0.5,0.5}; - pos10[] = {0.753,0.753}; - width = 2.5; - points[] = {{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 }}; - }; - }; - helmetMountedDisplay = 1; - helmetPosition[] = {-0.035,0.035,0.1}; - helmetRight[] = {0.07,0,0}; - helmetDown[] = {0,-0.07,0}; - }; - }; - - class Turrets: Turrets { - class MainTurret: MainTurret { - weapons[] = {"ACE_gatling_20mm_Comanche","missiles_DAGR","missiles_ASRAAM", "ACE_AIR_SAFETY"}; - magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; - - outGunnerMayFire = 1; - commanding = -1; - primaryGunner = 1; - gunnerOpticsModel = ""; - gunnerOpticsEffect[] = {"TankCommanderOptics1"}; - gunnerForceOptics = 0; - turretInfoType = "Rsc_ACE_Helo_UI_Turret"; - showAllTargets = 2; - discretedistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000}; - discretedistanceinitindex = 3; - copilotHasFlares = 1; - directionStabilized = 1; - isCopilot = 1; - showHMD = 1; - CanEject = 1; - startEngine = 0; - minElev = -51; - maxElev = 9; - initElev = 6; - minTurn = -120; - maxTurn = 120; - initTurn = 0; - - class OpticsIn - { - delete Narrow; - delete Medium; - delete Wide; - - class ACE_WideUnstabilized { - opticsDisplayName = "W NS"; - initAngleX = 0; - minAngleX = -35; - maxAngleX = 10; - initAngleY = 0; - minAngleY = -100; - maxAngleY = 100; - initFov = 0.466; - minFov = 0.466; - maxFov = 0.466; - visionMode[] = {"Normal","Ti"}; - thermalMode[] = {0,1}; - gunnerOpticsColor[] = {0,0,0,1}; - directionStabilized = 0; - horizontallyStabilized = 1; - gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F"; - }; - class ACE_Wide: ACE_WideUnstabilized { - opticsDisplayName = "W"; - initAngleX = 0; - minAngleX = -35; - maxAngleX = 10; - initAngleY = 0; - minAngleY = -100; - maxAngleY = 100; - initFov = 0.466; - minFov = 0.466; - maxFov = 0.466; - visionMode[] = {"Normal","Ti"}; - thermalMode[] = {0,1}; - gunnerOpticsColor[] = {0,0,0,1}; - directionStabilized = 1; - horizontallyStabilized = 1; - gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F"; - }; - class ACE_Medium: ACE_Wide { - opticsDisplayName = "M"; - initFov = 0.093; - minFov = 0.093; - maxFov = 0.093; - gunnerOpticsColor[] = {0,0,0,1}; - directionStabilized = 1; - horizontallyStabilized = 1; - gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_medium_F"; - }; - class ACE_Narrow: ACE_Wide { - opticsDisplayName = "N"; - initFov = 0.029; - minFov = 0.029; - maxFov = 0.029; - gunnerOpticsColor[] = {0,0,0,1}; - directionStabilized = 1; - horizontallyStabilized = 1; - gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F"; - - }; - class ACE_Narrower: ACE_Wide { - opticsDisplayName = "Z"; - initFov = 0.01; - minFov = 0.01; - maxFov = 0.01; - gunnerOpticsColor[] = {0,0,0,1}; - directionStabilized = 1; - horizontallyStabilized = 1; - gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F"; - - }; - }; - class OpticsOut - { - class Monocular - { - initAngleX = 0; - minAngleX = -30; - maxAngleX = 30; - initAngleY = 0; - minAngleY = -100; - maxAngleY = 100; - initFov = 1.1; - minFov = 0.133; - maxFov = 1.1; - visionMode[] = {"Normal","NVG"}; - gunnerOpticsModel = ""; - gunnerOpticsEffect[] = {}; - hideUnitInfo = 1; - }; - }; - }; - }; - - class AnimationSources: AnimationSources { - class Gatling { - weapon = "ACE_gatling_20mm_Comanche"; - }; - class Muzzle_flash { - weapon = "ACE_gatling_20mm_Comanche"; - }; - }; -}; +class Heli_Attack_01_base_F: Helicopter_Base_F { + lockDetectionSystem = 12; + incomingMissileDetectionSystem = 16; + driverCanEject = 1; + + class MFD + { + class AirplaneHUD + { + class Bones{}; + class Draw{}; + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + helmetMountedDisplay = 1; + helmetPosition[] = {0,0,0}; + helmetRight[] = {0,0,0}; + helmetDown[] = {0,0,0}; + }; + class ACE_HUD_1 + { + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + class Bones + { + class GunnerAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,"0.9 - 0.04 + 0.012"}; + pos10[] = {"0.5 + 0.0111","0.9 - 0.04 + 0.012 + 0.0133"}; + }; + class Target + { + source = "target"; + type = "vector"; + pos0[] = {0.5,0.5}; + pos10[] = {0.85,0.85}; + }; + class Velocity + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.5}; + pos10[] = {0.65,0.65}; + }; + class Velocity_slip + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.845}; + pos10[] = {0.53,0.845}; + }; + class VspeedBone + { + type = "linear"; + source = "vspeed"; + sourceScale = 1; + min = -10; + max = 10; + minPos[] = {0.93,0.2}; + maxPos[] = {0.93,0.8}; + }; + class RadarAltitudeBone + { + type = "linear"; + source = "altitudeAGL"; + sourceScale = 1; + min = 0; + max = 60; + minPos[] = {0.965,0.2}; + maxPos[] = {0.965,0.8}; + }; + class HorizonBankRot + { + type = "rotational"; + source = "horizonBank"; + center[] = {0.5,0.5}; + min = -3.1416; + max = 3.1416; + minAngle = -180; + maxAngle = 180; + aspectRatio = 1; + }; + class ForwardVec + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.25,0.25}; + }; + class WeaponAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.75,0.75}; + }; + class Level0 + { + type = "horizon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.78,0.78}; + angle = 0; + }; + class LevelP5: Level0 + { + angle = 5; + }; + class LevelM5: Level0 + { + angle = -5; + }; + class LevelP10: Level0 + { + angle = 10; + }; + class LevelM10: Level0 + { + angle = -10; + }; + class LevelP15: Level0 + { + angle = 15; + }; + class LevelM15: Level0 + { + angle = -15; + }; + class LevelP20: Level0 + { + angle = 20; + }; + class LevelM20: Level0 + { + angle = -20; + }; + class LevelP25: Level0 + { + angle = 25; + }; + class LevelM25: Level0 + { + angle = -25; + }; + class LevelP30: Level0 + { + angle = 30; + }; + class LevelM30: Level0 + { + angle = -30; + }; + class LevelP35: Level0 + { + angle = 35; + }; + class LevelM35: Level0 + { + angle = -35; + }; + class LevelP40: Level0 + { + angle = 40; + }; + class LevelM40: Level0 + { + angle = -40; + }; + class LevelP45: Level0 + { + angle = 45; + }; + class LevelM45: Level0 + { + angle = -45; + }; + class LevelP50: Level0 + { + angle = 50; + }; + class LevelM50: Level0 + { + angle = -50; + }; + }; + class Draw + { + color[] = {0.18,1,0.18}; + alpha = 1; + condition = "on"; + class Horizont + { + clipTL[] = {0.15,0.15}; + clipBR[] = {0.85,0.85}; + class Dimmed + { + class Level0 + { + type = "line"; + points[] = {{ "Level0",{ -0.42,0 },1 },{ "Level0",{ -0.38,0 },1 },{ },{ "Level0",{ -0.37,0 },1 },{ "Level0",{ -0.33,0 },1 },{ },{ "Level0",{ -0.32,0 },1 },{ "Level0",{ -0.28,0 },1 },{ },{ "Level0",{ -0.27,0 },1 },{ "Level0",{ -0.23,0 },1 },{ },{ "Level0",{ -0.22,0 },1 },{ "Level0",{ -0.18,0 },1 },{ },{ "Level0",{ -0.17,0 },1 },{ "Level0",{ -0.13,0 },1 },{ },{ "Level0",{ -0.12,0 },1 },{ "Level0",{ -0.08,0 },1 },{ },{ "Level0",{ 0.42,0 },1 },{ "Level0",{ 0.38,0 },1 },{ },{ "Level0",{ 0.37,0 },1 },{ "Level0",{ 0.33,0 },1 },{ },{ "Level0",{ 0.32,0 },1 },{ "Level0",{ 0.28,0 },1 },{ },{ "Level0",{ 0.27,0 },1 },{ "Level0",{ 0.23,0 },1 },{ },{ "Level0",{ 0.22,0 },1 },{ "Level0",{ 0.18,0 },1 },{ },{ "Level0",{ 0.17,0 },1 },{ "Level0",{ 0.13,0 },1 },{ },{ "Level0",{ 0.12,0 },1 },{ "Level0",{ 0.08,0 },1 }}; + }; + }; + }; + class HorizonBankRot + { + type = "line"; + width = 3; + points[] = {{ "HorizonBankRot",{ 0,0.25 },1 },{ "HorizonBankRot",{ -0.01,0.23 },1 },{ "HorizonBankRot",{ 0.01,0.23 },1 },{ "HorizonBankRot",{ 0,0.25 },1 }}; + }; + class Static_HAD_BOX + { + clipTL[] = {0,1}; + clipBR[] = {1,0}; + type = "line"; + width = 5; + points[] = {{ { "0.5-0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9+0.04" },1 },{ { "0.5+0.1","0.9-0.04" },1 },{ { "0.5-0.1","0.9-0.04" },1 },{ },{ { "0.5-0.1","0.9-0.04+0.012" },1 },{ { "0.5-0.092","0.9-0.04+0.012" },1 },{ },{ { "0.5+0.1","0.9-0.04+0.012" },1 },{ { "0.5+0.092","0.9-0.04+0.012" },1 },{ },{ { 0.5,"0.9-0.04" },1 },{ { 0.5,"0.9-0.032" },1 },{ },{ { 0.5,"0.9+0.04" },1 },{ { 0.5,"0.9+0.032" },1 },{ }}; + }; + class Gunner_HAD + { + type = "line"; + width = 6; + points[] = {{ "GunnerAim",{ -0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,0.008 },1 },{ "GunnerAim",{ 0.015,0.008 },1 },{ "GunnerAim",{ 0.015,-0.008 },1 },{ "GunnerAim",{ -0.015,-0.008 },1 }}; + }; + class Slip_ball_group + { + class Slip_bars + { + type = "line"; + width = 4; + points[] = {{ { "0.5-0.018","0.9-0.04" },1 },{ { "0.5-0.018","0.9-0.075" },1 },{ },{ { "0.5+0.018","0.9-0.04" },1 },{ { "0.5+0.018","0.9-0.075" },1 }}; + }; + class Slip_ball + { + type = "line"; + width = 6; + points[] = {{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","0.02 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.75","0 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.75","-0.0099999998 * 0.75" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.75","-0.01732 * 0.75" },1 },{ "Velocity_slip",1,{ "0 * 0.75","-0.02 * 0.75" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","0.02 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.6","0 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.6","-0.0099999998 * 0.6" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.6","-0.01732 * 0.6" },1 },{ "Velocity_slip",1,{ "0 * 0.6","-0.02 * 0.6" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","0.02 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.5","0 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.5","-0.0099999998 * 0.5" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.5","-0.01732 * 0.5" },1 },{ "Velocity_slip",1,{ "0 * 0.5","-0.02 * 0.5" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","0.02 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.4","0 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.4","-0.0099999998 * 0.4" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.4","-0.01732 * 0.4" },1 },{ "Velocity_slip",1,{ "0 * 0.4","-0.02 * 0.4" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","0.02 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.30","0 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.30","-0.0099999998 * 0.30" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.30","-0.01732 * 0.30" },1 },{ "Velocity_slip",1,{ "0 * 0.30","-0.02 * 0.30" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","0.02 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.20","0 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.20","-0.0099999998 * 0.20" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.20","-0.01732 * 0.20" },1 },{ "Velocity_slip",1,{ "0 * 0.20","-0.02 * 0.20" },1 },{ },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","0.02 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.02 * 0.1","0 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.01732 * 0.1","-0.0099999998 * 0.1" },1 },{ "Velocity_slip",1,{ "-0.0099999998 * 0.1","-0.01732 * 0.1" },1 },{ "Velocity_slip",1,{ "0 * 0.1","-0.02 * 0.1" },1 }}; + }; + }; + class Centerline + { + type = "line"; + width = 5; + points[] = {{ { 0.5,0.48 },1 },{ { 0.5,0.45 },1 },{ },{ { 0.5,0.52 },1 },{ { 0.5,0.55 },1 },{ },{ { 0.48,0.5 },1 },{ { 0.45,0.5 },1 },{ },{ { 0.52,0.5 },1 },{ { 0.55,0.5 },1 },{ }}; + }; + class WeaponName + { + type = "text"; + source = "weapon"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.86 },1}; + right[] = {{ 0.65,0.86 },1}; + down[] = {{ 0.61,0.9 },1}; + }; + class Ammo_GUN + { + type = "group"; + condition = "mgun"; + class Ammo_count_GUN + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_RKT + { + type = "group"; + condition = "rocket"; + class Ammo_count_RKT + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_AGM + { + type = "group"; + condition = "AAmissile"; + class Ammo_count_AGM + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_AAM + { + type = "group"; + condition = "ATmissile"; + class Ammo_count_AAM + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class Ammo_Bomb + { + type = "group"; + condition = "Bomb"; + class Ammo_count_Bomb + { + type = "text"; + source = "ammo"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.61,0.89 },1}; + right[] = {{ 0.65,0.89 },1}; + down[] = {{ 0.61,0.93 },1}; + }; + }; + class LightsGroup + { + type = "group"; + condition = "lights"; + class LightsText + { + type = "text"; + source = "static"; + text = "LIGHTS"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.055" },1}; + right[] = {{ 0.07,"0.53 + 0.055" },1}; + down[] = {{ 0.03,"0.53 + 0.095" },1}; + }; + }; + class CollisionLightsGroup + { + type = "group"; + condition = "collisionlights"; + class CollisionLightsText + { + type = "text"; + source = "static"; + text = "A-COL"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.105" },1}; + right[] = {{ 0.07,"0.53 + 0.105" },1}; + down[] = {{ 0.03,"0.53 + 0.145" },1}; + }; + }; + class GearGroup + { + type = "group"; + condition = "ils"; + class GearText + { + type = "text"; + source = "static"; + text = "GEAR"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,"0.53 + 0.155" },1}; + right[] = {{ 0.07,"0.53 + 0.155" },1}; + down[] = {{ 0.03,"0.53 + 0.195" },1}; + }; + }; + class ATMissileTOFGroup + { + condition = "ATmissile"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class LaserTOFGroup + { + condition = "Bomb"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class RocketTOFGroup + { + condition = "Rocket"; + type = "group"; + class TOFtext + { + type = "text"; + align = "right"; + source = "static"; + text = "TOF="; + scale = 1; + pos[] = {{ 0.61,0.92 },1}; + right[] = {{ 0.65,0.92 },1}; + down[] = {{ 0.61,0.96 },1}; + }; + class TOFnumber + { + type = "text"; + source = "targetDist"; + sourcescale = 0.0025; + align = "right"; + scale = 1; + pos[] = {{ 0.69,0.92 },1}; + right[] = {{ 0.73,0.92 },1}; + down[] = {{ 0.69,0.96 },1}; + }; + }; + class RangeNumber + { + type = "text"; + source = "targetDist"; + sourceScale = 1; + align = "left"; + scale = 1; + pos[] = {{ 0.39,0.89 },1}; + right[] = {{ 0.43,0.89 },1}; + down[] = {{ 0.39,0.93 },1}; + }; + class RangeText + { + type = "text"; + source = "static"; + text = "RNG"; + align = "left"; + scale = 1; + pos[] = {{ 0.39,0.86 },1}; + right[] = {{ 0.43,0.86 },1}; + down[] = {{ 0.39,0.9 },1}; + }; + class SpeedNumber + { + type = "text"; + align = "right"; + scale = 1; + source = "speed"; + sourceScale = 3.6; + pos[] = {{ 0.03,0.475 },1}; + right[] = {{ 0.08,0.475 },1}; + down[] = {{ 0.03,0.525 },1}; + }; + class TorqueNumber + { + condition = "simulRTD"; + class Torque_number + { + type = "text"; + align = "left"; + scale = 1; + source = "rtdRotorTorque"; + sourceScale = 290; + pos[] = {{ 0.065,0.175 },1}; + right[] = {{ 0.115,0.175 },1}; + down[] = {{ 0.065,0.225 },1}; + }; + class Torquetext + { + type = "text"; + source = "static"; + text = "%"; + align = "right"; + scale = 1; + pos[] = {{ 0.07,0.175 },1}; + right[] = {{ 0.12,0.175 },1}; + down[] = {{ 0.07,0.225 },1}; + }; + }; + class AltNumber: SpeedNumber + { + align = "right"; + source = "altitudeAGL"; + sourceScale = 1; + pos[] = {{ 0.83,0.475 },1}; + right[] = {{ 0.88,0.475 },1}; + down[] = {{ 0.83,0.525 },1}; + }; + class ASLNumber + { + type = "text"; + source = "altitudeASL"; + sourceScale = 1; + align = "right"; + scale = 1; + pos[] = {{ 0.835,0.18 },1}; + right[] = {{ 0.875,0.18 },1}; + down[] = {{ 0.835,0.22 },1}; + }; + class VspeedScalePosta + { + type = "line"; + width = 5; + points[] = {{ { 0.98,0.2 },1 },{ { 1,0.2 },1 },{ },{ { 0.93,0.2 },1 },{ { 0.95,0.2 },1 },{ },{ { 0.98,0.35 },1 },{ { 1,0.35 },1 },{ },{ { 0.93,0.35 },1 },{ { 0.95,0.35 },1 },{ },{ { 0.94,0.38 },1 },{ { 0.95,0.38 },1 },{ },{ { 0.94,0.41 },1 },{ { 0.95,0.41 },1 },{ },{ { 0.94,0.44 },1 },{ { 0.95,0.44 },1 },{ },{ { 0.94,0.47 },1 },{ { 0.95,0.47 },1 },{ },{ { 0.98,0.5 },1 },{ { 1,0.5 },1 },{ },{ { 0.93,0.5 },1 },{ { 0.95,0.5 },1 },{ },{ { 0.94,0.53 },1 },{ { 0.95,0.53 },1 },{ },{ { 0.94,0.56 },1 },{ { 0.95,0.56 },1 },{ },{ { 0.94,0.59 },1 },{ { 0.95,0.59 },1 },{ },{ { 0.94,0.62 },1 },{ { 0.95,0.62 },1 },{ },{ { 0.98,0.65 },1 },{ { 1,0.65 },1 },{ },{ { 0.93,0.65 },1 },{ { 0.95,0.65 },1 },{ },{ { 0.99,0.68 },1 },{ { 0.98,0.68 },1 },{ },{ { 0.99,0.71 },1 },{ { 0.98,0.71 },1 },{ },{ { 0.99,0.74 },1 },{ { 0.98,0.74 },1 },{ },{ { 0.99,0.77 },1 },{ { 0.98,0.77 },1 },{ },{ { 0.98,0.8 },1 },{ { 1,0.8 },1 },{ },{ { 0.93,0.8 },1 },{ { 0.95,0.8 },1 },{ }}; + }; + class RadarAltitudeBand + { + clipTL[] = {0,0.2}; + clipBR[] = {1,0.8}; + hideValue = 201; + class radarbanda + { + type = "line"; + width = 17; + points[] = {{ "RadarAltitudeBone",{ 0,0 },1 },{ "RadarAltitudeBone",{ 0,0.6 },1 }}; + }; + }; + class VspeedBand + { + type = "line"; + width = 3; + points[] = {{ "VspeedBone",{ -0.01,0 },1 },{ "VspeedBone",{ -0.025,-0.015 },1 },{ "VspeedBone",{ -0.025,0.015 },1 },{ "VspeedBone",{ -0.01,0 },1 },{ }}; + }; + class HeadingNumber: SpeedNumber + { + source = "heading"; + sourceScale = 1; + align = "center"; + pos[] = {{ 0.5,0.045 },1}; + right[] = {{ 0.56,0.045 },1}; + down[] = {{ 0.5,"0.045 + 0.06" },1}; + }; + class Center_box + { + type = "line"; + width = 1.5; + points[] = {{ { 0.45,"0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085 - 0.06" },1 },{ { "0.45 + 0.10","0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085" },1 },{ { 0.45,"0.02 + 0.085 - 0.06" },1 }}; + }; + class HeadingArrow + { + type = "line"; + width = 7; + points[] = {{ { "0.5","0.128 + 0.03" },1 },{ { 0.5,0.128 },1 }}; + }; + class HeadingScale_LEFT + { + clipTL[] = {0,0}; + clipBR[] = {0.45,1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class HeadingScale_RIGHT + { + clipTL[] = {0.55,0}; + clipBR[] = {1,1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class HeadingScale_BOTTOM + { + clipTL[] = {0.45,"0.02 + 0.085"}; + clipBR[] = {"0.45 + 0.10",1}; + class Heading_group + { + type = "scale"; + horizontal = 1; + source = "heading"; + sourceScale = 1; + width = 5; + top = 0.12; + center = 0.5; + bottom = 0.88; + lineXleft = "0.03 + 0.085"; + lineYright = "0.02 + 0.085"; + lineXleftMajor = "0.04 + 0.085"; + lineYrightMajor = "0.02 + 0.085"; + majorLineEach = 3; + numberEach = 3; + step = 10; + stepSize = "0.05"; + align = "center"; + scale = 1; + pos[] = {0.12,"0.0 + 0.065"}; + right[] = {0.16,"0.0 + 0.065"}; + down[] = {0.12,"0.04 + 0.065"}; + }; + }; + class Fuel_Text + { + type = "text"; + source = "static"; + text = "Fuel"; + align = "right"; + scale = 1; + pos[] = {{ 0.03,0.9 },1}; + right[] = {{ 0.07,0.9 },1}; + down[] = {{ 0.03,0.94 },1}; + }; + class Fuel_Number + { + type = "text"; + source = "fuel"; + sourceScale = 100; + align = "right"; + scale = 1; + pos[] = {{ 0.1,0.9 },1}; + right[] = {{ 0.14,0.9 },1}; + down[] = {{ 0.1,0.94 },1}; + }; + }; + helmetMountedDisplay = 1; + helmetPosition[] = {-0.04,0.04,0.1}; + helmetRight[] = {0.08,0,0}; + helmetDown[] = {0,-0.08,0}; + }; + class ACE_HUD_2 + { + topLeft = "HUD_top_left"; + topRight = "HUD_top_right"; + bottomLeft = "HUD_bottom_left"; + borderLeft = 0; + borderRight = 0; + borderTop = 0; + borderBottom = 0; + color[] = {0.15,1,0.15,1}; + enableParallax = 0; + class Bones + { + class Velocity + { + type = "vector"; + source = "velocity"; + pos0[] = {0.5,0.5}; + pos10[] = {0.75,0.75}; + }; + class ForwardVec1 + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.25,0.25}; + }; + class ForwardVec + { + type = "vector"; + source = "forward"; + pos0[] = {0,0}; + pos10[] = {0.253,0.253}; + }; + class WeaponAim + { + type = "vector"; + source = "weapon"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + }; + class WeaponAim1 + { + type = "vector"; + source = "weapon"; + pos0[] = {0,0}; + pos10[] = {0.253,0.23}; + }; + class Target + { + type = "vector"; + source = "target"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + }; + class RadarContact + { + type = "fixed"; + pos[] = {0,0}; + }; + }; + class Draw + { + color[] = {0.18,1,0.18}; + alpha = 1; + condition = "on"; + class PlaneMovementCrosshair + { + type = "line"; + width = 7; + points[] = {{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,0.02 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01732,-0.01 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.01,-0.01732 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ -0.04,0 },1 },{ "ForwardVec1",1,"Velocity",1,{ -0.02,0 },1 },{ },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.04 },1 },{ "ForwardVec1",1,"Velocity",1,{ 0,-0.02 },1 }}; + }; + class Gunner_AIM + { + type = "group"; + class Circle + { + type = "line"; + width = 6; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.03 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0325 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.0475 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.0475,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.03,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.0325,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.0475,0 },1 }}; + }; + }; + class GunCross + { + condition = "mgun"; + class Circle + { + type = "line"; + width = 9; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.05 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.015 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.05 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.015,0 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0.015,0 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0 },1 },{ }}; + }; + }; + class RocketCross + { + condition = "rocket"; + width = 6; + class Circle + { + type = "line"; + width = 6; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.05,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,-0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ 0,-0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0,0.08 },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ -0.05,0.08 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.05,0.08 },1 },{ }}; + }; + }; + class AT_Aim + { + condition = "ATmissile"; + width = 2; + class Circle + { + type = "line"; + width = 2; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,-0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ 0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,0.1 },1 },{ "ForwardVec",1,"WeaponAim",1,{ -0.1,-0.1 },1 }}; + }; + }; + class AA_aim + { + condition = "AAmissile"; + class Circle + { + type = "line"; + width = 2.5; + points[] = {{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","0.248559 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 4","0 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 4","-0.0431499 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 4","-0.0850072 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 4","-0.12428 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 4","-0.159774 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 4","-0.190396 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 4","-0.215252 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 4","-0.233571 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 4","-0.244781 / 4" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 4","-0.248559 / 4" },1 },{ },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","0.248559 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.25 / 2","0 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2462 / 2","-0.0431499 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.234925 / 2","-0.0850072 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.2165 / 2","-0.12428 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1915 / 2","-0.159774 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.1607 / 2","-0.190396 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.125 / 2","-0.215252 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0855 / 2","-0.233571 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "-0.0434 / 2","-0.244781 / 2" },1 },{ "ForwardVec",1,"WeaponAim",1,{ "0 / 2","-0.248559 / 2" },1 }}; + }; + }; + class TargetACQ + { + type = "line"; + width = 2; + points[] = {{ "ForwardVec",1,"target",{ 0,-0.06 },1 },{ "ForwardVec",1,"target",{ 0,-0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.05 },1 },{ "ForwardVec",1,"target",{ 0,-0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.04 },1 },{ "ForwardVec",1,"target",{ 0,-0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.03 },1 },{ "ForwardVec",1,"target",{ 0,-0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.02 },1 },{ "ForwardVec",1,"target",{ 0,-0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,-0.01 },1 },{ "ForwardVec",1,"target",{ 0,-0.005 },1 },{ },{ "ForwardVec",1,"target",{ 0,0 },1 },{ "ForwardVec",1,"target",{ 0,0 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.06 },1 },{ "ForwardVec",1,"target",{ 0,0.055 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.05 },1 },{ "ForwardVec",1,"target",{ 0,0.045 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.04 },1 },{ "ForwardVec",1,"target",{ 0,0.035 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.03 },1 },{ "ForwardVec",1,"target",{ 0,0.025 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.02 },1 },{ "ForwardVec",1,"target",{ 0,0.015 },1 },{ },{ "ForwardVec",1,"target",{ 0,0.01 },1 },{ "ForwardVec",1,"target",{ 0,0.005 },1 },{ },{ "ForwardVec",1,"target",{ -0.06,0 },1 },{ "ForwardVec",1,"target",{ -0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.05,0 },1 },{ "ForwardVec",1,"target",{ -0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.04,0 },1 },{ "ForwardVec",1,"target",{ -0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.03,0 },1 },{ "ForwardVec",1,"target",{ -0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.02,0 },1 },{ "ForwardVec",1,"target",{ -0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ -0.01,0 },1 },{ "ForwardVec",1,"target",{ -0.005,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.06,0 },1 },{ "ForwardVec",1,"target",{ 0.055,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.05,0 },1 },{ "ForwardVec",1,"target",{ 0.045,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.04,0 },1 },{ "ForwardVec",1,"target",{ 0.035,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.03,0 },1 },{ "ForwardVec",1,"target",{ 0.025,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.02,0 },1 },{ "ForwardVec",1,"target",{ 0.015,0 },1 },{ },{ "ForwardVec",1,"target",{ 0.01,0 },1 },{ "ForwardVec",1,"target",{ 0.005,0 },1 },{ }}; + }; + class RadarTargets + { + type = "radar"; + pos0[] = {0.5,0.5}; + pos10[] = {0.753,0.753}; + width = 2.5; + points[] = {{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,-0.01 },1 },{ "ForwardVec",1,"RadarContact",{ 0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,0.01 },1 },{ "ForwardVec",1,"RadarContact",{ -0.01,-0.01 },1 }}; + }; + }; + helmetMountedDisplay = 1; + helmetPosition[] = {-0.035,0.035,0.1}; + helmetRight[] = {0.07,0,0}; + helmetDown[] = {0,-0.07,0}; + }; + }; + + class Turrets: Turrets { + class MainTurret: MainTurret { + weapons[] = {"ACE_gatling_20mm_Comanche","missiles_DAGR","missiles_ASRAAM", "ACE_AIR_SAFETY"}; + magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; + + outGunnerMayFire = 1; + commanding = -1; + primaryGunner = 1; + gunnerOpticsModel = ""; + gunnerOpticsEffect[] = {"TankCommanderOptics1"}; + gunnerForceOptics = 0; + turretInfoType = "Rsc_ACE_Helo_UI_Turret"; + showAllTargets = 2; + discretedistance[] = {100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,2400,2500,2600,2700,2800,2900,3000}; + discretedistanceinitindex = 3; + copilotHasFlares = 1; + directionStabilized = 1; + isCopilot = 1; + showHMD = 1; + CanEject = 1; + startEngine = 0; + minElev = -51; + maxElev = 9; + initElev = 6; + minTurn = -120; + maxTurn = 120; + initTurn = 0; + + class OpticsIn + { + delete Narrow; + delete Medium; + delete Wide; + + class ACE_WideUnstabilized { + opticsDisplayName = "W NS"; + initAngleX = 0; + minAngleX = -35; + maxAngleX = 10; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.466; + minFov = 0.466; + maxFov = 0.466; + visionMode[] = {"Normal","Ti"}; + thermalMode[] = {0,1}; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 0; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F"; + }; + class ACE_Wide: ACE_WideUnstabilized { + opticsDisplayName = "W"; + initAngleX = 0; + minAngleX = -35; + maxAngleX = 10; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.466; + minFov = 0.466; + maxFov = 0.466; + visionMode[] = {"Normal","Ti"}; + thermalMode[] = {0,1}; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 1; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_wide_F"; + }; + class ACE_Medium: ACE_Wide { + opticsDisplayName = "M"; + initFov = 0.093; + minFov = 0.093; + maxFov = 0.093; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 1; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_medium_F"; + }; + class ACE_Narrow: ACE_Wide { + opticsDisplayName = "N"; + initFov = 0.029; + minFov = 0.029; + maxFov = 0.029; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 1; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F"; + + }; + class ACE_Narrower: ACE_Wide { + opticsDisplayName = "Z"; + initFov = 0.01; + minFov = 0.01; + maxFov = 0.01; + gunnerOpticsColor[] = {0,0,0,1}; + directionStabilized = 1; + horizontallyStabilized = 1; + gunnerOpticsModel = "\A3\Weapons_F_Beta\Reticle\Heli_Attack_01_Optics_Gunner_narrow_F"; + + }; + }; + class OpticsOut + { + class Monocular + { + initAngleX = 0; + minAngleX = -30; + maxAngleX = 30; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 1.1; + minFov = 0.133; + maxFov = 1.1; + visionMode[] = {"Normal","NVG"}; + gunnerOpticsModel = ""; + gunnerOpticsEffect[] = {}; + hideUnitInfo = 1; + }; + }; + }; + }; + + class AnimationSources: AnimationSources { + class Gatling { + weapon = "ACE_gatling_20mm_Comanche"; + }; + class Muzzle_flash { + weapon = "ACE_gatling_20mm_Comanche"; + }; + }; +}; diff --git a/addons/aircraft/RscInGameUI.hpp b/addons/aircraft/RscInGameUI.hpp index 620d895d9e..d3ef60c6b6 100644 --- a/addons/aircraft/RscInGameUI.hpp +++ b/addons/aircraft/RscInGameUI.hpp @@ -1,581 +1,581 @@ -class RscControlsGroup; -class RscText; -class RangeText: RscText{}; -class RscPicture; -class RscOpticsText; -class RscIGProgress; -class RscOpticsValue; -class VScrollbar; -class HScrollbar; -class RscLadderPicture; -class RscControlsGroupNoScrollbars; - - -class RscInGameUI -{ - class RscUnitInfo; - class Rsc_ACE_Helo_UI_Turret: RscUnitInfo - { - idd = 300; - controls[] = {"CA_IGUI_elements_group","CA_VehicleToggles"}; - class VScrollbar; - class HScrollbar; - class CA_IGUI_elements_group: RscControlsGroup - { - idc = 170; - class VScrollbar: VScrollbar - { - width = 0; - }; - class HScrollbar: HScrollbar - { - height = 0; - }; - x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; - y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; - w = "53.5 * (0.01875 * SafezoneH)"; - h = "40 * (0.025 * SafezoneH)"; - class controls - { - class CA_Distance: RscText - { - idc = 151; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - x = "24.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_Speed: RangeText - { - idc = 188; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "120"; - x = "14.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_Alt: RangeText - { - idc = 189; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "3825"; - x = "34.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_VisionMode: RscText - { - idc = 152; - style = 0; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "VIS"; - x = "12.58 * (0.01875 * SafezoneH)"; - y = "8 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_FlirMode: RscText - { - idc = 153; - style = 0; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "BHOT"; - x = "15.78 * (0.01875 * SafezoneH)"; - y = "8 * (0.025 * SafezoneH)"; - w = "4.5 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class ValueGrid: RangeText - { - idc = 172; - font = "EtelkaMonospacePro"; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "12.20 * (0.01875 * SafezoneH)"; - y = "3.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class TextTADS: RangeText - { - idc = 1010; - text = "TADS"; - font = "EtelkaMonospacePro"; - style = 2; - shadow = 0; - x = "12.30 * (0.01875 * SafezoneH)"; - y = "5 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class ValueTime: RangeText - { - idc = 190; - text = "20:28:35"; - font = "EtelkaMonospacePro"; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "12.1 * (0.01875 * SafezoneH)"; - y = "6.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class CA_Laser: RscText - { - idc = 158; - style = "0x30 + 0x800"; - sizeEx = "0.038*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = PATHTOF(data\Helo_LaserON.paa); - x = "20.45 * (0.01875 * SafezoneH)"; - y = "14.1 * (0.025 * SafezoneH)"; - w = "12.5 * (0.01875 * SafezoneH)"; - h = "12 * (0.025 * SafezoneH)"; - }; - class CA_Heading: RscText - { - idc = 156; - style = 0; - sizeEx = "0.038*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "023"; - x = "24.83 * (0.01875 * SafezoneH)"; - y = "6 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - }; - }; - }; - class Rsc_ACE_Helo_UI_01: RscUnitInfo - { - controls[] = {"WeaponInfoControlsGroupRight","CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"}; - }; - class Rsc_ACE_Helo_UI_02: RscUnitInfo - { - controls[] = {"CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"}; - }; - class Rsc_ACE_Drones_UI_Turret: RscUnitInfo - { - idd = 300; - controls[] = {"CA_Zeroing","CA_IGUI_elements_group","CA_VehicleToggles"}; - class CA_IGUI_elements_group: RscControlsGroup - { - idc = 170; - class VScrollbar: VScrollbar - { - width = 0; - }; - class HScrollbar: HScrollbar - { - height = 0; - }; - x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; - y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; - w = "53.5 * (0.01875 * SafezoneH)"; - h = "40 * (0.025 * SafezoneH)"; - class controls - { - class CA_Distance: RscText - { - idc = 151; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - x = "24.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_Speed: RangeText - { - idc = 188; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "120"; - x = "14.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class CA_Alt: RangeText - { - idc = 189; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "3825"; - x = "34.78 * (0.01875 * SafezoneH)"; - y = "30.88 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class ValueTime: RangeText - { - idc = 190; - text = "20:28:35"; - font = "EtelkaMonospacePro"; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "1.75 * (0.01875 * SafezoneH)"; - y = "10.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class CA_VisionMode: RscText - { - idc = 152; - style = 0; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "VIS"; - align = "right"; - x = "2.6 * (0.01875 * SafezoneH)"; - y = "12.0 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.0 * (0.025 * SafezoneH)"; - }; - class CA_FlirMode: RscText - { - idc = 153; - style = 0; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "BHOT"; - align = "right"; - x = "6.18 * (0.01875 * SafezoneH)"; - y = "12.0 * (0.025 * SafezoneH)"; - w = "4.5 * (0.01875 * SafezoneH)"; - h = "1.0 * (0.025 * SafezoneH)"; - }; - class TgT_Grid_text: RangeText - { - idc = 1005; - text = "TGT:"; - font = "EtelkaMonospacePro"; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "1.20 * (0.01875 * SafezoneH)"; - y = "13.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class TGT_ValueGrid: RangeText - { - idc = 172; - font = "EtelkaMonospacePro"; - colorText[] = {0.706,0.0745,0.0196,0.8}; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "5.20 * (0.01875 * SafezoneH)"; - y = "13.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class OWN_Grid_text: RangeText - { - idc = 1005; - text = "OWN:"; - font = "EtelkaMonospacePro"; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "1.20 * (0.01875 * SafezoneH)"; - y = "15 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class OWN_ValueGrid: RangeText - { - idc = 171; - font = "EtelkaMonospacePro"; - colorText[] = {0.15,1,0.15,0.8}; - style = 2; - sizeEx = "0.0295*SafezoneH"; - shadow = 0; - x = "5.20 * (0.01875 * SafezoneH)"; - y = "15 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class CA_Laser: RscText - { - idc = 158; - style = "0x30 + 0x800"; - sizeEx = "0.038*SafezoneH"; - shadow = 0; - align = "right"; - font = "EtelkaMonospacePro"; - text = PATHTOF(data\Helo_LaserON.paa); - x = "20.45 * (0.01875 * SafezoneH)"; - y = "14.1 * (0.025 * SafezoneH)"; - w = "12.5 * (0.01875 * SafezoneH)"; - h = "12 * (0.025 * SafezoneH)"; - }; - class CA_Heading: RscText - { - idc = 156; - style = 0; - sizeEx = "0.038*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "023"; - align = "right"; - x = "25 * (0.01875 * SafezoneH)"; - y = "5 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - }; - }; - }; - class Rsc_ACE_Drones_UI_Pilots: RscUnitInfo - { - idd = 300; - controls[] = {"WeaponInfoControlsGroupRight","CA_BackgroundVehicle","CA_BackgroundVehicleTitle","CA_BackgroundVehicleTitleDark","CA_BackgroundFuel","CA_Vehicle","CA_VehicleRole","CA_HitZones","CA_SpeedBackground","CA_SpeedUnits","CA_Speed","CA_ValueFuel","CA_AltBackground","CA_AltUnits","CA_Alt","CA_VehicleToggles","CA_Radar","DriverOpticsGroup"}; - class DriverOpticsGroup: RscControlsGroup - { - idc = 392; - class VScrollbar: VScrollbar - { - width = 0; - }; - class HScrollbar: HScrollbar - { - height = 0; - }; - x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; - y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; - w = "53.5 * (0.01875 * SafezoneH)"; - h = "40 * (0.025 * SafezoneH)"; - class controls - { - class TextGrid: RscText - { - style = 0; - sizeEx = "0.02*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - idc = 1005; - text = "GRID:"; - x = "5.8 * (0.01875 * SafezoneH)"; - y = "31.8 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class ValueGrid: TextGrid - { - idc = 189; - text = "382546"; - x = "10.3 * (0.01875 * SafezoneH)"; - y = "31.8 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class TextTime: TextGrid - { - idc = 1010; - text = "TIME [UTC]:"; - x = "5.8 * (0.01875 * SafezoneH)"; - y = "32.6 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class ValueTime: TextGrid - { - idc = 101; - text = "20:28:35"; - x = "10 * (0.01875 * SafezoneH)"; - y = "32.6 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class TextMag: TextGrid - { - idc = 1011; - text = "CAM MAG:"; - x = "5.8 * (0.01875 * SafezoneH)"; - y = "7 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class OpticsZoom: TextGrid - { - idc = 192; - text = "28x"; - x = "10.3 * (0.01875 * SafezoneH)"; - y = "7 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class BorderLineSpdTop: RscPicture - { - idc = 1203; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; - x = "3.343 * (0.01875 * SafezoneH)"; - y = "12.4 * (0.025 * SafezoneH)"; - w = "3 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class BorderLineSpdBottom: RscPicture - { - idc = 1207; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; - x = "3.343 * (0.01875 * SafezoneH)"; - y = "26.5 * (0.025 * SafezoneH)"; - w = "3 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class BorderLineAltTop: RscPicture - { - idc = 1205; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; - x = "47.16 * (0.01875 * SafezoneH)"; - y = "12.4 * (0.025 * SafezoneH)"; - w = "3 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class BorderLineAltBottom: RscPicture - { - idc = 1206; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; - x = "47.16 * (0.01875 * SafezoneH)"; - y = "26.5 * (0.025 * SafezoneH)"; - w = "3 * (0.01875 * SafezoneH)"; - h = "1 * (0.025 * SafezoneH)"; - }; - class TextSpd: TextGrid - { - idc = 1004; - text = "SPD"; - x = "4.8 * (0.01875 * SafezoneH)"; - y = "11.8 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class SpeedValueBorder: RscPicture - { - idc = 1200; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\altimeter_value_ca.paa"; - x = "6.3 * (0.01875 * SafezoneH)"; - y = "19 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "2 * (0.025 * SafezoneH)"; - }; - class CA_Speed: TextGrid - { - idc = 190; - sizeEx = "0.03*SafezoneH"; - text = "120"; - x = "7.5 * (0.01875 * SafezoneH)"; - y = "19.5 * (0.025 * SafezoneH)"; - w = "6 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class AnalogueSpeed: RscLadderPicture - { - idc = 384; - topValue = 1312; - bottomValue = -345; - visibleRange = -1; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAVspeedLadder_ca.paa"; - x = "1.5 * (0.01875 * SafezoneH)"; - y = "13 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "14 * (0.025 * SafezoneH)"; - }; - class TextAlt: TextGrid - { - idc = 1006; - text = "ALT"; - x = "46.9 * (0.01875 * SafezoneH)"; - y = "11.8 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class AltValueBorder: RscPicture - { - idc = 1201; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\airspeed_value_ca.paa"; - x = "42.25 * (0.01875 * SafezoneH)"; - y = "19 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "2 * (0.025 * SafezoneH)"; - }; - class CA_Alt: TextGrid - { - idc = 191; - sizeEx = "0.03*SafezoneH"; - style = 1; - text = "3825"; - x = "43 * (0.01875 * SafezoneH)"; - y = "19.5 * (0.025 * SafezoneH)"; - w = "3.2 * (0.01875 * SafezoneH)"; - h = "1.2 * (0.025 * SafezoneH)"; - }; - class AnalogueAlt: RscLadderPicture - { - idc = 385; - topValue = 14430; - bottomValue = -2110; - visibleRange = -1; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAValtLadder_ca.paa"; - x = "47 * (0.01875 * SafezoneH)"; - y = "13 * (0.025 * SafezoneH)"; - w = "2.5 * (0.01875 * SafezoneH)"; - h = "14 * (0.025 * SafezoneH)"; - }; - class AnalogueHorizon: RscLadderPicture - { - idc = 383; - topValue = 90; - bottomValue = -90; - visibleRange = -1; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_ladder_ca.paa"; - x = "16.75 * (0.01875 * SafezoneH)"; - y = "5 * (0.025 * SafezoneH)"; - w = "20 * (0.01875 * SafezoneH)"; - h = "30 * (0.025 * SafezoneH)"; - }; - class HorizonCenter: RscPicture - { - idc = 1202; - text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_aircraft_ca.paa"; - x = "24.75 * (0.01875 * SafezoneH)"; - y = "19 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "2 * (0.025 * SafezoneH)"; - }; - }; - }; - }; +class RscControlsGroup; +class RscText; +class RangeText: RscText{}; +class RscPicture; +class RscOpticsText; +class RscIGProgress; +class RscOpticsValue; +class VScrollbar; +class HScrollbar; +class RscLadderPicture; +class RscControlsGroupNoScrollbars; + + +class RscInGameUI +{ + class RscUnitInfo; + class Rsc_ACE_Helo_UI_Turret: RscUnitInfo + { + idd = 300; + controls[] = {"CA_IGUI_elements_group","CA_VehicleToggles"}; + class VScrollbar; + class HScrollbar; + class CA_IGUI_elements_group: RscControlsGroup + { + idc = 170; + class VScrollbar: VScrollbar + { + width = 0; + }; + class HScrollbar: HScrollbar + { + height = 0; + }; + x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; + y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; + w = "53.5 * (0.01875 * SafezoneH)"; + h = "40 * (0.025 * SafezoneH)"; + class controls + { + class CA_Distance: RscText + { + idc = 151; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + x = "24.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_Speed: RangeText + { + idc = 188; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "120"; + x = "14.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_Alt: RangeText + { + idc = 189; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "3825"; + x = "34.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_VisionMode: RscText + { + idc = 152; + style = 0; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "VIS"; + x = "12.58 * (0.01875 * SafezoneH)"; + y = "8 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_FlirMode: RscText + { + idc = 153; + style = 0; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "BHOT"; + x = "15.78 * (0.01875 * SafezoneH)"; + y = "8 * (0.025 * SafezoneH)"; + w = "4.5 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class ValueGrid: RangeText + { + idc = 172; + font = "EtelkaMonospacePro"; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "12.20 * (0.01875 * SafezoneH)"; + y = "3.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class TextTADS: RangeText + { + idc = 1010; + text = "TADS"; + font = "EtelkaMonospacePro"; + style = 2; + shadow = 0; + x = "12.30 * (0.01875 * SafezoneH)"; + y = "5 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class ValueTime: RangeText + { + idc = 190; + text = "20:28:35"; + font = "EtelkaMonospacePro"; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "12.1 * (0.01875 * SafezoneH)"; + y = "6.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class CA_Laser: RscText + { + idc = 158; + style = "0x30 + 0x800"; + sizeEx = "0.038*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = QPATHTOF(data\Helo_LaserON.paa); + x = "20.45 * (0.01875 * SafezoneH)"; + y = "14.1 * (0.025 * SafezoneH)"; + w = "12.5 * (0.01875 * SafezoneH)"; + h = "12 * (0.025 * SafezoneH)"; + }; + class CA_Heading: RscText + { + idc = 156; + style = 0; + sizeEx = "0.038*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "023"; + x = "24.83 * (0.01875 * SafezoneH)"; + y = "6 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + }; + }; + }; + class Rsc_ACE_Helo_UI_01: RscUnitInfo + { + controls[] = {"WeaponInfoControlsGroupRight","CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"}; + }; + class Rsc_ACE_Helo_UI_02: RscUnitInfo + { + controls[] = {"CA_TextFlaresMode","CA_TextFlares","CA_VehicleToggles","CA_Radar"}; + }; + class Rsc_ACE_Drones_UI_Turret: RscUnitInfo + { + idd = 300; + controls[] = {"CA_Zeroing","CA_IGUI_elements_group","CA_VehicleToggles"}; + class CA_IGUI_elements_group: RscControlsGroup + { + idc = 170; + class VScrollbar: VScrollbar + { + width = 0; + }; + class HScrollbar: HScrollbar + { + height = 0; + }; + x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; + y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; + w = "53.5 * (0.01875 * SafezoneH)"; + h = "40 * (0.025 * SafezoneH)"; + class controls + { + class CA_Distance: RscText + { + idc = 151; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + x = "24.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_Speed: RangeText + { + idc = 188; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "120"; + x = "14.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class CA_Alt: RangeText + { + idc = 189; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "3825"; + x = "34.78 * (0.01875 * SafezoneH)"; + y = "30.88 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class ValueTime: RangeText + { + idc = 190; + text = "20:28:35"; + font = "EtelkaMonospacePro"; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "1.75 * (0.01875 * SafezoneH)"; + y = "10.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class CA_VisionMode: RscText + { + idc = 152; + style = 0; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "VIS"; + align = "right"; + x = "2.6 * (0.01875 * SafezoneH)"; + y = "12.0 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.0 * (0.025 * SafezoneH)"; + }; + class CA_FlirMode: RscText + { + idc = 153; + style = 0; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "BHOT"; + align = "right"; + x = "6.18 * (0.01875 * SafezoneH)"; + y = "12.0 * (0.025 * SafezoneH)"; + w = "4.5 * (0.01875 * SafezoneH)"; + h = "1.0 * (0.025 * SafezoneH)"; + }; + class TgT_Grid_text: RangeText + { + idc = 1005; + text = "TGT:"; + font = "EtelkaMonospacePro"; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "1.20 * (0.01875 * SafezoneH)"; + y = "13.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class TGT_ValueGrid: RangeText + { + idc = 172; + font = "EtelkaMonospacePro"; + colorText[] = {0.706,0.0745,0.0196,0.8}; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "5.20 * (0.01875 * SafezoneH)"; + y = "13.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class OWN_Grid_text: RangeText + { + idc = 1005; + text = "OWN:"; + font = "EtelkaMonospacePro"; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "1.20 * (0.01875 * SafezoneH)"; + y = "15 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class OWN_ValueGrid: RangeText + { + idc = 171; + font = "EtelkaMonospacePro"; + colorText[] = {0.15,1,0.15,0.8}; + style = 2; + sizeEx = "0.0295*SafezoneH"; + shadow = 0; + x = "5.20 * (0.01875 * SafezoneH)"; + y = "15 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class CA_Laser: RscText + { + idc = 158; + style = "0x30 + 0x800"; + sizeEx = "0.038*SafezoneH"; + shadow = 0; + align = "right"; + font = "EtelkaMonospacePro"; + text = QPATHTOF(data\Helo_LaserON.paa); + x = "20.45 * (0.01875 * SafezoneH)"; + y = "14.1 * (0.025 * SafezoneH)"; + w = "12.5 * (0.01875 * SafezoneH)"; + h = "12 * (0.025 * SafezoneH)"; + }; + class CA_Heading: RscText + { + idc = 156; + style = 0; + sizeEx = "0.038*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "023"; + align = "right"; + x = "25 * (0.01875 * SafezoneH)"; + y = "5 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + }; + }; + }; + class Rsc_ACE_Drones_UI_Pilots: RscUnitInfo + { + idd = 300; + controls[] = {"WeaponInfoControlsGroupRight","CA_BackgroundVehicle","CA_BackgroundVehicleTitle","CA_BackgroundVehicleTitleDark","CA_BackgroundFuel","CA_Vehicle","CA_VehicleRole","CA_HitZones","CA_SpeedBackground","CA_SpeedUnits","CA_Speed","CA_ValueFuel","CA_AltBackground","CA_AltUnits","CA_Alt","CA_VehicleToggles","CA_Radar","DriverOpticsGroup"}; + class DriverOpticsGroup: RscControlsGroup + { + idc = 392; + class VScrollbar: VScrollbar + { + width = 0; + }; + class HScrollbar: HScrollbar + { + height = 0; + }; + x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; + y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; + w = "53.5 * (0.01875 * SafezoneH)"; + h = "40 * (0.025 * SafezoneH)"; + class controls + { + class TextGrid: RscText + { + style = 0; + sizeEx = "0.02*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + idc = 1005; + text = "GRID:"; + x = "5.8 * (0.01875 * SafezoneH)"; + y = "31.8 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class ValueGrid: TextGrid + { + idc = 189; + text = "382546"; + x = "10.3 * (0.01875 * SafezoneH)"; + y = "31.8 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class TextTime: TextGrid + { + idc = 1010; + text = "TIME [UTC]:"; + x = "5.8 * (0.01875 * SafezoneH)"; + y = "32.6 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class ValueTime: TextGrid + { + idc = 101; + text = "20:28:35"; + x = "10 * (0.01875 * SafezoneH)"; + y = "32.6 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class TextMag: TextGrid + { + idc = 1011; + text = "CAM MAG:"; + x = "5.8 * (0.01875 * SafezoneH)"; + y = "7 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class OpticsZoom: TextGrid + { + idc = 192; + text = "28x"; + x = "10.3 * (0.01875 * SafezoneH)"; + y = "7 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class BorderLineSpdTop: RscPicture + { + idc = 1203; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; + x = "3.343 * (0.01875 * SafezoneH)"; + y = "12.4 * (0.025 * SafezoneH)"; + w = "3 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class BorderLineSpdBottom: RscPicture + { + idc = 1207; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; + x = "3.343 * (0.01875 * SafezoneH)"; + y = "26.5 * (0.025 * SafezoneH)"; + w = "3 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class BorderLineAltTop: RscPicture + { + idc = 1205; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; + x = "47.16 * (0.01875 * SafezoneH)"; + y = "12.4 * (0.025 * SafezoneH)"; + w = "3 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class BorderLineAltBottom: RscPicture + { + idc = 1206; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\border_line_ca.paa"; + x = "47.16 * (0.01875 * SafezoneH)"; + y = "26.5 * (0.025 * SafezoneH)"; + w = "3 * (0.01875 * SafezoneH)"; + h = "1 * (0.025 * SafezoneH)"; + }; + class TextSpd: TextGrid + { + idc = 1004; + text = "SPD"; + x = "4.8 * (0.01875 * SafezoneH)"; + y = "11.8 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class SpeedValueBorder: RscPicture + { + idc = 1200; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\altimeter_value_ca.paa"; + x = "6.3 * (0.01875 * SafezoneH)"; + y = "19 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "2 * (0.025 * SafezoneH)"; + }; + class CA_Speed: TextGrid + { + idc = 190; + sizeEx = "0.03*SafezoneH"; + text = "120"; + x = "7.5 * (0.01875 * SafezoneH)"; + y = "19.5 * (0.025 * SafezoneH)"; + w = "6 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class AnalogueSpeed: RscLadderPicture + { + idc = 384; + topValue = 1312; + bottomValue = -345; + visibleRange = -1; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAVspeedLadder_ca.paa"; + x = "1.5 * (0.01875 * SafezoneH)"; + y = "13 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "14 * (0.025 * SafezoneH)"; + }; + class TextAlt: TextGrid + { + idc = 1006; + text = "ALT"; + x = "46.9 * (0.01875 * SafezoneH)"; + y = "11.8 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class AltValueBorder: RscPicture + { + idc = 1201; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\airspeed_value_ca.paa"; + x = "42.25 * (0.01875 * SafezoneH)"; + y = "19 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "2 * (0.025 * SafezoneH)"; + }; + class CA_Alt: TextGrid + { + idc = 191; + sizeEx = "0.03*SafezoneH"; + style = 1; + text = "3825"; + x = "43 * (0.01875 * SafezoneH)"; + y = "19.5 * (0.025 * SafezoneH)"; + w = "3.2 * (0.01875 * SafezoneH)"; + h = "1.2 * (0.025 * SafezoneH)"; + }; + class AnalogueAlt: RscLadderPicture + { + idc = 385; + topValue = 14430; + bottomValue = -2110; + visibleRange = -1; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\UAValtLadder_ca.paa"; + x = "47 * (0.01875 * SafezoneH)"; + y = "13 * (0.025 * SafezoneH)"; + w = "2.5 * (0.01875 * SafezoneH)"; + h = "14 * (0.025 * SafezoneH)"; + }; + class AnalogueHorizon: RscLadderPicture + { + idc = 383; + topValue = 90; + bottomValue = -90; + visibleRange = -1; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_ladder_ca.paa"; + x = "16.75 * (0.01875 * SafezoneH)"; + y = "5 * (0.025 * SafezoneH)"; + w = "20 * (0.01875 * SafezoneH)"; + h = "30 * (0.025 * SafezoneH)"; + }; + class HorizonCenter: RscPicture + { + idc = 1202; + text = "\A3\Ui_f\data\IGUI\Cfg\HelicopterHUD\horizon_aircraft_ca.paa"; + x = "24.75 * (0.01875 * SafezoneH)"; + y = "19 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "2 * (0.025 * SafezoneH)"; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 2ce2d0dc10..863797ebeb 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -2,13 +2,18 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","Crusty","commy2","jaynus","Kimi"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","Crusty","commy2","jaynus","Kimi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; + + // this prevents any patched class from requiring this addon + addonRootClass = "A3_Characters_F"; }; }; diff --git a/addons/aircraft/flightmodel_thunderbolt.hpp b/addons/aircraft/flightmodel_thunderbolt.hpp index fa99f40424..2446e166bc 100644 --- a/addons/aircraft/flightmodel_thunderbolt.hpp +++ b/addons/aircraft/flightmodel_thunderbolt.hpp @@ -20,4 +20,3 @@ envelope[] = {0,0,0.75,2.4,3.6,3.8,3.7,3.2,2.2,1.7,0.9}; thrustCoef[] = {1,1.2,1.3,1.25,1.06,1.01,1,0.92,0.75,0.65,0.5,0.25,0}; acceleration = 265; landingSpeed = 220; -gunAimDown = 0.087266463; diff --git a/addons/aircraft/script_component.hpp b/addons/aircraft/script_component.hpp index baa8e7ee21..e2379c0791 100644 --- a/addons/aircraft/script_component.hpp +++ b/addons/aircraft/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT aircraft +#define COMPONENT_BEAUTIFIED Aircraft #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_AIRCRAFT #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index 5480cb9740..5516551d42 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -7,7 +7,7 @@ Ráfaga Seria Dávka - Contre mesures + Rafale Очередь Sorozat Rajada @@ -50,4 +50,4 @@ Fechar porta de carga - + \ No newline at end of file diff --git a/addons/apl/config.cpp b/addons/apl/config.cpp index 089f4bffe0..6e2c852035 100644 --- a/addons/apl/config.cpp +++ b/addons/apl/config.cpp @@ -2,12 +2,13 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_main"}; - author[] = {"Bohemia Interactive"}; - authorUrl = "http://ace3mod.com"; + author = "Bohemia Interactive"; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/apl/script_component.hpp b/addons/apl/script_component.hpp index f2ae3d53f1..969c9dca7f 100644 --- a/addons/apl/script_component.hpp +++ b/addons/apl/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT APL +#define COMPONENT_BEAUTIFIED APL #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_APL #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/atragmx/CfgVehicles.hpp b/addons/atragmx/CfgVehicles.hpp index cc4a7880fe..6e8a136a03 100644 --- a/addons/atragmx/CfgVehicles.hpp +++ b/addons/atragmx/CfgVehicles.hpp @@ -9,7 +9,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(create_dialog)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\ATRAG_Icon.paa); + icon = QPATHTOF(UI\ATRAG_Icon.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; diff --git a/addons/atragmx/CfgWeapons.hpp b/addons/atragmx/CfgWeapons.hpp index 42d1e56ae2..af5e1a9955 100644 --- a/addons/atragmx/CfgWeapons.hpp +++ b/addons/atragmx/CfgWeapons.hpp @@ -8,8 +8,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(Name); descriptionShort = CSTRING(Description); - model = PATHTOF(data\tdsrecon.p3d); - picture = PATHTOF(UI\ATRAG_Icon.paa); + model = QPATHTOF(data\tdsrecon.p3d); + picture = QPATHTOF(UI\ATRAG_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; diff --git a/addons/atragmx/XEH_postInit.sqf b/addons/atragmx/XEH_postInit.sqf index 8d4907523b..82f3c25aeb 100644 --- a/addons/atragmx/XEH_postInit.sqf +++ b/addons/atragmx/XEH_postInit.sqf @@ -49,4 +49,4 @@ if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == [] call FUNC(init); [] call FUNC(restore_user_data); -["RangerfinderData", {_this call FUNC(sord)}] call EFUNC(common,addEventHandler); +[QEGVAR(vector,rangefinderData), {_this call FUNC(sord)}] call CBA_fnc_addEventHandler; diff --git a/addons/atragmx/config.cpp b/addons/atragmx/config.cpp index 3abe32ba34..aec53ba837 100644 --- a/addons/atragmx/config.cpp +++ b/addons/atragmx/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_ATragMX"}; weapons[] = {"ACE_ATragMX"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_common", "ACE_weather"}; - author = "Ruthberg"; + author = ECSTRING(common,ACETeam); + authors[] = {"Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -14,4 +17,8 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#include "RscTitles.hpp" \ No newline at end of file +#include "RscTitles.hpp" + +class ACE_newEvents { + RangerfinderData = QEGVAR(vector,rangefinderData); +}; diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index 791374c9d0..a9912ccd34 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -56,7 +56,7 @@ GVAR(DialogPFH) = [{ if (!GVAR(active)) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - __ctrlBackground ctrlSetText format [QUOTE(PATHTOF(UI\ATRAG_%1.paa)), ["N", "D"] select (call EFUNC(common,ambientBrightness))]; + __ctrlBackground ctrlSetText format [QPATHTOF(UI\ATRAG_%1.paa), ["N", "D"] select (call EFUNC(common,ambientBrightness))]; }, 60, []] call CBA_fnc_addPerFrameHandler; true diff --git a/addons/atragmx/functions/fnc_on_close_dialog.sqf b/addons/atragmx/functions/fnc_on_close_dialog.sqf index 1f254c646a..fca60574a9 100644 --- a/addons/atragmx/functions/fnc_on_close_dialog.sqf +++ b/addons/atragmx/functions/fnc_on_close_dialog.sqf @@ -1,5 +1,5 @@ -#include "script_component.hpp" - -uiNamespace setVariable ['ATragMX_Display', nil]; -GVAR(active) = false; +#include "script_component.hpp" + +uiNamespace setVariable ['ATragMX_Display', nil]; +GVAR(active) = false; [GVAR(DialogPFH)] call CBA_fnc_removePerFrameHandler; \ No newline at end of file diff --git a/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf index 14a0a276cc..692de386af 100644 --- a/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf +++ b/addons/atragmx/functions/fnc_target_speed_assist_timer.sqf @@ -30,7 +30,7 @@ if !(ctrlVisible 9000) then { if (!(GVAR(speedAssistTimer))) exitWith { GVAR(speedAssistTimer) = true; - ctrlSetText [8006, Str(Round((ACE_time - _startTime) * 10) / 10)]; + ctrlSetText [8006, Str(Round((CBA_missionTime - _startTime) * 10) / 10)]; [] call FUNC(calculate_target_speed_assist); @@ -40,7 +40,7 @@ if !(ctrlVisible 9000) then { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - ctrlSetText [9001, Str(Round((ACE_time - _startTime) * 10) / 10)]; + ctrlSetText [9001, Str(Round((CBA_missionTime - _startTime) * 10) / 10)]; - }, 0.1, [ACE_time]] call CBA_fnc_addPerFrameHandler; + }, 0.1, [CBA_missionTime]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/atragmx/initKeybinds.sqf b/addons/atragmx/initKeybinds.sqf index 51d2338292..94704e8132 100644 --- a/addons/atragmx/initKeybinds.sqf +++ b/addons/atragmx/initKeybinds.sqf @@ -33,4 +33,4 @@ _closeCode = { closeDialog 0; }; }; -[(localize LSTRING(Name)), QUOTE(PATHTOF(UI\ATRAG_Icon.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); +[(localize LSTRING(Name)), QPATHTOF(UI\ATRAG_Icon.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index ca6a5d24a0..d5da1ee973 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT atragmx +#define COMPONENT_BEAUTIFIED ATragMX #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/atragmx/stringtable.xml b/addons/atragmx/stringtable.xml index 3790fb1f2d..c4f358f5bc 100644 --- a/addons/atragmx/stringtable.xml +++ b/addons/atragmx/stringtable.xml @@ -18,7 +18,7 @@ Otwórz ATragMX Открыть ATragMX Abrir ATragMX - Ouvrir ATragMX + Ouvrir l'ATragMX ATragMX öffnen Apri ATragMX ATragMX elővétele @@ -42,7 +42,7 @@ Otwórz ATragMX Открыть ATragMX Abrir ATragMX - Ouvrir ATragMX + Ouvrir l'ATragMX ATragMX öffnen Apri ATragMX ATragMX elővétele @@ -50,4 +50,4 @@ Abrir ATragMX - + \ No newline at end of file diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index f85cac82b4..7ba8cebbc5 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -3,17 +3,17 @@ class CfgMagazines { class CA_Magazine; class B_IR_Grenade: CA_Magazine { ACE_Attachable = "B_IRStrobe"; - model = QUOTE(PATHTOF(data\ace_IRStrobe.p3d)); + model = QPATHTOF(data\ace_IRStrobe.p3d); }; class O_IR_Grenade: B_IR_Grenade { ACE_Attachable = "O_IRStrobe"; - model = QUOTE(PATHTOF(data\ace_IRStrobe.p3d)); + model = QPATHTOF(data\ace_IRStrobe.p3d); }; class I_IR_Grenade: B_IR_Grenade { ACE_Attachable = "I_IRStrobe"; - model = QUOTE(PATHTOF(data\ace_IRStrobe.p3d)); + model = QPATHTOF(data\ace_IRStrobe.p3d); }; class SmokeShell; diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index e462c0cefa..1e0c0f3e71 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -9,7 +9,7 @@ exceptions[] = {}; \ showDisabled = 0; \ priority = 0; \ - icon = PATHTOF(UI\attach_ca.paa); \ + icon = QPATHTOF(UI\attach_ca.paa); \ distance = 4.5; \ }; \ class GVAR(DetachVehicle) { \ @@ -19,7 +19,7 @@ exceptions[] = {}; \ showDisabled = 0; \ priority = 0.1; \ - icon = PATHTOF(UI\detach_ca.paa); \ + icon = QPATHTOF(UI\detach_ca.paa); \ distance = 4.5; \ }; \ }; \ @@ -60,7 +60,7 @@ class CfgVehicles { exceptions[] = {"isNotDragging"}; showDisabled = 0; priority = 5; - icon = PATHTOF(UI\attach_ca.paa); + icon = QPATHTOF(UI\attach_ca.paa); }; class GVAR(Detach) { displayName = CSTRING(Detach); @@ -69,7 +69,7 @@ class CfgVehicles { exceptions[] = {"isNotDragging"}; showDisabled = 0; priority = 5; - icon = PATHTOF(UI\detach_ca.paa); + icon = QPATHTOF(UI\detach_ca.paa); }; }; }; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index dfea64678d..cc50b3be5e 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -8,8 +8,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(IrStrobe_Name); descriptionShort = CSTRING(IrStrobe_Description); - model = QUOTE(PATHTOF(data\ace_IRStrobe.p3d)); - picture = PATHTOF(UI\irstrobe_item.paa); + model = QPATHTOF(data\ace_IRStrobe.p3d); + picture = QPATHTOF(UI\irstrobe_item.paa); class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/attach/XEH_clientInit.sqf b/addons/attach/XEH_clientInit.sqf index f7e663c2ae..feb7216e6b 100644 --- a/addons/attach/XEH_clientInit.sqf +++ b/addons/attach/XEH_clientInit.sqf @@ -3,4 +3,4 @@ if (!hasInterface) exitWith {}; //If attach placing, stop when opening menu: -["interactMenuOpened", {GVAR(placeAction) = 0;}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {GVAR(placeAction) = 0;}] call CBA_fnc_addEventHandler; diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 0ecc37788a..cadc84705b 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_IR_Strobe_Item"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"KoffeinFlummi","eRazeri","esteldunedain"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","eRazeri","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,7 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "GUI_VirtualAmmo.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; \ No newline at end of file diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 305c3c0960..cf80e74b1c 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -40,7 +40,7 @@ _onAtachText = format [localize LSTRING(Item_Attached), _onAtachText]; if (_unit == _attachToVehicle) then { //Self Attachment _attachedItem = _itemVehClass createVehicle [0,0,0]; - _attachedItem attachTo [_unit, [-0.05, 0, 0.12], "rightshoulder"]; + _attachedItem attachTo [_unit, [0.05, -0.09, 0.1], "leftshoulder"]; if (!_silentScripted) then { _unit removeItem _itemClassname; // Remove item [_onAtachText] call EFUNC(common,displayTextStructured); @@ -51,7 +51,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment [_unit, "forceWalk", "ACE_Attach", true] call EFUNC(common,statusEffect_set); - [{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); + [{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call CBA_fnc_execNextFrame; _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; _actionID = _unit addAction [format ["%1", localize LSTRING(CancelAction)], {GVAR(placeAction) = PLACE_CANCEL}]; diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 05c625b374..5b5b317cbd 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -19,7 +19,7 @@ params ["_attachToVehicle","_unit"], TRACE_2("params",_attachToVehicle,_unit); -private ["_attachedList", "_itemDisplayName", "_attachedObject", "_attachedIndex", "_itemName", "_minDistance"]; +private ["_attachedList", "_itemDisplayName", "_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_isChemlight"]; _attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; @@ -44,22 +44,28 @@ _minDistance = 1000; // Check if unit has an attached item if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; +// Check if item is a chemlight +_isChemlight = _attachedObject isKindOf "Chemlight_base"; + // Exit if can't add the item -if !(_unit canAdd _itemName) exitWith { +if (!(_unit canAdd _itemName) && {!_isChemlight}) exitWith { [localize LSTRING(Inventory_Full)] call EFUNC(common,displayTextStructured); }; -// Add item to inventory -_unit addItem _itemName; +// Add item to inventory (unless it's a chemlight) +if (!_isChemlight) then { + _unit addItem _itemName; +}; if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then { // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle detach _attachedObject; _attachedObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); // Delete attached item after 0.5 seconds - [{deleteVehicle (_this select 0)}, [_attachedObject], 2] call EFUNC(common,waitAndExecute); + [{deleteVehicle (_this select 0)}, [_attachedObject], 2] call CBA_fnc_waitAndExecute; } else { // Delete attached item + detach _attachedObject; deleteVehicle _attachedObject; }; diff --git a/addons/attach/functions/fnc_getChildrenAttachActions.sqf b/addons/attach/functions/fnc_getChildrenAttachActions.sqf index aeb75c00d4..0b2e4e705c 100644 --- a/addons/attach/functions/fnc_getChildrenAttachActions.sqf +++ b/addons/attach/functions/fnc_getChildrenAttachActions.sqf @@ -3,11 +3,11 @@ * Show the ammo counts for a static weapon. * Called from "insertChildren" on interact_menu * - * Argument: + * Arguments: * 0: Target * 1: Player * - * Return value: + * Return Value: * ChildActiosn * * Example: @@ -31,7 +31,7 @@ _actions = []; if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); - _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); + _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); _actions pushBack [_action, [], _target]; }; }; @@ -44,7 +44,7 @@ _actions = []; if (getText (_item >> "ACE_Attachable") != "") then { _displayName = getText(_item >> "displayName"); _picture = getText(_item >> "picture"); - _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call EFUNC(common,execNextFrame)}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); + _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {_this call FUNC(canAttach)}, {}, [_x]] call EFUNC(interact_menu,createAction); _actions pushBack [_action, [], _target]; }; }; diff --git a/addons/attach/functions/fnc_handleGetIn.sqf b/addons/attach/functions/fnc_handleGetIn.sqf index d9f469eee2..dd173c4125 100644 --- a/addons/attach/functions/fnc_handleGetIn.sqf +++ b/addons/attach/functions/fnc_handleGetIn.sqf @@ -36,7 +36,7 @@ if (!isNull _xObject) then { params ["_detachedLight"]; TRACE_1("delayed delete",_detachedLight); deleteVehicle _detachedLight; - }, [_xObject], 2] call EFUNC(common,waitAndExecute); + }, [_xObject], 2] call CBA_fnc_waitAndExecute; (_attachedList select 0) set [0, objNull]; }; diff --git a/addons/attach/functions/fnc_handleKilled.sqf b/addons/attach/functions/fnc_handleKilled.sqf index 06c5473c88..69ab31122b 100644 --- a/addons/attach/functions/fnc_handleKilled.sqf +++ b/addons/attach/functions/fnc_handleKilled.sqf @@ -32,7 +32,7 @@ if ((count _attachedList) == 0) exitWith {}; //If it's a vehicle, also delete the attached if (!(_deadUnit isKindOf "CAManBase")) then { _xObject setPos ((getPos _deadUnit) vectorAdd [0, 0, -1000]); - [{deleteVehicle (_this select 0)}, [_xObject], 2] call EFUNC(common,waitAndExecute); + [{deleteVehicle (_this select 0)}, [_xObject], 2] call CBA_fnc_waitAndExecute; }; } forEach _attachedList; diff --git a/addons/attach/script_component.hpp b/addons/attach/script_component.hpp index 68300f47cd..aa6165ae8e 100644 --- a/addons/attach/script_component.hpp +++ b/addons/attach/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT attach +#define COMPONENT_BEAUTIFIED Attach #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/backpacks/XEH_postInit.sqf b/addons/backpacks/XEH_postInit.sqf index 375fcd5f89..de5ffa4bee 100644 --- a/addons/backpacks/XEH_postInit.sqf +++ b/addons/backpacks/XEH_postInit.sqf @@ -1,3 +1,3 @@ #include "script_component.hpp" -["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler); +["ace_backpackOpened", {_this call FUNC(backpackOpened)}] call CBA_fnc_addEventHandler; diff --git a/addons/backpacks/config.cpp b/addons/backpacks/config.cpp index ddc7639921..80439533e2 100644 --- a/addons/backpacks/config.cpp +++ b/addons/backpacks/config.cpp @@ -2,14 +2,20 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"bux","commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"bux","commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" + +class ACE_newEvents { + backpackOpened = "ace_backpackOpened"; +}; diff --git a/addons/backpacks/functions/fnc_onOpenInventory.sqf b/addons/backpacks/functions/fnc_onOpenInventory.sqf index d9a99535eb..0857f6b7ab 100644 --- a/addons/backpacks/functions/fnc_onOpenInventory.sqf +++ b/addons/backpacks/functions/fnc_onOpenInventory.sqf @@ -24,7 +24,7 @@ private _target = objectParent _backpack; if (isNull _target) exitWith {false}; // raise event on target unit -["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent); +["ace_backpackOpened", [_target, _backpack], _target] call CBA_fnc_targetEvent; // return false to open inventory as usual false diff --git a/addons/backpacks/script_component.hpp b/addons/backpacks/script_component.hpp index 653e8ac684..6cfb663dd2 100644 --- a/addons/backpacks/script_component.hpp +++ b/addons/backpacks/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT backpacks +#define COMPONENT_BEAUTIFIED Backpacks #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_BACKPACKS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/ballistics/CfgAmmo.hpp b/addons/ballistics/CfgAmmo.hpp index eeb64fec47..0819f8aa4b 100644 --- a/addons/ballistics/CfgAmmo.hpp +++ b/addons/ballistics/CfgAmmo.hpp @@ -1,806 +1,806 @@ - -class CfgAmmo { - class BulletCore; - - class BulletBase: BulletCore { - timeToLive=6; - }; - - class B_556x45_Ball : BulletBase { - airFriction=-0.00126466; - hit=8; - typicalSpeed=750; - tracerScale = 1; - tracerStartTime=0.073; // M856 tracer burns out to 800m - tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.0176; - ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; - ACE_ballisticCoefficients[]={0.151}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; - ACE_barrelLengths[]={210.82, 238.76, 269.24, 299.72, 330.2, 360.68, 391.16, 419.1, 449.58, 480.06, 508.0, 609.6}; - }; - class ACE_556x45_Ball_Mk262 : B_556x45_Ball { - airFriction=-0.00109563; - caliber=0.8; - deflecting=18; - hit=11; - typicalSpeed=836; - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.9896; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.361}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={624, 816, 832, 838}; - ACE_barrelLengths[]={190.5, 368.3, 457.2, 508.0}; - }; - class ACE_556x45_Ball_Mk318 : B_556x45_Ball { - airFriction=-0.00123318; - caliber=0.8; - deflecting=18; - hit=9; - typicalSpeed=886; - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.0176; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.307}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={780, 886, 950}; - ACE_barrelLengths[]={254.0, 393.7, 508.0}; - }; - class ACE_556x45_Ball_M995_AP : B_556x45_Ball { - airFriction=-0.00123272; - caliber=1.6; - deflecting=18; - hit=6; - typicalSpeed=869; - ACE_caliber=5.69; - ACE_bulletLength=23.012; - ACE_bulletMass=4.5359237; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.310}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820, 865, 880}; - ACE_barrelLengths[]={254.0, 368.3, 508.0}; - }; - class B_556x45_Ball_Tracer_Red; - class ACE_B_556x45_Ball_Tracer_Dim: B_556x45_Ball_Tracer_Red { - nvgOnly = 1; - }; - class ACE_545x39_Ball_7N6M : B_556x45_Ball { - airFriction=-0.00114744; - caliber=0.6; - deflecting=18; - hit=7; - typicalSpeed=880; - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.42792; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={780, 880, 920}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class B_556x45_Ball_Tracer_Green; - class ACE_545x39_Ball_7T3M : B_556x45_Ball_Tracer_Green { - airFriction=-0.00114744; - caliber=0.6; - deflecting=18; - hit=7; - typicalSpeed=883; - tracerStartTime=0.073; // 7T3M tracer burns out to 850m - tracerEndTime=1.70236; // Time in seconds calculated with ballistics calculator - ACE_caliber=5.588; - ACE_bulletLength=21.59; - ACE_bulletMass=3.22704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.168}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={785, 883, 925}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class B_56x15_dual: BulletBase { - tracerScale = 0.5; - }; - class B_65x39_Caseless : BulletBase { - airFriction=-0.00075308; - typicalSpeed=800; - tracerScale = 1.1; //1.0; - ACE_caliber=6.706; - ACE_bulletLength=32.893; - ACE_bulletMass=7.9704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.263}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={730, 760, 788, 800, 810, 830}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4, 762.0}; - }; - class B_65x39_Case_yellow; - class ACE_65x39_Caseless_Tracer_Dim : B_65x39_Case_yellow { - nvgOnly = 1; - }; - class B_65x39_Caseless_green; - class ACE_65x39_Caseless_green_Tracer_Dim : B_65x39_Caseless_green { - nvgOnly = 1; - }; - class ACE_65x47_Ball_Scenar: B_65x39_Caseless { - airFriction=-0.00067037; - typicalSpeed=820 ; - caliber=0.9; - ACE_caliber=6.706; - ACE_bulletLength=34.646; - ACE_bulletMass=9.0072; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.290}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={730, 760, 790, 820, 830}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class ACE_65_Creedmor_Ball: B_65x39_Caseless { - airFriction=-0.00060887; - typicalSpeed=860 ; - caliber=1.1; - ACE_caliber=6.706; - ACE_bulletLength=36.22; - ACE_bulletMass=9.072; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.317}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={750, 820, 840, 852, 860}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class SubmunitionBullet; - class B_65x39_Minigun_Caseless: SubmunitionBullet { - tracerScale = 1.1; //1.0; - }; - class B_762x51_Ball : BulletBase { - airFriction=-0.00100957; - typicalSpeed=833; - hit=9; - tracerScale = 1.2; //0.6; - tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m - tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=9.4608; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.2}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class B_762x51_Tracer_Yellow; - class ACE_B_762x51_Tracer_Dim: B_762x51_Tracer_Yellow { - nvgOnly = 1; - }; - class ACE_762x51_Ball_M118LR : B_762x51_Ball { - airFriction=-0.00082828; - caliber=1.8; - hit=16; - typicalSpeed=790; - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=11.34; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.243}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={750, 780, 790, 794}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class ACE_762x51_Ball_Mk316_Mod_0 : B_762x51_Ball { - airFriction=-0.00082029; - caliber=1.8; - hit=16; - typicalSpeed=790; - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=11.34; - ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; - ACE_ballisticCoefficients[]={0.243}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={775, 790, 805, 810}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class ACE_762x51_Ball_Mk319_Mod_0 : B_762x51_Ball { - airFriction=-0.00102338; - caliber=1.5; - hit=14; - typicalSpeed=900; - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=8.424; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.377}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={838, 892, 910}; - ACE_barrelLengths[]={330.2, 406.4, 508.0}; - }; - class ACE_762x51_Ball_M993_AP : B_762x51_Ball { - airFriction=-0.00107148; - caliber=2.2; - hit=11; - typicalSpeed=910; - ACE_caliber=7.823; - ACE_bulletLength=31.496; - ACE_bulletMass=8.22946157; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.359}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={875, 910, 930}; - ACE_barrelLengths[]={330.2, 406.4, 508.0}; - }; - class ACE_762x51_Ball_Subsonic : B_762x51_Ball { - airFriction=-0.00049899; - caliber=1; - hit=6; - typicalSpeed=320; - ACE_caliber=7.823; - ACE_bulletLength=34.036; - ACE_bulletMass=12.96; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.235}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={305, 325, 335, 340}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class ACE_30_06_M1_Ball : B_762x51_Ball { - airFriction=-0.00080900; - typicalSpeed=800; - caliber=2.0; - hit=10; - ACE_caliber=7.823; - ACE_bulletLength=30.734; - ACE_bulletMass=11.2752; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.494}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={700, 785, 800, 830, 840}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class ACE_7_Remington_Magnum_Ball : B_762x51_Ball { - airFriction=-0.00056738; - typicalSpeed=820; - caliber=2.1; - hit=8; - ACE_caliber=7.214; - ACE_bulletLength=38.837; - ACE_bulletMass=11.664; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.345}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={720, 780, 812, 822, 830}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class ACE_243_Winchester_Ball : B_762x51_Ball { - airFriction=-0.00067875; - typicalSpeed=915; - caliber=2.3; - hit=6; - ACE_caliber=6.172; - ACE_bulletLength=32.563; - ACE_bulletMass=11.664; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.278}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={830, 875, 900, 915, 920}; - ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; - }; - class ACE_762x67_Ball_Mk248_Mod_0 : B_762x51_Ball { - airFriction=-0.00070530; - caliber=1.8; - hit=17; - typicalSpeed=900; - ACE_caliber=7.823; - ACE_bulletLength=34.366; - ACE_bulletMass=12.312; - ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; - ACE_ballisticCoefficients[]={0.268}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={865, 900, 924}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class ACE_762x67_Ball_Mk248_Mod_1 : B_762x51_Ball { - airFriction=-0.00061188; - caliber=1.9; - hit=18; - typicalSpeed=867; - ACE_caliber=7.823; - ACE_bulletLength=37.821; - ACE_bulletMass=14.256; - ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; - ACE_ballisticCoefficients[]={0.310}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={847, 867, 877}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class ACE_762x67_Ball_Berger_Hybrid_OTM : B_762x51_Ball { - airFriction=-0.00053733; - caliber=2.0; - hit=19; - typicalSpeed=853; - ACE_caliber=7.823; - ACE_bulletLength=40.691; - ACE_bulletMass=14.904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.368}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={800, 853, 884}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class B_762x54_Ball: B_762x51_Ball { - airFriction=-0.00100023; - typicalSpeed=820; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.8496; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.4}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={700, 800, 820, 833}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class ACE_762x54_Ball_7N14 : B_762x51_Ball { - airFriction=-0.00100023; - caliber=1.5; - hit=15; - typicalSpeed=820; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.8496; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.4}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={700, 800, 820, 833}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class B_762x54_Tracer_Green; - class ACE_762x54_Ball_7T2 : B_762x54_Tracer_Green { - airFriction=-0.00103989; - caliber=1.5; - hit=15; - typicalSpeed=800; - tracerStartTime=0.073; // Based on the 7T2 which burns three seconds - tracerEndTime=3; - ACE_caliber=7.925; - ACE_bulletLength=28.956; - ACE_bulletMass=9.6552; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.395}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={680, 750, 798, 800}; - ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; - }; - class ACE_762x35_Ball : B_762x51_Ball { - airFriction=-0.00128942; - caliber=1.5; - hit=11; - typicalSpeed=790; - ACE_caliber=7.823; - ACE_bulletLength=29.286; - ACE_bulletMass=8.1; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.349, 0.338, 0.330, 0.310}; - ACE_velocityBoundaries[]={792, 610, 488}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={620, 655, 675}; - ACE_barrelLengths[]={228.6, 406.4, 508.0}; - }; - class ACE_762x39_Ball : B_762x51_Ball { - airFriction=-0.00151621; - hit=12; - caliber=1.5; - typicalSpeed=716; - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=7.9704; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={650, 716, 750}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class ACE_762x39_Ball_57N231P : B_762x54_Tracer_Green { - airFriction=-0.00151621; - hit=12; - caliber=1.5; - typicalSpeed=716; - tracerStartTime = 0.073; //57N231P tracer burns out to 800m - tracerEndTime = 2.082; //Time in seconds calculated with ballistics calculator - ACE_caliber=7.823; - ACE_bulletLength=28.956; - ACE_bulletMass=7.5816; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.275}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={650, 716, 750}; - ACE_barrelLengths[]={254.0, 414.02, 508.0}; - }; - class B_9x21_Ball : BulletBase { - airFriction=-0.00226847; - typicalSpeed=390; - tracerScale = 0.5; - hit=6; - ACE_caliber=9.042; - ACE_bulletLength=15.494; - ACE_bulletMass=7.452; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.17}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={440, 460, 480}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class B_9x21_Ball_Tracer_Green: B_9x21_Ball { - tracerScale = 0.5; - }; - class ACE_9x18_Ball_57N181S : B_9x21_Ball { - hit=5; - airFriction=-0.00190333; - typicalSpeed=298; - ACE_caliber=9.271; - ACE_bulletLength=15.494; - ACE_bulletMass=6.00048; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.125}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={298, 330, 350}; - ACE_barrelLengths[]={96.52, 127.0, 228.6}; - }; - class ACE_9x19_Ball : B_9x21_Ball { - airFriction=-0.0018577; - typicalSpeed=370; - hit=6; - ACE_caliber=9.017; - ACE_bulletLength=15.494; - ACE_bulletMass=8.0352; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.165}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={340, 370, 400}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class ACE_10x25_Ball : B_9x21_Ball { - airFriction=-0.00181928; - typicalSpeed=425; - hit=7; - ACE_caliber=12.7; - ACE_bulletLength=19.406; - ACE_bulletMass=10.692; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.189}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={360, 400, 430}; - ACE_barrelLengths[]={101.6, 117.094, 228.6}; - }; - class ACE_765x17_Ball: B_9x21_Ball { - airFriction=-0.00163356; - typicalSpeed=282; - hit=7; - ACE_caliber=7.938; - ACE_bulletLength=15.494; - ACE_bulletMass=4.212; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.118}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={282, 300, 320}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class ACE_303_Ball : ACE_762x51_Ball_M118LR { - airFriction=-0.0008349; - typicalSpeed=761; - caliber=2.0; - ACE_caliber=7.899; - ACE_bulletLength=31.166; - ACE_bulletMass=11.2752; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.499, 0.493, 0.48}; - ACE_velocityBoundaries[]={671, 549}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={748, 761, 765}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class B_93x64_Ball : BulletBase { - airFriction=-0.00108571; - typicalSpeed=880; - ACE_caliber=9.296; - ACE_bulletLength=34.29; - ACE_bulletMass=14.904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.368}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={850, 870, 880}; - ACE_barrelLengths[]={508.0, 620.014, 660.4}; - }; - class B_408_Ball : BulletBase { - timeToLive=10; - airFriction=-0.00038944; - typicalSpeed=910; - tracerScale = 1.3; //1.2; - ACE_caliber=10.363; - ACE_bulletLength=54.0; - ACE_bulletMass=26.568; - ACE_transonicStabilityCoef=1; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.97}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={910}; - ACE_barrelLengths[]={736.6}; - }; - class ACE_106x83mm_Ball : B_408_Ball { - timeToLive=10; - airFriction=-0.00052047; - ACE_caliber=10.566; - ACE_bulletLength=53.061; - ACE_bulletMass=25.7904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.72}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={960}; - ACE_barrelLengths[]={736.6}; - }; - class B_338_Ball : BulletBase { - timeToLive=10; - airFriction=-0.00059133; - typicalSpeed=915; - ACE_caliber=8.585; - ACE_bulletLength=39.573; - ACE_bulletMass=16.2; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.322}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={880, 915, 925}; - ACE_barrelLengths[]={508.0, 660.4, 711.2}; - }; - class B_338_NM_Ball : BulletBase { - airFriction=-0.00052201; - typicalSpeed=820; - ACE_caliber=8.585; - ACE_bulletLength=43.18; - ACE_bulletMass=19.44; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.381}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={790, 807, 820}; - ACE_barrelLengths[]={508.0, 609.6, 660.4}; - }; - class ACE_338_Ball : B_338_Ball { - timeToLive=10; - airFriction=-0.00052190; - typicalSpeed=826; - ACE_caliber=8.585; - ACE_bulletLength=43.18; - ACE_bulletMass=19.44; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.381}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=7; - ACE_muzzleVelocities[]={800, 820, 826, 830}; - ACE_barrelLengths[]={508.0, 609.6, 673.1, 711.2}; - }; - class ACE_338_Ball_API526 : B_338_Ball { - timeToLive=10; - airFriction=-0.00069611; - caliber=2.8; - typicalSpeed=895; - ACE_caliber=8.585; - ACE_bulletLength=38.989; - ACE_bulletMass=16.3941242; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.560}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ICAO"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={880, 915, 925}; - ACE_barrelLengths[]={508.0, 660.4, 711.2}; - }; - class B_127x33_Ball: BulletBase { - tracerScale = 1.3; //1.2; - }; - class B_127x54_Ball : BulletBase { - airFriction=-0.00019268; - typicalSpeed=300; - tracerScale = 1.3;// - ACE_caliber=12.954; - ACE_bulletLength=64.516; - ACE_bulletMass=48.6; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={1.050}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={300}; - ACE_barrelLengths[]={436.88}; - }; - class B_127x99_Ball : BulletBase { - timeToLive=10; - airFriction=-0.00057503; - typicalSpeed=900; - tracerScale = 1.3; //1.2; - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9256; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class ACE_127x99_API : BulletBase { - timeToLive=10; - airFriction=-0.00057503; - typicalSpeed=900; - tracerScale = 1.3;// - hit=25; - caliber=4.0; - ACE_caliber=12.954; - ACE_bulletLength=58.674; - ACE_bulletMass=41.9904; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.670}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={900}; - ACE_barrelLengths[]={736.6}; - }; - class ACE_127x99_Ball_AMAX : B_127x99_Ball { - timeToLive=10; - airFriction=-0.00036645; - typicalSpeed=860; - caliber=3.0; - ACE_caliber=12.954; - ACE_bulletLength=64.516; - ACE_bulletMass=48.6; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={1.050}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={860}; - ACE_barrelLengths[]={736.6}; - }; - class B_127x108_Ball : BulletBase { - timeToLive=10; - airFriction=-0.00063800; - typicalSpeed=820; - tracerScale = 1.3; //1.5; - ACE_caliber=12.979; - ACE_bulletLength=64.008; - ACE_bulletMass=48.276; - ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; - ACE_ballisticCoefficients[]={0.63}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={820}; - ACE_barrelLengths[]={728.98}; - }; - class B_45ACP_Ball : BulletBase { - airFriction=-0.00081221; - typicalSpeed=250; - tracerScale = 0.6; - ACE_caliber=11.481; - ACE_bulletLength=17.272; - ACE_bulletMass=14.904; - ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; - ACE_ballisticCoefficients[]={0.195}; - ACE_velocityBoundaries[]={}; - ACE_standardAtmosphere="ASM"; - ACE_dragModel=1; - ACE_muzzleVelocities[]={230, 250, 285}; - ACE_barrelLengths[]={101.6, 127.0, 228.6}; - }; - class B_19mm_HE: BulletBase { - tracerScale = 1; - }; - class B_30mm_HE: B_19mm_HE { - tracerScale = 2.5; - }; - class B_20mm: BulletBase { - timeToLive=30; - tracerScale = 1.5; //1; - }; - class B_25mm: BulletBase { - timeToLive=30; - tracerScale = 2.0; //1; - }; - class B_30mm_AP: BulletBase { - timeToLive=30; - tracerScale = 2.5; - }; - class B_35mm_AA: BulletBase { - timeToLive=30; - tracerScale = 2.75; //1.85; - }; - class ShellBase; - class Sh_120mm_HE: ShellBase { - tracerScale = 3; - }; - class Sh_120mm_APFSDS: ShellBase { - tracerScale = 3; - }; - class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase { - tracerScale = 2.5; - }; -}; + +class CfgAmmo { + class BulletCore; + + class BulletBase: BulletCore { + timeToLive=6; + }; + + class B_556x45_Ball : BulletBase { + airFriction=-0.00126466; + hit=8; + typicalSpeed=750; + tracerScale = 1; + tracerStartTime=0.073; // M856 tracer burns out to 800m + tracerEndTime=1.57123; // Time in seconds calculated with ballistics calculator + ACE_caliber=5.69; + ACE_bulletLength=23.012; + ACE_bulletMass=4.0176; + ACE_ammoTempMuzzleVelocityShifts[]={-27.20, -26.44, -23.76, -21.00, -17.54, -13.10, -7.95, -1.62, 6.24, 15.48, 27.75}; + ACE_ballisticCoefficients[]={0.151}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={723, 764, 796, 825, 843, 866, 878, 892, 906, 915, 922, 900}; + ACE_barrelLengths[]={210.82, 238.76, 269.24, 299.72, 330.2, 360.68, 391.16, 419.1, 449.58, 480.06, 508.0, 609.6}; + }; + class ACE_556x45_Ball_Mk262 : B_556x45_Ball { + airFriction=-0.00109563; + caliber=0.8; + deflecting=18; + hit=11; + typicalSpeed=836; + ACE_caliber=5.69; + ACE_bulletLength=23.012; + ACE_bulletMass=4.9896; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.361}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={624, 816, 832, 838}; + ACE_barrelLengths[]={190.5, 368.3, 457.2, 508.0}; + }; + class ACE_556x45_Ball_Mk318 : B_556x45_Ball { + airFriction=-0.00123318; + caliber=0.8; + deflecting=18; + hit=9; + typicalSpeed=886; + ACE_caliber=5.69; + ACE_bulletLength=23.012; + ACE_bulletMass=4.0176; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.307}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={780, 886, 950}; + ACE_barrelLengths[]={254.0, 393.7, 508.0}; + }; + class ACE_556x45_Ball_M995_AP : B_556x45_Ball { + airFriction=-0.00123272; + caliber=1.6; + deflecting=18; + hit=6; + typicalSpeed=869; + ACE_caliber=5.69; + ACE_bulletLength=23.012; + ACE_bulletMass=4.5359237; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.310}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={820, 865, 880}; + ACE_barrelLengths[]={254.0, 368.3, 508.0}; + }; + class B_556x45_Ball_Tracer_Red; + class ACE_B_556x45_Ball_Tracer_Dim: B_556x45_Ball_Tracer_Red { + nvgOnly = 1; + }; + class ACE_545x39_Ball_7N6M : B_556x45_Ball { + airFriction=-0.00114744; + caliber=0.6; + deflecting=18; + hit=7; + typicalSpeed=880; + ACE_caliber=5.588; + ACE_bulletLength=21.59; + ACE_bulletMass=3.42792; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={780, 880, 920}; + ACE_barrelLengths[]={254.0, 414.02, 508.0}; + }; + class B_556x45_Ball_Tracer_Green; + class ACE_545x39_Ball_7T3M : B_556x45_Ball_Tracer_Green { + airFriction=-0.00114744; + caliber=0.6; + deflecting=18; + hit=7; + typicalSpeed=883; + tracerStartTime=0.073; // 7T3M tracer burns out to 850m + tracerEndTime=1.70236; // Time in seconds calculated with ballistics calculator + ACE_caliber=5.588; + ACE_bulletLength=21.59; + ACE_bulletMass=3.22704; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.168}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={785, 883, 925}; + ACE_barrelLengths[]={254.0, 414.02, 508.0}; + }; + class B_56x15_dual: BulletBase { + tracerScale = 0.5; + }; + class B_65x39_Caseless : BulletBase { + airFriction=-0.00075308; + typicalSpeed=800; + tracerScale = 1.1; //1.0; + ACE_caliber=6.706; + ACE_bulletLength=32.893; + ACE_bulletMass=7.9704; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.263}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={730, 760, 788, 800, 810, 830}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4, 762.0}; + }; + class B_65x39_Case_yellow; + class ACE_65x39_Caseless_Tracer_Dim : B_65x39_Case_yellow { + nvgOnly = 1; + }; + class B_65x39_Caseless_green; + class ACE_65x39_Caseless_green_Tracer_Dim : B_65x39_Caseless_green { + nvgOnly = 1; + }; + class ACE_65x47_Ball_Scenar: B_65x39_Caseless { + airFriction=-0.00067037; + typicalSpeed=820 ; + caliber=0.9; + ACE_caliber=6.706; + ACE_bulletLength=34.646; + ACE_bulletMass=9.0072; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.290}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={730, 760, 790, 820, 830}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class ACE_65_Creedmor_Ball: B_65x39_Caseless { + airFriction=-0.00060887; + typicalSpeed=860 ; + caliber=1.1; + ACE_caliber=6.706; + ACE_bulletLength=36.22; + ACE_bulletMass=9.072; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.317}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={750, 820, 840, 852, 860}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class SubmunitionBullet; + class B_65x39_Minigun_Caseless: SubmunitionBullet { + tracerScale = 1.1; //1.0; + }; + class B_762x51_Ball : BulletBase { + airFriction=-0.00100957; + typicalSpeed=833; + hit=9; + tracerScale = 1.2; //0.6; + tracerStartTime=0.073; // Based on the British L5A1 which burns out to 1000m + tracerEndTime=2.15957; // Time in seconds calculated with ballistics calculator + ACE_caliber=7.823; + ACE_bulletLength=28.956; + ACE_bulletMass=9.4608; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.2}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={700, 800, 820, 833, 845}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class B_762x51_Tracer_Yellow; + class ACE_B_762x51_Tracer_Dim: B_762x51_Tracer_Yellow { + nvgOnly = 1; + }; + class ACE_762x51_Ball_M118LR : B_762x51_Ball { + airFriction=-0.00082828; + caliber=1.8; + hit=16; + typicalSpeed=790; + ACE_caliber=7.823; + ACE_bulletLength=31.496; + ACE_bulletMass=11.34; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.243}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={750, 780, 790, 794}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class ACE_762x51_Ball_Mk316_Mod_0 : B_762x51_Ball { + airFriction=-0.00082029; + caliber=1.8; + hit=16; + typicalSpeed=790; + ACE_caliber=7.823; + ACE_bulletLength=31.496; + ACE_bulletMass=11.34; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; + ACE_ballisticCoefficients[]={0.243}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={775, 790, 805, 810}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class ACE_762x51_Ball_Mk319_Mod_0 : B_762x51_Ball { + airFriction=-0.00102338; + caliber=1.5; + hit=14; + typicalSpeed=900; + ACE_caliber=7.823; + ACE_bulletLength=31.496; + ACE_bulletMass=8.424; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.377}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={838, 892, 910}; + ACE_barrelLengths[]={330.2, 406.4, 508.0}; + }; + class ACE_762x51_Ball_M993_AP : B_762x51_Ball { + airFriction=-0.00107148; + caliber=2.2; + hit=11; + typicalSpeed=910; + ACE_caliber=7.823; + ACE_bulletLength=31.496; + ACE_bulletMass=8.22946157; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.359}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={875, 910, 930}; + ACE_barrelLengths[]={330.2, 406.4, 508.0}; + }; + class ACE_762x51_Ball_Subsonic : B_762x51_Ball { + airFriction=-0.00049899; + caliber=1; + hit=6; + typicalSpeed=320; + ACE_caliber=7.823; + ACE_bulletLength=34.036; + ACE_bulletMass=12.96; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.235}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={305, 325, 335, 340}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class ACE_30_06_M1_Ball : B_762x51_Ball { + airFriction=-0.00080900; + typicalSpeed=800; + caliber=2.0; + hit=10; + ACE_caliber=7.823; + ACE_bulletLength=30.734; + ACE_bulletMass=11.2752; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.494}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={700, 785, 800, 830, 840}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class ACE_7_Remington_Magnum_Ball : B_762x51_Ball { + airFriction=-0.00056738; + typicalSpeed=820; + caliber=2.1; + hit=8; + ACE_caliber=7.214; + ACE_bulletLength=38.837; + ACE_bulletMass=11.664; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.345}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={720, 780, 812, 822, 830}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class ACE_243_Winchester_Ball : B_762x51_Ball { + airFriction=-0.00067875; + typicalSpeed=915; + caliber=2.3; + hit=6; + ACE_caliber=6.172; + ACE_bulletLength=32.563; + ACE_bulletMass=11.664; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.278}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={830, 875, 900, 915, 920}; + ACE_barrelLengths[]={254.0, 406.4, 508.0, 609.6, 660.4}; + }; + class ACE_762x67_Ball_Mk248_Mod_0 : B_762x51_Ball { + airFriction=-0.00070530; + caliber=1.8; + hit=17; + typicalSpeed=900; + ACE_caliber=7.823; + ACE_bulletLength=34.366; + ACE_bulletMass=12.312; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; + ACE_ballisticCoefficients[]={0.268}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={865, 900, 924}; + ACE_barrelLengths[]={508.0, 609.6, 660.4}; + }; + class ACE_762x67_Ball_Mk248_Mod_1 : B_762x51_Ball { + airFriction=-0.00061188; + caliber=1.9; + hit=18; + typicalSpeed=867; + ACE_caliber=7.823; + ACE_bulletLength=37.821; + ACE_bulletMass=14.256; + ACE_ammoTempMuzzleVelocityShifts[]={-5.3, -5.1, -4.6, -4.2, -3.4, -2.6, -1.4, -0.3, 1.4, 3.0, 5.2}; + ACE_ballisticCoefficients[]={0.310}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={847, 867, 877}; + ACE_barrelLengths[]={508.0, 609.6, 660.4}; + }; + class ACE_762x67_Ball_Berger_Hybrid_OTM : B_762x51_Ball { + airFriction=-0.00053733; + caliber=2.0; + hit=19; + typicalSpeed=853; + ACE_caliber=7.823; + ACE_bulletLength=40.691; + ACE_bulletMass=14.904; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.368}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={800, 853, 884}; + ACE_barrelLengths[]={508.0, 609.6, 660.4}; + }; + class B_762x54_Ball: B_762x51_Ball { + airFriction=-0.00100023; + typicalSpeed=820; + ACE_caliber=7.925; + ACE_bulletLength=28.956; + ACE_bulletMass=9.8496; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.4}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={700, 800, 820, 833}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class ACE_762x54_Ball_7N14 : B_762x51_Ball { + airFriction=-0.00100023; + caliber=1.5; + hit=15; + typicalSpeed=820; + ACE_caliber=7.925; + ACE_bulletLength=28.956; + ACE_bulletMass=9.8496; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.4}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={700, 800, 820, 833}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class B_762x54_Tracer_Green; + class ACE_762x54_Ball_7T2 : B_762x54_Tracer_Green { + airFriction=-0.00103989; + caliber=1.5; + hit=15; + typicalSpeed=800; + tracerStartTime=0.073; // Based on the 7T2 which burns three seconds + tracerEndTime=3; + ACE_caliber=7.925; + ACE_bulletLength=28.956; + ACE_bulletMass=9.6552; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.395}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={680, 750, 798, 800}; + ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; + }; + class ACE_762x35_Ball : B_762x51_Ball { + airFriction=-0.00128942; + caliber=1.5; + hit=11; + typicalSpeed=790; + ACE_caliber=7.823; + ACE_bulletLength=29.286; + ACE_bulletMass=8.1; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.349, 0.338, 0.330, 0.310}; + ACE_velocityBoundaries[]={792, 610, 488}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={620, 655, 675}; + ACE_barrelLengths[]={228.6, 406.4, 508.0}; + }; + class ACE_762x39_Ball : B_762x51_Ball { + airFriction=-0.00151621; + hit=12; + caliber=1.5; + typicalSpeed=716; + ACE_caliber=7.823; + ACE_bulletLength=28.956; + ACE_bulletMass=7.9704; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={254.0, 414.02, 508.0}; + }; + class ACE_762x39_Ball_57N231P : B_762x54_Tracer_Green { + airFriction=-0.00151621; + hit=12; + caliber=1.5; + typicalSpeed=716; + tracerStartTime = 0.073; //57N231P tracer burns out to 800m + tracerEndTime = 2.082; //Time in seconds calculated with ballistics calculator + ACE_caliber=7.823; + ACE_bulletLength=28.956; + ACE_bulletMass=7.5816; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.275}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={650, 716, 750}; + ACE_barrelLengths[]={254.0, 414.02, 508.0}; + }; + class B_9x21_Ball : BulletBase { + airFriction=-0.00226847; + typicalSpeed=390; + tracerScale = 0.5; + hit=6; + ACE_caliber=9.042; + ACE_bulletLength=15.494; + ACE_bulletMass=7.452; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.17}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={440, 460, 480}; + ACE_barrelLengths[]={101.6, 127.0, 228.6}; + }; + class B_9x21_Ball_Tracer_Green: B_9x21_Ball { + tracerScale = 0.5; + }; + class ACE_9x18_Ball_57N181S : B_9x21_Ball { + hit=5; + airFriction=-0.00190333; + typicalSpeed=298; + ACE_caliber=9.271; + ACE_bulletLength=15.494; + ACE_bulletMass=6.00048; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.125}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={298, 330, 350}; + ACE_barrelLengths[]={96.52, 127.0, 228.6}; + }; + class ACE_9x19_Ball : B_9x21_Ball { + airFriction=-0.0018577; + typicalSpeed=370; + hit=6; + ACE_caliber=9.017; + ACE_bulletLength=15.494; + ACE_bulletMass=8.0352; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.165}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={340, 370, 400}; + ACE_barrelLengths[]={101.6, 127.0, 228.6}; + }; + class ACE_10x25_Ball : B_9x21_Ball { + airFriction=-0.00181928; + typicalSpeed=425; + hit=7; + ACE_caliber=12.7; + ACE_bulletLength=19.406; + ACE_bulletMass=10.692; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.189}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={360, 400, 430}; + ACE_barrelLengths[]={101.6, 117.094, 228.6}; + }; + class ACE_765x17_Ball: B_9x21_Ball { + airFriction=-0.00163356; + typicalSpeed=282; + hit=7; + ACE_caliber=7.938; + ACE_bulletLength=15.494; + ACE_bulletMass=4.212; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.118}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={282, 300, 320}; + ACE_barrelLengths[]={101.6, 127.0, 228.6}; + }; + class ACE_303_Ball : ACE_762x51_Ball_M118LR { + airFriction=-0.0008349; + typicalSpeed=761; + caliber=2.0; + ACE_caliber=7.899; + ACE_bulletLength=31.166; + ACE_bulletMass=11.2752; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.499, 0.493, 0.48}; + ACE_velocityBoundaries[]={671, 549}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={748, 761, 765}; + ACE_barrelLengths[]={508.0, 609.6, 660.4}; + }; + class B_93x64_Ball : BulletBase { + airFriction=-0.00108571; + typicalSpeed=880; + ACE_caliber=9.296; + ACE_bulletLength=34.29; + ACE_bulletMass=14.904; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.368}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={850, 870, 880}; + ACE_barrelLengths[]={508.0, 620.014, 660.4}; + }; + class B_408_Ball : BulletBase { + timeToLive=10; + airFriction=-0.00038944; + typicalSpeed=910; + tracerScale = 1.3; //1.2; + ACE_caliber=10.363; + ACE_bulletLength=54.0; + ACE_bulletMass=26.568; + ACE_transonicStabilityCoef=1; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.97}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={910}; + ACE_barrelLengths[]={736.6}; + }; + class ACE_106x83mm_Ball : B_408_Ball { + timeToLive=10; + airFriction=-0.00052047; + ACE_caliber=10.566; + ACE_bulletLength=53.061; + ACE_bulletMass=25.7904; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.72}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={960}; + ACE_barrelLengths[]={736.6}; + }; + class B_338_Ball : BulletBase { + timeToLive=10; + airFriction=-0.00059133; + typicalSpeed=915; + ACE_caliber=8.585; + ACE_bulletLength=39.573; + ACE_bulletMass=16.2; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.322}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={880, 915, 925}; + ACE_barrelLengths[]={508.0, 660.4, 711.2}; + }; + class B_338_NM_Ball : BulletBase { + airFriction=-0.00052201; + typicalSpeed=820; + ACE_caliber=8.585; + ACE_bulletLength=43.18; + ACE_bulletMass=19.44; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.381}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={790, 807, 820}; + ACE_barrelLengths[]={508.0, 609.6, 660.4}; + }; + class ACE_338_Ball : B_338_Ball { + timeToLive=10; + airFriction=-0.00052190; + typicalSpeed=826; + ACE_caliber=8.585; + ACE_bulletLength=43.18; + ACE_bulletMass=19.44; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.381}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=7; + ACE_muzzleVelocities[]={800, 820, 826, 830}; + ACE_barrelLengths[]={508.0, 609.6, 673.1, 711.2}; + }; + class ACE_338_Ball_API526 : B_338_Ball { + timeToLive=10; + airFriction=-0.00069611; + caliber=2.8; + typicalSpeed=895; + ACE_caliber=8.585; + ACE_bulletLength=38.989; + ACE_bulletMass=16.3941242; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.560}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ICAO"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={880, 915, 925}; + ACE_barrelLengths[]={508.0, 660.4, 711.2}; + }; + class B_127x33_Ball: BulletBase { + tracerScale = 1.3; //1.2; + }; + class B_127x54_Ball : BulletBase { + airFriction=-0.00019268; + typicalSpeed=300; + tracerScale = 1.3;// + ACE_caliber=12.954; + ACE_bulletLength=64.516; + ACE_bulletMass=48.6; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={1.050}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={300}; + ACE_barrelLengths[]={436.88}; + }; + class B_127x99_Ball : BulletBase { + timeToLive=10; + airFriction=-0.00057503; + typicalSpeed=900; + tracerScale = 1.3; //1.2; + ACE_caliber=12.954; + ACE_bulletLength=58.674; + ACE_bulletMass=41.9256; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.670}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={900}; + ACE_barrelLengths[]={736.6}; + }; + class ACE_127x99_API : BulletBase { + timeToLive=10; + airFriction=-0.00057503; + typicalSpeed=900; + tracerScale = 1.3;// + hit=25; + caliber=4.0; + ACE_caliber=12.954; + ACE_bulletLength=58.674; + ACE_bulletMass=41.9904; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.670}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={900}; + ACE_barrelLengths[]={736.6}; + }; + class ACE_127x99_Ball_AMAX : B_127x99_Ball { + timeToLive=10; + airFriction=-0.00036645; + typicalSpeed=860; + caliber=3.0; + ACE_caliber=12.954; + ACE_bulletLength=64.516; + ACE_bulletMass=48.6; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={1.050}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={860}; + ACE_barrelLengths[]={736.6}; + }; + class B_127x108_Ball : BulletBase { + timeToLive=10; + airFriction=-0.00063800; + typicalSpeed=820; + tracerScale = 1.3; //1.5; + ACE_caliber=12.979; + ACE_bulletLength=64.008; + ACE_bulletMass=48.276; + ACE_ammoTempMuzzleVelocityShifts[]={-26.55, -25.47, -22.85, -20.12, -16.98, -12.80, -7.64, -1.53, 5.96, 15.17, 26.19}; + ACE_ballisticCoefficients[]={0.63}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={820}; + ACE_barrelLengths[]={728.98}; + }; + class B_45ACP_Ball : BulletBase { + airFriction=-0.00081221; + typicalSpeed=250; + tracerScale = 0.6; + ACE_caliber=11.481; + ACE_bulletLength=17.272; + ACE_bulletMass=14.904; + ACE_ammoTempMuzzleVelocityShifts[]={-2.655, -2.547, -2.285, -2.012, -1.698, -1.280, -0.764, -0.153, 0.596, 1.517, 2.619}; + ACE_ballisticCoefficients[]={0.195}; + ACE_velocityBoundaries[]={}; + ACE_standardAtmosphere="ASM"; + ACE_dragModel=1; + ACE_muzzleVelocities[]={230, 250, 285}; + ACE_barrelLengths[]={101.6, 127.0, 228.6}; + }; + class B_19mm_HE: BulletBase { + tracerScale = 1; + }; + class B_30mm_HE: B_19mm_HE { + tracerScale = 2.5; + }; + class B_20mm: BulletBase { + timeToLive=30; + tracerScale = 1.5; //1; + }; + class B_25mm: BulletBase { + timeToLive=30; + tracerScale = 2.0; //1; + }; + class B_30mm_AP: BulletBase { + timeToLive=30; + tracerScale = 2.5; + }; + class B_35mm_AA: BulletBase { + timeToLive=30; + tracerScale = 2.75; //1.85; + }; + class ShellBase; + class Sh_120mm_HE: ShellBase { + tracerScale = 3; + }; + class Sh_120mm_APFSDS: ShellBase { + tracerScale = 3; + }; + class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase { + tracerScale = 2.5; + }; +}; diff --git a/addons/ballistics/config.cpp b/addons/ballistics/config.cpp index 768ba63e02..7f63a36dd2 100644 --- a/addons/ballistics/config.cpp +++ b/addons/ballistics/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_TargetWall","ACE_Box_Ammo"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2","Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/ballistics/script_component.hpp b/addons/ballistics/script_component.hpp index b648c74e76..0b2f31da6a 100644 --- a/addons/ballistics/script_component.hpp +++ b/addons/ballistics/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT ballistics +#define COMPONENT_BEAUTIFIED Ballistics #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_BALLISTICS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/ballistics/scripts/initTargetWall.sqf b/addons/ballistics/scripts/initTargetWall.sqf index d9b16eec10..0ce3950de1 100644 --- a/addons/ballistics/scripts/initTargetWall.sqf +++ b/addons/ballistics/scripts/initTargetWall.sqf @@ -11,5 +11,5 @@ if (local _wall) then { _paper attachTo [_wall, [0,-0.02,0.6]]; _paper setDir getDir _wall; - _paper setObjectTextureGlobal [0, QUOTE(PATHTOF(textures\target_ca.paa))]; + _paper setObjectTextureGlobal [0, QPATHTOF(textures\target_ca.paa)]; }; diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 916990f1b5..e2e8df28f1 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -55,3 +55,11 @@ class Extended_Respawn_EventHandlers { }; }; }; + +class Extended_Local_EventHandlers { + class CAManBase { + class ADDON { + local = QUOTE(call FUNC(handleLocal)); + }; + }; +}; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index a8215c0cdc..2afa1cfea4 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); exceptions[] = {}; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + icon = QPATHTOF(UI\handcuff_ca.paa); }; class ACE_MainActions { @@ -21,7 +21,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); exceptions[] = {}; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + icon = QPATHTOF(UI\handcuff_ca.paa); }; class ACE_EscortCaptive { displayName = CSTRING(EscortCaptive); @@ -30,7 +30,7 @@ class CfgVehicles { statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); exceptions[] = {}; showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + icon = QPATHTOF(UI\captive_ca.paa); priority = 2.3; }; class ACE_StopEscorting { @@ -40,7 +40,7 @@ class CfgVehicles { statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); exceptions[] = {"isNotEscorting"}; showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + icon = QPATHTOF(UI\captive_ca.paa); priority = 2.3; }; class ACE_LoadCaptive { @@ -50,7 +50,7 @@ class CfgVehicles { statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); exceptions[] = {"isNotEscorting"}; showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + icon = QPATHTOF(UI\captive_ca.paa); priority = 2.2; }; class GVAR(UnloadCaptive) { @@ -79,7 +79,7 @@ class CfgVehicles { exceptions[] = {}; showDisabled = 0; priority = 0; - icon = QUOTE(PATHTOF(UI\Surrender_ca.paa)); + icon = QPATHTOF(UI\Surrender_ca.paa); }; class ACE_StopSurrenderingSelf { displayName = CSTRING(StopSurrendering); @@ -88,7 +88,7 @@ class CfgVehicles { exceptions[] = {"isNotSurrendering"}; showDisabled = 0; priority = 0; - icon = QUOTE(PATHTOF(UI\Surrender_ca.paa)); + icon = QPATHTOF(UI\Surrender_ca.paa); }; }; }; @@ -154,7 +154,7 @@ class CfgVehicles { scope = 2; //show in editor isGlobal = 0; //run on server isTriggerActivated = 1; //Wait for triggers - icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Make_Unit_Surrender_ca.paa); functionPriority = 0; class Arguments {}; class ModuleDescription: ModuleDescription { @@ -170,7 +170,7 @@ class CfgVehicles { scope = 2; //show in editor isGlobal = 0; //run on server isTriggerActivated = 1; //Wait for triggers - icon = QUOTE(PATHTOF(UI\Icon_Module_Make_Unit_Handcuffed_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Make_Unit_Handcuffed_ca.paa); functionPriority = 0; class Arguments {}; class ModuleDescription: ModuleDescription { @@ -186,7 +186,7 @@ class CfgVehicles { displayName = CSTRING(ModuleSettings_DisplayName); function = QFUNC(moduleSettings); scope = 2; - icon = QUOTE(PATHTOF(UI\Icon_Module_settings_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_settings_ca.paa); isGlobal = 1; isSingular = 1; class Arguments { diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp index 7092962519..1b65a0a4bf 100644 --- a/addons/captives/CfgWeapons.hpp +++ b/addons/captives/CfgWeapons.hpp @@ -5,8 +5,8 @@ class CfgWeapons { class ACE_CableTie: ACE_ItemCore { displayName = CSTRING(CableTie); descriptionShort = CSTRING(CableTieDescription); - model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); - picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + model = QPATHTOF(models\ace_cabletie.p3d); + picture = QPATHTOF(UI\ace_cabletie_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/captives/XEH_PREP.hpp b/addons/captives/XEH_PREP.hpp index 2722214e1b..bfb1ade5e0 100644 --- a/addons/captives/XEH_PREP.hpp +++ b/addons/captives/XEH_PREP.hpp @@ -14,8 +14,11 @@ PREP(doLoadCaptive); PREP(doRemoveHandcuffs); PREP(doUnloadCaptive); PREP(findEmptyNonFFVCargoSeat); +PREP(handleAnimChangedHandcuffed); +PREP(handleAnimChangedSurrendered); PREP(handleGetIn); PREP(handleGetOut); +PREP(handleLocal); PREP(handleOnUnconscious); PREP(handlePlayerChanged); PREP(handleRespawn); diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf index 5aada0950f..c5a8a38ed3 100644 --- a/addons/captives/XEH_postInit.sqf +++ b/addons/captives/XEH_postInit.sqf @@ -1,11 +1,11 @@ #include "script_component.hpp" -["SettingsInitialized", { +["ace_settingsInitialized", { // Hold on a little bit longer to ensure anims will work [{ GVAR(captivityEnabled) = true; - }, [], 0.05] call EFUNC(common,waitAndExecute); -}] call EFUNC(common,addEventHandler); + }, [], 0.05] call CBA_fnc_waitAndExecute; +}] call CBA_fnc_addEventHandler; //Handles when someone starts escorting and then disconnects, leaving the captive attached //This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC @@ -24,15 +24,15 @@ if (isServer) then { }]; }; -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; +[QGVAR(moveInCaptive), FUNC(vehicleCaptiveMoveIn)] call CBA_fnc_addEventHandler; +[QGVAR(moveOutCaptive), FUNC(vehicleCaptiveMoveOut)] call CBA_fnc_addEventHandler; -["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); -["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler); +[QGVAR(setHandcuffed), FUNC(setHandcuffed)] call CBA_fnc_addEventHandler; +[QGVAR(setSurrendered), FUNC(setSurrendered)] call CBA_fnc_addEventHandler; //Medical Integration Events -["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler); +["ace_unconscious", FUNC(handleOnUnconscious)] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith {}; diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index c87408b341..b879e906fa 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {QGVAR(ModuleSettings), QGVAR(ModuleSurrender), QGVAR(ModuleHandcuffed)}; weapons[] = {"ACE_CableTie"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,4 +19,12 @@ class CfgPatches { #include "CfgMoves.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#include "CfgEden.hpp" \ No newline at end of file +#include "CfgEden.hpp" + +class ACE_newEvents { + SetSurrendered = QGVAR(setSurrendered); + SetHandcuffed = QGVAR(setHandcuffed); + MoveOutCaptive = QGVAR(moveOutCaptive); + MoveInCaptive = QGVAR(moveInCaptive); + CaptiveStatusChanged = "ace_captiveStatusChanged"; +}; diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 21bfe58747..d80ffc40a1 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -21,6 +21,6 @@ params ["_unit", "_target"]; playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10]; -["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); +[QGVAR(setHandcuffed), [_target, true], [_target]] call CBA_fnc_targetEvent; _unit removeItem "ACE_CableTie"; diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index a4d7df8892..2a8bc055ec 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -47,4 +47,4 @@ if (isNull _vehicle) then { if (isNull _vehicle) exitWith {ERROR("");}; _unit setVariable [QGVAR(isEscorting), false, true]; -["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); +[QGVAR(moveInCaptive), [_target, _vehicle], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf index 681b698de3..7f445440ba 100644 --- a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -17,4 +17,4 @@ params ["_unit", "_target"]; -["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent); +[QGVAR(setHandcuffed), [_target, false], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index 46ba618010..fd4375e4b7 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -18,4 +18,4 @@ params ["_unit", "_target"]; -["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent); +[QGVAR(moveOutCaptive), [_target], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/captives/functions/fnc_handleAnimChangedHandcuffed.sqf b/addons/captives/functions/fnc_handleAnimChangedHandcuffed.sqf new file mode 100644 index 0000000000..2f55d51fc3 --- /dev/null +++ b/addons/captives/functions/fnc_handleAnimChangedHandcuffed.sqf @@ -0,0 +1,37 @@ +/* + * Author: Nic547, commy2 + * Restart the handcuffing animation if it got interrupted. Called from a AnimChanged EH. + * + * Arguments: + * 0: The Unit + * 1: New animation + * + * ReturnValue: + * None + * + * Public: No + */ + + +#include "script_component.hpp" + +params ["_unit", "_newAnimation"]; +TRACE_2("AnimChanged",_unit,_newAnimation); +if (_unit == (vehicle _unit)) then { + if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { + TRACE_1("Handcuff animation interrupted",_newAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + }; +} else { + _turretPath = []; + { + _x params ["_xUnit", "", "", "_xTurretPath"]; + if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; + } forEach (fullCrew (vehicle _unit)); + TRACE_1("turret Path",_turretPath); + if (_turretPath isEqualTo []) exitWith {}; + + TRACE_1("Handcuff (FFV) animation interrupted",_newAnimation); + [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_handleAnimChangedSurrendered.sqf b/addons/captives/functions/fnc_handleAnimChangedSurrendered.sqf new file mode 100644 index 0000000000..cf17d8b873 --- /dev/null +++ b/addons/captives/functions/fnc_handleAnimChangedSurrendered.sqf @@ -0,0 +1,24 @@ +/* + * Author: Nic547, commy2 + * Restart the surrendering animation if it got interrupted. Called from a AnimChanged EH. + * + * Arguments: + * 0: The Unit + * 1: New animation + * + * ReturnValue: + * None + * + * Public: No + */ + + +#include "script_component.hpp" + +params ["_unit", "_newAnimation"]; + +TRACE_2("AnimChanged",_unit,_newAnimation); +if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { + TRACE_1("Surrender animation interrupted",_newAnimation); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_handleLocal.sqf b/addons/captives/functions/fnc_handleLocal.sqf new file mode 100644 index 0000000000..693eb844fd --- /dev/null +++ b/addons/captives/functions/fnc_handleLocal.sqf @@ -0,0 +1,63 @@ +/* + * Author: esteldunedain + * Called when a unit switched locality + * + * Arguments: + * 0: The Unit + * 1: Is local + * + * ReturnValue: + * None + * + * Public: No + */ + + +#include "script_component.hpp" + +params ["_unit", "_local"]; + +// Make sure that if the unit is captive or surrendered it has a AnimChanged EH running ONLY on the machine that owns it +if (_local) then { + + // If the unit is handcuffed + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + // If the unit already has an AnimChanged EH here then there's nothing to do either + if (_unit getVariable [QGVAR(handcuffAnimEHID), -1] != -1) exitWith {}; + + // Otherwise, restart the AnimChanged EH in the new machine + private _animChangedEHID = _unit addEventHandler ["AnimChanged", DFUNC(handleAnimChangedHandcuffed)]; + TRACE_2("Adding animChangedEH",_unit,_animChangedEHID); + _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; + }; + + // If the unit is surrendering + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + // If the unit already has an AnimChanged EH here then there's nothing to do either + if (_unit getVariable [QGVAR(surrenderAnimEHID), -1] != -1) exitWith {}; + + // Otherwise, restart the AnimChanged EH in the new machine + private _animChangedEHID = _unit addEventHandler ["AnimChanged", DFUNC(handleAnimChangedSurrendered)]; + TRACE_2("Adding animChangedEH",_unit,_animChangedEHID); + _unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID]; + }; + +} else { + + private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; + if (_animChangedEHID != -1) then { + // If the unit had a AnimChanged EH for handcuffing in the old machine then remove it + TRACE_1("Removing animChanged EH",_animChangedEHID); + _unit removeEventHandler ["AnimChanged", _animChangedEHID]; + _unit setVariable [QGVAR(handcuffAnimEHID), -1]; + }; + + _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1]; + if (_animChangedEHID != -1) then { + // If the unit had a AnimChanged EH for handcuffing in the old machine then remove it + TRACE_1("Removing animChanged EH",_animChangedEHID); + _unit removeEventHandler ["AnimChanged", _animChangedEHID]; + _unit setVariable [QGVAR(surrenderAnimEHID), -1]; + }; + +}; diff --git a/addons/captives/functions/fnc_handleOnUnconscious.sqf b/addons/captives/functions/fnc_handleOnUnconscious.sqf index ca6362d3da..456161d9de 100644 --- a/addons/captives/functions/fnc_handleOnUnconscious.sqf +++ b/addons/captives/functions/fnc_handleOnUnconscious.sqf @@ -1,6 +1,6 @@ /* * Author: commy2, PabstMirror - * Handles the "medical_onUnconscious" event + * Handles the "ace_unconscious" event * * Arguments: * 0: Unit diff --git a/addons/captives/functions/fnc_moduleHandcuffed.sqf b/addons/captives/functions/fnc_moduleHandcuffed.sqf index dcb59ff2a1..b2e0b431b3 100644 --- a/addons/captives/functions/fnc_moduleHandcuffed.sqf +++ b/addons/captives/functions/fnc_moduleHandcuffed.sqf @@ -30,9 +30,9 @@ if (!isServer) exitWith {}; params ["_units"]; { TRACE_2("event",_x,local _x); - ["SetHandcuffed", [_x], [_x, true]] call EFUNC(common,targetEvent); + [QGVAR(setHandcuffed), [_x, true], [_x]] call CBA_fnc_targetEvent; } forEach _units; -}, [_units], 0.05] call EFUNC(common,waitAndExecute); +}, [_units], 0.05] call CBA_fnc_waitAndExecute; if (!isNull _logic) then { deleteVehicle _logic; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf index 29659b351e..c4482ce904 100644 --- a/addons/captives/functions/fnc_moduleSurrender.sqf +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -30,9 +30,9 @@ if (!isServer) exitWith {}; params ["_units"]; { TRACE_2("event",_x,local _x); - ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); + [QGVAR(setSurrendered), [_x, true], [_x]] call CBA_fnc_targetEvent; } forEach _units; -}, [_units], 0.05] call EFUNC(common,waitAndExecute); +}, [_units], 0.05] call CBA_fnc_waitAndExecute; if (!isNull _logic) then { deleteVehicle _logic; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index d4f84730e6..1859bfb0b1 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -27,7 +27,7 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { // It's to soon to call this function, delay it if (EGVAR(common,settingsInitFinished)) then { // Settings are already initialized, but the small wait isn't over - [DFUNC(setHandCuffed), _this, 0.05] call EFUNC(common,waitAndExecute); + [DFUNC(setHandCuffed), _this, 0.05] call CBA_fnc_waitAndExecute; } else { // Settings are not initialized yet [DFUNC(setHandCuffed), _this] call EFUNC(common,runAfterSettingsInit); @@ -73,32 +73,11 @@ if (_state) then { TRACE_1("removing animChanged EH",_animChangedEHID); _unit removeEventHandler ["AnimChanged", _animChangedEHID]; }; - _animChangedEHID = _unit addEventHandler ["AnimChanged", { - params ["_unit", "_newAnimation"]; - TRACE_2("AnimChanged",_unit,_newAnimation); - if (_unit == (vehicle _unit)) then { - if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { - TRACE_1("Handcuff animation interrupted",_newAnimation); - [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); - }; - } else { - _turretPath = []; - { - _x params ["_xUnit", "", "", "_xTurretPath"]; - if (_unit == _xUnit) exitWith {_turretPath = _xTurretPath}; - } forEach (fullCrew (vehicle _unit)); - TRACE_1("turret Path",_turretPath); - if (_turretPath isEqualTo []) exitWith {}; - - TRACE_1("Handcuff (FFV) animation interrupted",_newAnimation); - [_unit, "ACE_HandcuffedFFV", 2] call EFUNC(common,doAnimation); - [_unit, "ACE_HandcuffedFFV", 1] call EFUNC(common,doAnimation); - }; - }]; + _animChangedEHID = _unit addEventHandler ["AnimChanged", DFUNC(handleAnimChangedHandcuffed)]; TRACE_2("Adding animChangedEH",_unit,_animChangedEHID); _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; - }, [_unit], 0.01] call EFUNC(common,waitAndExecute); + }, [_unit], 0.01] call CBA_fnc_waitAndExecute; } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; [_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set); @@ -124,4 +103,4 @@ if (_state) then { }; //Global Event after changes: -["CaptiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call EFUNC(common,globalEvent); +["ace_captiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call CBA_fnc_globalEvent; diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index ffc3c35081..6acd3436aa 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -27,7 +27,7 @@ if !(missionNamespace getVariable [QGVAR(captivityEnabled), false]) exitWith { // It's to soon to call this function, delay it if (EGVAR(common,settingsInitFinished)) then { // Settings are already initialized, but the small wait isn't over - [DFUNC(setSurrendered), _this, 0.05] call EFUNC(common,waitAndExecute); + [DFUNC(setSurrendered), _this, 0.05] call CBA_fnc_waitAndExecute; } else { // Settings are not initialized yet [DFUNC(setSurrendered), _this] call EFUNC(common,runAfterSettingsInit); @@ -64,16 +64,10 @@ if (_state) then { TRACE_1("removing animChanged EH",_animChangedEHID); _unit removeEventHandler ["AnimChanged", _animChangedEHID]; }; - _animChangedEHID = _unit addEventHandler ["AnimChanged", { - params ["_unit", "_newAnimation"]; - if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && {!(_unit getVariable ["ACE_isUnconscious", false])}) then { - TRACE_1("Surrender animation interrupted",_newAnimation); - [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); - }; - }]; + _animChangedEHID = _unit addEventHandler ["AnimChanged", DFUNC(handleAnimChangedSurrendered)]; _unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID]; }; - }, [_unit], 0.01] call EFUNC(common,waitAndExecute); + }, [_unit], 0.01] call CBA_fnc_waitAndExecute; } else { _unit setVariable [QGVAR(isSurrendering), false, true]; [_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set); @@ -103,7 +97,7 @@ if (_state) then { params ["_args", "_pfID"]; _args params ["_unit", "_maxTime"]; //If waited long enough or they re-surrendered or they are unconscious, exit loop - if ((ACE_time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith { + if ((CBA_missionTime > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith { [_pfID] call CBA_fnc_removePerFrameHandler; }; //Only break animation if they are actualy the "hands up" animation (because we are using switchmove there won't be an transition) @@ -112,9 +106,9 @@ if (_state) then { //Break out of hands up animation loop [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; - }, 0, [_unit, (ACE_time + 20)]] call CBA_fnc_addPerFrameHandler; + }, 0, [_unit, (CBA_missionTime + 20)]] call CBA_fnc_addPerFrameHandler; }; }; //Global Event after changes: -["CaptiveStatusChanged", [_unit, _state, "SetSurrendered"]] call EFUNC(common,globalEvent); +["ace_captiveStatusChanged", [_unit, _state, "SetSurrendered"]] call CBA_fnc_globalEvent; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index 95a842f15f..415ca8f4fd 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT captives +#define COMPONENT_BEAUTIFIED Captives #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_CAPTIVES #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 4044723c4a..fbb3d11541 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -5,7 +5,7 @@ Take Prisoner Gefangen nehmen Tomar prisionero - Prendre prisonnier + Prendre le prisonnier Aresztuj Zajmout osobu Arresta il prigioniero @@ -190,7 +190,7 @@ Spoutat jednotku Metti manette all'unità Hacer que la unidad esté esposada - Rend une unité captive + Rendre une unité captive Sync a unit to make them handcuffed. diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 3b2239019d..43412b7b72 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { class ACE_moduleCargoSettings: ACE_Module { scope = 2; displayName = CSTRING(SettingsModule_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Cargo_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Cargo_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleSettings); functionPriority = 1; @@ -36,7 +36,7 @@ class CfgVehicles { class GVAR(makeLoadable): ACE_Module { scope = 2; displayName = CSTRING(makeLoadable_displayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_makeLoadable_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_makeLoadable_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleMakeLoadable); isGlobal = 1; @@ -314,15 +314,16 @@ class CfgVehicles { GVAR(space) = 20; GVAR(hasCargo) = 1; }; - class Land_Pod_Heli_Transport_04_medevac_F: Pod_Heli_Transport_04_base_F { - GVAR(space) = 8; - GVAR(hasCargo) = 1; - }; class Land_Pod_Heli_Transport_04_repair_F: Pod_Heli_Transport_04_base_F { GVAR(space) = 12; GVAR(hasCargo) = 1; }; - + class Pod_Heli_Transport_04_crewed_base_F; + class Land_Pod_Heli_Transport_04_medevac_F: Pod_Heli_Transport_04_crewed_base_F { + GVAR(space) = 8; + GVAR(hasCargo) = 1; + }; + class StaticMortar; class Mortar_01_base_F: StaticMortar { GVAR(size) = 2; // 1 = small, 2 = large diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index f3789d641f..58a009c9f5 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -1,8 +1,8 @@ #include "script_component.hpp" -["AddCargoByClass", {_this call FUNC(addCargoItem)}] call EFUNC(common,addEventHandler); +["ace_addCargo", {_this call FUNC(addCargoItem)}] call CBA_fnc_addEventHandler; -["LoadCargo", { +["ace_loadCargo", { params ["_item", "_vehicle"]; TRACE_2("LoadCargo EH",_item,_vehicle); @@ -13,15 +13,15 @@ private _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); - ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); + [[_hint, _itemName, _vehicleName], 3.0] call EFUNC(common,displayTextStructured); if (_loaded) then { // Invoke listenable event - ["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent); + ["ace_cargoLoaded", [_item, _vehicle]] call CBA_fnc_globalEvent; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["UnloadCargo", { +["ace_unloadCargo", { params ["_item", "_vehicle", ["_unloader", objNull]]; TRACE_3("UnloadCargo EH",_item,_vehicle,_unloader); @@ -34,19 +34,19 @@ private _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); - ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); + [[_hint, _itemName, _vehicleName], 3.0] call EFUNC(common,displayTextStructured); if (_unloaded) then { // Invoke listenable event - ["cargoUnloaded", [_item, _vehicle]] call EFUNC(common,globalEvent); + ["ace_cargoUnloaded", [_item, _vehicle]] call CBA_fnc_globalEvent; }; // TOOO maybe drag/carry the unloaded item? -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["ServerUnloadCargo", { +[QGVAR(serverUnload), { params ["_item", "_emptyPosAGL"]; _item hideObjectGlobal false; _item setPosASL (AGLtoASL _emptyPosAGL); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/cargo/config.cpp b/addons/cargo/config.cpp index 1aefa49616..c368cab8d5 100644 --- a/addons/cargo/config.cpp +++ b/addons/cargo/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2", "Glowbal"}; - authorUrl = "https://ace3mod.com/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "Glowbal"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -16,3 +18,13 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "menu.hpp" + +class ACE_newEvents { + LoadCargo = "ace_loadCargo"; + cargoUnloaded = "ace_cargoUnloaded"; + cargoLoaded = "ace_cargoLoaded"; + AddCargoByClass = "ace_addCargo"; + ServerUnloadCargo = QGVAR(serverUnload); + UnloadCargo = "ace_unloadCargo"; + cargoAddedByClass = "ace_cargoAdded"; +}; diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf index 5e01214934..6e1b311098 100644 --- a/addons/cargo/functions/fnc_addCargoItem.sqf +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -26,4 +26,4 @@ for "_i" from 1 to _amount do { }; // Invoke listenable event -["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent); +["ace_cargoAdded", [_itemClass, _vehicle, _amount]] call CBA_fnc_globalEvent; diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf index bf1098dbf1..f576ea3e79 100644 --- a/addons/cargo/functions/fnc_canLoad.sqf +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -6,7 +6,7 @@ * 0: Player * 1: Object to load * - * Return value: + * Return Value: * Can load * * Example: diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index d6092c2a2d..e2bb1ecc4d 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -6,7 +6,7 @@ * 0: Item * 1: Holder Object (Vehicle) * - * Return value: + * Return Value: * Can load in * * Example: diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf index ea6cb7a6eb..1e8753cc27 100644 --- a/addons/cargo/functions/fnc_canUnloadItem.sqf +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -7,7 +7,7 @@ * 1: Object * 2: Unloader (player) * - * Return value: + * Return Value: * Can be unloaded * * Example: diff --git a/addons/cargo/functions/fnc_findNearestVehicle.sqf b/addons/cargo/functions/fnc_findNearestVehicle.sqf index b5b441df92..6d5b7ce1a8 100644 --- a/addons/cargo/functions/fnc_findNearestVehicle.sqf +++ b/addons/cargo/functions/fnc_findNearestVehicle.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Unit * - * Return value: + * Return Value: * Vehicle in Distance * * Example: diff --git a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf index 7d94570749..7e8594ffe4 100644 --- a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Object * - * Return value: + * Return Value: * Cargo space left * * Example: diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf index 775bdefd10..c53c05ee28 100644 --- a/addons/cargo/functions/fnc_getSizeItem.sqf +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Item * - * Return value: + * Return Value: * Cargo size (default: -1) * * Example: diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf index d50ea488d6..88b3cb9351 100644 --- a/addons/cargo/functions/fnc_handleDestroyed.sqf +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Object * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index dc8db802e5..92403b8dd9 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Object * - * Return value: + * Return Value: * None * * Example: @@ -39,7 +39,7 @@ private _statement = { [_player, _target] call FUNC(startLoadIn); }; private _text = localize LSTRING(loadObject); -private _icon = QUOTE(PATHTOF(UI\Icon_load.paa)); +private _icon = QPATHTOF(UI\Icon_load.paa); private _action = [QGVAR(load), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index 7e19b0acd0..2dfc8b796b 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -29,7 +29,7 @@ if (isServer) then { _cargoClassname = getText (_x >> "type"); _cargoCount = getNumber (_x >> "amount"); TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); - ["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent); + ["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent; }; } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); }; diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 443143ece0..1d59cc1e64 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -7,7 +7,7 @@ * 0: Item * 1: Vehicle * - * Return value: + * Return Value: * Object loaded * * Example: @@ -35,7 +35,7 @@ _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; if (_item isEqualType objNull) then { detach _item; _item attachTo [_vehicle,[0,0,-100]]; - ["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent); + [QEGVAR(common,hideObjectGlobal), [_item, true]] call CBA_fnc_serverEvent; }; true diff --git a/addons/cargo/functions/fnc_makeLoadable.sqf b/addons/cargo/functions/fnc_makeLoadable.sqf index ceb1dc1acd..27513a1864 100644 --- a/addons/cargo/functions/fnc_makeLoadable.sqf +++ b/addons/cargo/functions/fnc_makeLoadable.sqf @@ -7,7 +7,7 @@ * 1: Set as loadable (default: true) * 2: Size. (default: 1) * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index a045862e36..a9f558ac76 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Display * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 6fcd3cf62c..466471c375 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -6,7 +6,7 @@ * 0: Player * 1: Object * - * Return value: + * Return Value: * Load ProgressBar Started * * Example: @@ -40,7 +40,7 @@ if ([_object, _vehicle] call FUNC(canLoadItemIn)) then { [ 5 * _size, [_object,_vehicle], - {["LoadCargo", _this select 0] call EFUNC(common,localEvent)}, + {["ace_loadCargo", _this select 0] call CBA_fnc_localEvent}, {}, localize LSTRING(LoadingItem) ] call EFUNC(common,progressBar); @@ -48,7 +48,7 @@ if ([_object, _vehicle] call FUNC(canLoadItemIn)) then { } else { private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"); - ["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); + [[LSTRING(LoadingFailed), _displayName], 3.0] call EFUNC(common,displayTextStructured); }; _return diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index 46a69e737f..8f2dcfb2e2 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -5,7 +5,7 @@ * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -37,7 +37,7 @@ if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then [ 5 * _size, [_item, GVAR(interactionVehicle), ACE_player], - {["UnloadCargo", _this select 0] call EFUNC(common,localEvent)}, + {["ace_unloadCargo", _this select 0] call CBA_fnc_localEvent}, {}, localize LSTRING(UnloadingItem), {true}, @@ -47,5 +47,5 @@ if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; private _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); - ["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); + [[LSTRING(UnloadingFailed), _displayName], 3.0] call EFUNC(common,displayTextStructured); }; diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 8bd18f989e..ce84772c1f 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -6,7 +6,7 @@ * 0: Item * 1: Vehicle * - * Return value: + * Return Value: * Object unloaded * * Example: @@ -29,7 +29,7 @@ if ((count _emptyPosAGL) != 3) exitWith { TRACE_4("Could not find unload pos",_vehicle,getPosASL _vehicle,isTouchingGround _vehicle,speed _vehicle); if ((!isNull _unloader) && {_unloader == ACE_player}) then { //display text saying there are no safe places to exit the vehicle - ["displayTextStructured", [localize ELSTRING(common,NoRoomToUnload)]] call EFUNC(common,localEvent); + [localize ELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); }; false }; @@ -52,7 +52,7 @@ if (_item isEqualType objNull) then { detach _item; // hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly // do both on server to ensure they are executed in the correct order - ["ServerUnloadCargo", [_item, _emptyPosAGL]] call EFUNC(common,serverEvent); + [QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent; } else { private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, ""]; _newItem setPosASL (AGLtoASL _emptyPosAGL); diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf index ecb011aed3..6e3d79cf8d 100644 --- a/addons/cargo/functions/fnc_validateCargoSpace.sqf +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Object * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp index 55079a16c2..905a8b0613 100644 --- a/addons/cargo/script_component.hpp +++ b/addons/cargo/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT cargo +#define COMPONENT_BEAUTIFIED Cargo #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index e3cb368362..1bc494b6fe 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -65,7 +65,7 @@ Povolit náklad Habilitar carga Abilita Cargo - Activer la cargaison + Activer la mise en cargaison Enable the load in cargo module @@ -76,7 +76,7 @@ Habilitar la carga en el módulo de carga Umožňuje naložit předměty do nákladového prostoru vozidla Abilita il modulo di caricamento in cargo - Activer le chargement dans le module de cargaison. + Active le chargement de cargaison dans un vehicule Cargo Settings @@ -87,7 +87,7 @@ Nastavení nákladu Ajustes de carga Impostazioni Cargo - Réglages de cargaison + Paramètres de cargaison Configure the cargo module settings @@ -98,7 +98,7 @@ Configure los ajustes del módulo de carga Konfigurace nákladního modulu Configura le impostazioni del modulo cargo - Configurer les réglages du module de cargaison + Configure les paramètres du module de cargaison %1<br/>loaded into<br/>%2 @@ -176,6 +176,7 @@ Hacer objeto cargable Rendre l'objet chargeable Vytvořit objekt nakladatelným + Fazer objeto carregável Sets the synced object as loadable by the cargo system. @@ -185,6 +186,7 @@ Sincronizar un objecto para hacerlo cargable. Rend l'objet synchronisé comme chargeable par le système de cargaison. Nastaví synchronizované objekty nakladatelnými za pomocí Nákladního systému. + Seta o objeto sincronizado como carregável Object's Size @@ -194,6 +196,7 @@ Tamaño del objeto Taille de l'objet Velikost objektu + Tamanho do objeto \ No newline at end of file diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index 5d55e40f2d..beb07e35e7 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -33,7 +33,7 @@ class Extended_InitPost_EventHandlers { }; class CAManBase { class GVAR(setName) { - init = QUOTE(if (local (_this select 0)) then {[ARR_2(FUNC(setName),_this)] call FUNC(execNextFrame)};); + init = QUOTE(if (local (_this select 0)) then {[ARR_2(FUNC(setName),_this)] call CBA_fnc_execNextFrame};); }; class GVAR(muteUnit) { init = QUOTE(_this call FUNC(muteUnitHandleInitPost)); diff --git a/addons/common/CfgUnitInsignia.hpp b/addons/common/CfgUnitInsignia.hpp index c1cd541e9c..337baa4235 100644 --- a/addons/common/CfgUnitInsignia.hpp +++ b/addons/common/CfgUnitInsignia.hpp @@ -3,13 +3,13 @@ class CfgUnitInsignia { class ACE_insignia_logo { displayName = "ACE3"; author = CSTRING(ACETeam); - texture = PATHTOF(data\Insignia_ace3logo_ca.paa); + texture = QPATHTOF(data\Insignia_ace3logo_ca.paa); textureVehicle = ""; }; class ACE_insignia_banana { displayName = "ABE3"; author = CSTRING(ACETeam); - texture = PATHTOF(data\insignia_banana_ca.paa); + texture = QPATHTOF(data\insignia_banana_ca.paa); textureVehicle = ""; }; }; diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp index de1f7f7cf4..1e958027be 100644 --- a/addons/common/CfgVehicles.hpp +++ b/addons/common/CfgVehicles.hpp @@ -36,7 +36,7 @@ class CfgVehicles { scope = 2; isGlobal = 1; isSingular = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_CheckPBO_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_CheckPBO_ca.paa); class Arguments { class Action { displayName = CSTRING(CheckPBO_Action_DisplayName); @@ -82,7 +82,7 @@ class CfgVehicles { displayName = CSTRING(LSDVehicles_DisplayName); function = "ACE_Common_fnc_moduleLSDVehicles"; scope = 2; - icon = QUOTE(PATHTOF(UI\Icon_Module_LSD_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_LSD_ca.paa); isGlobal = 1; class Arguments {}; class ModuleDescription: ModuleDescription { @@ -132,7 +132,7 @@ class CfgVehicles { class ACE_Headbug_Fix: Bicycle { scope = 1; side = 3; - model = PATHTOF(data\ACE_HeadBanger.p3d); + model = QPATHTOF(data\ACE_HeadBanger.p3d); //model = QPATHTO_M(ACE_HeadBanger.p3d); author = CSTRING(ACETeam); displayName = " "; diff --git a/addons/common/CfgWeapons.hpp b/addons/common/CfgWeapons.hpp index 22075e2903..488d4210c4 100644 --- a/addons/common/CfgWeapons.hpp +++ b/addons/common/CfgWeapons.hpp @@ -34,8 +34,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(bananaDisplayName); descriptionShort = CSTRING(bananaDescr); - model = PATHTOF(data\banana.p3d); - picture = PATHTOF(data\icon_banana_ca.paa); + model = QPATHTOF(data\banana.p3d); + picture = QPATHTOF(data\icon_banana_ca.paa); icon = "iconObject_circle"; mapSize = 0.034; class ItemInfo: InventoryItem_Base_F { diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index e5af2454cb..97d4b325e9 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -1,114 +1,118 @@ class RscInGameUI { class RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscUnitInfoNoHUD { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscUnitInfoSoldier: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSoldier', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Soldier')])] call CBA_fnc_localEvent;); }; class RscUnitInfoTank: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgVehicle', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Vehicle')])] call CBA_fnc_localEvent;); }; class RscUnitInfoAirNoWeapon: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call CBA_fnc_localEvent;); }; class RscUnitInfoAir: RscUnitInfoAirNoWeapon { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call CBA_fnc_localEvent;); }; class RscUnitInfo_AH64D_gunner { - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call FUNC(localEvent);); + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgAircraft', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Aircraft')])] call CBA_fnc_localEvent;); }; class RscUnitInfoUAV { - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgUAV', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'UAV')])] call FUNC(localEvent);); + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgUAV', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'UAV')])] call CBA_fnc_localEvent;); }; class RscUnitInfoSubmarine: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgSubmarine', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Submarine')])] call CBA_fnc_localEvent;); }; class RscUnitInfoShip: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgShip', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Ship')])] call CBA_fnc_localEvent;); }; class RscWeaponEmpty { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinder { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeArtillery { - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call FUNC(localEvent);); + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeArtilleryAuto { - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call FUNC(localEvent);); + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_dlgArtillery', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Artillery')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinderPAS13 { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_LaserDesignator { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinderMAAWS { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinderAbramsCom { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinderAbramsGun { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscWeaponRangeFinderStrykerMGSGun { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_strider_commander { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_titan { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_punisher { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_SDV_periscope { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscUnitInfoParachute: RscUnitInfo { - onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2('ACE_dlgParachute', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Parachute')])] call CBA_fnc_localEvent;); }; class RscUnitVehicle { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscOptics_LaserDesignator_02 { - onLoad = QUOTE([ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call FUNC(localEvent);); + onLoad = QUOTE([ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Any')])] call CBA_fnc_localEvent;); }; class RscStaminaBar { onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStaminaBar"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgStaminaBar)),_this select 0)]); }; + + class RscStanceInfo { + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscStanceInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Stance')])] call CBA_fnc_localEvent;); + }; }; diff --git a/addons/common/XEH_PREP.hpp b/addons/common/XEH_PREP.hpp index 3dea56a98d..4f56dd4d86 100644 --- a/addons/common/XEH_PREP.hpp +++ b/addons/common/XEH_PREP.hpp @@ -24,6 +24,7 @@ PREP(debugModule); PREP(defineVariable); PREP(deviceKeyFindValidIndex); PREP(deviceKeyRegisterNew); +PREP(deprecateComponent); PREP(disableAI); PREP(disableUserInput); PREP(displayIcon); @@ -59,6 +60,7 @@ PREP(getFirstTerrainIntersection); PREP(getForceWalkStatus); PREP(getGunner); PREP(getInPosition); +PREP(getMapData); PREP(getMapGridData); PREP(getMapGridFromPos); PREP(getMapPosFromGrid); @@ -235,7 +237,6 @@ PREP(dumpPerformanceCounters); PREP(dumpArray); PREP(globalEvent); -PREP(_handleNetEvent); PREP(addEventHandler); PREP(objectEvent); PREP(targetEvent); @@ -277,5 +278,3 @@ PREP(hashListCreateHash); PREP(hashListSelect); PREP(hashListSet); PREP(hashListPush); - -PREP(timePFH); diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 88012a7884..e7a43e68d2 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -3,47 +3,6 @@ // #define DEBUG_MODE_FULL #include "script_component.hpp" - -////////////////////////////////////////////////// -// PFHs -////////////////////////////////////////////////// - -//Singe PFEH to handle execNextFrame, waitAndExec and waitUntilAndExec: -[{ - BEGIN_COUNTER(waitAndExec); - - //Handle the waitAndExec array: - while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do { - private _entry = GVAR(waitAndExecArray) deleteAt 0; - (_entry select 2) call (_entry select 1); - }; - - //Handle the execNextFrame array: - { - (_x select 0) call (_x select 1); - false - } count GVAR(nextFrameBufferA); - - //Swap double-buffer: - GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB); - GVAR(nextFrameBufferB) = []; - GVAR(nextFrameNo) = diag_frameno + 1; - - //Handle the waitUntilAndExec array: - { - // if condition is satisifed call statement - if ((_x select 2) call (_x select 0)) then { - // make sure to delete the correct handle when multiple conditions are met in one frame - GVAR(waitUntilAndExecArray) deleteAt (GVAR(waitUntilAndExecArray) find _x); - (_x select 2) call (_x select 1); - }; - nil - } count +GVAR(waitUntilAndExecArray); - - END_COUNTER(waitAndExec); -}, 0, []] call CBA_fnc_addPerFrameHandler; - - ////////////////////////////////////////////////// // Get Map Data ////////////////////////////////////////////////// @@ -59,29 +18,29 @@ ////////////////////////////////////////////////// //Status Effect EHs: -["setStatusEffect", {_this call FUNC(statusEffect_set)}] call FUNC(addEventHandler); +[QGVAR(setStatusEffect), {_this call FUNC(statusEffect_set)}] call CBA_fnc_addEventHandler; ["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType); ["blockSprint", false, []] call FUNC(statusEffect_addType); -["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), QEGVAR(medical,unconscious)]] call FUNC(statusEffect_addType); +["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType); ["blockDamage", false, ["fixCollision"]] call FUNC(statusEffect_addType); ["blockEngine", false, ["ACE_Refuel"]] call FUNC(statusEffect_addType); -["forceWalk", { +[QGVAR(forceWalk), { params ["_object", "_set"]; TRACE_2("forceWalk EH",_object,_set); _object forceWalk (_set > 0); -}] call FUNC(addEventHandler); -["blockSprint", { //Name reversed from `allowSprint` because we want NOR logic +}] call CBA_fnc_addEventHandler; +[QGVAR(blockSprint), { //Name reversed from `allowSprint` because we want NOR logic params ["_object", "_set"]; TRACE_2("blockSprint EH",_object,_set); _object allowSprint (_set == 0); -}] call FUNC(addEventHandler); -["setCaptive", { +}] call CBA_fnc_addEventHandler; +[QGVAR(setCaptive), { params ["_object", "_set"]; TRACE_2("setCaptive EH",_object,_set); _object setCaptive (_set > 0); -}] call FUNC(addEventHandler); -["blockDamage", { //Name reversed from `allowDamage` because we want NOR logic +}] call CBA_fnc_addEventHandler; +[QGVAR(blockDamage), { //Name reversed from `allowDamage` because we want NOR logic params ["_object", "_set"]; if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then { TRACE_2("blockDamage EH (using medical)",_object,_set); @@ -90,12 +49,12 @@ TRACE_2("blockDamage EH (using allowDamage)",_object,_set); _object allowDamage (_set == 0); }; -}] call FUNC(addEventHandler); -["blockEngine", { +}] call CBA_fnc_addEventHandler; +[QGVAR(blockEngine), { params ["_vehicle", "_set"]; _vehicle setVariable [QGVAR(blockEngine), _set > 0, true]; _vehicle engineOn false; -}] call FUNC(addEventHandler); +}] call CBA_fnc_addEventHandler; //Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit //This variable is used for isPlayer checks @@ -116,7 +75,7 @@ if (isServer) then { }; // Listens for global "SettingChanged" events, to update the force status locally -["SettingChanged", { +["ace_settingChanged", { params ["_name", "_value", "_force"]; if (_force) then { @@ -126,46 +85,54 @@ if (isServer) then { _settingData set [6, _force]; }; -}] call FUNC(addEventhandler); +}] call CBA_fnc_addEventHandler; // Event to log Fix Headbug output -["HeadbugFixUsed", { +[QGVAR(headbugFixUsed), { params ["_profileName", "_animation"]; ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation); -}] call FUNC(addEventHandler); +}] call CBA_fnc_addEventHandler; -["fixCollision", FUNC(fixCollision)] call FUNC(addEventhandler); -["fixFloating", FUNC(fixFloating)] call FUNC(addEventhandler); -["fixPosition", FUNC(fixPosition)] call FUNC(addEventhandler); +[QGVAR(fixCollision), FUNC(fixCollision)] call CBA_fnc_addEventHandler; +[QGVAR(fixFloating), FUNC(fixFloating)] call CBA_fnc_addEventHandler; +[QGVAR(fixPosition), FUNC(fixPosition)] call CBA_fnc_addEventHandler; -["loadPersonEvent", FUNC(loadPersonLocal)] call FUNC(addEventhandler); -["unloadPersonEvent", FUNC(unloadPersonLocal)] call FUNC(addEventhandler); +["ace_loadPersonEvent", FUNC(loadPersonLocal)] call CBA_fnc_addEventHandler; +["ace_unloadPersonEvent", FUNC(unloadPersonLocal)] call CBA_fnc_addEventHandler; -["lockVehicle", { +[QGVAR(lockVehicle), { _this setVariable [QGVAR(lockStatus), locked _this]; _this lock 2; -}] call FUNC(addEventhandler); +}] call CBA_fnc_addEventHandler; -["unlockVehicle", { +[QGVAR(unlockVehicle), { _this lock (_this getVariable [QGVAR(lockStatus), locked _this]); -}] call FUNC(addEventhandler); +}] call CBA_fnc_addEventHandler; -["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler); -["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler); -["engineOn", {(_this select 0) engineOn (_this select 1)}] call FUNC(addEventhandler); -["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler); -["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler); -["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler); -["playMove", {(_this select 0) playMove (_this select 1)}] call FUNC(addEventHandler); -["playMoveNow", {(_this select 0) playMoveNow (_this select 1)}] call FUNC(addEventHandler); -["switchMove", {(_this select 0) switchMove (_this select 1)}] call FUNC(addEventHandler); -["setVectorDirAndUp", {(_this select 0) setVectorDirAndUp (_this select 1)}] call FUNC(addEventHandler); -["setVanillaHitPointDamage", {(_this select 0) setHitPointDamage (_this select 1)}] call FUNC(addEventHandler); +[QGVAR(setDir), {(_this select 0) setDir (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(setFuel), {(_this select 0) setFuel (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(engineOn), {(_this select 0) engineOn (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(setSpeaker), {(_this select 0) setSpeaker (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(selectLeader), {(_this select 0) selectLeader (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(setVelocity), {(_this select 0) setVelocity (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(playMove), {(_this select 0) playMove (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(playMoveNow), {(_this select 0) playMoveNow (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(switchMove), {(_this select 0) switchMove (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(setVectorDirAndUp), {(_this select 0) setVectorDirAndUp (_this select 1)}] call CBA_fnc_addEventHandler; +[QGVAR(setVanillaHitPointDamage), {(_this select 0) setHitPointDamage (_this select 1)}] call CBA_fnc_addEventHandler; + +// Request framework +[QGVAR(requestCallback), FUNC(requestCallback)] call CBA_fnc_addEventHandler; +[QGVAR(receiveRequest), FUNC(receiveRequest)] call CBA_fnc_addEventHandler; + +[QGVAR(systemChatGlobal), {systemChat _this}] call CBA_fnc_addEventHandler; if (isServer) then { - ["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler); - ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler); + [QGVAR(hideObjectGlobal), {(_this select 0) hideObjectGlobal (_this select 1)}] call CBA_fnc_addEventHandler; + [QGVAR(enableSimulationGlobal), {(_this select 0) enableSimulationGlobal (_this select 1)}] call CBA_fnc_addEventHandler; + ["ace_setOwner", {(_this select 0) setOwner (_this select 1)}] call CBA_fnc_addEventHandler; + [QGVAR(serverLog), FUNC(serverLog)] call CBA_fnc_addEventHandler; }; @@ -173,23 +140,19 @@ if (isServer) then { // Set up remote execution ////////////////////////////////////////////////// -// ACE events -"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; -"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)}; - // Synced ACE events // Handle JIP scenario if (!isServer) then { - ["PlayerJip", { + ["ace_playerJIP", { ACE_LOGINFO("JIP event synchronization initialized"); - ["SEH_all", [player]] call FUNC(serverEvent); - }] call FUNC(addEventHandler); + ["ACEa", [player]] call CBA_fnc_serverEvent; + }] call CBA_fnc_addEventHandler; } else { - ["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler); + ["ACEa", FUNC(_handleRequestAllSyncedEvents)] call CBA_fnc_addEventHandler; }; -["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); +["ACEe", FUNC(_handleSyncedEvent)] call CBA_fnc_addEventHandler; +["ACEs", FUNC(_handleRequestSyncedEvent)] call CBA_fnc_addEventHandler; if (isServer) then { [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler; @@ -222,16 +185,16 @@ call FUNC(checkFiles); ////////////////////////////////////////////////// -// Set up SettingsInitialized eventhandler +// Set up ace_settingsInitialized eventhandler ////////////////////////////////////////////////// -["SettingsInitialized", { +["ace_settingsInitialized", { [ GVAR(checkPBOsAction), GVAR(checkPBOsCheckAll), GVAR(checkPBOsWhitelist) ] call FUNC(checkPBOs) -}] call FUNC(addEventHandler); +}] call CBA_fnc_addEventHandler; // Create a pfh to wait until all postinits are ready and settings are initialized [{ @@ -258,7 +221,7 @@ call FUNC(checkFiles); [] call FUNC(readSettingsFromParamsArray); }; // Event so that ACE_Modules have their settings loaded: - ["InitSettingsFromModules", []] call FUNC(localEvent); + [QGVAR(initSettingsFromModules), []] call CBA_fnc_localEvent; if (isServer) then { // Publish all settings data after all configs and modules are read @@ -274,7 +237,7 @@ call FUNC(checkFiles); ACE_LOGINFO("Settings initialized."); //Event that settings are safe to use: - ["SettingsInitialized", []] call FUNC(localEvent); + ["ace_settingsInitialized", []] call CBA_fnc_localEvent; //Set init finished and run all delayed functions: GVAR(settingsInitFinished) = true; @@ -307,12 +270,21 @@ call FUNC(assignedItemFix); enableCamShake true; +//FUNC(showHud) needs to be refreshed if it was set during mission init +["ace_infoDisplayChanged", { + GVAR(showHudHash) params ["", "_masks"]; + if (!(_masks isEqualTo [])) then { + [] call FUNC(showHud); + }; +}] call CBA_fnc_addEventHandler; + + ////////////////////////////////////////////////// // Eventhandler to set player names ////////////////////////////////////////////////// // Set the name for the current player -["playerChanged", { +["unit", { params ["_newPlayer","_oldPlayer"]; if (alive _newPlayer) then { @@ -322,150 +294,86 @@ enableCamShake true; if (alive _oldPlayer) then { [_oldPlayer] call FUNC(setName); }; -}] call FUNC(addEventhandler); +}] call CBA_fnc_addPlayerEventHandler; ////////////////////////////////////////////////// // Set up numerous eventhanders for player controlled units ////////////////////////////////////////////////// -// default variables -GVAR(OldPlayerVehicle) = vehicle objNull; -GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); -GVAR(OldPlayerWeapon) = currentWeapon objNull; -GVAR(OldPlayerInventory) = []; -GVAR(OldPlayerInventoryNoAmmo) = []; -GVAR(OldPlayerVisionMode) = currentVisionMode objNull; -GVAR(OldCameraView) = ""; -GVAR(OldVisibleMap) = false; -GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this +// "playerChanged" event +["unit", { + ACE_player = (_this select 0); + ["ace_playerChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "playerVehicleChanged" event +["vehicle", { + ["ace_playerVehicleChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "playerTurretChanged" event +["turret", { + ["ace_playerTurretChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "playerWeaponChanged" event +["weapon", { + ["ace_playerWeaponChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "playerInventoryChanged" event +["loadout", { + ["ace_playerInventoryChanged", [ACE_player, [ACE_player, false] call FUNC(getAllGear)]] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "playerVisionModeChanged" event +["visionMode", { + ["ace_playerVisionModeChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +// "cameraViewChanged" event +["cameraView", { + ["ace_cameraViewChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + +["visibleMap", { + ["ace_visibleMapChanged", _this] call CBA_fnc_localEvent; +}] call CBA_fnc_addPlayerEventHandler; + GVAR(OldIsCamera) = false; -// PFH to raise varios events [{ BEGIN_COUNTER(stateChecker); - // "playerChanged" event - private _data = call FUNC(player); - if !(_data isEqualTo ACE_player) then { - private _oldPlayer = ACE_player; - - ACE_player = _data; - uiNamespace setVariable ["ACE_player", _data]; - - // Raise ACE event locally - ["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent); - }; - - // "playerVehicleChanged" event - _data = vehicle ACE_player; - if !(_data isEqualTo GVAR(OldPlayerVehicle)) then { - // Raise ACE event locally - GVAR(OldPlayerVehicle) = _data; - ["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - - // "playerTurretChanged" event - _data = [ACE_player] call FUNC(getTurretIndex); - if !(_data isEqualTo GVAR(OldPlayerTurret)) then { - // Raise ACE event locally - GVAR(OldPlayerTurret) = _data; - ["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - - // "playerWeaponChanged" event - _data = currentWeapon ACE_player; - if (_data != GVAR(OldPlayerWeapon)) then { - // Raise ACE event locally - GVAR(OldPlayerWeapon) = _data; - ["playerWeaponChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - - // "playerInventoryChanged" event - _data = getUnitLoadout ACE_player; - if !(_data isEqualTo GVAR(OldPlayerInventory)) then { - // Raise ACE event locally - GVAR(OldPlayerInventory) = _data; - - // we don't want to trigger this just because your ammo counter decreased. - _data = + GVAR(OldPlayerInventory); - - private _weaponInfo = _data param [0, []]; - if !(_weaponInfo isEqualTo []) then { - _weaponInfo set [4, primaryWeaponMagazine ACE_player]; - _weaponInfo deleteAt 5; - }; - - _weaponInfo = _data param [1, []]; - if !(_weaponInfo isEqualTo []) then { - _weaponInfo set [4, secondaryWeaponMagazine ACE_player]; - _weaponInfo deleteAt 5; - }; - - _weaponInfo = _data param [2, []]; - if !(_weaponInfo isEqualTo []) then { - _weaponInfo set [4, handgunMagazine ACE_player]; - _weaponInfo deleteAt 5; - }; - - if !(_data isEqualTo GVAR(OldPlayerInventoryNoAmmo)) then { - GVAR(OldPlayerInventoryNoAmmo) = _data; - ["playerInventoryChanged", [ACE_player, [ACE_player, false] call FUNC(getAllGear)]] call FUNC(localEvent); - }; - }; - - // "playerVisionModeChanged" event - _data = currentVisionMode ACE_player; - if !(_data isEqualTo GVAR(OldPlayerVisionMode)) then { - // Raise ACE event locally - GVAR(OldPlayerVisionMode) = _data; - ["playerVisionModeChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - - // "cameraViewChanged" event - _data = cameraView; - if !(_data isEqualTo GVAR(OldCameraView)) then { - // Raise ACE event locally - GVAR(OldCameraView) = _data; - ["cameraViewChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - - // "visibleMapChanged" event - _data = visibleMap; - if (!_data isEqualTo GVAR(OldVisibleMap)) then { - // Raise ACE event locally - GVAR(OldVisibleMap) = _data; - ["visibleMapChanged", [ACE_player, _data]] call FUNC(localEvent); - }; - // "activeCameraChanged" event - _data = call FUNC(isfeatureCameraActive); + private _data = call FUNC(isfeatureCameraActive); if !(_data isEqualTo GVAR(OldIsCamera)) then { // Raise ACE event locally GVAR(OldIsCamera) = _data; - ["activeCameraChanged", [ACE_player, _data]] call FUNC(localEvent); + ["ace_activeCameraChanged", [ACE_player, _data]] call CBA_fnc_localEvent; }; END_COUNTER(stateChecker); -}, 0, []] call CBA_fnc_addPerFrameHandler; +}, 0.5, []] call CBA_fnc_addPerFrameHandler; ////////////////////////////////////////////////// // Eventhandlers for player controlled machines ////////////////////////////////////////////////// -["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler); -["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler); +[QGVAR(displayTextStructured), {_this call FUNC(displayTextStructured)}] call CBA_fnc_addEventHandler; +[QGVAR(displayTextPicture), {_this call FUNC(displayTextPicture)}] call CBA_fnc_addEventHandler; -["medical_onUnconscious", { +["ace_unconscious", { params ["_unit", "_isUnconscious"]; if (local _unit && {!_isUnconscious}) then { [_unit, false, QFUNC(loadPerson), west /* dummy side */] call FUNC(switchToGroupSide); }; -}] call FUNC(addEventhandler); +}] call CBA_fnc_addEventHandler; -["useItem", DFUNC(useItem)] call FUNC(addEventHandler); +["ace_useItem", DFUNC(useItem)] call CBA_fnc_addEventHandler; ////////////////////////////////////////////////// @@ -503,7 +411,7 @@ if (didJip) then { // We are jipping! Get ready and wait, and throw the event [{ if(!isNull player && GVAR(settingsInitFinished)) then { - ["PlayerJip", [player]] call FUNC(localEvent); + ["ace_playerJIP", [player]] call CBA_fnc_localEvent; [_this select 1] call CBA_fnc_removePerFrameHandler; }; }, 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index dea4e64538..0f0657c4ab 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -5,10 +5,6 @@ ADDON = false; #include "XEH_PREP.hpp" -//ACE events global variables -GVAR(eventsLocation) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; -GVAR(eventsLocation) setText QGVAR(eventsLocation); - // backwards comp DFUNC(canUseWeapon) = { ACE_DEPRECATED("ace_common_fnc_canUseWeapon","3.7.0","CBA_fnc_canUseWeapon"); @@ -23,13 +19,6 @@ DFUNC(selectWeaponMode) = { GVAR(syncedEvents) = HASH_CREATE; GVAR(showHudHash) = [] call FUNC(hashCreate); -//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute -GVAR(waitAndExecArray) = []; -GVAR(nextFrameNo) = diag_frameno; -GVAR(nextFrameBufferA) = []; -GVAR(nextFrameBufferB) = []; -GVAR(waitUntilAndExecArray) = []; - GVAR(settingsInitFinished) = false; GVAR(runAtSettingsInitialized) = []; @@ -55,20 +44,6 @@ GVAR(setHearingCapabilityMap) = []; ACE_player = objNull; uiNamespace setVariable ["ACE_player", objNull]; -////////////////////////////////////////////////// -// Time handling -////////////////////////////////////////////////// - -ACE_time = diag_tickTime; -ACE_realTime = diag_tickTime; -ACE_virtualTime = diag_tickTime; -ACE_diagTime = diag_tickTime; -ACE_gameTime = time; -ACE_pausedTime = 0; -ACE_virtualPausedTime = 0; - -[FUNC(timePFH), 0, []] call CBA_fnc_addPerFrameHandler; - // Init toHex [0] call FUNC(toHex); diff --git a/addons/common/config.cpp b/addons/common/config.cpp index cbe5c5df6a..3985b8f70d 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -2,16 +2,82 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Box_Misc", "ACE_bananaItem"}; weapons[] = {"ACE_ItemCore","ACE_FakePrimaryWeapon", "ACE_Banana"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_main","ace_modules"}; - author[] = {"KoffeinFlummi"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = CSTRING(ACETeam); + authors[] = {"KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG_COMMON; }; }; +// This class will be deprecated in version 3.8.0 +class ACE_newEvents { + // Status effect events + forceWalk = QGVAR(forceWalk); + blockSprint = QGVAR(blockSprint); + setCaptive = QGVAR(setCaptive); + blockDamage = QGVAR(blockDamage); + blockEngine = QGVAR(blockEngine); + + // Public listenable events + PlayerJip = "ace_playerJIP"; + activeCameraChanged = "ace_activeCameraChanged"; + visibleMapChanged = "ace_visibleMapChanged"; + cameraViewChanged = "ace_cameraViewChanged"; + playerVisionModeChanged = "ace_playerVisionModeChanged"; + playerInventoryChanged = "ace_playerInventoryChanged"; + playerWeaponChanged = "ace_playerWeaponChanged"; + playerTurretChanged = "ace_playerTurretChanged"; + playerVehicleChanged = "ace_playerVehicleChanged"; + playerChanged = "ace_playerChanged"; + SettingsInitialized = "ace_settingsInitialized"; + SettingChanged = "ace_settingChanged"; + firedNonPlayerVehicle = "ace_firedNonPlayerVehicle"; + firedPlayerVehicleNonLocal = "ace_firedPlayerVehicleNonLocal"; + firedPlayerVehicle = "ace_firedPlayerVehicle"; + firedNonPlayer = "ace_firedNonPlayer"; + firedPlayerNonLocal = "ace_firedPlayerNonLocal"; + firedPlayer = "ace_firedPlayer"; + unloadPersonEvent = "ace_unloadPersonEvent"; + loadPersonEvent = "ace_loadPersonEvent"; + useItem = "ace_useItem"; + infoDisplayChanged = "ace_infoDisplayChanged"; + + // Internal callable events + setStatusEffect = QGVAR(setStatusEffect); + HeadbugFixUsed = QGVAR(headbugFixUsed); + InitSettingsFromModules = QGVAR(initSettingsFromModules); + enableSimulationGlobal = QGVAR(enableSimulationGlobal); + hideObjectGlobal = QGVAR(hideObjectGlobal); + fixPosition = QGVAR(fixPosition); + fixFloating = QGVAR(fixFloating); + fixCollision = QGVAR(fixCollision); + unlockVehicle = QGVAR(unlockVehicle); + lockVehicle = QGVAR(lockVehicle); + displayTextPicture = QGVAR(displayTextPicture); + displayTextStructured = QGVAR(displayTextStructured); + setVanillaHitPointDamage = QGVAR(setVanillaHitPointDamage); + setVectorDirAndUp = QGVAR(setVectorDirAndUp); + switchMove = QGVAR(switchMove); + playMoveNow = QGVAR(playMoveNow); + playMove = QGVAR(playMove); + setVelocity = QGVAR(setVelocity); + selectLeader = QGVAR(selectLeader); + setSpeaker = QGVAR(setSpeaker); + engineOn = QGVAR(engineOn); + setFuel = QGVAR(setFuel); + setDir = QGVAR(setDir); + + // Events framework + SEH_s = "ACEs"; + SEH = "ACEe"; + SEH_all = "ACEa"; +}; + #include "CfgEventHandlers.hpp" #include "CfgLocationTypes.hpp" diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf deleted file mode 100644 index 54cef66228..0000000000 --- a/addons/common/functions/fnc__handleNetEvent.sqf +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Author: jaynus - * Internal net event handler. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_eventType", "_event"]; - -if (_eventType == "ACEg") then { - _event params ["_eventName", "_eventArgs"]; - - private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; - if (!isNil "_eventFunctions") then { - - #ifdef DEBUG_EVENTS - ACE_LOGINFO_1("* Net Event %1",_eventName); - ACE_LOGINFO_1(" args=%1",_eventArgs); - #endif - - { - if (!isNil "_x") then { - _eventArgs call CALLSTACK_NAMED(_x, FORMAT_2("Net Event %1 ID: %2",_eventName,_forEachIndex)); - #ifdef DEBUG_EVENTS_CALLSTACK - ACE_LOGINFO_1(" ID: %1",_forEachIndex); - #endif - }; - } forEach _eventFunctions; - }; -}; - -if (_eventType == "ACEc") then { - if (isServer) then { - _event params ["_eventName", "_eventTargets", "_eventArgs"]; - - private _sentEvents = []; - - if (!IS_ARRAY(_eventTargets)) then { - _eventTargets = [_eventTargets]; - }; - - //If not multiplayer, and there are targets, then just run localy - if (!isMultiplayer && {count _eventTargets > 0}) exitWith { - ACEg = [_eventName, _eventArgs]; - ["ACEg", ACEg] call FUNC(_handleNetEvent); - }; - - private _serverFlagged = false; - - { - private _owner = _x; - - if (IS_OBJECT(_x)) then { - _owner = owner _x; - }; - if !(_owner in _sentEvents) then { - _sentEvents pushBack _owner; - ACEg = [_eventName, _eventArgs]; - - if (isDedicated || {_x != ACE_player}) then { - if (isDedicated && {local _x} && {!_serverFlagged}) then { - _serverFlagged = true; - ["ACEg", ACEg] call FUNC(_handleNetEvent); - } else { - _owner publicVariableClient "ACEg"; - }; - } else { - ["ACEg", ACEg] call FUNC(_handleNetEvent); - }; - }; - false - } count _eventTargets; - }; -}; diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf index 8c8cbd1486..14d17ae118 100644 --- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf +++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf @@ -1,25 +1,25 @@ -/* - * Author: jaynus - * Handles a server-side request for synchronization ALL events on JIP to a client. - * - * Arguments: - * 0: client - * - * Return Value: - * Event is successed - * - * Public: No - */ -#include "script_component.hpp" - -params ["_client"]; - -{ - private _eventEntry = HASH_GET(GVAR(syncedEvents),_x); - _eventEntry params ["", "_eventLog"]; - - ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent); - false -} count (GVAR(syncedEvents) select 0); - -true +/* + * Author: jaynus + * Handles a server-side request for synchronization ALL events on JIP to a client. + * + * Arguments: + * 0: client + * + * Return Value: + * Event is successed + * + * Public: No + */ +#include "script_component.hpp" + +params ["_client"]; + +{ + private _eventEntry = HASH_GET(GVAR(syncedEvents),_x); + _eventEntry params ["", "_eventLog"]; + + ["ACEs", [_x, _eventLog], _client] call CBA_fnc_targetEvent; + false +} count (GVAR(syncedEvents) select 0); + +true diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf index 9d6c062ac2..2b239ea056 100644 --- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf @@ -1,48 +1,48 @@ -/* - * Author: jaynus - * Receives either requests for synchronization from clients, or the synchronization data from the server. - * - * Arguments [Client] : - * 0: eventName - * 1: eventLog - * - * Arguments [Server] : - * 0: eventName - * 1: client - * - * Return Value: - * Event is successed - * - * Public: No - */ -#include "script_component.hpp" - -//SEH_s -if (isServer) then { - // Find the event name, and shovel out the events to the client - params ["_eventName", "_client"]; - - if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { - ACE_LOGERROR_1("Request for synced event - key [%1] not found.", _eventName); - false - }; - - private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); - _eventEntry params ["", "_eventLog"]; - - ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent); -} else { - params ["_eventName", "_eventLog"]; - - // This is the client handling the response from the server - // Start running the events - { - _x params ["", "_eventArgs","_ttl"]; - [_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent); - false - } count _eventLog; - - ACE_LOGINFO_1("[%1] synchronized",_eventName); -}; - -true +/* + * Author: jaynus + * Receives either requests for synchronization from clients, or the synchronization data from the server. + * + * Arguments [Client] : + * 0: eventName + * 1: eventLog + * + * Arguments [Server] : + * 0: eventName + * 1: client + * + * Return Value: + * Event is successed + * + * Public: No + */ +#include "script_component.hpp" + +//SEH_s +if (isServer) then { + // Find the event name, and shovel out the events to the client + params ["_eventName", "_client"]; + + if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith { + ACE_LOGERROR_1("Request for synced event - key [%1] not found.", _eventName); + false + }; + + private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); + _eventEntry params ["", "_eventLog"]; + + ["ACEs", [_eventName, _eventLog], _client] call CBA_fnc_targetEvent; +} else { + params ["_eventName", "_eventLog"]; + + // This is the client handling the response from the server + // Start running the events + { + _x params ["", "_eventArgs","_ttl"]; + [_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent); + false + } count _eventLog; + + ACE_LOGINFO_1("[%1] synchronized",_eventName); +}; + +true diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index db8151dbd7..d708178c4f 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -1,37 +1,37 @@ -/* - * Author: jaynus - * Handles synced events being received. Server will log them, and server/client will execute them. - * - * Arguments [Client] : - * 0: eventName - * 1: arguments - * 2: ttl - * - * Return Value: - * Boolean of success - * - * Public: No - */ -#include "script_component.hpp" - -params ["_name", "_args", "_ttl"]; - -if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - ACE_LOGERROR_1("Synced event key [%1] not found (_handleSyncedEvent).", _name); - false -}; - -private _internalData = HASH_GET(GVAR(syncedEvents),_name); - -if (isServer) then { - // Server needs to internally log it for synchronization - if (_ttl > -1) then { - _internalData = HASH_GET(GVAR(syncedEvents),_name); - - _internalData params ["", "_eventLog"]; - _eventLog pushBack [ACE_diagTime, _args, _ttl]; - }; -}; - -_internalData params ["_eventCode"]; -_args call _eventCode; +/* + * Author: jaynus + * Handles synced events being received. Server will log them, and server/client will execute them. + * + * Arguments [Client] : + * 0: eventName + * 1: arguments + * 2: ttl + * + * Return Value: + * Boolean of success + * + * Public: No + */ +#include "script_component.hpp" + +params ["_name", "_args", "_ttl"]; + +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR_1("Synced event key [%1] not found (_handleSyncedEvent).", _name); + false +}; + +private _internalData = HASH_GET(GVAR(syncedEvents),_name); + +if (isServer) then { + // Server needs to internally log it for synchronization + if (_ttl > -1) then { + _internalData = HASH_GET(GVAR(syncedEvents),_name); + + _internalData params ["", "_eventLog"]; + _eventLog pushBack [diag_tickTime, _args, _ttl]; + }; +}; + +_internalData params ["_eventCode"]; +_args call _eventCode; diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf index e7df00f5ff..6ded410c87 100644 --- a/addons/common/functions/fnc_addEventHandler.sqf +++ b/addons/common/functions/fnc_addEventHandler.sqf @@ -1,25 +1,14 @@ -/* - * Author: Nou - * Add an event handler. - * - * Arguments: - * 0: Event name - * 1: Event code - * - * Return Value: - * Event handler ID number (for use with fnc_removeEventHandler) - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName", "_eventCode"]; - -private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; - -if (isNil "_eventFunctions") then { - _eventFunctions = []; - GVAR(eventsLocation) setVariable [_eventName, _eventFunctions]; -}; - -_eventFunctions pushBack _eventCode // Return event function count +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_eventName", "_eventCode"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName, _eventCode] call CBA_fnc_addEventHandler; + +ACE_DEPRECATED("ace_common_fnc_addEventHandler","3.8.0","CBA_fnc_addEventHandler"); diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf index 0cf25b860a..c4b97ddcce 100644 --- a/addons/common/functions/fnc_addSetting.sqf +++ b/addons/common/functions/fnc_addSetting.sqf @@ -37,4 +37,4 @@ missionNamespace setVariable [_name, _value]; GVAR(settings) pushBack _this; // Raise event locally -["SettingChanged", [_name, _value]] call FUNC(localEvent); +["ace_settingChanged", [_name, _value]] call CBA_fnc_localEvent; diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf index 126bb6a957..0481f7d11f 100644 --- a/addons/common/functions/fnc_addSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf @@ -1,30 +1,30 @@ -/* - * Author: jaynus - * Register an event handler for an ACE synced event - * - * Arguments: - * 0: Name - * 1: Handler - * 2: TTL (optional: 0) - * - * Return Value: - * Boolean of success - * - * Example: - * ["myEvent", {_this call x}, 0] call ace_common_fnc_addSyncedEventHandler - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_name", "_handler", ["_ttl", 0]]; - -if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - ACE_LOGERROR_1("Duplicate synced event [%1] creation.",_name); - false -}; - -private _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -private _data = [_handler, [], _ttl, _eventId]; - -HASH_SET(GVAR(syncedEvents),_name,_data); +/* + * Author: jaynus + * Register an event handler for an ACE synced event + * + * Arguments: + * 0: Name + * 1: Handler + * 2: TTL (optional: 0) + * + * Return Value: + * Boolean of success + * + * Example: + * ["myEvent", {_this call x}, 0] call ace_common_fnc_addSyncedEventHandler + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_name", "_handler", ["_ttl", 0]]; + +if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR_1("Duplicate synced event [%1] creation.",_name); + false +}; + +private _eventId = [_name, FUNC(_handleSyncedEvent)] call CBA_fnc_addEventHandler; +private _data = [_handler, [], _ttl, _eventId]; + +HASH_SET(GVAR(syncedEvents),_name,_data); diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf index 18dd6b4e0c..9a4ac5bf47 100644 --- a/addons/common/functions/fnc_assignedItemFix.sqf +++ b/addons/common/functions/fnc_assignedItemFix.sqf @@ -28,7 +28,7 @@ GVAR(AssignedItemsShownItems) = [ ACE_isGPSEnabled ]; -["playerInventoryChanged", { +["loadout", { params ["_unit"]; private _assignedItems = getUnitLoadout _unit param [9, ["","","","","",""]]; // ["ItemMap","ItemGPS","ItemRadio","ItemCompass","ItemWatch","NVGoggles"] @@ -48,4 +48,4 @@ GVAR(AssignedItemsShownItems) = [ showWatch _showWatch; showRadio _showRadio; showGPS (_showGPS || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key) -}] call FUNC(addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/common/functions/fnc_binocularMagazine.sqf b/addons/common/functions/fnc_binocularMagazine.sqf index b5f4f0558e..aacac7c142 100644 --- a/addons/common/functions/fnc_binocularMagazine.sqf +++ b/addons/common/functions/fnc_binocularMagazine.sqf @@ -15,18 +15,6 @@ */ #include "script_component.hpp" -params [["_unit", objNull, [objNull]]]; +ACE_DEPRECATED("ace_common_fnc_binocularMagazine","3.8.0","CBA_fnc_binocularMagazine"); -private _binocular = binocular _unit; - -scopeName "main"; - -{ - if ((_x select 0) isEqualTo _binocular) then { - // note: if there is no magazine, _x(4,0) will be nil, which skips the breakOut. - (_x select 4 select 0) breakOut "main"; - }; - false -} count weaponsitems _unit; - -"" +_this call CBA_fnc_binocularMagazine diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf index 2c7cdd4b27..8ff6744a54 100644 --- a/addons/common/functions/fnc_cachedCall.sqf +++ b/addons/common/functions/fnc_cachedCall.sqf @@ -19,8 +19,8 @@ params ["_params", "_function", "_namespace", "_uid", "_duration", "_event"]; -if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { - _namespace setVariable [_uid, [ACE_diagTime + _duration, _params call _function]]; +if ((_namespace getVariable [_uid, [-99999]]) select 0 < diag_tickTime) then { + _namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]]; // Does the cache needs to be cleared on an event? if (!isNil "_event") then { @@ -46,7 +46,7 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { } forEach _cacheList; // Empty the list missionNamespace setVariable [_varName, []]; - }] call FUNC(addEventhandler); + }] call CBA_fnc_addEventHandler; }; // Add this cache to the list of the event diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index f447d126af..1328624a0c 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -61,7 +61,8 @@ if (!isServer) then { _error = _error + "Newer version; "; }; - //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + //[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; + ACE_LOGERROR(_error); if (_mode < 2) then { @@ -79,7 +80,7 @@ if (!isServer) then { params ["_rscLayer"]; TRACE_2("Hiding Error message after 10 seconds",time,_rscLayer); _rscLayer cutFadeOut 0.2; - }, [_rscLayer], 10] call FUNC(waitAndExecute); + }, [_rscLayer], 10] call CBA_fnc_waitAndExecute; }; }; @@ -89,7 +90,7 @@ if (!isServer) then { TRACE_2("Player is alive, showing msg and exiting",time,_text); _text = composeText [parseText format ["%1", _text]]; ["[ACE] ERROR", _text, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); - }, [_text]] call FUNC(waitUntilAndExecute); + }, [_text]] call CBA_fnc_waitUntilAndExecute; }; }; diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index cc514a2a6f..214de6052b 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -28,9 +28,9 @@ _target setVariable [QGVAR(owner), _unit, true]; // lock target object if (_lockTarget) then { if (!isNull _unit) then { - ["lockVehicle", _target, _target] call FUNC(targetEvent); + [QGVAR(lockVehicle), _target, _target] call CBA_fnc_targetEvent; } else { - ["unlockVehicle", _target, _target] call FUNC(targetEvent); + [QGVAR(unlockVehicle), _target, _target] call CBA_fnc_targetEvent; }; }; diff --git a/addons/common/functions/fnc_codeToString.sqf b/addons/common/functions/fnc_codeToString.sqf index b4fe37db35..62e4cb5698 100644 --- a/addons/common/functions/fnc_codeToString.sqf +++ b/addons/common/functions/fnc_codeToString.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Code * - * Return value: + * Return Value: * Code * * Public: Yes diff --git a/addons/common/functions/fnc_deprecateComponent.sqf b/addons/common/functions/fnc_deprecateComponent.sqf new file mode 100644 index 0000000000..21905e8e4e --- /dev/null +++ b/addons/common/functions/fnc_deprecateComponent.sqf @@ -0,0 +1,63 @@ +/* + * Author: Glowbal + * Mark a component as deprecated and switches it to a new component if that is available + * + * Arguments: + * 0: Component + * 1: New component + * 2: Version when the compent will be removed + * + * Return Value: + * Replaced by new component + * + * Public: No + * + * Example: + * [["ace_sitting", "ace_sitting_enabled"], ["acex_sitting", "acex_sitting_enabled"], "3.7.0"] call ace_common_fnc_deprecateComponent; + */ +#include "script_component.hpp" + +params ["_oldComponent", "_newComponent", "_version"]; + +_oldComponent params ["_oldComponentName", "_oldSettingName"]; +_newComponent params ["_newComponentName", "_newSettingName"]; + +private _isReplacementAvailable = isClass (configFile >> "CfgPatches" >> _newComponentName); +private _isDeprecatedLoaded = missionNamespace getvariable [_oldSettingName, false]; +private _isReplacementLoaded = missionNamespace getvariable [_newSettingName, false]; + +if (_isDeprecatedLoaded && {_isReplacementAvailable} && {!_isReplacementLoaded}) then { + [_newSettingName, true, true, true] call FUNC(setSetting); +}; + +if (_isDeprecatedLoaded && {!_isReplacementLoaded}) then { + private _componentVersion = getText (configFile >> "CfgPatches" >> _oldComponentName >> "version"); + ((_componentVersion splitString ".") apply {parseNumber _x}) params ["_componentMajor", "_componentMinor", "_componentPatch"]; + ((_version splitString ".") apply {parseNumber _x}) params ["_major", "_minor", "_patch"]; + + switch (true) do { + case (_componentMajor >= _major && {_componentMinor >= _minor} && {_componentPatch >= _patch}): { // Removed from this version + private _message = format[ + "Component %1 is deprecated. It has been replaced by %2. The component %1 is no longer usable on this version. ", _oldComponentName, _newComponentName, _version]; + systemChat format["ACE [ERROR] - %1", _message]; + ACE_LOGERROR(_message); + }; + case (_componentMajor >= _major && {_componentMinor >= _minor-1}): { // Removed the next this version + private _message = format[ + "Component %1 is deprecated. It is replaced by %2. Please disable %1 and make use of %2. " + + "The component (%1) will no longer be available from version %3 and later.", _oldComponentName, _newComponentName, _version]; + systemChat format["ACE [WARNING] - %1", _message]; + ACE_LOGWARNING(_message); + }; + case (_componentMajor == _major && {_componentMinor >= _minor - 2}): { // we are in a version leading up to removal + private _message = format[ + "Component %1 is deprecated. It is replaced by %2. Please disable %1 and make use of %2. " + + "The component (%1) will no longer be available from version %3 and later.", _oldComponentName, _newComponentName, _version]; + ACE_LOGWARNING(_message); + }; + default { + }; + }; +}; + +_isReplacementAvailable; diff --git a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf index 416eef2c77..ce012fc3aa 100644 --- a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf +++ b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf @@ -13,7 +13,7 @@ * None * * Example: - * [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditionCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew + * [(localize "STR_ACE_microdagr_itemName"), QPATHTOF(images\microDAGR_item.paa), _conditionCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew * * Public: No */ diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf index c51b3bd454..e4f824791a 100644 --- a/addons/common/functions/fnc_displayIcon.sqf +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -14,7 +14,7 @@ * None * * Example: - * ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; + * ["myID", true, QPATHTOF(data\icon_group.paa), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; * * Public: Yes */ @@ -89,11 +89,11 @@ private _refresh = { if (_show) then { if ({_x select 0 == _iconId} count _list == 0) then { - _list pushBack [_iconId, _icon, _color, ACE_time]; + _list pushBack [_iconId, _icon, _color, CBA_missionTime]; } else { { if (_x select 0 == _iconId) exitWith { - _list set [_forEachIndex, [_iconId, _icon, _color, ACE_time]]; + _list set [_forEachIndex, [_iconId, _icon, _color, CBA_missionTime]]; }; } forEach _list; }; @@ -104,7 +104,7 @@ if (_show) then { if (_timeAlive >= 0) then { [{ [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon); - }, [_iconId], _timeAlive, _timeAlive] call FUNC(waitAndExecute); + }, [_iconId], _timeAlive, _timeAlive] call CBA_fnc_waitAndExecute; }; } else { diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index 3c68327535..ee22f6949a 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -25,7 +25,7 @@ if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; GVAR(lastHint) params ["_lastHintTime", "_lastHintPriority"]; -private _time = ACE_time; +private _time = CBA_missionTime; if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; @@ -33,5 +33,5 @@ if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { GVAR(lastHint) set [0, _time]; GVAR(lastHint) set [1, _priority]; - [{if ((_this select 0) == GVAR(lastHint) select 0) then {hintSilent ""};}, [_time], _delay, 0] call FUNC(waitAndExecute); + [{if ((_this select 0) == GVAR(lastHint) select 0) then {hintSilent ""};}, [_time], _delay, 0] call CBA_fnc_waitAndExecute; }; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index a0bcb47e11..b0c42824be 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -5,17 +5,22 @@ * Arguments: * 0: Text * 1: Image - * 2: Image color (default: [0, 0, 0, 0]) - * 3: Target Unit. Will only display if target is the player controlled object (default: ACE_player) + * 2: Image color (default: [1, 1, 1]) + * 3: Target Unit. Will only display if target is the player controlled object (default: ACE_player) + * 4: Size (default: 2) * * Return Value: * None * + * Example: + * ["text", "image", [1, 1, 1], ACE_player, 2] call ace_common_fnc_displayTextPicture + * ["text", "image", nil, nil, 3] call ace_common_fnc_displayTextPicture + * * Public: Yes */ #include "script_component.hpp" -params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]]; +params [["_text", ""], ["_image", "", [""]], ["_imageColor", [1,1,1], [[]]], ["_target", ACE_player, [objNull]], ["_size", 2, [0]]]; if (_target != ACE_player) exitWith {}; @@ -41,4 +46,4 @@ if (typeName _text != "TEXT") then { _text = composeText [parseText format ["", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text]; -[_text, 2] call FUNC(displayTextStructured); +[_text, _size] call FUNC(displayTextStructured); diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 9fff7bb056..e952fce9a4 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -4,17 +4,20 @@ * * Arguments: * 0: Text - * 1: Size of the textbox (default: 1.5) - * 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player) + * 1: Size of the textbox (default: 1.5) + * 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player) * * Return Value: * None * + * Example: + * + * * Public: Yes */ #include "script_component.hpp" -params ["_text", ["_size", 1.5], ["_target", ACE_player]]; +params [["_text", ""], ["_size", 1.5, [0]], ["_target", ACE_player, [objNull]]]; if (_target != ACE_player) exitWith {}; diff --git a/addons/common/functions/fnc_doAnimation.sqf b/addons/common/functions/fnc_doAnimation.sqf index bfd50b08b8..720518d003 100644 --- a/addons/common/functions/fnc_doAnimation.sqf +++ b/addons/common/functions/fnc_doAnimation.sqf @@ -41,34 +41,34 @@ TRACE_2("",local _unit,vehicle _unit); switch (_priority) do { case 0: { if (_unit == vehicle _unit) then { - ["playMove", _unit, [_unit, _animation]] call FUNC(objectEvent); + [QGVAR(playMove), [_unit, _animation], _unit] call CBA_fnc_targetEvent; } else { // Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles. - ["playMove", [_unit, _animation]] call FUNC(globalEvent); + [QGVAR(playMove), [_unit, _animation]] call CBA_fnc_globalEvent; }; }; case 1: { if (_unit == vehicle _unit) then { - ["playMoveNow", _unit, [_unit, _animation]] call FUNC(objectEvent); + [QGVAR(playMoveNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent; } else { // Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles. - ["playMoveNow", [_unit, _animation]] call FUNC(globalEvent); + [QGVAR(playMoveNow), [_unit, _animation]] call CBA_fnc_globalEvent; }; }; case 2: { // try playMoveNow first if (_unit == vehicle _unit) then { - ["playMoveNow", _unit, [_unit, _animation]] call FUNC(objectEvent); + [QGVAR(playMoveNow), [_unit, _animation], _unit] call CBA_fnc_targetEvent; } else { // Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles. - ["playMoveNow", [_unit, _animation]] call FUNC(globalEvent); + [QGVAR(playMoveNow), [_unit, _animation]] call CBA_fnc_globalEvent; }; // if animation doesn't respond, do switchMove if (animationState _unit != _animation) then { TRACE_1("did not respond to playMoveNow",animationState _unit); // Execute on all machines. SwitchMove has local effects. - ["switchMove", [_unit, _animation]] call FUNC(globalEvent); + [QGVAR(switchMove), [_unit, _animation]] call CBA_fnc_globalEvent; }; }; default {}; diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf index 7b7ee5765e..b0d77af7d5 100644 --- a/addons/common/functions/fnc_dropBackpack.sqf +++ b/addons/common/functions/fnc_dropBackpack.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Unit that has a backpack * - * Return value: + * Return Value: * Ground wepaon holder with backpack * * Public: Yes diff --git a/addons/common/functions/fnc_dumpArray.sqf b/addons/common/functions/fnc_dumpArray.sqf index 026b08501e..b274f1119e 100644 --- a/addons/common/functions/fnc_dumpArray.sqf +++ b/addons/common/functions/fnc_dumpArray.sqf @@ -1,44 +1,44 @@ -/* - * Author: ? - * Dumps an array to the RPT, showing the depth of each element. - * - * Arguments: - * 0: Array to be dumped - * 1: Depth - * - * Return Value: - * None - * - * Example: - * [[0, [1,2], [[3]]]] call ace_common_fnc_dumpArray - * - * Public: No - */ -#include "script_component.hpp" - -params ["_var", ["_depth", 0, [0]]]; - -private _pad = ""; - -for "_i" from 0 to _depth do { - _pad = _pad + toString [9]; -}; - -_depth = _depth + 1; - -if (IS_ARRAY(_var)) then { - if (_var isEqualTo []) then { - diag_log text format ["%1[],", _pad]; - } else { - diag_log text format ["%1[", _pad]; - - { - [_x, _depth] call FUNC(dumpArray); - false - } count _var; - - diag_log text format ["%1],", _pad]; - }; -} else { - diag_log text format ["%1%2", _pad, _var]; -}; +/* + * Author: ? + * Dumps an array to the RPT, showing the depth of each element. + * + * Arguments: + * 0: Array to be dumped + * 1: Depth + * + * Return Value: + * None + * + * Example: + * [[0, [1,2], [[3]]]] call ace_common_fnc_dumpArray + * + * Public: No + */ +#include "script_component.hpp" + +params ["_var", ["_depth", 0, [0]]]; + +private _pad = ""; + +for "_i" from 0 to _depth do { + _pad = _pad + toString [9]; +}; + +_depth = _depth + 1; + +if (IS_ARRAY(_var)) then { + if (_var isEqualTo []) then { + diag_log text format ["%1[],", _pad]; + } else { + diag_log text format ["%1[", _pad]; + + { + [_x, _depth] call FUNC(dumpArray); + false + } count _var; + + diag_log text format ["%1],", _pad]; + }; +} else { + diag_log text format ["%1%2", _pad, _var]; +}; diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf index afb71b423a..ec6f225ce4 100644 --- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf +++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf @@ -1,88 +1,88 @@ -/* - * Author: ? - * Dumps performance counter statistics into Logs. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -diag_log text format ["REGISTERED ACE PFH HANDLERS"]; -diag_log text format ["-------------------------------------------"]; - -if (!isNil "ACE_PFH_COUNTER") then { - { - _x params ["_pfh", "_parameters"]; - - private _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; - - diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2]; - false - } count ACE_PFH_COUNTER; -}; - -diag_log text format ["ACE COUNTER RESULTS"]; -diag_log text format ["-------------------------------------------"]; - -{ - private _counterEntry = _x; - private _iter = 0; - private _total = 0; - private _count = 0; - private _averageResult = 0; - - if (count _counterEntry > 3) then { - // calc - { - if (_iter > 2) then { - _count = _count + 1; - private _delta = (_x select 1) - (_x select 0); - - _total = _total + _delta; - }; - - _iter = _iter + 1; - false - } count _counterEntry; - - // results - _averageResult = (_total / _count) * 1000; - - // dump results - diag_log text format ["%1: Average: %2s / %3 = %4ms", _counterEntry select 0, _total, _count, _averageResult]; - } else { - diag_log text format ["%1: No results", _counterEntry select 0]; - }; - false -} count ACE_COUNTERS; - -/* -// Dump PFH Trackers -diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"]; -diag_log text format["-------------------------------------------"]; -{ - private _delay = _x select 2; - //if(_delay > 0) then { _delay = _delay / 1000; }; - - diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)]; -} forEach ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER; - -// Dump PFH Trackers -diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"]; -diag_log text format["-------------------------------------------"]; -{ - private _delta = _x select 1; - //if(_delta > 0) then { _delta = _delta / 1000; }; - diag_log text format[" DELTA: %1s", _delta]; -} forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER; - -//{ -// -//} forEach ACRE_EXCESSIVE_FRAME_TRACKER; - -*/ +/* + * Author: ? + * Dumps performance counter statistics into Logs. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +diag_log text format ["REGISTERED ACE PFH HANDLERS"]; +diag_log text format ["-------------------------------------------"]; + +if (!isNil "ACE_PFH_COUNTER") then { + { + _x params ["_pfh", "_parameters"]; + + private _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; + + diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2]; + false + } count ACE_PFH_COUNTER; +}; + +diag_log text format ["ACE COUNTER RESULTS"]; +diag_log text format ["-------------------------------------------"]; + +{ + private _counterEntry = _x; + private _iter = 0; + private _total = 0; + private _count = 0; + private _averageResult = 0; + + if (count _counterEntry > 3) then { + // calc + { + if (_iter > 2) then { + _count = _count + 1; + private _delta = (_x select 1) - (_x select 0); + + _total = _total + _delta; + }; + + _iter = _iter + 1; + false + } count _counterEntry; + + // results + _averageResult = (_total / _count) * 1000; + + // dump results + diag_log text format ["%1: Average: %2s / %3 = %4ms", _counterEntry select 0, _total, _count, _averageResult]; + } else { + diag_log text format ["%1: No results", _counterEntry select 0]; + }; + false +} count ACE_COUNTERS; + +/* +// Dump PFH Trackers +diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"]; +diag_log text format["-------------------------------------------"]; +{ + private _delay = _x select 2; + //if(_delay > 0) then { _delay = _delay / 1000; }; + + diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)]; +} forEach ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER; + +// Dump PFH Trackers +diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"]; +diag_log text format["-------------------------------------------"]; +{ + private _delta = _x select 1; + //if(_delta > 0) then { _delta = _delta / 1000; }; + diag_log text format[" DELTA: %1s", _delta]; +} forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER; + +//{ +// +//} forEach ACRE_EXCESSIVE_FRAME_TRACKER; + +*/ diff --git a/addons/common/functions/fnc_execNextFrame.sqf b/addons/common/functions/fnc_execNextFrame.sqf index 7b3f034c6d..c1c4b81592 100644 --- a/addons/common/functions/fnc_execNextFrame.sqf +++ b/addons/common/functions/fnc_execNextFrame.sqf @@ -13,10 +13,6 @@ */ #include "script_component.hpp" -params ["_func", "_params"]; +ACE_DEPRECATED("ace_common_fnc_execNextFrame","3.8.0","CBA_fnc_execNextFrame"); -if (diag_frameno != GVAR(nextFrameNo)) then { - GVAR(nextFrameBufferA) pushBack [_params, _func]; -} else { - GVAR(nextFrameBufferB) pushBack [_params, _func]; -}; +_this call CBA_fnc_execNextFrame; diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index d70f0a8650..29e58a4c6a 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -2,7 +2,7 @@ * Author: esteldunedain * Unfied handling of weapon fire * - * Argument: + * Arguments: * 0: unit - Object the event handler is assigned to * 1: weapon - Fired weapon * 2: muzzle - Muzzle that was used @@ -11,7 +11,7 @@ * 5: magazine - magazine name which was used * 6: projectile - Object of the projectile that was shot * - * Return value: + * Return Value: * None * * Public: No @@ -26,12 +26,12 @@ TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile if (_unit isKindOf "CAManBase") then { // The unit it on foot if (_unit == ACE_player) then { - ["firedPlayer", _this] call FUNC(localEvent); + ["ace_firedPlayer", _this] call CBA_fnc_localEvent; } else { if ([_unit] call EFUNC(common,isPlayer)) then { - ["firedPlayerNonLocal", _this] call FUNC(localEvent); + ["ace_firedPlayerNonLocal", _this] call CBA_fnc_localEvent; } else { - ["firedNonPlayer", _this] call FUNC(localEvent); + ["ace_firedNonPlayer", _this] call CBA_fnc_localEvent; }; }; } else { @@ -55,12 +55,12 @@ if (_unit isKindOf "CAManBase") then { }; if (_gunner == ACE_player) then { - ["firedPlayerVehicle", _this] call FUNC(localEvent); + ["ace_firedPlayerVehicle", _this] call CBA_fnc_localEvent; } else { if ([_gunner] call EFUNC(common,isPlayer)) then { - ["firedPlayerVehicleNonLocal", _this] call FUNC(localEvent); + ["ace_firedPlayerVehicleNonLocal", _this] call CBA_fnc_localEvent; } else { - ["firedNonPlayerVehicle", _this] call FUNC(localEvent); + ["ace_firedNonPlayerVehicle", _this] call CBA_fnc_localEvent; }; }; }; diff --git a/addons/common/functions/fnc_fixCollision.sqf b/addons/common/functions/fnc_fixCollision.sqf index c0cf7b93e7..3b3b16a9f9 100644 --- a/addons/common/functions/fnc_fixCollision.sqf +++ b/addons/common/functions/fnc_fixCollision.sqf @@ -19,4 +19,4 @@ if (!local _this) exitWith {}; [_this, "blockDamage", "fixCollision", true] call FUNC(statusEffect_set); // re-allow damage after 2 seconds -[{[_this, "blockDamage", "fixCollision", false] call FUNC(statusEffect_set);}, _this, 2] call EFUNC(common,waitAndExecute); +[{[_this, "blockDamage", "fixCollision", false] call FUNC(statusEffect_set);}, _this, 2] call CBA_fnc_waitAndExecute; diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 1d8da1c8a4..5a00aa3863 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -21,7 +21,7 @@ if (!local _object) exitWith {}; if (_object isKindOf "CAManBase") exitWith {}; //We need to manually set allowDamage to true for setHitIndex to function -["blockDamage", [_object, 0]] call FUNC(localEvent); +[QGVAR(blockDamage), [_object, 0]] call CBA_fnc_localEvent; // save and restore hitpoints, see below why private _hitPointDamages = getAllHitPointsDamage _object; @@ -41,4 +41,4 @@ _object setDamage damage _object; //manually re-enable allowDamage to previous setting (ref statusEffect_funcs) private _effectVarName = format [QGVAR(effect_%1), "blockDamage"]; private _effectNumber = _object getVariable [_effectVarName, 0]; -["blockDamage", [_object, _effectNumber]] call FUNC(localEvent); +[QGVAR(blockDamage), [_object, _effectNumber]] call CBA_fnc_localEvent; diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf index 689512d925..883a502c4e 100644 --- a/addons/common/functions/fnc_fixPosition.sqf +++ b/addons/common/functions/fnc_fixPosition.sqf @@ -3,7 +3,7 @@ * * Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object. * - * Argument: + * Arguments: * Object * * Return Value: diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf index cebcc489f1..de6ea62dff 100644 --- a/addons/common/functions/fnc_getAllGear.sqf +++ b/addons/common/functions/fnc_getAllGear.sqf @@ -64,5 +64,5 @@ if (isNull _unit) exitWith {[ handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit, assignedItems _unit, binocular _unit, - [_unit] call FUNC(binocularMagazine) + [_unit] call CBA_fnc_binocularMagazine ] diff --git a/addons/common/functions/fnc_getConfigType.sqf b/addons/common/functions/fnc_getConfigType.sqf index 1496cfa2b9..34aaa03172 100644 --- a/addons/common/functions/fnc_getConfigType.sqf +++ b/addons/common/functions/fnc_getConfigType.sqf @@ -12,12 +12,6 @@ */ #include "script_component.hpp" -params ["_item"]; +ACE_DEPRECATED("ace_common_fnc_getConfigType","3.8.0","CBA_fnc_getItemConfig"); -if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"}; - -if (isClass (configFile >> "CfgMagazines" >> _item)) exitWith {"CfgMagazines"}; - -if (isClass (configFile >> "CfgGlasses" >> _item)) exitWith {"CfgGlasses"}; - -"" +configName (configHierarchy (_item call CBA_fnc_getItemConfig) param [1, configNull]) diff --git a/addons/common/functions/fnc_getConfigTypeObject.sqf b/addons/common/functions/fnc_getConfigTypeObject.sqf index 6186ad6bff..92a6d43a42 100644 --- a/addons/common/functions/fnc_getConfigTypeObject.sqf +++ b/addons/common/functions/fnc_getConfigTypeObject.sqf @@ -12,10 +12,6 @@ */ #include "script_component.hpp" -params ["_object"]; +ACE_DEPRECATED("ace_common_fnc_getConfigTypeObject","3.8.0","CBA_fnc_getObjectConfig"); -if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"}; - -if (isClass (configFile >> "CfgAmmo" >> _object)) exitWith {"CfgAmmo"}; - -"" +configName (configHierarchy (_item call CBA_fnc_getObjectConfig) param [1, configNull]) diff --git a/addons/common/functions/fnc_getItemType.sqf b/addons/common/functions/fnc_getItemType.sqf index d3eb511949..eb5015e20a 100644 --- a/addons/common/functions/fnc_getItemType.sqf +++ b/addons/common/functions/fnc_getItemType.sqf @@ -15,9 +15,11 @@ params ["_item"]; -private _cfgType = [_item] call FUNC(getConfigType); +private _config = _item call CBA_fnc_getItemConfig; -if (_cfgType == "") exitWith {["", ""]}; +if (isNull _config) exitWith {["", ""]}; + +private _cfgType = configName ((configHierarchy _config) param [1, configNull]); if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]}; diff --git a/addons/common/functions/fnc_getMGRSdata.sqf b/addons/common/functions/fnc_getMGRSdata.sqf index 44fc204638..6b29b6625a 100644 --- a/addons/common/functions/fnc_getMGRSdata.sqf +++ b/addons/common/functions/fnc_getMGRSdata.sqf @@ -4,7 +4,7 @@ * Also gets longitude, latitude and altitude offset for the map. * Writes return values to GVAR(MGRS_data) if run on the current map. * - * Argument: + * Arguments: * 0: Map name (default: worldName) * * Return Value: @@ -22,83 +22,14 @@ private _long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude"); private _lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude"); private _altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset"); -_map = toLower _map; -if (_map in ["abbottabad"]) then { _lat = 34; _altitude = 1256; }; //Abbottabad elevation 1256m (Wikipedia) -if (_map in ["abramia"]) then { _lat = 60; _altitude = 0; }; -if (_map in ["af_kandahar_province"]) then { _lat = 42; _altitude = 0; }; -if (_map in ["altis"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["angel"]) then { _lat = 38; _altitude = 0; }; -if (_map in ["anim_helvantis_v2"]) then { _lat = 50; _altitude = 0; }; -if (_map in ["australia"]) then { _lat = -25; _altitude = 0; }; -if (_map in ["bootcamp_acr"]) then { _lat = 50; _altitude = 0; }; -if (_map in ["bornholm"]) then { _lat = 55; _altitude = 0; }; -if (_map in ["bozcaada"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["caribou"]) then { _lat = 68; _altitude = 0; }; -if (_map in ["catalina"]) then { _lat = 33; _altitude = 0; }; -if (_map in ["chernarus", "chernarus_summer", "chernarus_winter"]) then { _lat = 50; _altitude = 0; }; -if (_map in ["chernobylzone", "chernobylzonea2"]) then { _lat = 51; _altitude = 0; }; -if (_map in ["clafghan"]) then { _lat = 34; _altitude = 640; }; -if (_map in ["dakrong"]) then { _lat = 17; _altitude = 0; }; //Unsung Mod -if (_map in ["desert_e"]) then { _lat = 40; _altitude = 800; }; -if (_map in ["dya"]) then { _lat = 34; _altitude = 110; }; //Diyala Iraq - default elevationOffset -if (_map in ["esseker"]) then { _lat = 43; _altitude = 2000; }; -if (_map in ["evergreen"]) then { _lat = 41; _altitude = 0; }; //Burgazada, Turkey - default elevationOffset -if (_map in ["fallujah"]) then { _lat = 33; _altitude = 0; }; -if (_map in ["fata"]) then { _lat = 33; _altitude = 1347; }; -if (_map in ["gorgona"]) then { _lat = 43; _altitude = 0; }; -if (_map in ["hellskitchen", "hellskitchens"]) then { _lat = 32; _altitude = 900; }; //Sangin summer, Sangin winter - Sangin elevation 888m (Wikipedia) -if (_map in ["hindukush"]) then { _lat = 36; _altitude = 0; }; -if (_map in ["imrali", "imralispring"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["intro"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["isladuala3"]) then { _lat = -19; _altitude = 0; }; -if (_map in ["jacobi"]) then { _lat = 34; _altitude = 2000; }; //default elevationOffset -if (_map in ["kapaulio"]) then { _lat = 0; _altitude = 0; }; -if (_map in ["kerama"]) then { _lat = 26; _altitude = 0; }; //Kerama Islands, Japan - default elevationOffset -if (_map in ["kholm"]) then { _lat = 36; _altitude = 0; }; -if (_map in ["koplic"]) then { _lat = 42; _altitude = 0; }; -if (_map in ["kunduz"]) then { _lat = 37; _altitude = 0; }; -if (_map in ["lingor", "lingor3"]) then { _lat = -4; _altitude = 0; }; -if (_map in ["lost", "lostw"]) then { _lat = 60; _altitude = 0; }; -if (_map in ["mcn_aliabad"]) then { _lat = 36; _altitude = 0; }; -if (_map in ["malvinas"]) then { _lat = -52; _altitude = 0; }; -if (_map in ["namalsk"]) then { _lat = 65; _altitude = 0; }; -if (_map in ["mef_alaska"]) then { _lat = 60; _altitude = 5; }; -if (_map in ["mountains_acr"]) then { _lat = 35; _altitude = 2000; }; -if (_map in ["napf", "napfwinter"]) then { _lat = 47; _altitude = 0; }; -if (_map in ["panthera3"]) then { _lat = 46; _altitude = 0; }; -if (_map in ["pianosa_aut"]) then { _lat = 43; _altitude = 0; }; //Pianosa, Italy - default elevationOffset -if (_map in ["pja305"]) then { _lat = 0; _altitude = 0; }; //G.O.S N'Ziwasogo -if (_map in ["pja306"]) then { _lat = 35; _altitude = 0; }; //G.O.S Kalu Khan -if (_map in ["pja307"]) then { _lat = 17; _altitude = 0; }; //F.S.F Daryah -if (_map in ["pja308"]) then { _lat = 36; _altitude = 0; }; //G.O.S Gunkizli -if (_map in ["pja310"]) then { _lat = 36; _altitude = 0; }; //G.O.S Al Rayak -if (_map in ["pja312"]) then { _lat = 16; _altitude = 0; }; //G.O.S Song Bin Tanh -if (_map in ["porquerolles"]) then { _lat = 43; _altitude = 0; }; -if (_map in ["porto"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["provinggrounds_pmc"]) then { _lat = 35; _altitude = 100; }; -if (_map in ["reshmaan"]) then { _lat = 35; _altitude = 2000; }; -if (_map in ["sara", "sara_dbe1"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["saralite"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["sb3"]) then { _lat = 53; _altitude = 25; }; //TrpUebPl Einfelde Nord (Munster North Training Area, Germany) - default elevationOffset -if (_map in ["shapur_baf"]) then { _lat = 35; _altitude = 100; }; -if (_map in ["sfp_sturko"]) then { _lat = 56; _altitude = 0; }; -if (_map in ["sfp_wamako"]) then { _lat = 14; _altitude = 0; }; -if (_map in ["stratis"]) then { _lat = 40; _altitude = 0; }; -if (_map in ["sugarlake"]) then { _lat = 29; _altitude = 0; }; -if (_map in ["takistan"]) then { _lat = 35; _altitude = 2000; }; -if (_map in ["thirsk"]) then { _lat = 65; _altitude = 0; }; -if (_map in ["tilos"]) then { _lat = 36; _altitude = 0; }; -if (_map in ["utes"]) then { _lat = 50; _altitude = 0; }; -if (_map in ["vt5"]) then { _lat = 61; _altitude = 100; }; //Vt5, Suomi Finland - default elevationOffset -if (_map in ["wake"]) then { _lat = 19; _altitude = 0; }; -if (_map in ["waziristan"]) then { _lat = 33; _altitude = 0; }; -if (_map in ["wintermap"]) then { _lat = 61; _altitude = 0; }; //Nordkvingo - default elevationOffset -if (_map in ["wintertown", "wintertowna3"]) then { _lat = 39; _altitude = 600; }; //U.S. state Kansas mean elevation 610m (Wikipedia) -if (_map in ["woodland_acr"]) then { _lat = 50; _altitude = 0; }; -if (_map in ["xcam_prototype"]) then { _lat = 35; _altitude = 0; }; -if (_map in ["zargabad"]) then { _lat = 35; _altitude = 2000; }; +private _mapData = _map call FUNC(getMapData); +if (!(_mapData isEqualTo [])) then { + _lat = _mapData select 0; + _alt = _mapData select 1; +}; +TRACE_2("Latitude and Altitude",_lat,_alt); -private _UTM = [_long,_lat] call BIS_fnc_posDegToUTM; +private _UTM = [_long, _lat] call BIS_fnc_posDegToUTM; private _easting = _UTM select 0; private _northing = _UTM select 1; //private _zone = _UTM select 2; diff --git a/addons/common/functions/fnc_getMapData.sqf b/addons/common/functions/fnc_getMapData.sqf new file mode 100644 index 0000000000..7d7bef817f --- /dev/null +++ b/addons/common/functions/fnc_getMapData.sqf @@ -0,0 +1,107 @@ +/* + * Author: VKing, bux + * Gets the current latitude and altitude offset for the map. + * + * Arguments: + * 0: Map name (default: worldName) + * + * Return Value: + * 0: Latitude + * 1: Altitude + * + * Public: No + */ + +params ["_map"]; +_map = toLower _map; + +// [latitude, altitude] + +// the more important ones +if (_map in ["tanoa"]) exitWith { [-18, 0] }; +if (_map in ["altis"]) exitWith { [40, 0] }; +if (_map in ["stratis"]) exitWith { [40, 0] }; + +if (_map in ["abbottabad"]) exitWith { [34, 1256] }; //Abbottabad elevation 1256m (Wikipedia) +if (_map in ["abel"]) exitWith { [39, 0] }; //CWR2 Malden +if (_map in ["abramia"]) exitWith { [60, 0] }; +if (_map in ["af_kandahar_province"]) exitWith { [42, 0] }; +if (_map in ["angel"]) exitWith { [38, 0] }; +if (_map in ["anim_helvantis_v2"]) exitWith { [50, 0] }; +if (_map in ["australia"]) exitWith { [-25, 0] }; +if (_map in ["bootcamp_acr"]) exitWith { [50, 0] }; +if (_map in ["bornholm"]) exitWith { [55, 0] }; +if (_map in ["bozcaada"]) exitWith { [40, 0] }; +if (_map in ["cain"]) exitWith { [40, 0] }; //CWR2 Kolgujev +if (_map in ["caribou"]) exitWith { [68, 0] }; +if (_map in ["cartercity"]) exitWith { [43, 130] }; //Pecher, based on Grozny (1995 - 1996) elevation 130m (Wikipedia) +if (_map in ["catalina"]) exitWith { [33, 0] }; +if (_map in ["chernarus", "chernarus_summer", "chernarus_winter"]) exitWith { [50, 0] }; +if (_map in ["chernobylzone", "chernobylzonea2"]) exitWith { [51, 0] }; +if (_map in ["clafghan"]) exitWith { [34, 640] }; +if (_map in ["dakrong"]) exitWith { [16, 0] }; //Unsung Mod +if (_map in ["desert_e"]) exitWith { [40, 800] }; +if (_map in ["desert_island"]) exitWith { [40, 0] }; //CWR2 Desert Island +if (_map in ["dya"]) exitWith { [34, 110] }; //Diyala Iraq - default elevationOffset +if (_map in ["eden"]) exitWith { [45, 0] }; //CWR2 Everon +if (_map in ["esseker"]) exitWith { [43, 2000] }; +if (_map in ["evergreen"]) exitWith { [41, 0] }; //Burgazada, Turkey - default elevationOffset +if (_map in ["fallujah"]) exitWith { [33, 0] }; +if (_map in ["fata"]) exitWith { [33, 1347] }; +if (_map in ["gorgona"]) exitWith { [43, 0] }; +if (_map in ["hellskitchen", "hellskitchens"]) exitWith { [32, 900] }; //Sangin summer, Sangin winter - Sangin elevation 888m (Wikipedia) +if (_map in ["hindukush"]) exitWith { [36, 0] }; +if (_map in ["imrali", "imralispring"]) exitWith { [40, 0] }; +if (_map in ["intro"]) exitWith { [40, 0] }; +if (_map in ["isladuala3"]) exitWith { [-19, 0] }; +if (_map in ["jacobi"]) exitWith { [34, 2000] }; //default elevationOffset +if (_map in ["kapaulio"]) exitWith { [0, 0] }; +if (_map in ["kerama"]) exitWith { [26, 0] }; //Kerama Islands, Japan - default elevationOffset +if (_map in ["kholm"]) exitWith { [36, 0] }; +if (_map in ["kidal"]) exitWith { [18, 0] }; //Kidal, Mali - default elevationOffset +if (_map in ["koplic"]) exitWith { [42, 0] }; +if (_map in ["kunduz"]) exitWith { [37, 0] }; +if (_map in ["lingor", "lingor3"]) exitWith { [-4, 0] }; +if (_map in ["lost", "lostw"]) exitWith { [60, 0] }; +if (_map in ["malvinas"]) exitWith { [-52, 0] }; +if (_map in ["mcn_aliabad"]) exitWith { [36, 0] }; +if (_map in ["mef_alaska"]) exitWith { [60, 5] }; +if (_map in ["mountains_acr"]) exitWith { [35, 2000] }; +if (_map in ["namalsk"]) exitWith { [65, 0] }; +if (_map in ["napf", "napfwinter"]) exitWith { [47, 0] }; +if (_map in ["newyork_lumnuon"]) exitWith { [41, 5] }; //Governer´s Island, New York - default elevationOffset +if (_map in ["noe"]) exitWith { [45, 0] }; //CWR2 Nogova +if (_map in ["panthera3"]) exitWith { [46, 0] }; +if (_map in ["pianosa_aut"]) exitWith { [43, 0] }; //Pianosa, Italy - default elevationOffset +if (_map in ["pja305"]) exitWith { [0, 0] }; //G.O.S N'Ziwasogo +if (_map in ["pja306"]) exitWith { [35, 0] }; //G.O.S Kalu Khan +if (_map in ["pja307"]) exitWith { [17, 0] }; //F.S.F Daryah +if (_map in ["pja308"]) exitWith { [36, 0] }; //G.O.S Gunkizli +if (_map in ["pja310"]) exitWith { [36, 0] }; //G.O.S Al Rayak +if (_map in ["pja312"]) exitWith { [16, 0] }; //G.O.S Song Bin Tanh +if (_map in ["porquerolles"]) exitWith { [43, 0] }; +if (_map in ["porto"]) exitWith { [40, 0] }; +if (_map in ["provinggrounds_pmc"]) exitWith { [35, 100] }; +if (_map in ["reshmaan"]) exitWith { [35, 2000] }; +if (_map in ["rungsat"]) exitWith { [10, 0] }; //Unsung Mod +if (_map in ["sara", "sara_dbe1"]) exitWith { [40, 0] }; +if (_map in ["saralite"]) exitWith { [40, 0] }; +if (_map in ["sb3"]) exitWith { [53, 25] }; //TrpUebPl Einfelde Nord (Munster North Training Area, Germany) - default elevationOffset +if (_map in ["sfp_sturko"]) exitWith { [56, 0] }; +if (_map in ["sfp_wamako"]) exitWith { [14, 0] }; +if (_map in ["shapur_baf"]) exitWith { [35, 100] }; +if (_map in ["sugarlake"]) exitWith { [29, 0] }; +if (_map in ["takistan"]) exitWith { [35, 2000] }; +if (_map in ["thirsk"]) exitWith { [65, 0] }; +if (_map in ["tilos"]) exitWith { [36, 0] }; +if (_map in ["utes"]) exitWith { [50, 0] }; +if (_map in ["vt5"]) exitWith { [61, 100] }; //Vt5, Suomi Finland - default elevationOffset +if (_map in ["wake"]) exitWith { [19, 0] }; +if (_map in ["waziristan"]) exitWith { [33, 0] }; +if (_map in ["wintermap"]) exitWith { [61, 0] }; //Nordkvingo - default elevationOffset +if (_map in ["wintertown", "wintertowna3"]) exitWith { [39, 600] }; //U.S. state Kansas mean elevation 610m (Wikipedia) +if (_map in ["woodland_acr"]) exitWith { [50, 0] }; +if (_map in ["xcam_prototype"]) exitWith { [35, 0] }; +if (_map in ["zargabad"]) exitWith { [35, 2000] }; + +[] //Return empty array if we have no specific data for the map diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf index 92c84cdca9..1de8af459e 100644 --- a/addons/common/functions/fnc_getTurretDirection.sqf +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -1,42 +1,42 @@ -/* - * Author: jaynus - * Get the absolute turret direction for FOV/PIP turret. - * - * Arguments: - * 0: Vehicle - * 1: Turret Position - * - * Return Value: - * 0: Position ASL - * 1: Direction - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_vehicle", "_position"]; - -private _turret = [_vehicle, _position] call CBA_fnc_getTurret; - -private _pov = getText (_turret >> "memoryPointGunnerOptics"); -private _gunBeg = getText (_turret >> "gunBeg"); -private _gunEnd = getText (_turret >> "gunEnd"); - -TRACE_3("", _pov, _gunBeg, _gunEnd); - -// Pull the PIP pov or barrel direction, depending on how the model is set up -private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? -private _povDir = [0,0,0]; - -if (_pov == "pip0_pos") then { - private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); - - _povDir = _pipDir vectorDiff _povPos; -} else { - private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); - private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); - - _povDir = _gunBeginPos vectorDiff _gunEndPos; -}; - -[_povPos, _povDir] +/* + * Author: jaynus + * Get the absolute turret direction for FOV/PIP turret. + * + * Arguments: + * 0: Vehicle + * 1: Turret Position + * + * Return Value: + * 0: Position ASL + * 1: Direction + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_vehicle", "_position"]; + +private _turret = [_vehicle, _position] call CBA_fnc_getTurret; + +private _pov = getText (_turret >> "memoryPointGunnerOptics"); +private _gunBeg = getText (_turret >> "gunBeg"); +private _gunEnd = getText (_turret >> "gunEnd"); + +TRACE_3("", _pov, _gunBeg, _gunEnd); + +// Pull the PIP pov or barrel direction, depending on how the model is set up +private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? +private _povDir = [0,0,0]; + +if (_pov == "pip0_pos") then { + private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); + + _povDir = _pipDir vectorDiff _povPos; +} else { + private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); + private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); + + _povDir = _gunBeginPos vectorDiff _gunEndPos; +}; + +[_povPos, _povDir] diff --git a/addons/common/functions/fnc_globalEvent.sqf b/addons/common/functions/fnc_globalEvent.sqf index 126419b553..b58a0f092c 100644 --- a/addons/common/functions/fnc_globalEvent.sqf +++ b/addons/common/functions/fnc_globalEvent.sqf @@ -1,21 +1,14 @@ -/* - * Author: Nou - * Execute a global event on all clients, including self. - * - * Arguments: - * 0: Event name - * 1: Event args - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName", "_eventArgs"]; - -ACEg = [_eventName, _eventArgs]; -publicVariable "ACEg"; - -["ACEg", ACEg] call FUNC(_handleNetEvent); +#define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_eventName", "_eventArgs"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName, _eventArgs] call CBA_fnc_globalEvent; + +ACE_DEPRECATED("ace_common_fnc_globalEvent","3.8.0","CBA_fnc_globalEvent"); diff --git a/addons/common/functions/fnc_goKneeling.sqf b/addons/common/functions/fnc_goKneeling.sqf index 4ee502f929..9e7aed708a 100644 --- a/addons/common/functions/fnc_goKneeling.sqf +++ b/addons/common/functions/fnc_goKneeling.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 - * Move unit to kneeling position. + * Move unit to kneeling position (only if not yet prone). * * Arguments: * 0: Unit @@ -14,7 +14,8 @@ params ["_unit"]; -if (stance _unit == "PRONE") exitWith {}; +// Animation changes even inside vehicle post-1.60 +if (stance _unit == "PRONE" || {vehicle ACE_player != ACE_player}) exitWith {}; [ _unit, diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index b2978f9cc4..97998c1298 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -// diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this]; +// diag_log text format["%1 HASH HAS KEY: %2", diag_tickTime, _this]; params ["_hash", "_key"]; diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index 10e2881c10..0890578857 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -// diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this]; +// diag_log text format["%1 HASH SET: %2", diag_tickTime, _this]; params ["_hash", "_key", "_val"]; diff --git a/addons/common/functions/fnc_headBugFix.sqf b/addons/common/functions/fnc_headBugFix.sqf index dffb28ff4b..07a1652b1b 100644 --- a/addons/common/functions/fnc_headBugFix.sqf +++ b/addons/common/functions/fnc_headBugFix.sqf @@ -17,8 +17,8 @@ private _unit = ACE_player; private _anim = animationState _unit; -["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent); -["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent); +[QGVAR(headbugFixUsed), [profileName, _anim]] call CBA_fnc_serverEvent; +[QGVAR(headbugFixUsed), [profileName, _anim]] call CBA_fnc_localEvent; if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false}; diff --git a/addons/common/functions/fnc_hideUnit.sqf b/addons/common/functions/fnc_hideUnit.sqf index 85636a08f7..e0adb201c3 100644 --- a/addons/common/functions/fnc_hideUnit.sqf +++ b/addons/common/functions/fnc_hideUnit.sqf @@ -28,5 +28,5 @@ if !(_reason in _setHiddenReasons) then { }; if !(isObjectHidden _unit) then { - ["hideObjectGlobal", [_unit, true]] call FUNC(serverEvent); + [QGVAR(hideObjectGlobal), [_unit, true]] call CBA_fnc_serverEvent; }; diff --git a/addons/common/functions/fnc_isInBuilding.sqf b/addons/common/functions/fnc_isInBuilding.sqf index e5234b9200..d4a9307cd6 100644 --- a/addons/common/functions/fnc_isInBuilding.sqf +++ b/addons/common/functions/fnc_isInBuilding.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Unit * - * Return value: + * Return Value: * Is the unit in a building? * * Public: Yes diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 6c728134d1..f8a4456b96 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -32,7 +32,7 @@ private _nearVehicles = nearestObjects [_unit, ["Car", "Air", "Tank", "Ship_F"], if (!isNull _vehicle) then { [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); - ["loadPersonEvent", _unit, [_unit, _vehicle, _caller]] call FUNC(objectEvent); + ["ace_loadPersonEvent", [_unit, _vehicle, _caller], _unit] call CBA_fnc_targetEvent; }; _vehicle diff --git a/addons/common/functions/fnc_localEvent.sqf b/addons/common/functions/fnc_localEvent.sqf index bf17cc0d0e..fb473b75b8 100644 --- a/addons/common/functions/fnc_localEvent.sqf +++ b/addons/common/functions/fnc_localEvent.sqf @@ -1,36 +1,13 @@ -/* - * Author: Nou - * Execute a local event on this client only. - * - * Arguments: - * 0: Event name (string) - * 1: Event args (any) - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_eventName", "_eventArgs"]; - -private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; - -if (!isNil "_eventFunctions") then { - - #ifdef DEBUG_EVENTS - ACE_LOGINFO_1("* Local Event: %1",_eventName); - ACE_LOGINFO_1(" args=%1",_eventArgs); - #endif - - { - if (!isNil "_x") then { - _eventArgs call CALLSTACK_NAMED(_x,FORMAT_2("Local Event %1 ID: %2",_eventName,_forEachIndex)); - - #ifdef DEBUG_EVENTS_CALLSTACK - ACE_LOGINFO_1(" ID: %1",_forEachIndex); - #endif - }; - } forEach _eventFunctions; -}; +#include "script_component.hpp" + +params ["_eventName", "_eventArgs"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName, _eventArgs] call CBA_fnc_localEvent; + +ACE_DEPRECATED("ace_common_fnc_localEvent","3.8.0","CBA_fnc_localEvent"); diff --git a/addons/common/functions/fnc_monitor.sqf b/addons/common/functions/fnc_monitor.sqf index 4672d6eec0..8aef62895c 100644 --- a/addons/common/functions/fnc_monitor.sqf +++ b/addons/common/functions/fnc_monitor.sqf @@ -2,7 +2,7 @@ * Author: commy2 * hint retun value of given function every frame * - * Argument: + * Arguments: * * * Return Value: diff --git a/addons/common/functions/fnc_muteUnit.sqf b/addons/common/functions/fnc_muteUnit.sqf index d4648155b6..11c18aedd7 100644 --- a/addons/common/functions/fnc_muteUnit.sqf +++ b/addons/common/functions/fnc_muteUnit.sqf @@ -29,6 +29,6 @@ private _speaker = speaker _unit; if (_speaker == "ACE_NoVoice") exitWith {}; -["setSpeaker", [_unit, "ACE_NoVoice"]] call FUNC(globalEvent); +[QGVAR(setSpeaker), [_unit, "ACE_NoVoice"]] call CBA_fnc_globalEvent; _unit setVariable ["ACE_OriginalSpeaker", _speaker, true]; diff --git a/addons/common/functions/fnc_muteUnitHandleInitPost.sqf b/addons/common/functions/fnc_muteUnitHandleInitPost.sqf index 8c5967b0d3..53e8d4d5b7 100644 --- a/addons/common/functions/fnc_muteUnitHandleInitPost.sqf +++ b/addons/common/functions/fnc_muteUnitHandleInitPost.sqf @@ -16,5 +16,5 @@ params ["_unit"]; // setSpeaker gets overwritten after init on remote units; if unit is muted, setSpeaker again if (count (_unit getVariable [QGVAR(muteUnitReasons), []]) > 0) then { - ["setSpeaker", [_unit, "ACE_NoVoice"]] call FUNC(localEvent); + [QGVAR(setSpeaker), [_unit, "ACE_NoVoice"]] call CBA_fnc_localEvent; }; diff --git a/addons/common/functions/fnc_muteUnitHandleRespawn.sqf b/addons/common/functions/fnc_muteUnitHandleRespawn.sqf index a1a64eada3..ceb0614116 100644 --- a/addons/common/functions/fnc_muteUnitHandleRespawn.sqf +++ b/addons/common/functions/fnc_muteUnitHandleRespawn.sqf @@ -18,4 +18,4 @@ params ["_unit"]; _unit setVariable [QGVAR(muteUnitReasons), _unit getVariable [QGVAR(muteUnitReasons), []], true]; // fix mp issues with respawning and the speaker -["setSpeaker", [_unit, speaker _unit]] call FUNC(globalEvent); +[QGVAR(setSpeaker), [_unit, speaker _unit]] call CBA_fnc_globalEvent; diff --git a/addons/common/functions/fnc_objectEvent.sqf b/addons/common/functions/fnc_objectEvent.sqf index 2015ad77dc..21ba60b802 100644 --- a/addons/common/functions/fnc_objectEvent.sqf +++ b/addons/common/functions/fnc_objectEvent.sqf @@ -1,34 +1,13 @@ -/* - * Author: PabstMirror - * Execute an event where object is local. - * If local there is no network traffic/delay (Unlike targetEvent) - * - * Arguments: - * 0: Event name (STRING) - * 1: Event target - * 2: Event args - * - * Return Value: - * None - * - * Example: - * ["doThing", vehicle player, []] call ace_common_fnc_objectEvent - * - * Public: Yes - */ #include "script_component.hpp" params ["_eventName", "_eventTarget", "_eventArgs"]; -#ifdef DEBUG_EVENTS - ACE_LOGINFO_2("* Object Event: %1 - %2",_eventName,_eventTarget); - ACE_LOGINFO_1(" args=%1",_eventArgs); -#endif - -if (local _eventTarget) then { - [_eventName, _eventArgs] call FUNC(localEvent); -} else { - _this call FUNC(targetEvent); +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; }; -nil +[_eventName, _eventArgs, _eventTargets] call CBA_fnc_targetEvent; + +ACE_DEPRECATED("ace_common_fnc_objectEvent","3.8.0","CBA_fnc_targetEvent"); diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf index d88969b059..8c77719256 100644 --- a/addons/common/functions/fnc_onAnswerRequest.sqf +++ b/addons/common/functions/fnc_onAnswerRequest.sqf @@ -20,7 +20,7 @@ if (!isNil "_info") then { _info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; private _replyParams = [_info, _accepted]; - [_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc); + [QGVAR(requestCallback), _replyParams, _caller] call CBA_fnc_targetEvent; _unit setVariable [_id, nil]; }; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index 6129f14a65..7103dd08e4 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -46,7 +46,7 @@ _ctrlPos set [1, ((0 + 29 * GVAR(settingProgressBarLocation)) * ((((safezoneW / [{ (_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"]; - private _elapsedTime = ACE_time - _startTime; + private _elapsedTime = CBA_missionTime - _startTime; private _errorCode = -1; // this does not check: target fell unconscious, target died, target moved inside vehicle / left vehicle, target moved outside of players range, target moves at all. @@ -82,13 +82,13 @@ _ctrlPos set [1, ((0 + 29 * GVAR(settingProgressBarLocation)) * ((((safezoneW / if (_errorCode == 0) then { if (_onFinish isEqualType "") then { - [_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); + [_onFinish, [_args, _elapsedTime, _totalTime, _errorCode]] call CBA_fnc_localEvent; } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFinish; }; } else { if (_onFail isEqualType "") then { - [_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call FUNC(localEvent); + [_onFail, [_args, _elapsedTime, _totalTime, _errorCode]] call CBA_fnc_localEvent; } else { [_args, _elapsedTime, _totalTime, _errorCode] call _onFail; }; @@ -97,4 +97,4 @@ _ctrlPos set [1, ((0 + 29 * GVAR(settingProgressBarLocation)) * ((((safezoneW / //Update Progress Bar (ratio of elepased:total) (uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime); }; -}, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; +}, 0, [_args, _onFinish, _onFail, _condition, _player, CBA_missionTime, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index 75f684f5dd..1bb48428df 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -45,7 +45,7 @@ GVAR(RECIEVE_REQUEST_ADD_ACTION_DECLINE) = _target addAction ["Decline", compile GVAR(RECIEVE_REQUEST_ID_KEY_BINDING) = _requestID; -GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { // @todo +GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [CBA_missionTime, _target, _requestID] spawn { // @todo params ["_time", "_target", "_requestID"]; _time = _time + 40; @@ -55,7 +55,7 @@ GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { waitUntil { _id = _target getVariable _requestID; - (ACE_time > _time || isNil "_id") + (CBA_missionTime > _time || isNil "_id") }; _target setVariable [_requestID, nil]; diff --git a/addons/common/functions/fnc_removeAllEventHandlers.sqf b/addons/common/functions/fnc_removeAllEventHandlers.sqf index ed1cce278c..958923f808 100644 --- a/addons/common/functions/fnc_removeAllEventHandlers.sqf +++ b/addons/common/functions/fnc_removeAllEventHandlers.sqf @@ -1,17 +1,14 @@ -/* - * Author: Nou - * Remove all events of a certain event type. - * - * Argument: - * 0: Event name - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName"]; - -GVAR(eventsLocation) setVariable [_eventName, nil]; +#include "script_component.hpp" + +params ["_eventName"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +CBA_events_eventNamespace setVariable [_eventName,nil]; +CBA_events_eventHashes setVariable [_eventName,nil]; + +ACE_DEPRECATED("ace_common_fnc_removeAllEventHandlers","3.8.0","N/A (remove events individually w/ CBA_fnc_removeEventHandler)"); diff --git a/addons/common/functions/fnc_removeBinocularMagazine.sqf b/addons/common/functions/fnc_removeBinocularMagazine.sqf index 487295ccc3..4f1e0fcdd6 100644 --- a/addons/common/functions/fnc_removeBinocularMagazine.sqf +++ b/addons/common/functions/fnc_removeBinocularMagazine.sqf @@ -15,13 +15,6 @@ */ #include "script_component.hpp" -params [["_unit", objNull, [objNull]]]; +ACE_DEPRECATED("ace_common_fnc_removeBinocularMagazine","3.8.0","CBA_fnc_removeBinocularMagazine"); -private _binocular = binocular _unit; -private _selectBinocular = currentWeapon _unit == _binocular; - -_unit addWeapon _binocular; - -if (_selectBinocular) then { - _unit selectWeapon _binocular; -}; +_this call CBA_fnc_removeBinocularMagazine diff --git a/addons/common/functions/fnc_removeEventHandler.sqf b/addons/common/functions/fnc_removeEventHandler.sqf index a0b5ed5333..ff89571a6e 100644 --- a/addons/common/functions/fnc_removeEventHandler.sqf +++ b/addons/common/functions/fnc_removeEventHandler.sqf @@ -1,23 +1,13 @@ -/* - * Author: Nou - * Remove an event handler. - * - * Argument: - * 0: Event name - * 1: Event code - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName", "_eventCodeIndex"]; - -private _eventFunctions = GVAR(eventsLocation) getVariable _eventName; - -if (isNil "_eventFunctions") exitWith {TRACE_1("eventName not found",_eventName);}; -if ((_eventCodeIndex < 0) || {(count _eventFunctions) <= _eventCodeIndex}) exitWith {TRACE_2("index out of bounds",_eventName,_eventCodeIndex);}; - -_eventFunctions set [_eventCodeIndex, nil]; +#include "script_component.hpp" + +params ["_eventName", "_eventCode"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName, _eventCode] call CBA_fnc_removeEventHandler; + +ACE_DEPRECATED("ace_common_fnc_removeEventHandler","3.8.0","CBA_fnc_removeEventHandler"); diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index 23803acdd1..d3d94aa421 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -1,26 +1,26 @@ -/* - * Author: jaynus - * Remove a synced event handler - * - * Arguments: - * 0: Name - * - * Return Value: - * Boolean of success - * - * Public: No - */ -#include "script_component.hpp" - -params ["_name"]; - -if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - ACE_LOGERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name); - false -}; - -private _data = HASH_GET(GVAR(syncedEvents),_name); -_data params ["", "", "", "_eventId"]; - -[_eventId] call FUNC(removeEventHandler); -HASH_REM(GVAR(syncedEvents),_name); +/* + * Author: jaynus + * Remove a synced event handler + * + * Arguments: + * 0: Name + * + * Return Value: + * Boolean of success + * + * Public: No + */ +#include "script_component.hpp" + +params ["_name"]; + +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name); + false +}; + +private _data = HASH_GET(GVAR(syncedEvents),_name); +_data params ["", "", "", "_eventId"]; + +[_eventId] call CBA_fnc_removeEventHandler; +HASH_REM(GVAR(syncedEvents),_name); diff --git a/addons/common/functions/fnc_requestSyncedEvent.sqf b/addons/common/functions/fnc_requestSyncedEvent.sqf index 7cbc8f6c8d..e35c1e3645 100644 --- a/addons/common/functions/fnc_requestSyncedEvent.sqf +++ b/addons/common/functions/fnc_requestSyncedEvent.sqf @@ -1,20 +1,20 @@ -/* - * Author: jaynus - * Send a request to synchronize an event name from the client->server. Execute on client only. - * - * Arguments: - * 0: eventName - * - * Return Value: - * Boolean of success - * - * Public: No - */ -#include "script_component.hpp" - -params ["_eventName"]; - -// Only JIP machines on initialization send this off, requesting sync on events with the serverCommand -if (isServer) exitWith {false}; - -["SEH_s", [_eventName, ACE_player] ] call FUNC(serverEvent); +/* + * Author: jaynus + * Send a request to synchronize an event name from the client->server. Execute on client only. + * + * Arguments: + * 0: eventName + * + * Return Value: + * Boolean of success + * + * Public: No + */ +#include "script_component.hpp" + +params ["_eventName"]; + +// Only JIP machines on initialization send this off, requesting sync on events with the serverCommand +if (isServer) exitWith {false}; + +["ACEs", [_eventName, ACE_player]] call CBA_fnc_serverEvent; diff --git a/addons/common/functions/fnc_runAfterSettingsInit.sqf b/addons/common/functions/fnc_runAfterSettingsInit.sqf index cf3faa1d7e..15631a626a 100644 --- a/addons/common/functions/fnc_runAfterSettingsInit.sqf +++ b/addons/common/functions/fnc_runAfterSettingsInit.sqf @@ -2,11 +2,11 @@ * Author: PabstMirror * Executes code after setting are initilized. * - * Argument: + * Arguments: * 0: Code to execute * 1: Parameters to run the code with * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/common/functions/fnc_sendRequest.sqf b/addons/common/functions/fnc_sendRequest.sqf index c8d2ef7e2b..a0c505c575 100644 --- a/addons/common/functions/fnc_sendRequest.sqf +++ b/addons/common/functions/fnc_sendRequest.sqf @@ -20,7 +20,7 @@ params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; if (isPlayer _target) then { // Pass request on to target locality for player accept/decline. - [[_caller, _target, _requestID, _requestMessage, _callBack], QFUNC(receiveRequest), _target, false] call FUNC(execRemoteFnc); + [QGVAR(receiveRequest), [_caller, _target, _requestID, _requestMessage, _callBack], _target] call CBA_fnc_targetEvent; } else { // accept it, since it's an AI. [_caller, _target, true] call compile _callBack; diff --git a/addons/common/functions/fnc_serverEvent.sqf b/addons/common/functions/fnc_serverEvent.sqf index 65ab0da2a7..5b116e9661 100644 --- a/addons/common/functions/fnc_serverEvent.sqf +++ b/addons/common/functions/fnc_serverEvent.sqf @@ -1,29 +1,13 @@ -/* - * Author: Nou - * Execute a event only on the server. - * - * Argument: - * 0: Event name - * 1: Event args - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName", "_eventArgs"]; - -#ifdef DEBUG_EVENTS - ACE_LOGINFO_1("* Server Event: %1",_eventName); - ACE_LOGINFO_1(" args=%1",_eventArgs); -#endif - -ACEg = [_eventName, _eventArgs]; - -if (!isServer) then { - publicVariableServer "ACEg"; -} else { - ["ACEg", ACEg] call FUNC(_handleNetEvent); -}; +#include "script_component.hpp" + +params ["_eventName", "_eventArgs"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName, _eventArgs] call CBA_fnc_serverEvent; + +ACE_DEPRECATED("ace_common_fnc_serverEvent","3.8.0","CBA_fnc_serverEvent"); diff --git a/addons/common/functions/fnc_serverLog.sqf b/addons/common/functions/fnc_serverLog.sqf index 2525f81c95..af7485c494 100644 --- a/addons/common/functions/fnc_serverLog.sqf +++ b/addons/common/functions/fnc_serverLog.sqf @@ -20,5 +20,5 @@ params [["_msg", "", [""]]]; if (isServer) then { diag_log text _msg; } else { - [_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc); + [QGVAR(serverLog), _this] call CBA_fnc_serverEvent; }; diff --git a/addons/common/functions/fnc_setApproximateVariablePublic.sqf b/addons/common/functions/fnc_setApproximateVariablePublic.sqf index 5131f99058..549dea9eb4 100644 --- a/addons/common/functions/fnc_setApproximateVariablePublic.sqf +++ b/addons/common/functions/fnc_setApproximateVariablePublic.sqf @@ -2,13 +2,13 @@ * Author: esteldunedain * Publish a variable if it's different enough from the previously published value. * - * Argument: + * Arguments: * 0: Object the variable should be assigned to * 1: Name of the variable * 2: Value of the variable * 3: Absolute tolerance * - * Return value: + * Return Value: * Nothing. * * Example: diff --git a/addons/common/functions/fnc_setProne.sqf b/addons/common/functions/fnc_setProne.sqf index 75be8bac2d..c40b0de254 100644 --- a/addons/common/functions/fnc_setProne.sqf +++ b/addons/common/functions/fnc_setProne.sqf @@ -9,8 +9,6 @@ * None * * Public: Yes - * - * Note: Not functional, because FUNC(localAnim) does no longer exist */ #include "script_component.hpp" @@ -19,4 +17,4 @@ params ["_unit"]; [ _unit, ["amovppnemstpsnonwnondnon", "amovppnemstpsraswrfldnon", "amovppnemstpsraswlnrdnon", "amovppnemstpsraswpstdnon"] select (([primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find currentWeapon _unit) + 1) -] call FUNC(localAnim); +] call FUNC(doAnimation); diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index a2bd9e700e..5a56b385a7 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -78,8 +78,8 @@ if (isServer && {_broadcastChanges}) then { publicVariable _name; // Raise event globally, this publicizes eventual changes in _force status so clients can update it locally - ["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent); + ["ace_settingChanged", [_name, _value, _force]] call CBA_fnc_globalEvent; } else { // Raise event locally - ["SettingChanged", [_name, _value, _force]] call FUNC(localEvent); + ["ace_settingChanged", [_name, _value, _force]] call CBA_fnc_localEvent; }; diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index bf6b35a862..5eeff87aee 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -2,13 +2,13 @@ * Author: commy2 and CAA-Picard and joko and PabstMirror * Publish a variable, but wait a certain amount of time before allowing it to be published it again. * - * Argument: + * Arguments: * 0: Object the variable should be assigned to * 1: Name of the variable * 2: Value of the variable * 3: Embargo delay (Optional. Default: 1) * - * Return value: + * Return Value: * Nothing. * * Example: @@ -50,4 +50,4 @@ TRACE_2("Starting Embargo", _varName, _delay); if (!(_value isEqualTo _curValue)) then { _this call FUNC(setVariablePublic); }; -}, _this, _delay] call FUNC(waitAndExecute); +}, _this, _delay] call CBA_fnc_waitAndExecute; diff --git a/addons/common/functions/fnc_showUser.sqf b/addons/common/functions/fnc_showUser.sqf index b783fb4ec5..2e7af12a3f 100644 --- a/addons/common/functions/fnc_showUser.sqf +++ b/addons/common/functions/fnc_showUser.sqf @@ -2,7 +2,7 @@ * Author: commy2 * hint the Variable ACE_isUsedBy from the input Object every frame * - * Argument: + * Arguments: * * * Return Value: diff --git a/addons/common/functions/fnc_statusEffect_addType.sqf b/addons/common/functions/fnc_statusEffect_addType.sqf index afd7ff7be7..b5d6c1e879 100644 --- a/addons/common/functions/fnc_statusEffect_addType.sqf +++ b/addons/common/functions/fnc_statusEffect_addType.sqf @@ -3,7 +3,7 @@ * Adds a status effect that will be handled. * * Arguments: - * 0: Status Effect Name, this should match a corisponding event name + * 0: Status Effect Name, this should match a corresponding event name * 1: Send event globaly * 2: Common Effect Reaons to pre-seed durring init * @@ -30,8 +30,6 @@ GVAR(statusEffect_isGlobal) pushBack _isGlobal; //We add reasons at any time, but more efficenet to add all common ones at one time during init if (isServer && {!(_commonReasonsArray isEqualTo [])}) then { //Switch case to lower: - { - _commonReasonsArray set [_forEachIndex, toLower _x]; - } forEach _commonReasonsArray; + _commonReasonsArray = _commonReasonsArray apply { toLower _x }; missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _name]), _commonReasonsArray, true]; }; diff --git a/addons/common/functions/fnc_statusEffect_sendEffects.sqf b/addons/common/functions/fnc_statusEffect_sendEffects.sqf index 4291de1ad8..f82ab10427 100644 --- a/addons/common/functions/fnc_statusEffect_sendEffects.sqf +++ b/addons/common/functions/fnc_statusEffect_sendEffects.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Object - * 1: Effect name (or "" or send all) + * 1: Effect name (or "" to send all) * * Return Value: * Nothing @@ -30,18 +30,13 @@ if (isNull _object) exitWith {}; //We only do anything if the effect has been defined at some point in the game for this unit TRACE_2("checking if event is nil",_x,_effectNumber); if (_effectNumber != -1) then { + private _eventName = format [QGVAR(%1), _x]; if (GVAR(statusEffect_isGlobal) select _forEachIndex) then { TRACE_2("Sending Global Event", _object, _effectNumber); - [_x, [_object, _effectNumber]] call FUNC(globalEvent); + [_eventName, [_object, _effectNumber]] call CBA_fnc_globalEvent; } else { - if (local _object) then { - //If local, send directly to bypass network delay of targetEvent call - TRACE_2("Sending Target Local Event", _object, _effectNumber); - [_x, [_object, _effectNumber]] call FUNC(localEvent); - } else { - TRACE_2("Sending Target Non-Local Event", _object, _effectNumber); - [_x, [_object], [_object, _effectNumber]] call FUNC(targetEvent); - }; + TRACE_2("Sending Target Event", _object, _effectNumber); + [_eventName, [_object, _effectNumber], _object] call CBA_fnc_targetEvent; }; }; }; diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index c752d1eba2..e6c7b43361 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -1,26 +1,26 @@ -/* - * Author: jaynus - * Call and propegate a synced event - * - * Arguments: - * 0: Name - * 1: Arguments - * 2: TTL [Optional] for this specific event call - * - * Return Value: - * Boolean of success - * - * Public: No - */ -#include "script_component.hpp" - -params ["_name", "_args", ["_ttl", 0]]; - -if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { - ACE_LOGERROR_1("Synced event key [%1] not found (syncedEvent).", _name); - false -}; - -private _eventData = [_name, _args, _ttl]; - -["SEH", _eventData] call FUNC(globalEvent); +/* + * Author: jaynus + * Call and propegate a synced event + * + * Arguments: + * 0: Name + * 1: Arguments + * 2: TTL [Optional] for this specific event call + * + * Return Value: + * Boolean of success + * + * Public: No + */ +#include "script_component.hpp" + +params ["_name", "_args", ["_ttl", 0]]; + +if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { + ACE_LOGERROR_1("Synced event key [%1] not found (syncedEvent).", _name); + false +}; + +private _eventData = [_name, _args, _ttl]; + +["ACEe", _eventData] call CBA_fnc_globalEvent; diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index 62df8f10a7..c0c840c894 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -1,62 +1,62 @@ -/* - * Author: ? - * - * ? - * - * Arguments: - * ? - * - * Return Value: - * ? - * - * Public: ? - */ -#include "script_component.hpp" - -if (!isServer) exitWith {false}; - -// Walk through the local synced events and clean up anything thats already EOL -// @TODO: This should be iteration limited to prevent FPS lag - -{ - private _name = _x; - - private _data = HASH_GET(GVAR(syncedEvents),_name); - _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; - - private _newEventLog = []; - - // @TODO: This should be iteration limited to prevent FPS lag - { - private _eventEntry = _x; - private _ttlReturn = true; - - if (_globalEventTTL isEqualType {}) then { - _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; - } else { - _ttlReturn = call {_globalEventTTL < 1 || {ACE_diagTime < (_eventEntry select 0) + _globalEventTTL}}; - }; - - if (_ttlReturn) then { - // Do event based TTL check - _eventEntry params ["_time", "", "_eventTTL"]; - - if (_eventTTL isEqualType {}) then { - _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; - } else { - _ttlReturn = call {_eventTTL < 1 || {ACE_diagTime < _time + _eventTTL}}; - }; - }; - - // Finally drop it if the TTL check fails - if (_ttlReturn) then { - _newEventLog pushBack _x; - }; - false - } count _eventLog; - - _data set [1, _newEventLog]; - false -} count (GVAR(syncedEvents) select 0); - -// @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events +/* + * Author: ? + * + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ +#include "script_component.hpp" + +if (!isServer) exitWith {false}; + +// Walk through the local synced events and clean up anything thats already EOL +// @TODO: This should be iteration limited to prevent FPS lag + +{ + private _name = _x; + + private _data = HASH_GET(GVAR(syncedEvents),_name); + _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; + + private _newEventLog = []; + + // @TODO: This should be iteration limited to prevent FPS lag + { + private _eventEntry = _x; + private _ttlReturn = true; + + if (_globalEventTTL isEqualType {}) then { + _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; + } else { + _ttlReturn = call {_globalEventTTL < 1 || {diag_tickTime < (_eventEntry select 0) + _globalEventTTL}}; + }; + + if (_ttlReturn) then { + // Do event based TTL check + _eventEntry params ["_time", "", "_eventTTL"]; + + if (_eventTTL isEqualType {}) then { + _ttlReturn = [_eventTime, _eventEntry] call _eventTTL; + } else { + _ttlReturn = call {_eventTTL < 1 || {diag_tickTime < _time + _eventTTL}}; + }; + }; + + // Finally drop it if the TTL check fails + if (_ttlReturn) then { + _newEventLog pushBack _x; + }; + false + } count _eventLog; + + _data set [1, _newEventLog]; + false +} count (GVAR(syncedEvents) select 0); + +// @TODO: Next, detect if we had a new request from a JIP player, and we need to continue syncing events diff --git a/addons/common/functions/fnc_targetEvent.sqf b/addons/common/functions/fnc_targetEvent.sqf index b9802f0835..8cce931547 100644 --- a/addons/common/functions/fnc_targetEvent.sqf +++ b/addons/common/functions/fnc_targetEvent.sqf @@ -1,33 +1,13 @@ -/* - * Author: Nou - * Execute a event only on specific clients. - * - * Arguments: - * 0: Event name (STRING) - * 1: Event targets - * 2: Event args - * - * Note: If local executor is in list of targets, event will execute with - * network delay, and not immediatly. - * - * Return Value: - * None - * - * Public: Yes - */ -#include "script_component.hpp" - -params ["_eventName", "_eventTargets", "_eventArgs"]; - -#ifdef DEBUG_EVENTS - ACE_LOGINFO_2("* Target Event: %1 - %2",_eventName,_eventTargets); - ACE_LOGINFO_1(" args=%1",_eventArgs); -#endif - -ACEc = [_eventName, _eventTargets, _eventArgs]; - -if (!isServer) then { - publicVariableServer "ACEc"; -} else { - ["ACEc", ACEc] call FUNC(_handleNetEvent); -}; +#include "script_component.hpp" + +params ["_eventName", "_eventTargets", "_eventArgs"]; + +private _newName = getText (configFile >> "ACE_newEvents" >> _eventName); +if (_newName != "") then { + TRACE_2("Switching Names",_eventName,_newName); + _eventName = _newName; +}; + +[_eventName,_eventArgs,_eventTargets] call CBA_fnc_targetEvent; + +ACE_DEPRECATED("ace_common_fnc_targetEvent","3.8.0","CBA_fnc_targetEvent"); diff --git a/addons/common/functions/fnc_throttledPublicVariable.sqf b/addons/common/functions/fnc_throttledPublicVariable.sqf index 67cfc50f9a..3aaa3c8f47 100644 --- a/addons/common/functions/fnc_throttledPublicVariable.sqf +++ b/addons/common/functions/fnc_throttledPublicVariable.sqf @@ -25,7 +25,7 @@ if (isNil QGVAR(publishSchedId)) then { GVAR(publishNextTime) = 1e7; GVAR(publishSchedId) = [{ - if (ACE_diagTime > GVAR(publishNextTime)) then { + if (diag_tickTime > GVAR(publishNextTime)) then { { _x params [_unit, _varName]; _unit setVariable [_varName, _unit getVariable _varName, true]; @@ -41,8 +41,8 @@ if (isNil QGVAR(publishSchedId)) then { // If the variable is not on the list if (GVAR(publishVarNames) find [_unit, _varName] == -1) exitWith { GVAR(publishVarNames) pushBack [_unit, _varName]; - GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); + GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); }; // If the variable is on the list -GVAR(publishNextTime) = GVAR(publishNextTime) min (ACE_diagTime + _maxDelay); +GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); diff --git a/addons/common/functions/fnc_timePFH.sqf b/addons/common/functions/fnc_timePFH.sqf deleted file mode 100644 index e5366d331e..0000000000 --- a/addons/common/functions/fnc_timePFH.sqf +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Author: jaynus - * PFEH to set all Ace Time Variables - * - * Arguments: - * None - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -BEGIN_COUNTER(timePFH); - -private _lastTickTime = ACE_diagTime; -private _lastGameTime = ACE_gameTime; - -ACE_gameTime = time; -ACE_diagTime = diag_tickTime; - -private _delta = ACE_diagTime - _lastTickTime; - -if (ACE_gameTime <= _lastGameTime) then { - TRACE_1("paused",_delta); - ACE_paused = true; - // Game is paused or not running - ACE_pausedTime = ACE_pausedTime + _delta; - ACE_virtualPausedTime = ACE_pausedTime + (_delta * accTime); -} else { - TRACE_1("live",_delta); - ACE_paused = false; - // Time is updating - ACE_realTime = ACE_realTime + _delta; - ACE_virtualTime = ACE_virtualTime + (_delta * accTime); - ACE_time = ACE_virtualTime; -}; - -END_COUNTER(timePFH); diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf index b9fa35243a..309387086f 100644 --- a/addons/common/functions/fnc_translateToModelSpace.sqf +++ b/addons/common/functions/fnc_translateToModelSpace.sqf @@ -1,23 +1,23 @@ -/* - * Author: ? - * ? - * - * Arguments: - * ? - * - * Return Value: - * ? - * - * Public: ? - */ -#include "script_component.hpp" - -params ["_object", "_matrix", "_offset"]; - -private _origin = getPosASL _object; - -_matrix params ["_xVec", "_yVec", "_zVec"]; - -_offset params ["_x", "_y", "_z"]; - -(_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y) vectorAdd (_zVec vectorMultiply _z) vectorAdd _origin // return +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ +#include "script_component.hpp" + +params ["_object", "_matrix", "_offset"]; + +private _origin = getPosASL _object; + +_matrix params ["_xVec", "_yVec", "_zVec"]; + +_offset params ["_x", "_y", "_z"]; + +(_xVec vectorMultiply _x) vectorAdd (_yVec vectorMultiply _y) vectorAdd (_zVec vectorMultiply _z) vectorAdd _origin // return diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf index cd360bd874..fab3fe6a3c 100644 --- a/addons/common/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf @@ -1,29 +1,29 @@ -/* - * Author: ? - * ? - * - * Arguments: - * ? - * - * Return Value: - * ? - * - * Public: ? - */ -#include "script_component.hpp" - -params ["_object", "_matrix", "_offset"]; - -private _origin = getPosASL _object; - -_matrix params ["_xVec", "_yVec", "_zVec"]; - -_offset = _offset vectorDiff _origin; - -_offset params ["_x", "_y", "_z"]; - -[ - ((_xVec select 0) * _x) + ((_xVec select 1) * _y) + ((_xVec select 2) * _z), - ((_yVec select 0) * _x) + ((_yVec select 1) * _y) + ((_yVec select 2) * _z), - ((_zVec select 0) * _x) + ((_zVec select 1) * _y) + ((_zVec select 2) * _z) -] // return +/* + * Author: ? + * ? + * + * Arguments: + * ? + * + * Return Value: + * ? + * + * Public: ? + */ +#include "script_component.hpp" + +params ["_object", "_matrix", "_offset"]; + +private _origin = getPosASL _object; + +_matrix params ["_xVec", "_yVec", "_zVec"]; + +_offset = _offset vectorDiff _origin; + +_offset params ["_x", "_y", "_z"]; + +[ + ((_xVec select 0) * _x) + ((_xVec select 1) * _y) + ((_xVec select 2) * _z), + ((_yVec select 0) * _x) + ((_yVec select 1) * _y) + ((_yVec select 2) * _z), + ((_zVec select 0) * _x) + ((_zVec select 1) * _y) + ((_zVec select 2) * _z) +] // return diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf index 908dbf3dc8..cb988cde1b 100644 --- a/addons/common/functions/fnc_unhideUnit.sqf +++ b/addons/common/functions/fnc_unhideUnit.sqf @@ -28,5 +28,5 @@ if (_reason in _setHiddenReasons) then { }; if (_setHiddenReasons isEqualTo []) then { - ["hideObjectGlobal",[_unit,false]] call FUNC(serverEvent); + [QGVAR(hideObjectGlobal), [_unit,false]] call CBA_fnc_serverEvent; }; diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index 72816f2c3f..716f46dc8e 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) +#define GROUP_SWITCH_ID QFUNC(loadPerson) params ["_unit"]; @@ -26,7 +26,7 @@ if (_vehicle == _unit) exitWith {false}; if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 2}) exitWith {false}; if (!isNull _vehicle) then { - ["unloadPersonEvent", [_unit], [_unit, _vehicle]] call EFUNC(common,targetEvent); + ["ace_unloadPersonEvent", [_unit, _vehicle], [_unit]] call CBA_fnc_targetEvent; }; true diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index ff5813434a..517e0aa2ad 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -14,7 +14,7 @@ */ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) +#define GROUP_SWITCH_ID QFUNC(loadPerson) params ["_unit", "_vehicle", ["_unloader", objNull]]; TRACE_3("params",_unit,_vehicle,_unloader); @@ -27,7 +27,7 @@ if (count _emptyPos != 3) exitwith { ACE_LOGWARNING_4("Could not find unload pos %1-ASL: %2 isTouchingGround: %3 Speed: %4",_vehicle, getPosASL _vehicle, isTouchingGround _vehicle, speed _vehicle); if ((!isNull _unloader) && {[_unloader] call FUNC(isPlayer)}) then { //display text saying there are no safe places to exit the vehicle - ["displayTextStructured", [_unloader], [localize LSTRING(NoRoomToUnload)]] call FUNC(targetEvent); + [QGVAR(displayTextStructured), [localize LSTRING(NoRoomToUnload)], [_unloader]] call CBA_fnc_targetEvent; }; false }; @@ -58,10 +58,10 @@ _unit action ["Eject", vehicle _unit]; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call FUNC(doAnimation); }; - }, [_unit, _anim], 0.5] call FUNC(waitAndExecute); + }, [_unit, _anim], 0.5] call CBA_fnc_waitAndExecute; }; }; -}, [_unit, _emptyPos], 0.5] call FUNC(waitAndExecute); +}, [_unit, _emptyPos], 0.5] call CBA_fnc_waitAndExecute; [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); diff --git a/addons/common/functions/fnc_unmuteUnit.sqf b/addons/common/functions/fnc_unmuteUnit.sqf index a995eed244..b6d673cfd5 100644 --- a/addons/common/functions/fnc_unmuteUnit.sqf +++ b/addons/common/functions/fnc_unmuteUnit.sqf @@ -32,4 +32,4 @@ private _speaker = _unit getVariable ["ACE_OriginalSpeaker", ""]; if (_speaker == "") exitWith {}; -["setSpeaker", _unit, [_unit, _speaker]] call FUNC(targetEvent); +[QGVAR(setSpeaker), [_unit, _speaker], _unit] call CBA_fnc_targetEvent; diff --git a/addons/common/functions/fnc_waitAndExecute.sqf b/addons/common/functions/fnc_waitAndExecute.sqf index 6f282ba656..1ac0d3f54d 100644 --- a/addons/common/functions/fnc_waitAndExecute.sqf +++ b/addons/common/functions/fnc_waitAndExecute.sqf @@ -17,7 +17,6 @@ */ #include "script_component.hpp" -params ["_func", "_params", "_delay"]; +ACE_DEPRECATED("ace_common_fnc_waitAndExecute","3.8.0","CBA_fnc_waitAndExecute"); -GVAR(waitAndExecArray) pushBack [ACE_time + _delay, _func, _params]; -GVAR(waitAndExecArray) sort true; +_this call CBA_fnc_waitAndExecute; diff --git a/addons/common/functions/fnc_waitUntilAndExecute.sqf b/addons/common/functions/fnc_waitUntilAndExecute.sqf index bbc6c540fe..52c596c70a 100644 --- a/addons/common/functions/fnc_waitUntilAndExecute.sqf +++ b/addons/common/functions/fnc_waitUntilAndExecute.sqf @@ -2,12 +2,12 @@ * Author: joko // Jonas * Executes a code once with after the Condition is True, using a PFH * - * Argument: + * Arguments: * 0: Condition * 1: Code to execute * 2: Parameters to run the code with * - * Return value: + * Return Value: * None * * Example: @@ -17,7 +17,8 @@ */ #include "script_component.hpp" -TRACE_1("Adding",_this); +ACE_DEPRECATED("ace_common_fnc_waitUntilAndExecute","3.8.0","CBA_fnc_waitUntilAndExecute"); + +_this call CBA_fnc_waitUntilAndExecute; -GVAR(waitUntilAndExecArray) pushBack _this; nil diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index bc278a9b70..c140b1ce94 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -1,24 +1,24 @@ -/* - * Author: jaynus - * Gets the wave height at a specific location. Uses a logic, so may be performance iffy - * - * Arguments: - * 0: Position ASL to get height at - * - * Return Value: - * Wave height in meters - * - * - * Public: No - */ -#include "script_component.hpp" - -params ["_position"]; - -if (isNil QGVAR(waveHeightLogic)) then { - GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; -}; - -GVAR(waveHeightLogic) setPosASL _position; - -(getPosASLW GVAR(waveHeightLogic) select 2) - (getPosASL GVAR(waveHeightLogic) select 2) +/* + * Author: jaynus + * Gets the wave height at a specific location. Uses a logic, so may be performance iffy + * + * Arguments: + * 0: Position ASL to get height at + * + * Return Value: + * Wave height in meters + * + * + * Public: No + */ +#include "script_component.hpp" + +params ["_position"]; + +if (isNil QGVAR(waveHeightLogic)) then { + GVAR(waveHeightLogic) = "Logic" createVehicleLocal [0,0,0]; +}; + +GVAR(waveHeightLogic) setPosASL _position; + +(getPosASLW GVAR(waveHeightLogic) select 2) - (getPosASL GVAR(waveHeightLogic) select 2) diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf index c9e5551d19..65b0164ca0 100644 --- a/addons/common/functions/fnc_worldToScreenBounds.sqf +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -1,74 +1,74 @@ -/* - * Author: zGuba 2011 - * Function helper for framing objects on screen. - * - * Arguments: - * 0: object - * 1: margins 3D - * 0: X - * 1: Y - * 2: Z - * 2: offset 3D - * 0: X - * 1: Y - * 2: Z - * - * Return Value: - * 0: Minimal X - * 1: Minimal Y - * 2: Maximal X - * 3: Maximal Y - * - * Public: No - */ -#include "script_component.hpp" - -params ["_object", "_margins", "_offsets"]; - -private _minX = 10; -private _minY = 10; -private _maxX = -10; -private _maxY = -10; - -private _bounds = boundingBox _object; -_margins params ["_marginsX", "_marginsY", "_marginsZ"]; -_offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"]; - -_bounds params ["_boundsMin", "_boundsMax"]; -_boundsMin params ["_boundsMinX", "_boundsMinY", "_boundsMinZ"]; -_boundsMax params ["_boundsMaxX", "_boundsMaxY", "_boundsMaxZ"]; - -_boundsMinX = _boundsMinX - _marginsX + _offsetsX; -_boundsMinY = _boundsMinY - _marginsY + _offsetsY; -_boundsMinZ = _boundsMinZ - _marginsZ + _offsetsZ; - -_boundsMaxX = _boundsMaxX + _marginsX + _offsetsX; -_boundsMaxY = _boundsMaxY + _marginsY + _offsetsY; -_boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ; - -private _boundsCorners = [ - [_boundsMinX, _boundsMinY, _boundsMinZ], - [_boundsMinX, _boundsMinY, _boundsMaxZ], - [_boundsMinX, _boundsMaxY, _boundsMinZ], - [_boundsMinX, _boundsMaxY, _boundsMaxZ], - [_boundsMaxX, _boundsMinY, _boundsMinZ], - [_boundsMaxX, _boundsMinY, _boundsMaxZ], - [_boundsMaxX, _boundsMaxY, _boundsMinZ], - [_boundsMaxX, _boundsMaxY, _boundsMaxZ] -]; - -{ - private _ppos = worldToScreen (_object modelToWorld _x); - - if (count _ppos >= 2) then { - _ppos params ["_pposX", "_pposY"]; - - if (_pposX < _minX) then {_minX = _pposX}; - if (_pposX > _maxX) then {_maxX = _pposX}; - if (_pposY < _minY) then {_minY = _pposY}; - if (_pposY > _maxY) then {_maxY = _pposY}; - }; //else - what to do if it is offscreen? - false -} count _boundsCorners; - -[_minX, _minY, _maxX, _maxY] +/* + * Author: zGuba 2011 + * Function helper for framing objects on screen. + * + * Arguments: + * 0: object + * 1: margins 3D + * 0: X + * 1: Y + * 2: Z + * 2: offset 3D + * 0: X + * 1: Y + * 2: Z + * + * Return Value: + * 0: Minimal X + * 1: Minimal Y + * 2: Maximal X + * 3: Maximal Y + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object", "_margins", "_offsets"]; + +private _minX = 10; +private _minY = 10; +private _maxX = -10; +private _maxY = -10; + +private _bounds = boundingBox _object; +_margins params ["_marginsX", "_marginsY", "_marginsZ"]; +_offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"]; + +_bounds params ["_boundsMin", "_boundsMax"]; +_boundsMin params ["_boundsMinX", "_boundsMinY", "_boundsMinZ"]; +_boundsMax params ["_boundsMaxX", "_boundsMaxY", "_boundsMaxZ"]; + +_boundsMinX = _boundsMinX - _marginsX + _offsetsX; +_boundsMinY = _boundsMinY - _marginsY + _offsetsY; +_boundsMinZ = _boundsMinZ - _marginsZ + _offsetsZ; + +_boundsMaxX = _boundsMaxX + _marginsX + _offsetsX; +_boundsMaxY = _boundsMaxY + _marginsY + _offsetsY; +_boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ; + +private _boundsCorners = [ + [_boundsMinX, _boundsMinY, _boundsMinZ], + [_boundsMinX, _boundsMinY, _boundsMaxZ], + [_boundsMinX, _boundsMaxY, _boundsMinZ], + [_boundsMinX, _boundsMaxY, _boundsMaxZ], + [_boundsMaxX, _boundsMinY, _boundsMinZ], + [_boundsMaxX, _boundsMinY, _boundsMaxZ], + [_boundsMaxX, _boundsMaxY, _boundsMinZ], + [_boundsMaxX, _boundsMaxY, _boundsMaxZ] +]; + +{ + private _ppos = worldToScreen (_object modelToWorld _x); + + if (count _ppos >= 2) then { + _ppos params ["_pposX", "_pposY"]; + + if (_pposX < _minX) then {_minX = _pposX}; + if (_pposX > _maxX) then {_maxX = _pposX}; + if (_pposY < _minY) then {_minY = _pposY}; + if (_pposY > _maxY) then {_maxY = _pposY}; + }; //else - what to do if it is offscreen? + false +} count _boundsCorners; + +[_minX, _minY, _maxX, _maxY] diff --git a/addons/common/functions/script_component.hpp b/addons/common/functions/script_component.hpp index c213544655..bb0d2d5dff 100644 --- a/addons/common/functions/script_component.hpp +++ b/addons/common/functions/script_component.hpp @@ -1,13 +1,13 @@ -#include "\z\ace\addons\common\script_component.hpp" - -#define VALIDHASH(hash) (IS_ARRAY(hash) && {(count hash) >= 2} && {IS_ARRAY(hash select 0)} && {IS_ARRAY(hash select 1)}) -#define ERROR(msg) throw msg + format[" @ %1:%2", _callFrom, _lineNo] -#define HANDLECATCH diag_log text _exception; assert(exception=="") - -#define ERRORDATA(c) private ["_callFrom", "_lineNo"];\ - _callFrom = "";\ - _lineNo = -1;\ - if((count _this) > c) then {\ - _callFrom = _this select c;\ - _lineNo = _this select c+1;\ - }; +#include "\z\ace\addons\common\script_component.hpp" + +#define VALIDHASH(hash) (IS_ARRAY(hash) && {(count hash) >= 2} && {IS_ARRAY(hash select 0)} && {IS_ARRAY(hash select 1)}) +#define ERROR(msg) throw msg + format[" @ %1:%2", _callFrom, _lineNo] +#define HANDLECATCH diag_log text _exception; assert(exception=="") + +#define ERRORDATA(c) private ["_callFrom", "_lineNo"];\ + _callFrom = "";\ + _lineNo = -1;\ + if((count _this) > c) then {\ + _callFrom = _this select c;\ + _lineNo = _this select c+1;\ + }; diff --git a/addons/common/init_versionTooltip.sqf b/addons/common/init_versionTooltip.sqf index 7aef3f4786..ce0d005a14 100644 --- a/addons/common/init_versionTooltip.sqf +++ b/addons/common/init_versionTooltip.sqf @@ -30,7 +30,7 @@ _display setVariable [QGVAR(versionTooltip), [_display] spawn { _ctrl ctrlCommit 0; // pls ignore - _ctrl ctrlSetText QUOTE(PATHTOF(data\icon_banana_ca.paa)); + _ctrl ctrlSetText QPATHTOF(data\icon_banana_ca.paa); // animate with random speed _position set [1, 1 - safezoneY]; diff --git a/addons/common/script_component.hpp b/addons/common/script_component.hpp index 4e941943fa..f5dec2fd55 100644 --- a/addons/common/script_component.hpp +++ b/addons/common/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT common +#define COMPONENT_BEAUTIFIED Common #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/common/scripts/checkVersionNumber.sqf b/addons/common/scripts/checkVersionNumber.sqf index 07bd443a06..402e5d9f56 100644 --- a/addons/common/scripts/checkVersionNumber.sqf +++ b/addons/common/scripts/checkVersionNumber.sqf @@ -100,7 +100,7 @@ if (!isServer) then { _error = _error call _fnc_cutComma; diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; }; _missingAddonServer = false; @@ -117,7 +117,7 @@ if (!isServer) then { _error = _error call _fnc_cutComma; diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; }; _oldVersionClient = false; @@ -134,7 +134,7 @@ if (!isServer) then { _error = _error call _fnc_cutComma; diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; }; _oldVersionServer = false; @@ -151,7 +151,7 @@ if (!isServer) then { _error = _error call _fnc_cutComma; diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; }; ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer]; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 820712189f..5065acbc91 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -738,7 +738,7 @@ ACE3 Vybavení ACE3 Equipo Equipaggiamento ACE3 - Equipement ACE3 + ACE3 Equipement ACE3 Common @@ -749,7 +749,7 @@ ACE3 Común ACE3 Obecné Comune ACE3 - Commun ACE3 + ACE3 Commun ACE3 Weapons @@ -760,7 +760,7 @@ ACE3 Zbraně ACE3 Armas Armi ACE3 - Armes ACE3 + ACE3 Armes ACE3 Movement @@ -771,7 +771,7 @@ ACE3 Movimiento ACE3 Pohyb Movimento ACE3 - Mouvement ACE3 + ACE3 Mouvement ACE3 Scope Adjustment @@ -782,7 +782,7 @@ ACE3 Nastavení optiky ACE3 Ajuste de miras Regolazione Ottiche ACE3 - Ajustement de la lunette ACE3 + ACE3 Ajustement de la lunette ACE3 Vehicles @@ -793,7 +793,7 @@ ACE3 Vozidla ACE3 Vehículos Veicoli ACE3 - Vehicules ACE3 + ACE3 Vehicules No Room to unload @@ -803,6 +803,7 @@ No hay espacio para descargar. Pas de place pour décharger Nedostatek místa k vyložení + Sem espaço para descarregar \ No newline at end of file diff --git a/addons/common/tests/script_component.hpp b/addons/common/tests/script_component.hpp deleted file mode 100644 index 6a1bf9154d..0000000000 --- a/addons/common/tests/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\common\script_component.hpp" diff --git a/addons/common/tests/test_eventHandlers.sqf b/addons/common/tests/test_eventHandlers.sqf deleted file mode 100644 index 5a75cb0a06..0000000000 --- a/addons/common/tests/test_eventHandlers.sqf +++ /dev/null @@ -1,78 +0,0 @@ -// ---------------------------------------------------------------------------- -#define DEBUG_MODE_FULL -#include "script_component.hpp" - -#ifndef TEST_DEFINED_AND_OP -if (true) exitWith {}; -#endif - -// ---------------------------------------------------------------------------- - -LOG('Testing EventHandlers'); - -TEST_DEFINED(QFUNC(_handleNetEvent),""); -TEST_DEFINED(QFUNC(addEventHandler),""); -TEST_DEFINED(QFUNC(localEvent),""); -TEST_DEFINED(QFUNC(targetEvent),""); -TEST_DEFINED(QFUNC(globalEvent),""); -TEST_DEFINED(QFUNC(serverEvent),""); -TEST_DEFINED(QFUNC(removeAllEventHandlers),""); -TEST_DEFINED(QFUNC(removeEventHandler),""); - -private _result = ["A", {}] call ace_common_fnc_addEventHandler; -private _expected = 0; -TEST_DEFINED_AND_OP(_result,==,_expected,"Adding first A EH"); - -_result = ["A", {GVAR(test_A2) = _this}] call ace_common_fnc_addEventHandler; -_expected = 1; -TEST_DEFINED_AND_OP(_result,==,_expected,"Adding second A EH"); - -_result = ["A", {GVAR(test_A3) = _this}] call ace_common_fnc_addEventHandler; -_expected = 2; -TEST_DEFINED_AND_OP(_result,==,_expected,"Adding third A EH"); - -GVAR(test_A2) = -1; -["A", 11] call FUNC(localEvent); -_expected = 11; -_result = GVAR(test_A2); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test Local Event"); - -//Remove 2nd EH -["A", 1] call FUNC(removeEventHandler); - -GVAR(test_A2) = -1; -GVAR(test_A3) = -1; -["A", 22] call FUNC(localEvent); -_expected = -1; -_result = GVAR(test_A2); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test 2nd (removed) EH"); -_expected = 22; -_result = GVAR(test_A3); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd Event"); - -//Remove All EH: -["A"] call FUNC(removeAllEventHandlers); - -GVAR(test_A3) = -1; -["A", 77] call FUNC(localEvent); -_expected = -1; -_result = GVAR(test_A3); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd is removed after removeAll"); - -//Much harder to test network events -TRACE_2("testing network events",isServer,isDedicated); - -["B", {GVAR(test_B) = _this}] call ace_common_fnc_addEventHandler; - -GVAR(test_B) = -1; -["B", 33] call FUNC(globalEvent); -_expected = 33; -_result = GVAR(test_B); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test globalEvent"); - -GVAR(test_B) = -1; -["B", 44] call FUNC(serverEvent); -_expected = if (isServer) then {44} else {-1}; -_result = GVAR(test_B); -TEST_DEFINED_AND_OP(_result,==,_expected,"Test serverEvent"); - diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index 88975ea7e9..d7f5d0d82a 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { scope = 1; displayName = ""; - model = PATHTOF(data\ACE_ConcertinaWireNoGeo.p3d); + model = QPATHTOF(data\ACE_ConcertinaWireNoGeo.p3d); destrType = "DestructTent"; accuracy = 0.3; mapSize = 2.8; @@ -75,7 +75,7 @@ class CfgVehicles { class ACE_ConcertinaWire: ACE_ConcertinaWireNoGeo { scope = 2; displayName = $STR_ACE_CONCERTINA_WIRE; - model = PATHTOF(data\ACE_ConcertinaWire.p3d); + model = QPATHTOF(data\ACE_ConcertinaWire.p3d); EGVAR(logistics_wirecutter,isFence) = 1; class ACE_Actions { class ACE_MainActions { @@ -91,7 +91,7 @@ class CfgVehicles { showDisabled = 0; exceptions[] = {}; priority = 5; - icon = PATHTOF(UI\icon_sandbag_ca.paa); + icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; }; }; @@ -105,7 +105,7 @@ class CfgVehicles { scope = 2; displayName = $STR_ACE_CONCERTINA_WIRECOIL; - model = PATHTOF(data\ACE_ConcertinaWireCoil.p3d); + model = QPATHTOF(data\ACE_ConcertinaWireCoil.p3d); mapsize = 0.5; animated = 0; nameSound = "fence"; @@ -134,11 +134,11 @@ class CfgVehicles { distance = 4; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [ARR_2(_target,_player)])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(deploy)}, [ARR_2(_target,_player)])] call CBA_fnc_execNextFrame); showDisabled = 0; exceptions[] = {}; priority = 5; - icon = PATHTOF(UI\icon_sandbag_ca.paa); + icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; }; }; diff --git a/addons/concertina_wire/XEH_postInit.sqf b/addons/concertina_wire/XEH_postInit.sqf index 58bd1f63c7..7cb8909c81 100644 --- a/addons/concertina_wire/XEH_postInit.sqf +++ b/addons/concertina_wire/XEH_postInit.sqf @@ -4,10 +4,10 @@ GVAR(placer) = objNull; GVAR(deployPFH) = -1; // Deploy concertina wire if interact menu is opened -["interactMenuOpened", { +["ace_interactMenuOpened", { if (GVAR(deployPFH) != -1) then { GVAR(placer) setVariable [QGVAR(wireDeployed), true]; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -[QGVAR(vehicleDamage), {_this call FUNC(vehicleDamage)}] call EFUNC(common,addEventHandler); +[QGVAR(vehicleDamage), {_this call FUNC(vehicleDamage)}] call CBA_fnc_addEventHandler; diff --git a/addons/concertina_wire/config.cpp b/addons/concertina_wire/config.cpp index 06b7bf5d86..326c1cd0ea 100644 --- a/addons/concertina_wire/config.cpp +++ b/addons/concertina_wire/config.cpp @@ -2,14 +2,21 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_ConcertinaWire", "ACE_ConcertinaWireNoGeo", "ACE_ConcertinaWireCoil"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_interaction"}; - author[] = {"Rocko", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rocko", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; diff --git a/addons/concertina_wire/functions/fnc_dismount.sqf b/addons/concertina_wire/functions/fnc_dismount.sqf index 6e8ae8f4f5..50429c054b 100644 --- a/addons/concertina_wire/functions/fnc_dismount.sqf +++ b/addons/concertina_wire/functions/fnc_dismount.sqf @@ -18,7 +18,7 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitWith { [{ _this call FUNC(dismount); - }, _this] call EFUNC(common,execNextFrame); + }, _this] call CBA_fnc_execNextFrame; }; params ["_wire", "_unit"]; diff --git a/addons/concertina_wire/functions/fnc_handleKilled.sqf b/addons/concertina_wire/functions/fnc_handleKilled.sqf index 1af3f93151..fa03b58972 100644 --- a/addons/concertina_wire/functions/fnc_handleKilled.sqf +++ b/addons/concertina_wire/functions/fnc_handleKilled.sqf @@ -34,4 +34,4 @@ if (_distance > 14 || {_distance < 2}) exitWith {}; // Fix if shooting wire _vehicle = vehicle _killer; -[QGVAR(vehicleDamage), [_vehicle], [_wire, _vehicle]] call EFUNC(common,targetEvent); +[QGVAR(vehicleDamage), [_wire, _vehicle], [_vehicle]] call CBA_fnc_targetEvent; diff --git a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf index dffa15b609..0bca28c3cf 100644 --- a/addons/concertina_wire/functions/fnc_vehicleDamage.sqf +++ b/addons/concertina_wire/functions/fnc_vehicleDamage.sqf @@ -114,7 +114,7 @@ if (_mode == 1) then { _vDir = getDir _vehicle; _vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]); // TODO: Needs to be placed in safe distance to wire, so we do not constantly re-spawn new wires - }, [_vehicle, _wire], 0.1] call EFUNC(common,waitAndExecute); + }, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute; }; //TODO: Create broken geoless wire (two version) diff --git a/addons/concertina_wire/script_component.hpp b/addons/concertina_wire/script_component.hpp index cdde4d05be..38af41b899 100644 --- a/addons/concertina_wire/script_component.hpp +++ b/addons/concertina_wire/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT concertina_wire +#define COMPONENT_BEAUTIFIED Concertina Wire #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/dagr/CfgVehicles.hpp b/addons/dagr/CfgVehicles.hpp index 7f0a7f6cff..89bfd8af4e 100644 --- a/addons/dagr/CfgVehicles.hpp +++ b/addons/dagr/CfgVehicles.hpp @@ -9,7 +9,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(menuInit)); showDisabled = 0; priority = 0.1; - icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa)); + icon = QPATHTOF(UI\DAGR_Icon.paa); exceptions[] = {"isNotInside", "isNotSitting"}; class GVAR(toggle) { displayName = CSTRING(ToggleDAGR); @@ -17,7 +17,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(toggleOverlay)); showDisabled = 0; priority = 0.2; - icon = QUOTE(PATHTOF(UI\DAGR_Icon.paa)); + icon = QPATHTOF(UI\DAGR_Icon.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; diff --git a/addons/dagr/CfgWeapons.hpp b/addons/dagr/CfgWeapons.hpp index 9fcd903cdd..b6601e094c 100644 --- a/addons/dagr/CfgWeapons.hpp +++ b/addons/dagr/CfgWeapons.hpp @@ -7,9 +7,9 @@ class CfgWeapons { author[] = {$STR_ACE_Common_ACETeam, "Ruthberg"}; scope = 2; displayName = CSTRING(Name); - model = QUOTE(PATHTOF(data\DAGR.p3d)); + model = QPATHTOF(data\DAGR.p3d); descriptionShort = CSTRING(Description); - picture = PATHTOF(UI\DAGR_Icon.paa); + picture = QPATHTOF(UI\DAGR_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; class ItemInfo: InventoryItem_Base_F { diff --git a/addons/dagr/Dialog.hpp b/addons/dagr/Dialog.hpp index 8511829e5e..52e3a8f683 100644 --- a/addons/dagr/Dialog.hpp +++ b/addons/dagr/Dialog.hpp @@ -156,7 +156,7 @@ class DAGR_Menu { idc = 266861; x = 0.175; y = -0.173; - text = QUOTE(PATHTOF(UI\dagr_menu.paa)); + text = QPATHTOF(UI\dagr_menu.paa); sizeEx = 0.1; }; diff --git a/addons/dagr/XEH_postInit.sqf b/addons/dagr/XEH_postInit.sqf index 883a73d418..4c3fce167d 100644 --- a/addons/dagr/XEH_postInit.sqf +++ b/addons/dagr/XEH_postInit.sqf @@ -30,4 +30,4 @@ GVAR(vectorConnected) = false; GVAR(noVectorData) = true; GVAR(vectorGrid) = "00000000"; -["RangerfinderData", FUNC(handleRangeFinderData)] call EFUNC(common,addEventHandler); +[QEGVAR(vector,rangefinderData), FUNC(handleRangeFinderData)] call CBA_fnc_addEventHandler; diff --git a/addons/dagr/config.cpp b/addons/dagr/config.cpp index 9f46660aaa..f84f4aeb38 100644 --- a/addons/dagr/config.cpp +++ b/addons/dagr/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_DAGR"}; weapons[] = {"ACE_DAGR"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_weather"}; - author[] = {"Rosuto", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rosuto", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -16,3 +19,7 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "Dialog.hpp" #include "RscTitles.hpp" + +class ACE_newEvents { + RangerfinderData = QEGVAR(vector,rangefinderData); +}; diff --git a/addons/dagr/functions/fnc_menuInit.sqf b/addons/dagr/functions/fnc_menuInit.sqf index 54cb4467c5..9bf36c393c 100644 --- a/addons/dagr/functions/fnc_menuInit.sqf +++ b/addons/dagr/functions/fnc_menuInit.sqf @@ -134,19 +134,19 @@ GVAR(menuRun) = true; GVAR(vectorConnected) = false; if (!GVAR(busy)) then { GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data."; - if (ACE_time - GVAR(busyTimer) > 0.5) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.5) then { (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data.."; }; - if (ACE_time - GVAR(busyTimer) > 1.0) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.0) then { (__dsp displayCtrl __mainText) ctrlSetText "Acquiring Data..."; }; - if (ACE_time - GVAR(busyTimer) > 1.5) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.5) then { (__dsp displayCtrl __mainText) ctrlSetText "Position Acquired"; }; - if (ACE_time - GVAR(busyTimer) > 3.0) then { + if (CBA_missionTime - GVAR(busyTimer) > 3.0) then { GVAR(busy) = false; }; }; @@ -156,7 +156,7 @@ GVAR(menuRun) = true; if (!GVAR(busy)) then { GVAR(showNoWaypointsFound) = true; GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; } else { GVAR(menu) = "goto_wp"; GVAR(numSelections) = GVAR(numWaypoints); GVAR(selection) = 0; @@ -168,7 +168,7 @@ GVAR(menuRun) = true; }; }; if (GVAR(busy) && GVAR(showNoWaypointsFound)) then { - if (ACE_time - GVAR(busyTimer) > 2) then { + if (CBA_missionTime - GVAR(busyTimer) > 2) then { GVAR(showNoWaypointsFound) = false; GVAR(busy) = false; }; @@ -179,7 +179,7 @@ GVAR(menuRun) = true; (__dsp displayCtrl __Option2) ctrlSetText "WP LIST"; (__dsp displayCtrl __Option3) ctrlSetText "CONNECT TO"; (__dsp displayCtrl __Option4) ctrlSetText "OPTIONS"; - (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); }; }; case "goto_wp": { @@ -190,7 +190,7 @@ GVAR(menuRun) = true; (__dsp displayCtrl __Option3) ctrlSetText GVAR(wpString3); (__dsp displayCtrl __Option4) ctrlSetText GVAR(wpString4); if (GVAR(numSelections) > 0) then { - (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); }; }; if (GVAR(SEL)) then { @@ -206,21 +206,21 @@ GVAR(menuRun) = true; if (!GVAR(busy)) then { GVAR(showInfoUpdating) = true; GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; }; if (GVAR(busy) && GVAR(showInfoUpdating)) then { (__dsp displayCtrl __mainText) ctrlSetText "Info Update."; - if (ACE_time - GVAR(busyTimer) > 1) then { + if (CBA_missionTime - GVAR(busyTimer) > 1) then { (__dsp displayCtrl __mainText) ctrlSetText "Info Update.."; }; - if (ACE_time - GVAR(busyTimer) > 1.2) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.2) then { (__dsp displayCtrl __mainText) ctrlSetText "Info Update..."; }; - if (ACE_time - GVAR(busyTimer) > 1.4) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.4) then { (__dsp displayCtrl __mainText) ctrlSetText "Info Updated"; }; - if (ACE_time - GVAR(busyTimer) > 2.9) then { + if (CBA_missionTime - GVAR(busyTimer) > 2.9) then { GVAR(showInfoUpdating) = false; GVAR(busy) = false; }; @@ -238,7 +238,7 @@ GVAR(menuRun) = true; (__dsp displayCtrl __F2) ctrlSetText "Edit"; (__dsp displayCtrl __F3) ctrlSetText "Delete"; if (GVAR(numSelections) > 0) then { - (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); }; }; if (GVAR(F3) && GVAR(numWaypoints) > 0) then { @@ -289,21 +289,21 @@ GVAR(menuRun) = true; GVAR(numSelections) = GVAR(numWaypoints); GVAR(showDeleting) = true; GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; }; if (GVAR(busy) && GVAR(showDeleting)) then { (__dsp displayCtrl __mainText) ctrlSetText "Deleting."; - if (ACE_time - GVAR(busyTimer) > 1) then { + if (CBA_missionTime - GVAR(busyTimer) > 1) then { (__dsp displayCtrl __mainText) ctrlSetText "Deleting.."; }; - if (ACE_time - GVAR(busyTimer) > 1.2) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.2) then { (__dsp displayCtrl __mainText) ctrlSetText "Deleting..."; }; - if (ACE_time - GVAR(busyTimer) > 1.4) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.4) then { (__dsp displayCtrl __mainText) ctrlSetText "Waypoint Deleted"; }; - if (ACE_time - GVAR(busyTimer) > 2.9) then { + if (CBA_missionTime - GVAR(busyTimer) > 2.9) then { GVAR(showDeleting) = false; GVAR(busy) = false; }; @@ -313,7 +313,7 @@ GVAR(menuRun) = true; if (!GVAR(busy)) then { GVAR(showOutOfSpace) = true; GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; } else { GVAR(digit1) = 0; @@ -330,7 +330,7 @@ GVAR(menuRun) = true; }; if (GVAR(busy) && GVAR(showOutOfSpace)) then { (__dsp displayCtrl __mainText) ctrlSetText "Out of Space"; - if (ACE_time - GVAR(busyTimer) > 2.5) then { + if (CBA_missionTime - GVAR(busyTimer) > 2.5) then { GVAR(showOutOfSpace) = false; GVAR(busy) = false; }; @@ -399,7 +399,7 @@ GVAR(menuRun) = true; (__dsp displayCtrl __F3) ctrlSetText "Cancel"; GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8); (__dsp displayCtrl __mainText) ctrlSetText GVAR(output); - (__dsp displayCtrl __PSelection1 + GVAR(pointer)) ctrlSetText QUOTE(PATHTOF(UI\DAGR_PSelection.paa)); + (__dsp displayCtrl __PSelection1 + GVAR(pointer)) ctrlSetText QPATHTOF(UI\DAGR_PSelection.paa); }; if (GVAR(F1)) then { if (!GVAR(busy)) then { @@ -425,22 +425,22 @@ GVAR(menuRun) = true; }; }; GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; (__dsp displayCtrl __F1) ctrlSetText ""; (__dsp displayCtrl __F2) ctrlSetText ""; (__dsp displayCtrl __F3) ctrlSetText ""; (__dsp displayCtrl __mainText) ctrlSetText "Saving."; - if (ACE_time - GVAR(busyTimer) > 1) then { + if (CBA_missionTime - GVAR(busyTimer) > 1) then { (__dsp displayCtrl __mainText) ctrlSetText "Saving.."; }; - if (ACE_time - GVAR(busyTimer) > 1.2) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.2) then { (__dsp displayCtrl __mainText) ctrlSetText "Saving..."; }; - if (ACE_time - GVAR(busyTimer) > 1.4) then { + if (CBA_missionTime - GVAR(busyTimer) > 1.4) then { (__dsp displayCtrl __mainText) ctrlSetText "Waypoint Saved"; }; - if (ACE_time - GVAR(busyTimer) > 2.9) then { + if (CBA_missionTime - GVAR(busyTimer) > 2.9) then { GVAR(edit) = false; GVAR(add) = false; GVAR(busy) = false; @@ -464,7 +464,7 @@ GVAR(menuRun) = true; if (GVAR(F3)) then { if (!GVAR(busy)) then { GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; } else { (__dsp displayCtrl __F1) ctrlSetText "Save"; (__dsp displayCtrl __F2) ctrlSetText "Vector"; @@ -472,7 +472,7 @@ GVAR(menuRun) = true; GVAR(output) = str GVAR(digit1) + str GVAR(digit2) + str GVAR(digit3) + str GVAR(digit4) + str GVAR(digit5) + str GVAR(digit6) + str GVAR(digit7) + str GVAR(digit8); (__dsp displayCtrl __mainText) ctrlSetText GVAR(output); }; - if (ACE_time - GVAR(busyTimer) > 0.1) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.1) then { GVAR(add) = false; GVAR(edit) = false; GVAR(busy) = false; @@ -507,21 +507,21 @@ GVAR(menuRun) = true; case "connect": { if (!GVAR(busy)) then { (__dsp displayCtrl __Option0) ctrlSetText "Vector 21"; - (__dsp displayCtrl __Selection0) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + (__dsp displayCtrl __Selection0) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); }; if (GVAR(SEL)) then { if (!GVAR(busy)) then { GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; (__dsp displayCtrl __mainText) ctrlSetText "Connecting."; - if (ACE_time - GVAR(busyTimer) > 0.2) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.2) then { (__dsp displayCtrl __mainText) ctrlSetText "Connecting.."; }; - if (ACE_time - GVAR(busyTimer) > 0.4) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.4) then { (__dsp displayCtrl __mainText) ctrlSetText "Connecting..."; }; - if (ACE_time - GVAR(busyTimer) > 0.6) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.6) then { if (({_x isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]} count (weapons ACE_player)) > 0) then { GVAR(displaySelection) = "VECTOR"; (__dsp displayCtrl __mainText) ctrlSetText "Vector Connected"; @@ -531,7 +531,7 @@ GVAR(menuRun) = true; GVAR(vectorConnected) = false; }; }; - if (ACE_time - GVAR(busyTimer) > 3.1) then { + if (CBA_missionTime - GVAR(busyTimer) > 3.1) then { GVAR(busy) = false; if (GVAR(vectorConnected)) then { GVAR(menu) = "main"; GVAR(numSelections) = 5; @@ -542,7 +542,7 @@ GVAR(menuRun) = true; case "options": { (__dsp displayCtrl __Option0) ctrlSetText "Signal Delay"; (__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" }); - (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QUOTE(PATHTOF(UI\DAGR_Selection.paa)); + (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); if (GVAR(SEL)) then { GVAR(vectorConnected) = false; switch (GVAR(selection)) do { @@ -556,19 +556,19 @@ GVAR(menuRun) = true; GVAR(updateInterval) = GVAR(tmpUpdateRate); if (!GVAR(busy)) then { GVAR(busy) = true; - GVAR(busyTimer) = ACE_time; + GVAR(busyTimer) = CBA_missionTime; }; (__dsp displayCtrl __mainText) ctrlSetText "Updating."; - if (ACE_time - GVAR(busyTimer) > 0.2) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.2) then { (__dsp displayCtrl __mainText) ctrlSetText "Updating.."; }; - if (ACE_time - GVAR(busyTimer) > 0.4) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.4) then { (__dsp displayCtrl __mainText) ctrlSetText "Updating..."; }; - if (ACE_time - GVAR(busyTimer) > 0.6) then { + if (CBA_missionTime - GVAR(busyTimer) > 0.6) then { (__dsp displayCtrl __mainText) ctrlSetText "Update Success"; }; - if (ACE_time - GVAR(busyTimer) > 2.1) then { + if (CBA_missionTime - GVAR(busyTimer) > 2.1) then { GVAR(busy) = false; GVAR(menu) = "options"; GVAR(numSelections) = 2; }; diff --git a/addons/dagr/functions/fnc_outputData.sqf b/addons/dagr/functions/fnc_outputData.sqf index 63350c71a3..a981514e54 100644 --- a/addons/dagr/functions/fnc_outputData.sqf +++ b/addons/dagr/functions/fnc_outputData.sqf @@ -25,7 +25,7 @@ #define __timeControl (__display displayCtrl 266855) #define __background (__display displayCtrl 266856) -__background ctrlSetText QUOTE(PATHTOF(UI\dagr_gps.paa)); +__background ctrlSetText QPATHTOF(UI\dagr_gps.paa); if (GVAR(outputPFH) != -1) exitWith {}; diff --git a/addons/dagr/functions/fnc_outputVector.sqf b/addons/dagr/functions/fnc_outputVector.sqf index ef93a53d8a..23996c46b4 100644 --- a/addons/dagr/functions/fnc_outputVector.sqf +++ b/addons/dagr/functions/fnc_outputVector.sqf @@ -27,7 +27,7 @@ private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevati #define __timeControl (__display displayCtrl 266855) #define __background (__display displayCtrl 266856) -__background ctrlSetText QUOTE(PATHTOF(UI\dagr_vector.paa)); +__background ctrlSetText QPATHTOF(UI\dagr_vector.paa); if (GVAR(noVectorData)) exitWith {}; GVAR(LAZPOS) params ["_lazPosX", "_lazPosY", "_lazPosZ"]; diff --git a/addons/dagr/functions/fnc_outputWP.sqf b/addons/dagr/functions/fnc_outputWP.sqf index 204a5ef556..2d1aee4d4e 100644 --- a/addons/dagr/functions/fnc_outputWP.sqf +++ b/addons/dagr/functions/fnc_outputWP.sqf @@ -25,7 +25,7 @@ #define __timeControl (__display displayCtrl 266859) #define __background (__display displayCtrl 266856) -__background ctrlSetText QUOTE(PATHTOF(UI\dagr_wp.paa)); +__background ctrlSetText QPATHTOF(UI\dagr_wp.paa); if (GVAR(outputPFH) != -1) exitWith {}; diff --git a/addons/dagr/initKeybinds.sqf b/addons/dagr/initKeybinds.sqf index 1a2f25ac4d..74a522e87f 100644 --- a/addons/dagr/initKeybinds.sqf +++ b/addons/dagr/initKeybinds.sqf @@ -56,4 +56,4 @@ _closeCode = { closeDialog 0; }; }; -["DAGR", QUOTE(PATHTOF(UI\DAGR_Icon.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); +["DAGR", QPATHTOF(UI\DAGR_Icon.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); diff --git a/addons/dagr/script_component.hpp b/addons/dagr/script_component.hpp index 792ef7f119..e392295765 100644 --- a/addons/dagr/script_component.hpp +++ b/addons/dagr/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT dagr +#define COMPONENT_BEAUTIFIED DAGR #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/disarming/CfgVehicles.hpp b/addons/disarming/CfgVehicles.hpp index b4a1a4c7dd..1d04bb157c 100644 --- a/addons/disarming/CfgVehicles.hpp +++ b/addons/disarming/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { distance = 3.5; condition = QUOTE([ARR_2(_player,_target)] call FUNC(canPlayerDisarmUnit)); statement = QUOTE([ARR_2(_player,_target)] call FUNC(openDisarmDialog)); - icon = PATHTOF(UI\disarm.paa); + icon = QPATHTOF(UI\disarm.paa); exceptions[] = {}; }; }; diff --git a/addons/disarming/CfgWeapons.hpp b/addons/disarming/CfgWeapons.hpp index 404ef4aa76..4e7122ba41 100644 --- a/addons/disarming/CfgWeapons.hpp +++ b/addons/disarming/CfgWeapons.hpp @@ -5,7 +5,7 @@ class CfgWeapons { class ACE_DebugPotato: ACE_ItemCore { displayName = "ACE Potato (debug)"; descriptionShort = "Glorious Potato
If you see this in game it means someone fucked up"; - picture = QUOTE(PATHTOF(UI\potato_ca.paa)); + picture = QPATHTOF(UI\potato_ca.paa); scope = 1; class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/disarming/XEH_postInit.sqf b/addons/disarming/XEH_postInit.sqf index ef17e6e96a..6944f8b146 100644 --- a/addons/disarming/XEH_postInit.sqf +++ b/addons/disarming/XEH_postInit.sqf @@ -1,4 +1,4 @@ #include "script_component.hpp" -["DisarmDropItems", FUNC(eventTargetStart)] call EFUNC(common,addEventHandler); -["DisarmDebugCallback", FUNC(eventCallerFinish)] call EFUNC(common,addEventHandler); +[QGVAR(dropItems), FUNC(eventTargetStart)] call CBA_fnc_addEventHandler; +[QGVAR(debugCallback), FUNC(eventCallerFinish)] call CBA_fnc_addEventHandler; diff --git a/addons/disarming/config.cpp b/addons/disarming/config.cpp index 00f8204b09..d8f249a9c6 100644 --- a/addons/disarming/config.cpp +++ b/addons/disarming/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_DebugPotato"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; - author[] = {"PabstMirror"}; - authorUrl = "https://github.com/PabstMirror/"; + author = ECSTRING(common,ACETeam); + authors[] = {"PabstMirror"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,8 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "gui_disarm.hpp" + +class ACE_newEvents { + DisarmDebugCallback = QGVAR(debugCallback); + DisarmDropItems = QGVAR(dropItems); +}; diff --git a/addons/disarming/functions/fnc_disarmDropItems.sqf b/addons/disarming/functions/fnc_disarmDropItems.sqf index be2f932028..c9eb920084 100644 --- a/addons/disarming/functions/fnc_disarmDropItems.sqf +++ b/addons/disarming/functions/fnc_disarmDropItems.sqf @@ -67,7 +67,7 @@ if (isNull _holder) exitWith { if (_holder getVariable [QGVAR(holderInUse), false]) exitWith { [{ _this call FUNC(disarmDropItems); - }, _this] call EFUNC(common,execNextFrame); + }, _this] call CBA_fnc_execNextFrame; }; _holder setVariable [QGVAR(holderInUse), true]; @@ -177,7 +177,7 @@ if (_holderIsEmpty) then { _needToRemoveVest = ((vest _target) != "") && {(vest _target) in _listOfItemsToRemove}; _needToRemoveUniform = ((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove}; - if ((ACE_time < _maxWaitTime) && {[_target] call FUNC(canBeDisarmed)} && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then { + if ((CBA_missionTime < _maxWaitTime) && {[_target] call FUNC(canBeDisarmed)} && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then { //action drop weapons (keeps loaded magazine and attachements) { if (_x in _listOfItemsToRemove) then { @@ -233,7 +233,7 @@ if (_holderIsEmpty) then { clearItemCargoGlobal _holder; }; //Verify we didn't timeout waiting on drop action - if (ACE_time >= _maxWaitTime) exitWith { + if (CBA_missionTime >= _maxWaitTime) exitWith { _holder setVariable [QGVAR(holderInUse), false]; [_caller, _target, "Debug: Drop Actions Timeout"] call FUNC(eventTargetFinish); }; @@ -263,4 +263,4 @@ if (_holderIsEmpty) then { [_caller, _target, ""] call FUNC(eventTargetFinish); }; -}, 0.0, [_caller,_target, _listOfItemsToRemove, _holder, _holderIsEmpty, (ACE_time + TIME_MAX_WAIT), _doNotDropAmmo, _targetMagazinesEnd]] call CBA_fnc_addPerFrameHandler; +}, 0.0, [_caller,_target, _listOfItemsToRemove, _holder, _holderIsEmpty, (CBA_missionTime + TIME_MAX_WAIT), _doNotDropAmmo, _targetMagazinesEnd]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/disarming/functions/fnc_eventCallerFinish.sqf b/addons/disarming/functions/fnc_eventCallerFinish.sqf index e1376f4052..bf1daee2f0 100644 --- a/addons/disarming/functions/fnc_eventCallerFinish.sqf +++ b/addons/disarming/functions/fnc_eventCallerFinish.sqf @@ -23,4 +23,4 @@ params ["_caller", "_target", "_errorMsg"]; if (_caller != ACE_player) exitWith {}; systemChat format ["Debug-Caller: Disarm finished from [%1] with code [%2]", _target, _errorMsg]; -ACE_LOGINFO_2("%1 - eventCallerFinish: %2",ACE_time,_this); +ACE_LOGINFO_2("%1 - eventCallerFinish: %2",CBA_missionTime,_this); diff --git a/addons/disarming/functions/fnc_eventTargetFinish.sqf b/addons/disarming/functions/fnc_eventTargetFinish.sqf index b7364a8f40..4b7487d47c 100644 --- a/addons/disarming/functions/fnc_eventTargetFinish.sqf +++ b/addons/disarming/functions/fnc_eventTargetFinish.sqf @@ -22,6 +22,6 @@ params ["_caller", "_target", "_errorMsg"]; if (_errorMsg != "") then { - ACE_LOGINFO_2("%1 - eventTargetFinish: %2",ACE_time,_this); - ["DisarmDebugCallback", [_caller], [_caller, _target, _errorMsg]] call EFUNC(common,targetEvent); + ACE_LOGINFO_2("%1 - eventTargetFinish: %2",CBA_missionTime,_this); + [QGVAR(debugCallback), [_caller, _target, _errorMsg], [_caller]] call CBA_fnc_targetEvent; }; diff --git a/addons/disarming/functions/fnc_openDisarmDialog.sqf b/addons/disarming/functions/fnc_openDisarmDialog.sqf index 92f98a0756..0883fde2dd 100644 --- a/addons/disarming/functions/fnc_openDisarmDialog.sqf +++ b/addons/disarming/functions/fnc_openDisarmDialog.sqf @@ -42,7 +42,7 @@ GVAR(disarmTarget) = _target; if (isNull GVAR(disarmTarget)) exitWith {ERROR("disarmTarget is null");}; TRACE_2("Debug: Droping %1 from %2",_data,GVAR(disarmTarget)); - ["DisarmDropItems", [GVAR(disarmTarget)], [ACE_player, GVAR(disarmTarget), [_data]]] call EFUNC(common,targetEvent); + [QGVAR(dropItems), [ACE_player, GVAR(disarmTarget), [_data]], [GVAR(disarmTarget)]] call CBA_fnc_targetEvent; false //not sure what this does }]; diff --git a/addons/disarming/script_component.hpp b/addons/disarming/script_component.hpp index af0ede134c..7bd87ade59 100644 --- a/addons/disarming/script_component.hpp +++ b/addons/disarming/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT disarming +#define COMPONENT_BEAUTIFIED Disarming #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/disposable/CfgMagazines.hpp b/addons/disposable/CfgMagazines.hpp index d26d5ecea2..d9ad0508db 100644 --- a/addons/disposable/CfgMagazines.hpp +++ b/addons/disposable/CfgMagazines.hpp @@ -5,7 +5,7 @@ class CfgMagazines { scope = 1; scopeArsenal = 1; displayName = CSTRING(PreloadedMissileDummy); - picture = PATHTOEF(common,UI\blank_CO.paa); + picture = QPATHTOEF(common,UI\blank_CO.paa); weaponPoolAvailable = 0; mass = 0; }; diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index 94ad62b1cc..4b395c6a64 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -3,13 +3,13 @@ if (!hasInterface) exitWith {}; -["playerInventoryChanged", { +["loadout", { params ["_unit"]; [_unit] call FUNC(takeLoadedATWeapon); [_unit] call FUNC(updateInventoryDisplay); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; // Register fire event handler // Only for the local player and for AI. Non-local players will handle it themselves -["firedPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); -["firedNonPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(replaceATWeapon)] call CBA_fnc_addEventHandler; +["ace_firedNonPlayer", DFUNC(replaceATWeapon)] call CBA_fnc_addEventHandler; diff --git a/addons/disposable/config.cpp b/addons/disposable/config.cpp index 0f256824d7..19b02871bc 100644 --- a/addons/disposable/config.cpp +++ b/addons/disposable/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index cd15715601..32402bc3e5 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT disposable +#define COMPONENT_BEAUTIFIED Disposable #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_ATTACH #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index 1529d39319..ba4ff87186 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -19,12 +19,6 @@ class CfgVehicles { GVAR(canDrag) = 0; }; - //remove actions from Taru Pods - class Pod_Heli_Transport_04_base_F: StaticWeapon { - GVAR(canCarry) = 0; - GVAR(canDrag) = 0; - }; - class StaticMortar; class Mortar_01_base_F: StaticMortar { GVAR(canCarry) = 1; @@ -53,6 +47,11 @@ class CfgVehicles { GVAR(canCarry) = 0; GVAR(canDrag) = 0; }; + //remove actions from Taru Pods + class Pod_Heli_Transport_04_base_F: Slingload_base_F { + GVAR(canCarry) = 0; + GVAR(canDrag) = 0; + }; class EAST_Box_Base: ReammoBox_F { GVAR(canCarry) = 1; diff --git a/addons/dragging/XEH_postInit.sqf b/addons/dragging/XEH_postInit.sqf index 9e20d8ee60..6b2fd02dde 100644 --- a/addons/dragging/XEH_postInit.sqf +++ b/addons/dragging/XEH_postInit.sqf @@ -20,11 +20,11 @@ if (isNil "ACE_maxWeightCarry") then { ["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition); // release object on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerWeaponChanged", {_this call FUNC(handlePlayerWeaponChanged)}] call EFUNC(common,addEventhandler); +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addEventHandler; +["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addEventHandler; +["weapon", FUNC(handlePlayerWeaponChanged)] call CBA_fnc_addEventHandler; // handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; //@todo Captivity? diff --git a/addons/dragging/config.cpp b/addons/dragging/config.cpp index 0c9cfb3c43..8747ee44ea 100644 --- a/addons/dragging/config.cpp +++ b/addons/dragging/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Garth 'L-H' de Wet", "commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Garth 'L-H' de Wet", "commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index ec00693825..9fb198e02c 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -44,7 +44,7 @@ if (_target isKindOf "CAManBase") then { _target attachTo [_unit, _position]; }; -["setDir", _target, [_target, _direction]] call EFUNC(common,targetEvent); +[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent; _unit setVariable [QGVAR(isCarrying), true, true]; _unit setVariable [QGVAR(carriedObject), _target, true]; @@ -64,7 +64,7 @@ if (_target isKindOf "CAManBase") then { }; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index 948af15891..963921efa7 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -20,7 +20,7 @@ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING - systemChat format ["%1 carryObjectPFH running", ACE_time]; + systemChat format ["%1 carryObjectPFH running", CBA_missionTime]; #endif params ["_args", "_idPFH"]; @@ -34,10 +34,10 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); - if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) - TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index 3237ddbb07..4672aa89c4 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -33,7 +33,7 @@ _position = _position vectorAdd [0, 0, _offset]; // attach object TRACE_3("attaching",_position,_offset,_direction); _target attachTo [_unit, _position]; -["setDir", _target, [_target, _direction]] call EFUNC(common,targetEvent); +[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent; if (_target isKindOf "CAManBase") then { [_target, "AinjPpneMrunSnonWnonDb_still", 0, true] call EFUNC(common,doAnimation); @@ -53,7 +53,7 @@ _unit setVariable [QGVAR(ReleaseActionID), [ [localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything -[FUNC(dragObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; +[FUNC(dragObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index ab117e90fd..08aeba738b 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -20,7 +20,7 @@ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING - systemChat format ["%1 dragObjectPFH running", ACE_time]; + systemChat format ["%1 dragObjectPFH running", CBA_missionTime]; #endif params ["_args", "_idPFH"]; @@ -34,10 +34,10 @@ if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { TRACE_2("dead/distance",_unit,_target); - if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith { //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) - TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime); }; [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 604f6c25b7..c70bf90c38 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -30,8 +30,8 @@ if !(_unit getVariable ["ACE_isUnconscious", false]) then { }; // prevent collision damage -["fixCollision", _unit] call EFUNC(common,localEvent); -["fixCollision", _target, _target] call EFUNC(common,targetEvent); +[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent; +[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent; // release object detach _target; @@ -62,8 +62,8 @@ _unit setVariable [QGVAR(draggedObject), objNull, true]; [objNull, _target, true] call EFUNC(common,claim); if !(_target isKindOf "CAManBase") then { - ["fixPosition", _target, _target] call EFUNC(common,targetEvent); - ["fixFloating", _target, _target] call EFUNC(common,targetEvent); + [QEGVAR(common,fixPosition), _target, _target] call CBA_fnc_targetEvent; + [QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent; }; if (_unit getVariable ["ACE_isUnconscious", false]) then { diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index 2002142e2e..c3521bbed0 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -25,8 +25,8 @@ TRACE_2("params",_unit,_target); private _inBuilding = [_unit] call FUNC(isObjectOnObject); // prevent collision damage -["fixCollision", _unit] call EFUNC(common,localEvent); -["fixCollision", _target, _target] call EFUNC(common,targetEvent); +[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent; +[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent; // release object detach _target; @@ -67,8 +67,8 @@ _unit setVariable [QGVAR(carriedObject), objNull, true]; [objNull, _target, true] call EFUNC(common,claim); if !(_target isKindOf "CAManBase") then { - ["fixPosition", _target, _target] call EFUNC(common,targetEvent); - ["fixFloating", _target, _target] call EFUNC(common,targetEvent); + [QEGVAR(common,fixPosition), _target, _target] call CBA_fnc_targetEvent; + [QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent; }; // recreate UAV crew diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index c97284618c..e3a30ea9e0 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -42,6 +42,6 @@ _carriedItem attachTo [_unit]; //reset the carry direction private _direction = _carriedItem getVariable [QGVAR(carryDirection), 0]; -["setDir", _carriedItem, [_carriedItem, _direction]] call EFUNC(common,targetEvent); +[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent; true diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index b9f623395e..d36ffe9339 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -2,7 +2,7 @@ * Author: commy2 * Initialize variables for drag or carryable objects. Called from init EH. * - * Argument: + * Arguments: * 0: Any object * * Return Value: diff --git a/addons/dragging/functions/fnc_initPerson.sqf b/addons/dragging/functions/fnc_initPerson.sqf index 9e4aefeead..c8c26a4f8c 100644 --- a/addons/dragging/functions/fnc_initPerson.sqf +++ b/addons/dragging/functions/fnc_initPerson.sqf @@ -2,10 +2,10 @@ * Author: commy2 * Initialize variables for drag or carryable persons. Called from init EH. * - * Argument: + * Arguments: * 0: Unit * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/dragging/functions/fnc_isObjectOnObject.sqf b/addons/dragging/functions/fnc_isObjectOnObject.sqf index c113688322..cec6ce764e 100644 --- a/addons/dragging/functions/fnc_isObjectOnObject.sqf +++ b/addons/dragging/functions/fnc_isObjectOnObject.sqf @@ -2,10 +2,10 @@ * Author: commy2 * Check if Object is Overlapping * - * Argument: + * Arguments: * 0: Object * - * Return value: + * Return Value: * * * Example; diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 0253c6ed4b..4de52e7bd8 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -2,7 +2,7 @@ * Author: commy2 * Enable the object to be carried. * - * Argument: + * Arguments: * 0: Any object * 1: true to enable carrying, false to disable * 2: Position offset for attachTo command (default: [0,1,1]) diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index 4c4d11ecf6..1fbcb995dc 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -2,13 +2,13 @@ * Author: commy2 * Enable the object to be dragged. * - * Argument: + * Arguments: * 0: Any object * 1: true to enable dragging, false to disable * 2: Position offset for attachTo command (Array, optinal; default: [0,0,0]) * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index fd528b0104..1890dbac1a 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -26,7 +26,7 @@ if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWit [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; -private _timer = ACE_time + 5; +private _timer = CBA_missionTime + 5; // handle objects vs persons if (_target isKindOf "CAManBase") then { @@ -46,7 +46,7 @@ if (_target isKindOf "CAManBase") then { [_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2, true] call EFUNC(common,doAnimation); [_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2, true] call EFUNC(common,doAnimation); - _timer = ACE_time + 15; + _timer = CBA_missionTime + 15; } else { diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf index 4d39672a9e..007469d960 100644 --- a/addons/dragging/functions/fnc_startCarryPFH.sqf +++ b/addons/dragging/functions/fnc_startCarryPFH.sqf @@ -20,7 +20,7 @@ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING - systemChat format ["%1 startCarryPFH running", ACE_time]; + systemChat format ["%1 startCarryPFH running", CBA_missionTime]; #endif params ["_args", "_idPFH"]; @@ -28,28 +28,28 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting carry if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { - TRACE_4("carry false",_unit,_target,_timeOut,ACE_time); + TRACE_4("carry false",_unit,_target,_timeOut,CBA_missionTime); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { - TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); + TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // handle persons vs objects if (_target isKindOf "CAManBase") then { - if (ACE_time > _timeOut) exitWith { - TRACE_4("Start carry person",_unit,_target,_timeOut,ACE_time); + if (CBA_missionTime > _timeOut) exitWith { + TRACE_4("Start carry person",_unit,_target,_timeOut,CBA_missionTime); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; } else { - if (ACE_time > _timeOut) exitWith { - TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); + if (CBA_missionTime > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout @@ -59,7 +59,7 @@ if (_target isKindOf "CAManBase") then { // wait for the unit to stand up if (stance _unit == "STAND") exitWith { - TRACE_4("Start carry object",_unit,_target,_timeOut,ACE_time); + TRACE_4("Start carry object",_unit,_target,_timeOut,CBA_missionTime); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 24a279e7a7..5ddaa0ede4 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -2,11 +2,11 @@ * Author: commy2 * Start the dragging process. * - * Argument: + * Arguments: * 0: Unit that should do the dragging * 1: Object to drag * - * Return value: + * Return Value: * None * * Example: @@ -39,7 +39,7 @@ _unit selectWeapon primaryWeapon _unit; [_unit, _target, true] call EFUNC(common,claim); // can't play action that depends on weapon if it was added the same frame -[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame); +[{_this playActionNow "grabDrag";}, _unit] call CBA_fnc_execNextFrame; // move a bit closer and adjust direction when trying to pick up a person if (_target isKindOf "CAManBase") then { @@ -52,4 +52,4 @@ if (_target isKindOf "CAManBase") then { // prevents draging and carrying at the same time _unit setVariable [QGVAR(isDragging), true, true]; -[FUNC(startDragPFH), 0.2, [_unit, _target, ACE_time + 5]] call CBA_fnc_addPerFrameHandler; +[FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index cfa84fe279..c7843cfdc9 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -20,7 +20,7 @@ #include "script_component.hpp" #ifdef DEBUG_ENABLED_DRAGGING - systemChat format ["%1 startDragPFH running", ACE_time]; + systemChat format ["%1 startDragPFH running", CBA_missionTime]; #endif params ["_args", "_idPFH"]; @@ -28,20 +28,20 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting drag if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { - TRACE_4("drag false",_unit,_target,_timeOut,ACE_time); + TRACE_4("drag false",_unit,_target,_timeOut,CBA_missionTime); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { - TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); + TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; -// timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame time. -if (ACE_time > _timeOut) exitWith { - TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); +// timeout. Do nothing. Quit. CBA_missionTime, because anim length is linked to ingame time. +if (CBA_missionTime > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout @@ -51,7 +51,7 @@ if (ACE_time > _timeOut) exitWith { // unit is ready to start dragging if (animationState _unit in DRAG_ANIMATIONS) exitWith { - TRACE_4("Start Dragging",_unit,_target,_timeOut,ACE_time); + TRACE_4("Start Dragging",_unit,_target,_timeOut,CBA_missionTime); [_unit, _target] call FUNC(dragObject); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/script_component.hpp b/addons/dragging/script_component.hpp index b4acb948c9..13915637ab 100644 --- a/addons/dragging/script_component.hpp +++ b/addons/dragging/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT dragging +#define COMPONENT_BEAUTIFIED Dragging #include "\z\ace\addons\main\script_mod.hpp" //#define DEBUG_ENABLED_DRAGGING diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index 280906432f..145ae0804e 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -11,52 +11,52 @@ onSetup parameters: class Command { isAttachable = 1; displayName = CSTRING(clacker_displayName); - picture = PATHTOF(Data\UI\Clacker.paa); + picture = QPATHTOF(Data\UI\Clacker.paa); onPlace = QUOTE(_this call FUNC(AddClacker);false); requires[] = {"ACE_Clacker"}; }; class MK16_Transmitter: Command { isAttachable = 1; displayName = CSTRING(M152_displayName); - picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa); + picture = QPATHTOF(Data\UI\MK16_Reciever_ca.paa); requires[] = {"ACE_M26_Clacker"}; }; class DeadManSwitch: Command { isAttachable = 1; displayName = CSTRING(DeadManSwitch_displayName); - picture = PATHTOF(Data\UI\DeadmanSwitch.paa); + picture = QPATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; class Cellphone: Command { isAttachable = 1; displayName = CSTRING(cellphone_displayName); - picture = PATHTOF(Data\UI\Cellphone_UI.paa); + picture = QPATHTOF(Data\UI\Cellphone_UI.paa); onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); requires[] = {"ACE_Cellphone"}; }; class PressurePlate { isAttachable = 0; displayName = CSTRING(PressurePlate); - picture = PATHTOF(Data\UI\PressurePlate.paa); + picture = QPATHTOF(Data\UI\PressurePlate.paa); onPlace = QUOTE(false); }; class IRSensor { isAttachable = 0; displayName = CSTRING(IRSensor); - picture = PATHTOF(Data\UI\PressurePlate.paa); + picture = QPATHTOF(Data\UI\PressurePlate.paa); onPlace = "false"; }; class Timer { isAttachable = 1; displayName = CSTRING(timerName); - picture = PATHTOF(data\UI\Timer.paa); + picture = QPATHTOF(data\UI\Timer.paa); onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false); onSetup = QUOTE(_this call FUNC(openTimerSetUI);true); }; class Tripwire { isAttachable = 0; displayName = CSTRING(TripWire); - picture = PATHTOF(Data\UI\Tripwire.paa); + picture = QPATHTOF(Data\UI\Tripwire.paa); onPlace = "false"; }; }; diff --git a/addons/explosives/CfgModule.hpp b/addons/explosives/CfgModule.hpp index b651903f59..a4e0d8dbd2 100644 --- a/addons/explosives/CfgModule.hpp +++ b/addons/explosives/CfgModule.hpp @@ -3,11 +3,11 @@ class ACE_ModuleExplosive: ACE_Module { author = ECSTRING(common,ACETeam); category = "ACE"; displayName = CSTRING(Module_DisplayName); - function = QUOTE(FUNC(module)); + function = QFUNC(module); scope = 2; isGlobal = 1; isSingular = 1; - icon = PATHTOF(UI\Icon_Module_Explosives_ca.paa); + icon = QPATHTOF(UI\Icon_Module_Explosives_ca.paa); class Arguments { class RequireSpecialist { displayName = CSTRING(RequireSpecialist_DisplayName); diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 3db6546208..b2cd562b18 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -12,7 +12,7 @@ class CfgVehicles { exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 4; - icon = PATHTOF(UI\Explosives_Menu_ca.paa); + icon = QPATHTOF(UI\Explosives_Menu_ca.paa); insertChildren = QUOTE([_player] call FUNC(addTransmitterActions);); //Sub-menu items class ACE_Place { @@ -22,7 +22,7 @@ class CfgVehicles { insertChildren = QUOTE([_player] call FUNC(addExplosiveActions);); exceptions[] = {"isNotSwimming"}; showDisabled = 1; - icon = PATHTOF(UI\Place_Explosive_ca.paa); + icon = QPATHTOF(UI\Place_Explosive_ca.paa); priority = 1; }; class ACE_Cellphone { @@ -31,7 +31,7 @@ class CfgVehicles { statement = "closeDialog 0;createDialog 'Rsc_ACE_PhoneInterface';"; exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; showDisabled = 0; - icon = PATHTOF(Data\UI\Cellphone_UI.paa); + icon = QPATHTOF(Data\UI\Cellphone_UI.paa); priority = 0.8; }; }; @@ -44,37 +44,30 @@ class CfgVehicles { class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; }; - author = "ACE"; + author = ECSTRING(common,aceteam); _generalMacro = "ACE_DefuseObject"; displayName = "ACE Defuse Helper"; - mapSize = 0.2; - icon = "iconObject_1x2"; model = "\A3\Weapons_f\dummyweapon.p3d"; scope = 1; - vehicleClass = "Cargo"; + class ACE_Actions { - class ACE_MainActions { - selection = ""; + class ACE_Defuse { distance = 1; - condition = "true"; - class ACE_Defuse { - displayName = CSTRING(Defuse); - condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDefuse)); - statement = QUOTE([ARR_2(_player,_target)] call FUNC(startDefuse);); - exceptions[] = {"isNotSwimming"}; - showDisabled = 0; - icon = PATHTOF(UI\Defuse_ca.paa); - priority = 0.8; - }; + displayName = CSTRING(Defuse); + condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDefuse)); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(startDefuse);); + exceptions[] = {"isNotSwimming"}; + icon = QPATHTOF(UI\Defuse_ca.paa); }; }; }; + class ACE_Explosives_Place: Items_base_F { class EventHandlers { class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; }; - author = "ACE"; + author = ECSTRING(common,aceteam); _generalMacro = "ACE_Explosives_Place"; displayName = "Multi-meter"; mapSize = 0.2; @@ -96,7 +89,7 @@ class CfgVehicles { showDisabled = 0; exceptions[] = {"isNotSwimming"}; priority = 5; - icon = QUOTE(PATHTOF(UI\Explosives_Menu_ca.paa)); + icon = QPATHTOF(UI\Explosives_Menu_ca.paa); }; class ACE_PickUp { selection = ""; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index cd900b2da3..a3f3b32d4c 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -11,8 +11,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(clacker_displayName); descriptionShort = CSTRING(clacker_description); - picture = PATHTOF(Data\UI\Clacker.paa); - model = QUOTE(PATHTOF(data\ace_m57.p3d)); + picture = QPATHTOF(Data\UI\Clacker.paa); + model = QPATHTOF(data\ace_m57.p3d); GVAR(Range) = 250; GVAR(Detonator) = 1; GVAR(triggerType) = "Command"; @@ -24,7 +24,7 @@ class CfgWeapons { }; class ACE_M26_Clacker: ACE_Clacker { displayName = CSTRING(M152_Clacker_displayName); - picture = PATHTOF(Data\UI\MK26_Transmitter_ca.paa); + picture = QPATHTOF(Data\UI\MK26_Transmitter_ca.paa); GVAR(Range) = 5000; GVAR(triggerType) = "MK16_Transmitter"; }; @@ -32,7 +32,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(DefusalKit_displayName); descriptionShort = CSTRING(DefusalKit_description); - picture = PATHTOF(Data\UI\Pliers.paa); + picture = QPATHTOF(Data\UI\Pliers.paa); model = "\A3\Structures_F\Items\Tools\Pliers_F.p3d"; class ItemInfo: ACE_ExplosiveItem { @@ -44,7 +44,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(DeadManSwitch_displayName); descriptionShort = CSTRING(DeadManSwitch_description); - picture = PATHTOF(Data\UI\DeadmanSwitch.paa); + picture = QPATHTOF(Data\UI\DeadmanSwitch.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; GVAR(Range) = 100; GVAR(Detonator) = 1; @@ -59,7 +59,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(cellphone_displayName); descriptionShort = CSTRING(cellphone_description); - picture = PATHTOF(Data\UI\Cellphone_UI.paa); + picture = QPATHTOF(Data\UI\Cellphone_UI.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; GVAR(Range) = 15000; GVAR(Detonator) = 1; diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp index 45582a8564..cf97794d8f 100644 --- a/addons/explosives/ExplosivesUI.hpp +++ b/addons/explosives/ExplosivesUI.hpp @@ -113,7 +113,7 @@ class Rsc_ACE_PhoneInterface { class controls { class RscPicture_1200: RscPicture { idc = 1200; - text = PATHTOF(Data\UI\Cellphone_Background.paa); + text = QPATHTOF(Data\UI\Cellphone_Background.paa); x = 0.231875 * safezoneW + safezoneX; y = 0.104 * safezoneH + safezoneY; w = 0.195937 * safezoneW; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index fe12a88b7f..1ddd52cc53 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -16,29 +16,30 @@ #include "script_component.hpp" //Event for setting explosive placement angle/pitch: -[QGVAR(place), {_this call FUNC(setPosition)}] call EFUNC(common,addEventHandler); +[QGVAR(place), {_this call FUNC(setPosition)}] call CBA_fnc_addEventHandler; +[QGVAR(startDefuse), FUNC(startDefuse)] call CBA_fnc_addEventHandler; //When getting knocked out in medical, trigger deadman explosives: //Event is global, only run on server (ref: ace_medical_fnc_setUnconscious) if (isServer) then { - ["medical_onUnconscious", { + ["ace_unconscious", { params ["_unit", "_isUnconscious"]; if (!_isUnconscious) exitWith {}; TRACE_1("Knocked Out, Doing Deadman", _unit); [_unit] call FUNC(onIncapacitated); - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addEventHandler; - ["clientRequestsOrientations", { + [QGVAR(sendOrientations), { params ["_logic"]; - TRACE_1("clientRequestsOrientations received:",_logic); + TRACE_1("sendOrientations received:",_logic); // Filter the array before sending it GVAR(explosivesOrientations) = GVAR(explosivesOrientations) select { _x params ["_explosive"]; (!isNull _explosive && {alive _explosive}) }; - TRACE_1("serverSendsOrientations sent:",GVAR(explosivesOrientations)); - ["serverSendsOrientations", _logic, [GVAR(explosivesOrientations)]] call EFUNC(common,targetEvent); - }] call EFUNC(common,addEventHandler); + TRACE_1("orientationsSent sent:",GVAR(explosivesOrientations)); + [QGVAR(orientationsSent), [GVAR(explosivesOrientations)], _logic] call CBA_fnc_targetEvent; + }] call CBA_fnc_addEventHandler; }; if (!hasInterface) exitWith {}; @@ -51,9 +52,9 @@ GVAR(CurrentSpeedDial) = 0; // In case we are a JIP client, ask the server for orientation of any previously // placed mine. if (didJIP) then { - ["serverSendsOrientations", { + [QGVAR(orientationsSent), { params ["_explosivesOrientations"]; - TRACE_1("serverSendsOrientations received:",_explosivesOrientations); + TRACE_1("orientationsSent received:",_explosivesOrientations); { _x params ["_explosive","_direction","_pitch"]; TRACE_3("orientation set:",_explosive,_direction,_pitch); @@ -61,15 +62,15 @@ if (didJIP) then { } forEach _explosivesOrientations; deleteVehicle GVAR(localLogic); GVAR(localLogic) = nil; - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addEventHandler; // Create a logic to get the client ID GVAR(localLogic) = ([sideLogic] call CBA_fnc_getSharedGroup) createUnit ["Logic", [0,0,0], [], 0, "NONE"]; - TRACE_1("clientRequestsOrientations sent:",GVAR(localLogic)); - ["clientRequestsOrientations", [GVAR(localLogic)]] call EFUNC(common,serverEvent); + TRACE_1("sendOrientations sent:",GVAR(localLogic)); + [QGVAR(sendOrientations), [GVAR(localLogic)]] call CBA_fnc_serverEvent; }; -["interactMenuOpened", { +["ace_interactMenuOpened", { //Cancel placement if interact menu opened if (GVAR(pfeh_running)) then { GVAR(placeAction) = PLACE_CANCEL; @@ -78,4 +79,4 @@ if (didJIP) then { //Show defuse actions on CfgAmmos (allMines): _this call FUNC(interactEH); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 3fc047fa6a..8b660197e9 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_ModuleMine_SLAMBottomMine", "ACE_ModuleExplosive_IEDUrbanBig_Range", "ACE_ModuleExplosive_IEDLandBig_Range", "ACE_ModuleExplosive_IEDUrbanSmall_Range", "ACE_ModuleExplosive_IEDLandSmall_Range"}; weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "http://garth.snakebiteink.co.za/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Garth 'L-H' de Wet"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -42,3 +44,8 @@ class CfgMineTriggers { mineTriggerRange = 1; }; }; + +class ACE_newEvents { + clientRequestsOrientations = QGVAR(sendOrientations); + serverSendsOrientations = QGVAR(orientationsSent); +}; diff --git a/addons/explosives/functions/fnc_addExplosiveActions.sqf b/addons/explosives/functions/fnc_addExplosiveActions.sqf index e744af6bce..fc494a5fad 100644 --- a/addons/explosives/functions/fnc_addExplosiveActions.sqf +++ b/addons/explosives/functions/fnc_addExplosiveActions.sqf @@ -45,7 +45,7 @@ _children = []; format ["Explosive_%1", _forEachIndex], format [_name + " (%1)", _itemCount select _forEachIndex], getText(_x >> "picture"), - {[{_this call FUNC(setupExplosive)}, _this] call EFUNC(common,execNextFrame)}, + {[{_this call FUNC(setupExplosive)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, (configName _x) diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index 147d722987..b98b992f8e 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -22,8 +22,8 @@ TRACE_2("params",_unit,_explosive); if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> QGVAR(explodeOnDefuseChance)))}) exitWith { TRACE_1("exploding on defuse",_explosive); [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); - [QGVAR(explodeOnDefuse), [_explosive, _unit]] call EFUNC(common,globalEvent); + [QGVAR(explodeOnDefuse), [_explosive, _unit]] call CBA_fnc_globalEvent; }; _unit action ["Deactivate", _unit, _explosive]; -[QGVAR(defuse), [_explosive, _unit]] call EFUNC(common,globalEvent); +[QGVAR(defuse), [_explosive, _unit]] call CBA_fnc_globalEvent; diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index a01f181635..b7f4893e52 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -49,6 +49,6 @@ if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhe if (!isNull _explosive) then { _explosive setDamage 1; }; -}, [_item select 0], (_item select 1)] call EFUNC(common,waitAndExecute); +}, [_item select 0], (_item select 1)] call CBA_fnc_waitAndExecute; _result diff --git a/addons/explosives/functions/fnc_dialPhone.sqf b/addons/explosives/functions/fnc_dialPhone.sqf index 44addcda9f..6bfeac8595 100644 --- a/addons/explosives/functions/fnc_dialPhone.sqf +++ b/addons/explosives/functions/fnc_dialPhone.sqf @@ -40,7 +40,7 @@ if (_unit == ace_player) then { [{ playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; (_this select 0) setVariable [QGVAR(Dialing), false, true]; - }, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call EFUNC(common,waitAndExecute); + }, [_unit,_explosive select 0], 0.25 * (count _arr - 4)] call CBA_fnc_waitAndExecute; [_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer); }; }; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index 83cdb2fef8..455b768b97 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -95,6 +95,6 @@ if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_tr _pitch = getNumber (_magazineTrigger >> "pitch"); //Globaly set the position and angle: -[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call EFUNC(common,globalEvent); +[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call CBA_fnc_globalEvent; _explosive diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 709ea688d5..6dd1094c6a 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -187,7 +187,7 @@ GVAR(TweakedAngle) = 0; _unit removeMagazine _magClassname; _unit playActionNow "PutDown"; _unit setVariable [QGVAR(PlantingExplosive), true]; - [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call EFUNC(common,waitAndExecute); + [{_this setVariable [QGVAR(PlantingExplosive), false]}, _unit, 1.5] call CBA_fnc_waitAndExecute; }; } else { diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf index 84d7274069..8e3f071661 100644 --- a/addons/explosives/functions/fnc_startDefuse.sqf +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -44,7 +44,7 @@ if (STANCE _unit == "Prone") then { if (ACE_player != _unit) then { // If the unit is a player, call the function on the player. if (isPlayer _unit) then { - [[_unit, _target], QFUNC(startDefuse), _unit] call EFUNC(common,execRemoteFnc); + [QGVAR(startDefuse), [_unit, _target], _unit] call CBA_fnc_targetEvent; } else { _unit playActionNow _actionToPlay; _unit disableAI "MOVE"; @@ -56,7 +56,7 @@ if (ACE_player != _unit) then { [_unit, _target] call FUNC(defuseExplosive); _unit enableAI "MOVE"; _unit enableAI "TARGET"; - }, [_unit, _target], _defuseTime] call EFUNC(common,waitAndExecute); + }, [_unit, _target], _defuseTime] call CBA_fnc_waitAndExecute; }; } else { _unit playActionNow _actionToPlay; diff --git a/addons/explosives/functions/fnc_startTimer.sqf b/addons/explosives/functions/fnc_startTimer.sqf index ca219ed13c..1f529d9765 100644 --- a/addons/explosives/functions/fnc_startTimer.sqf +++ b/addons/explosives/functions/fnc_startTimer.sqf @@ -25,4 +25,4 @@ TRACE_2("params",_explosive,_delay); if (!isNull _explosive) then { [_explosive, -1, [_explosive, 0]] call FUNC(detonateExplosive); }; -}, [_explosive], _delay] call EFUNC(common,waitAndExecute); +}, [_explosive], _delay] call CBA_fnc_waitAndExecute; diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp index 86eefd72b6..7245801cc9 100644 --- a/addons/explosives/script_component.hpp +++ b/addons/explosives/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT explosives +#define COMPONENT_BEAUTIFIED Explosives #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index c49d09502f..ec80081cb0 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -30,7 +30,7 @@ Zünden Detonar Detonuj - Mise à feu + Détoner Odpálit Detona Robbantás @@ -45,7 +45,8 @@ Odpálit VŠE Detonuj wszystkie Detona Tutti - Tout mettre à feu + Tout détoner + Detonar Tudo Explosive code: %1 @@ -459,7 +460,7 @@ Brak dostępnych zapalników dla %1 No hay detonadores disponibles para %1 Keine Auslöser für %1 vorhanden - Pas de mise à feu disponible pour %1 + Pas de détonateur disponible pour %1 Žádný detonátor k dispozici pro %1 Nessun attivatore disponibile per %1 Nincs elérhető gyújtóeszköz ide: %1 @@ -505,7 +506,7 @@ Dead Man's Switch Totmannschalter - Mise à feu par relâchement de pression + Détonateur par relâchement de pression Spínač mrtvého muže Czuwak Detonador de hombre muerto @@ -517,7 +518,7 @@ Used to remotely trigger explosives when released. Zündet Sprengladungen wenn losgelassen. - Déclenche la mise à feu d'un explosif lorsqu'il est relaché. + Utilisé pour déclencher des explosifs à distance quand relaché. Používaný k vzdálenému odpálení, při uvolnění odpálí výbušniny Używany w celu zdalnej detonacji ładunków, kiedy jego operator zostanie zabity. Utilizado para detonar explosivos remotamente al soltarlo. @@ -649,6 +650,7 @@ Mine M6 SLAM (par le bas) Mina M6 SLAM (base) M6 SLAM (Útok zespoda) + Mina M6 SLAM (Ataque Inferior) M6 SLAM Mine (Side Attack) @@ -665,6 +667,7 @@ Mine M6 SLAM (de flanc) STR_ACE_Explosives_Module_SLAMBottomAttack_DisplayName M6 SLAM Mine (Bottom Attack) Mine M6 SLAM (par le bas) M6-SLAM-Mine (Bodenangriff) Mina M6 SLAM (base) Mina M6 SLAM (atak od dołu) Mina M6 SLAM (Laterale) M6 SLAM (Útok do strany) + Mina M6 SLAM (Ataque Lateral) Large IED (Urban, Pressure Plate) @@ -681,6 +684,7 @@ Grand EEI (Urbain, plaque de pression) IED grande (urbano, a pressione) IED, Velké (Městské, Nášlapné) + IED Grande (Urbano, Placa de pressão) Large IED (Dug-in, Pressure Plate) @@ -697,6 +701,7 @@ Grand EEI (Enterré, plaque de pression) IED grande (interrato, a pressione) IED, Velké (Zakopané, Nášlapné) + IED Grande (Enterrado, Placa de pressão) Small IED (Urban, Pressure Plate) @@ -713,6 +718,7 @@ Petit EEI (Urbain, plaque de pression) IED piccolo (urbano, a pressione) IED, Malé (Městské, Nášlapné) + IED Pequeno(Urbano, Placa de pressão) Small IED (Dug-in, Pressure Plate) @@ -729,6 +735,7 @@ Petit EEI (Enterré, plaque de pression) IED piccolo (interrato, a pressione) IED, Malé (Zakopané, Nášlapné) + IED Pequeno (Enterrado, Placa de pressão) Connect to %1 diff --git a/addons/fastroping/CfgMoves.hpp b/addons/fastroping/CfgMoves.hpp index 94f3fe51f0..b978539432 100644 --- a/addons/fastroping/CfgMoves.hpp +++ b/addons/fastroping/CfgMoves.hpp @@ -9,7 +9,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { class States { class Crew; class ACE_FastRoping: Crew { - file = QUOTE(PATHTOF(anim\fastroping.rtm)); + file = QPATHTOF(anim\fastroping.rtm); interpolateTo[] = {"Unconscious", 1}; disableWeapons = 1; disableWeaponsLong = 1; diff --git a/addons/fastroping/CfgVehicles.hpp b/addons/fastroping/CfgVehicles.hpp index 609e386e68..5ade667c12 100644 --- a/addons/fastroping/CfgVehicles.hpp +++ b/addons/fastroping/CfgVehicles.hpp @@ -20,9 +20,9 @@ class CfgVehicles { class ACE_moduleEquipFRIES: ACE_Module { scope = 2; displayName = CSTRING(Module_FRIES_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_FRIES_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_FRIES_ca.paa); category = "ACE"; - function = QUOTE(FUNC(moduleEquipFRIES)); + function = QFUNC(moduleEquipFRIES); functionPriority = 10; isGlobal = 0; isTriggerActivated = 0; @@ -48,7 +48,7 @@ class CfgVehicles { class ACE_deployRopes { displayName = CSTRING(Interaction_deployRopes); condition = QUOTE([ARR_2(_player, vehicle _player)] call FUNC(canDeployRopes)); - statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [vehicle _player])] call EFUNC(common,serverEvent)); + statement = QUOTE([ARR_2(QUOTE(QGVAR(deployRopes)), [vehicle _player])] call CBA_fnc_serverEvent); showDisabled = 0; priority = 1; }; @@ -81,7 +81,7 @@ class CfgVehicles { class ACE_friesAnchorBar: ACE_friesBase { author = "jokoho48"; scope = 1; - model = QUOTE(PATHTOF(data\friesAnchorBar.p3d)); + model = QPATHTOF(data\friesAnchorBar.p3d); animated = 1; class AnimationSources { class extendHookRight { @@ -99,7 +99,7 @@ class CfgVehicles { class ACE_friesGantry: ACE_friesBase { author = "jokoho48"; scope = 1; - model = QUOTE(PATHTOF(data\friesGantry.p3d)); + model = QPATHTOF(data\friesGantry.p3d); animated = 1; class AnimationSources { class adjustWidth { @@ -152,9 +152,10 @@ class CfgVehicles { class GVAR(helper): Helicopter_Base_F { author = "KoffeinFlummi"; scope = 1; - model = PATHTOF(data\helper.p3d); + model = QPATHTOF(data\helper.p3d); class ACE_Actions {}; class Turrets {}; + class TransportItems {}; }; class Helicopter_Base_H; diff --git a/addons/fastroping/CfgWaypoints.hpp b/addons/fastroping/CfgWaypoints.hpp index 4c4da2a7cb..f3303c28ff 100644 --- a/addons/fastroping/CfgWaypoints.hpp +++ b/addons/fastroping/CfgWaypoints.hpp @@ -4,8 +4,8 @@ class CfgWaypoints { class Fastrope { displayName = CSTRING(Waypoint_Fastrope); displayNameDebug = "Fastrope"; - file = QUOTE(PATHTOF(functions\fnc_deployAIWaypoint.sqf)); - icon = QUOTE(PATHTOF(UI\Icon_Waypoint.paa)); + file = QPATHTOF(functions\fnc_deployAIWaypoint.sqf); + icon = QPATHTOF(UI\Icon_Waypoint.paa); }; }; }; diff --git a/addons/fastroping/XEH_postInit.sqf b/addons/fastroping/XEH_postInit.sqf index ae88feaa76..752ac2f756 100644 --- a/addons/fastroping/XEH_postInit.sqf +++ b/addons/fastroping/XEH_postInit.sqf @@ -2,8 +2,8 @@ [QGVAR(deployRopes), { _this call FUNC(deployRopes); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; [QGVAR(startFastRope), { [FUNC(fastRopeServerPFH), 0, _this] call CBA_fnc_addPerFrameHandler; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/fastroping/config.cpp b/addons/fastroping/config.cpp index 7275741f40..f2bf1d4a5e 100644 --- a/addons/fastroping/config.cpp +++ b/addons/fastroping/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"KoffeinFlummi", "BaerMitUmlaut"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi", "BaerMitUmlaut"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/fastroping/functions/fnc_checkVehicleThread.sqf b/addons/fastroping/functions/fnc_checkVehicleThread.sqf index 0cd0ca3234..38a2cad8c6 100644 --- a/addons/fastroping/functions/fnc_checkVehicleThread.sqf +++ b/addons/fastroping/functions/fnc_checkVehicleThread.sqf @@ -21,5 +21,5 @@ params ["_vehicle", "_fries"]; if (isNull _vehicle) then { deleteVehicle _fries; } else { - [FUNC(checkVehicleThread), _this, 5] call EFUNC(common,waitAndExecute); + [FUNC(checkVehicleThread), _this, 5] call CBA_fnc_waitAndExecute; }; diff --git a/addons/fastroping/functions/fnc_cutRopes.sqf b/addons/fastroping/functions/fnc_cutRopes.sqf index dcabda56ba..d619a24297 100644 --- a/addons/fastroping/functions/fnc_cutRopes.sqf +++ b/addons/fastroping/functions/fnc_cutRopes.sqf @@ -36,7 +36,7 @@ _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; //Only delete the hook first so the rope falls down. //Note: ropeDetach was used here before, but the command seems a bit broken. deleteVehicle _hook; - [{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy], 60] call EFUNC(common,waitAndExecute); + [{{deleteVehicle _x} count _this}, [_ropeTop, _ropeBottom, _dummy], 60] call CBA_fnc_waitAndExecute; } count _deployedRopes; _vehicle setVariable [QGVAR(deployedRopes), [], true]; @@ -50,4 +50,4 @@ if (isText (_config >> QGVAR(onCut))) then { [{ _this setVariable [QGVAR(deploymentStage), 0, true]; -}, _vehicle, _waitTime] call EFUNC(common,waitAndExecute); +}, _vehicle, _waitTime] call CBA_fnc_waitAndExecute; diff --git a/addons/fastroping/functions/fnc_deployAI.sqf b/addons/fastroping/functions/fnc_deployAI.sqf index dd4bfe4e71..843f23cdb5 100644 --- a/addons/fastroping/functions/fnc_deployAI.sqf +++ b/addons/fastroping/functions/fnc_deployAI.sqf @@ -64,7 +64,7 @@ _deployTime = 0; if (getText (_config >> QGVAR(onPrepare)) != "") then { _deployTime = [_vehicle] call (missionNamespace getVariable (getText (_config >> QGVAR(onPrepare)))); }; -[{[_this] call FUNC(deployRopes)}, _vehicle, _deployTime] call EFUNC(common,waitAndExecute); +[{[_this] call FUNC(deployRopes)}, _vehicle, _deployTime] call CBA_fnc_waitAndExecute; driver _vehicle disableAI "MOVE"; DFUNC(deployAIRecursive) = { @@ -80,8 +80,8 @@ DFUNC(deployAIRecursive) = { params ["_vehicle"]; private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []]; ({!(_x select 5)} count (_deployedRopes)) > 0 - }, FUNC(deployAIRecursive), _this] call EFUNC(common,waitUntilAndExecute); - }, [_vehicle, _unitsToDeploy], 1] call EFUNC(common,waitAndExecute); + }, FUNC(deployAIRecursive), _this] call CBA_fnc_waitUntilAndExecute; + }, [_vehicle, _unitsToDeploy], 1] call CBA_fnc_waitAndExecute; } else { [{ private _deployedRopes = _this getVariable [QGVAR(deployedRopes), []]; @@ -89,8 +89,8 @@ DFUNC(deployAIRecursive) = { }, { [_this] call FUNC(cutRopes); driver _this enableAI "MOVE"; - }, _vehicle] call EFUNC(common,waitUntilAndExecute); + }, _vehicle] call CBA_fnc_waitUntilAndExecute; }; }; -[FUNC(deployAIRecursive), [_vehicle, _unitsToDeploy], _deployTime + 4] call EFUNC(common,waitAndExecute); +[FUNC(deployAIRecursive), [_vehicle, _unitsToDeploy], _deployTime + 4] call CBA_fnc_waitAndExecute; diff --git a/addons/fastroping/functions/fnc_equipFRIES.sqf b/addons/fastroping/functions/fnc_equipFRIES.sqf index eaf603f938..6d714611be 100644 --- a/addons/fastroping/functions/fnc_equipFRIES.sqf +++ b/addons/fastroping/functions/fnc_equipFRIES.sqf @@ -35,6 +35,6 @@ if !(isNumber (_config >> QGVAR(enabled))) then { [_vehicle] call FUNC(cutRopes); }; }]; - [FUNC(checkVehicleThread), [_vehicle, _fries], 5] call EFUNC(common,waitAndExecute); + [FUNC(checkVehicleThread), [_vehicle, _fries], 5] call CBA_fnc_waitAndExecute; }; }; diff --git a/addons/fastroping/functions/fnc_fastRope.sqf b/addons/fastroping/functions/fnc_fastRope.sqf index 17991c538e..0db73f4fce 100644 --- a/addons/fastroping/functions/fnc_fastRope.sqf +++ b/addons/fastroping/functions/fnc_fastRope.sqf @@ -35,6 +35,6 @@ _deployedRopes set [_usableRopeIndex, _usableRope]; _vehicle setVariable [QGVAR(deployedRopes), _deployedRopes, true]; //Start server PFH asap -[QGVAR(startFastRope), [_unit, _vehicle, _usableRope, _usableRopeIndex, false]] call EFUNC(common,serverEvent); +[QGVAR(startFastRope), [_unit, _vehicle, _usableRope, _usableRopeIndex, false]] call CBA_fnc_serverEvent; moveOut _unit; -[FUNC(fastRopeLocalPFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex, ACE_diagTime]] call CBA_fnc_addPerFrameHandler; +[FUNC(fastRopeLocalPFH), 0, [_unit, _vehicle, _usableRope, _usableRopeIndex, diag_tickTime]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/fastroping/functions/fnc_fastRopeLocalPFH.sqf b/addons/fastroping/functions/fnc_fastRopeLocalPFH.sqf index 03df460f55..72177bce00 100644 --- a/addons/fastroping/functions/fnc_fastRopeLocalPFH.sqf +++ b/addons/fastroping/functions/fnc_fastRopeLocalPFH.sqf @@ -38,12 +38,14 @@ if (isNull attachedTo _unit) exitWith { [_unit, "", 2] call EFUNC(common,doAnimation); _unit setVectorUp [0, 0, 1]; - playSound QGVAR(Thud); + if (_unit == ACE_player) then { + playSound QGVAR(Thud); + }; [_pfhHandle] call CBA_fnc_removePerFrameHandler; }; -if (ACE_diagTime > _timeToPlayRopeSound) then { +if (_unit == ACE_player && {diag_tickTime > _timeToPlayRopeSound}) then { _arguments set [4, (_timeToPlayRopeSound + 1)]; playSound QGVAR(Rope); }; diff --git a/addons/fastroping/functions/fnc_onCutCommon.sqf b/addons/fastroping/functions/fnc_onCutCommon.sqf index 404f94e9d8..004c176b65 100644 --- a/addons/fastroping/functions/fnc_onCutCommon.sqf +++ b/addons/fastroping/functions/fnc_onCutCommon.sqf @@ -30,7 +30,7 @@ if !(isNull _fries) then { _this animate ["dvere1_posunZ", 0]; _this animate ["dvere2_posunZ", 0]; _this setVariable [QGVAR(doorsLocked), false, true]; - }, _vehicle, 2] call EFUNC(common,waitAndExecute); + }, _vehicle, 2] call CBA_fnc_waitAndExecute; 4 } else { diff --git a/addons/fastroping/functions/fnc_onPrepareCommon.sqf b/addons/fastroping/functions/fnc_onPrepareCommon.sqf index 5e8bf931bb..37eb6c7eb8 100644 --- a/addons/fastroping/functions/fnc_onPrepareCommon.sqf +++ b/addons/fastroping/functions/fnc_onPrepareCommon.sqf @@ -35,7 +35,7 @@ if !(isNull _fries) then { [{ _this animate ["extendHookRight", 1]; _this animate ["extendHookLeft", 1]; - }, _fries, 2] call EFUNC(common,waitAndExecute); + }, _fries, 2] call CBA_fnc_waitAndExecute; _waitTime = 4; }; diff --git a/addons/fastroping/functions/fnc_prepareFRIES.sqf b/addons/fastroping/functions/fnc_prepareFRIES.sqf index 4896259014..e4bce8458c 100644 --- a/addons/fastroping/functions/fnc_prepareFRIES.sqf +++ b/addons/fastroping/functions/fnc_prepareFRIES.sqf @@ -29,4 +29,4 @@ if (isText (_config >> QGVAR(onPrepare))) then { [{ _this setVariable [QGVAR(deploymentStage), 2, true]; -}, _vehicle, _waitTime] call EFUNC(common,waitAndExecute); +}, _vehicle, _waitTime] call CBA_fnc_waitAndExecute; diff --git a/addons/fastroping/script_component.hpp b/addons/fastroping/script_component.hpp index 3770bfe0d4..bb0b891f2b 100644 --- a/addons/fastroping/script_component.hpp +++ b/addons/fastroping/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT fastroping +#define COMPONENT_BEAUTIFIED Fastroping #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/fastroping/stringtable.xml b/addons/fastroping/stringtable.xml index 7b0e4ad1f8..7525921b2f 100644 --- a/addons/fastroping/stringtable.xml +++ b/addons/fastroping/stringtable.xml @@ -9,6 +9,7 @@ Equipar FRIES Equipaggia la FRIES Vybavit FRIES + Equipar FRIES Equips compatible helicopters with a Fast Rope Insertion Extraction System. @@ -18,6 +19,7 @@ Equipar helicoptero compatible con un Sistema de Inserción Extracción Fast Rope. Equipagga l'elicottero compatibile con il Fast Rope Insertion Exstraction System Vybavit kompatibilní vrtulníky systémem Fast Rope Insertion Extraction (FRIES). + Equipa um helicóptero compatível com o Fast Rope Insertion Exctraction System. Prepare fast roping system @@ -27,6 +29,7 @@ Preparar el sistema fast roping Prepara le corde Připravit systém slaňování + Prepara sistema de descida rápida Deploy ropes @@ -36,6 +39,7 @@ Desplegar cuerdas Srotola le corde Připravit lana + Jogar cordas Fast rope @@ -45,6 +49,7 @@ Descender por la cuerda Scendi sulla corda SLANIT + Descida rápida Cut ropes @@ -54,15 +59,17 @@ Cortar cuerdas Taglia le corde Odříznout lano + Cortar cordas Equip helicopter with FRIES Rüste Helicopter mit FRIES aus Wyposaż helikopter w FRIES - Equiper l'hélicoptère avec le FRIED + Equiper l'hélicoptère avec le FRIES Equipar helicoptero con FRIES Equipaggia l'elicottero con FRIES Vybavit vrtulník pomocí FRIES + Equipar helicóptero com FRIES Equips the selected helicopter with a Fast Rope Insertion Extraction System @@ -72,11 +79,14 @@ Equipa el helicoptero seleccionado con un Sistema de Inserción Extracción Fast Rope Equipaggia l'elicottero selezionato con il Fast Rope Insertion Extraction System Vybavit vybraný vrtulník systémem Fast Rope Insertion Extraction (FRIES) + Equipa um helicóptero selecionado com um sistema de Fast Rope Insertion Extraction System LET UNITS FAST ROPE EINHEITEN ABSEILEN LASSEN SCENDI DALLE CORDE + Equipa o helicóptero selecionado com o Fast Rope Insertion Extraction System + LAISSER LES UNITES UTILISER LA CORDE \ No newline at end of file diff --git a/addons/fcs/ACE_UI.hpp b/addons/fcs/ACE_UI.hpp new file mode 100644 index 0000000000..ca35779f36 --- /dev/null +++ b/addons/fcs/ACE_UI.hpp @@ -0,0 +1,7 @@ +class ACE_UI { + class gunnerZeroing { + class conditions { + ADDON = "false"; + }; + }; +}; diff --git a/addons/fcs/CfgWeapons.hpp b/addons/fcs/CfgWeapons.hpp index ec72bc6f44..760e39e2de 100644 --- a/addons/fcs/CfgWeapons.hpp +++ b/addons/fcs/CfgWeapons.hpp @@ -12,7 +12,7 @@ class CfgWeapons { }; class autocannon_35mm: CannonCore { canLock = 0; - ballisticsComputer = 0; + ballisticsComputer = 4; //was "4 + 2", 2 is for manual zeroing, 4 is for the lead indicator - https://community.bistudio.com/wiki/A3_Locking_Review#ballisticsComputer magazines[] += {"ACE_120Rnd_35mm_ABM_shells","ACE_120Rnd_35mm_ABM_shells_Tracer_Red","ACE_120Rnd_35mm_ABM_shells_Tracer_Green","ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow"}; }; diff --git a/addons/fcs/XEH_postInit.sqf b/addons/fcs/XEH_postInit.sqf index 25fd09ba8c..02c9e72ae5 100644 --- a/addons/fcs/XEH_postInit.sqf +++ b/addons/fcs/XEH_postInit.sqf @@ -8,16 +8,16 @@ if (!hasInterface) exitWith {}; #include "initKeybinds.sqf" -["infoDisplayChanged", { +["ace_infoDisplayChanged", { if (!isNull ((_this select 0) displayCtrl 1713151)) then { uiNamespace setVariable ["ACE_dlgRangefinder", _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0,0,0,0]; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Register fire event handler -["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); -["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["ace_firedPlayerVehicle", DFUNC(firedEH)] call CBA_fnc_addEventHandler; +["ace_firedPlayerVehicleNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler; // Register event for global updates -[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); +[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call CBA_fnc_addEventHandler; diff --git a/addons/fcs/config.cpp b/addons/fcs/config.cpp index 12edf02ba3..29aba659b5 100644 --- a/addons/fcs/config.cpp +++ b/addons/fcs/config.cpp @@ -2,17 +2,23 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"KoffeinFlummi","BadGuy (simon84)","commy2"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","BadGuy (simon84)","commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; + + // this prevents any patched class from requiring this addon + addonRootClass = "A3_Characters_F"; }; }; #include "CfgEventHandlers.hpp" +#include "ACE_UI.hpp" #include "CfgAmmo.hpp" #include "CfgMagazines.hpp" diff --git a/addons/fcs/functions/fnc_calculateSolution.sqf b/addons/fcs/functions/fnc_calculateSolution.sqf index 6d489de006..61bfbd8c58 100644 --- a/addons/fcs/functions/fnc_calculateSolution.sqf +++ b/addons/fcs/functions/fnc_calculateSolution.sqf @@ -8,7 +8,7 @@ * 2: Target distance * 3: Azimuth offset * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index b57435f388..cf0dcf2674 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -2,7 +2,7 @@ * Author: KoffeinFlummi * Called from config. Can player reset FCS? * - * Argument: + * Arguments: * Nothing * * Return Value: diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index 3899584788..de4af99d7a 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -18,3 +18,4 @@ getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 && {cameraView == "GUNNER"} && {!([ACE_player] call CBA_fnc_canUseWeapon)} //Not Turned Out +&& {cameraOn != (getConnectedUAV ACE_player)} //Not Controlling a UAV diff --git a/addons/fcs/functions/fnc_getRange.sqf b/addons/fcs/functions/fnc_getRange.sqf index 64619241c4..ba49621047 100644 --- a/addons/fcs/functions/fnc_getRange.sqf +++ b/addons/fcs/functions/fnc_getRange.sqf @@ -2,13 +2,13 @@ * Author: commy2 * Read laser distance measurement from engine. * - * Argument: + * Arguments: * 0: Measurement Accuracy (default: 1) * 1: Maximum measure distance (default: 5000) * 2: Minimum measure distance (default: 0) * 3: Blank display on range error (default: false) * - * Return value: + * Return Value: * Measured distance * * Public: No diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index e61baed136..3c4943badf 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -29,7 +29,7 @@ private _distance = [ if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; -GVAR(time) = ACE_time; +GVAR(time) = CBA_missionTime; private _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 113d369a3c..a07f5d5d35 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -44,10 +44,10 @@ private _angleTarget = asin (_weaponDirection select 2); private _movingAzimuth = 0; -if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then { +if (CBA_missionTime - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then { // calculate speed of target private _posTarget = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance); - private _velocityTarget = (_posTarget vectorDiff GVAR(position)) vectorMultiply (1 / (ACE_time - GVAR(time))); + private _velocityTarget = (_posTarget vectorDiff GVAR(position)) vectorMultiply (1 / (CBA_missionTime - GVAR(time))); // estimate time to target private _magazine = _vehicle currentMagazineTurret _turret; diff --git a/addons/fcs/functions/fnc_onForceUpdate.sqf b/addons/fcs/functions/fnc_onForceUpdate.sqf index 1bf1f0d701..2c6d136300 100644 --- a/addons/fcs/functions/fnc_onForceUpdate.sqf +++ b/addons/fcs/functions/fnc_onForceUpdate.sqf @@ -1,13 +1,13 @@ -#include "script_component.hpp" - -params ["_unit"]; - -private _vehicle = vehicle _unit; - -if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false}; -if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; - -private _turret = [_unit] call EFUNC(common,getTurretIndex); - -[_vehicle, _turret] call FUNC(keyDown); -[_vehicle, _turret] call FUNC(keyUp); +#include "script_component.hpp" + +params ["_unit"]; + +private _vehicle = vehicle _unit; + +if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false}; +if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; + +private _turret = [_unit] call EFUNC(common,getTurretIndex); + +[_vehicle, _turret] call FUNC(keyDown); +[_vehicle, _turret] call FUNC(keyUp); diff --git a/addons/fcs/functions/fnc_updateRangeHUD.sqf b/addons/fcs/functions/fnc_updateRangeHUD.sqf index 374254c620..0bb15b2507 100644 --- a/addons/fcs/functions/fnc_updateRangeHUD.sqf +++ b/addons/fcs/functions/fnc_updateRangeHUD.sqf @@ -2,10 +2,10 @@ * Author: commy2 * Update compatible info elements. * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/fcs/script_component.hpp b/addons/fcs/script_component.hpp index e3f9181526..6f5aa2cc86 100644 --- a/addons/fcs/script_component.hpp +++ b/addons/fcs/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT fcs +#define COMPONENT_BEAUTIFIED FCS #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/fcs/stringtable.xml b/addons/fcs/stringtable.xml index 8750d2a4e3..2623351972 100644 --- a/addons/fcs/stringtable.xml +++ b/addons/fcs/stringtable.xml @@ -19,7 +19,7 @@ Ajustado a Wyzerowany na Nastaveno na - Zéroté à + Remise à zéro à Выставлено на Nullázási táv Fixado em diff --git a/addons/finger/ACE_Settings.hpp b/addons/finger/ACE_Settings.hpp index a4beb40eb8..73e1db1904 100644 --- a/addons/finger/ACE_Settings.hpp +++ b/addons/finger/ACE_Settings.hpp @@ -1,27 +1,27 @@ -class ACE_Settings { - class GVAR(enabled) { - value = 0; - typeName = "BOOL"; - displayName = CSTRING(enabled_displayName); - }; - class GVAR(maxRange) { - value = 4; - typeName = "SCALAR"; - displayName = CSTRING(maxRange_displayName); - description = CSTRING(maxRange_description); - }; - class GVAR(indicatorForSelf) { - value = 1; - typeName = "BOOL"; - isClientSettable = 1; - displayName = CSTRING(indicatorForSelf_name); - description = CSTRING(indicatorForSelf_description); - }; - class GVAR(indicatorColor) { - value[] = {0.83, 0.68, 0.21, 0.75}; - typeName = "COLOR"; - isClientSettable = 1; - displayName = CSTRING(indicatorColor_name); - description = CSTRING(indicatorColor_description); - }; -}; +class ACE_Settings { + class GVAR(enabled) { + value = 0; + typeName = "BOOL"; + displayName = CSTRING(enabled_displayName); + }; + class GVAR(maxRange) { + value = 4; + typeName = "SCALAR"; + displayName = CSTRING(maxRange_displayName); + description = CSTRING(maxRange_description); + }; + class GVAR(indicatorForSelf) { + value = 1; + typeName = "BOOL"; + isClientSettable = 1; + displayName = CSTRING(indicatorForSelf_name); + description = CSTRING(indicatorForSelf_description); + }; + class GVAR(indicatorColor) { + value[] = {0.83, 0.68, 0.21, 0.75}; + typeName = "COLOR"; + isClientSettable = 1; + displayName = CSTRING(indicatorColor_name); + description = CSTRING(indicatorColor_description); + }; +}; diff --git a/addons/finger/CfgVehicles.hpp b/addons/finger/CfgVehicles.hpp index 74229968e4..8125e7f2f5 100644 --- a/addons/finger/CfgVehicles.hpp +++ b/addons/finger/CfgVehicles.hpp @@ -4,7 +4,7 @@ class CfgVehicles { scope = 2; category = "ACE"; displayName = CSTRING(moduleSettings_displayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_finger_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_finger_ca.paa); function = QFUNC(moduleSettings); isGlobal = 0; isSingular = 1; diff --git a/addons/finger/XEH_postInit.sqf b/addons/finger/XEH_postInit.sqf index 94a22d7224..a1b7ebb9f0 100644 --- a/addons/finger/XEH_postInit.sqf +++ b/addons/finger/XEH_postInit.sqf @@ -6,18 +6,18 @@ GVAR(lastFPTime) = -1; GVAR(fingersHash) = HASH_CREATE; GVAR(pfeh_id) = -1; -["SettingsInitialized", { - //If not enabled, dont't bother adding keybind or eventhandler +["ace_settingsInitialized", { + //If not enabled, dont't bother adding eventhandler + TRACE_1("ace_settingsInitialized eh", GVAR(enabled)); if (!GVAR(enabled)) exitWith {}; + [QGVAR(fingered), {_this call FUNC(incomingFinger)}] call CBA_fnc_addEventHandler; +}] call CBA_fnc_addEventHandler; - [QGVAR(fingered), {_this call FUNC(incomingFinger)}] call EFUNC(common,addEventHandler); - - ["ACE3 Common", - QGVAR(finger), - [(localize LSTRING(keyComb)), (localize LSTRING(keyComb_description))], - { - _this call FUNC(keyPress); - }, - {false}, - [41, [true, false, false]], true] call CBA_fnc_addKeybind; // Shift + Tilda (hold) -}] call EFUNC(common,addEventHandler); +//Add Keybind: +["ACE3 Common", QGVAR(finger), [(localize LSTRING(keyComb)), (localize LSTRING(keyComb_description))], +{ + if (!GVAR(enabled)) exitWith {false}; + _this call FUNC(keyPress); +}, +{false}, +[41, [true, false, false]], true] call CBA_fnc_addKeybind; // Shift + Tilda (hold) diff --git a/addons/finger/config.cpp b/addons/finger/config.cpp index 2cc3be5ddd..ec1fd596b0 100644 --- a/addons/finger/config.cpp +++ b/addons/finger/config.cpp @@ -1,18 +1,20 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {QGVAR(moduleSettings)}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"Drill"}; - authorUrl = "https://github.com/TheDrill/"; - VERSION_CONFIG; - }; -}; - - -#include "ACE_Settings.hpp" -#include "CfgEventHandlers.hpp" -#include "CfgVehicles.hpp" +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {QGVAR(moduleSettings)}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Drill"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index 02c870a519..0f34f3f215 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Source Unit (can be self) - * 1: Position being pointed at (from positionCameraToWorld) + * 1: Position being pointed at (ASL) * * Return Value: * None @@ -16,18 +16,18 @@ */ #include "script_component.hpp" -private ["_data", "_fingerPos"]; +params ["_sourceUnit", "_fingerPosPrecise", "_distance"]; -params ["_sourceUnit", "_fingerPosPrecise"]; - -//add some random float to location if it's not our own finger: -_fingerPos = if (_sourceUnit == ACE_player) then { +// Add some random float to location if it's not our own finger: +private _fingerPos = if (_sourceUnit == ACE_player) then { _fingerPosPrecise } else { - _fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] + _fingerPosPrecise vectorAdd ([random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance) }; -_data = [ACE_diagTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))]; +TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); + +private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))]; HASH_SET(GVAR(fingersHash), _sourceUnit, _data); if (GVAR(pfeh_id) == -1) then { diff --git a/addons/finger/functions/fnc_keyPress.sqf b/addons/finger/functions/fnc_keyPress.sqf index 1ce83d62dc..ec2d7722ad 100644 --- a/addons/finger/functions/fnc_keyPress.sqf +++ b/addons/finger/functions/fnc_keyPress.sqf @@ -15,7 +15,6 @@ */ #include "script_component.hpp" -private["_fingerPosPrecise", "_playerEyePos", "_sendFingerToPlayers", "_nearbyMen"]; if (!alive ACE_player) exitWith {false}; // Conditions: canInteract @@ -25,27 +24,31 @@ if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "Stat //Check camera view (not in GUNNER) if !(cameraView in ["INTERNAL", "EXTERNAL"]) exitWith {false}; //Exit if run recently (run every 1 seconds) -if (ACE_diagTime < (GVAR(lastFPTime) + FP_ACTION_TIMEOUT)) exitWith {true}; +if (diag_tickTime < (GVAR(lastFPTime) + FP_ACTION_TIMEOUT)) exitWith {true}; -GVAR(lastFPTime) = ACE_diagTime; +GVAR(lastFPTime) = diag_tickTime; -_fingerPosPrecise = positionCameraToWorld [0, 0, FP_DISTANCE]; -_playerEyePos = eyePos ACE_player; +// Find where is the finger pointing +private _originASL = AGLtoASL positionCameraToWorld [0, 0, 0]; +private _fingerPosASL = AGLtoASL positionCameraToWorld [0, 0, FP_DISTANCE]; +private _intersections = lineIntersectsSurfaces [_originASL, _fingerPosASL, ACE_player, vehicle ACE_player, true, 1]; +if !(_intersections isEqualTo []) then { + _fingerPosASL = _intersections select 0 select 0; +}; -_sendFingerToPlayers = []; - - -_nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); +// Find who should the finger be sent to +private _playerEyePosASL = eyePos ACE_player; +private _sendFingerToPlayers = []; +private _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); { _nearbyMen append (crew _x); } count (ACE_player nearObjects ["StaticWeapon", (GVAR(maxRange) + 2)]); - { - if ((((eyePos _x) vectorDistance _playerEyePos) < GVAR(maxRange)) && + if ((((eyePos _x) vectorDistance _playerEyePosASL) < GVAR(maxRange)) && {alive _x} && {(_x == (vehicle _x)) || {(vehicle _x) isKindOf "StaticWeapon"}} && {GVAR(indicatorForSelf) || {_x != ACE_player}} && - {!(lineIntersects [(eyePos _x), _playerEyePos, ACE_player, _x])} && + {!(lineIntersects [(eyePos _x), _playerEyePosASL, ACE_player, _x])} && {[_x] call EFUNC(common,isPlayer)}) then { _sendFingerToPlayers pushBack _x; @@ -55,7 +58,7 @@ _nearbyMen = (ACE_player nearObjects ["CAManBase", (GVAR(maxRange) + 2)]); TRACE_1("sending finger to",_sendFingerToPlayers); -[QGVAR(fingered), _sendFingerToPlayers, [ACE_player, _fingerPosPrecise]] call EFUNC(common,targetEvent); +[QGVAR(fingered), [ACE_player, _fingerPosASL, _originASL vectorDistance _fingerPosASL], _sendFingerToPlayers] call CBA_fnc_targetEvent; ACE_player playActionNow "GestureGo"; diff --git a/addons/finger/functions/fnc_perFrameEH.sqf b/addons/finger/functions/fnc_perFrameEH.sqf index 61c8f077ab..0263462d04 100644 --- a/addons/finger/functions/fnc_perFrameEH.sqf +++ b/addons/finger/functions/fnc_perFrameEH.sqf @@ -15,33 +15,26 @@ */ #include "script_component.hpp" -private["_drawColor", "_fovCorrection", "_iconSize", "_timeLeftToShow", "_cameraOffset"]; - if (!alive ACE_player) then {GVAR(fingersHash) = HASH_CREATE;}; // Conditions: canInteract if !([ACE_player, ACE_player, ["isNotInside"]] call EFUNC(common,canInteractWith)) then {GVAR(fingersHash) = HASH_CREATE;}; -//make sure player is dismounted or in a static weapon: +// Make sure player is dismounted or in a static weapon: if ((ACE_player != vehicle ACE_player) && {!((vehicle ACE_player) isKindOf "StaticWeapon")}) then {GVAR(fingersHash) = HASH_CREATE;}; -_cameraOffset = worldToScreen (positionCameraToWorld [1000, 0, 10000]); -_fovCorrection = 0; -if (count _cameraOffset > 0) then {_fovCorrection = (_cameraOffset select 0) - 0.5;}; -_iconSize = BASE_SIZE * _fovCorrection; +private _iconSize = BASE_SIZE * 0.10713 * (call EFUNC(common,getZoom)); { - _data = HASH_GET(GVAR(fingersHash), _x); + private _data = HASH_GET(GVAR(fingersHash), _x); _data params ["_lastTime", "_pos", "_name"]; - _timeLeftToShow = _lastTime + FP_TIMEOUT - ACE_diagTime; + private _timeLeftToShow = _lastTime + FP_TIMEOUT - diag_tickTime; if (_timeLeftToShow <= 0) then { HASH_REM(GVAR(fingersHash), _x); } else { - _drawColor = + GVAR(indicatorColor); - //Fade out: - if (_timeLeftToShow < 0.5) then { - _drawColor set [3, ((_drawColor select 3) * (_timeLeftToShow / 0.5))]; - }; + private _drawColor = + GVAR(indicatorColor); + // Fade out: + _drawColor set [3, ((_drawColor select 3) * ((_timeLeftToShow min 0.5) / 0.5))]; - drawIcon3D [QUOTE(PATHTOF(UI\fp_icon2.paa)), _drawColor, _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"]; + drawIcon3D [QPATHTOF(UI\fp_icon2.paa), _drawColor, ASLtoAGL _pos, _iconSize, _iconSize, 0, _name, 1, 0.03, "RobotoCondensed"]; }; } count (GVAR(fingersHash) select 0); diff --git a/addons/finger/script_component.hpp b/addons/finger/script_component.hpp index edaf93a942..85abc395f5 100644 --- a/addons/finger/script_component.hpp +++ b/addons/finger/script_component.hpp @@ -1,26 +1,27 @@ -#define COMPONENT finger -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_FINGER - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_FINGER - #define DEBUG_SETTINGS DEBUG_SETTINGS_FINGER -#endif - -#include "\z\ace\addons\main\script_macros.hpp" - -#define BASE_SIZE 44 - -#define FP_TIMEOUT 2 -#define FP_ACTION_TIMEOUT 1 - -#define FP_DISTANCE 10000 -#define FP_RANDOMIZATION_X 350 -#define FP_RANDOMIZATION_Y 100 +#define COMPONENT finger +#define COMPONENT_BEAUTIFIED Finger +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_FINGER + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_FINGER + #define DEBUG_SETTINGS DEBUG_SETTINGS_FINGER +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define BASE_SIZE 44 + +#define FP_TIMEOUT 2 +#define FP_ACTION_TIMEOUT 1 + +#define FP_DISTANCE 5000 +#define FP_RANDOMIZATION_X 0.0350 +#define FP_RANDOMIZATION_Y 0.0100 diff --git a/addons/finger/stringtable.xml b/addons/finger/stringtable.xml index 3f68d337f2..113b3e5c2e 100644 --- a/addons/finger/stringtable.xml +++ b/addons/finger/stringtable.xml @@ -5,7 +5,7 @@ Show pointing indicator to self Zeigersymbol einem selbst anzeigen Индикатор пальца для показывающего - Afficher un indicateur de pointage pour soi-même + Afficher un indicateur de pointage à soi-même Pokaż indykator wskazywania palcem dla siebie Saját mutatási indikátor megjelenítése Mostrar indicador para si mesmo @@ -41,7 +41,7 @@ Color of the pointing indicator circle Farbe des Zeigersymbols Цвет индикатора указания пальцем - Couleur de l'indicateur de pointage + Couleur du cercle de l'indicateur de pointage Kolor okręgu wyświetlanego przy wskazywaniu palcem Mutatási indikátor körének színe Cor do círculo de indicação @@ -64,7 +64,7 @@ Points, and shows a virtual marker of where you are looking to nearby units. Can be held down. Zeigt in der Nähe befindlichen Spielern die eigene Blickrichtung mit Hilfe eines Kreissymbols an. - Montre du doigt et affiche un marqueur virtuel de la direction pointée aux uinités proches. Peut être maintenu + Montre, et affiche un marqueur virtuel là ou vous regardez aux unités proches. Peut être maintenu. Wskazuje a także wyświetla wirtualny marker-okrąg w miejscu, w które patrzysz, dla wszystkich pobliskich jednostek. Może być przytrzymywany. Mutat, és elhelyez egy virtuális jelölőt a nézett területhez közeli egységekhez. Lenyomva tartható. Aponta e mostra um marcador virtual para onde você está olhando para unidades próximas. Pode ser utilizado para baixo. @@ -76,7 +76,7 @@ Pointing Settings Zeigen Einstellungen - Options "Montrer du doigt" + Options de pointage Ustawienia wskazywania palcem Ujj beállításai Preferências de apontamento @@ -88,7 +88,7 @@ Pointing Enabled Zeigen aktiviert - "Montrer du doigt" activé + Pointage activé Aktywuj wskazywanie Mutatás engedélyezése Apontamento ativado @@ -100,7 +100,7 @@ Pointing Max Range Maximale Zeigerreichweite - Distance maximale du pointage + Distance maximale de pointage Maks. zasięg wskazywania Ujj maximum hatótávja Distância máxima do apontamento @@ -122,4 +122,4 @@ Distanza massima tra giocatori per mostrare l'indicatore di puntamento [default: 4 metri] - + \ No newline at end of file diff --git a/addons/flashlights/CfgWeapons.hpp b/addons/flashlights/CfgWeapons.hpp index 09fe70d764..84edac6c85 100644 --- a/addons/flashlights/CfgWeapons.hpp +++ b/addons/flashlights/CfgWeapons.hpp @@ -17,8 +17,8 @@ class CfgWeapons { 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); + model = QPATHTOF(data\MX_991.p3d); + picture = QPATHTOF(UI\mx991_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; @@ -32,8 +32,8 @@ class CfgWeapons { 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); + model = QPATHTOF(data\KSF_1.p3d); + picture = QPATHTOF(UI\ksf1_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; @@ -47,8 +47,8 @@ class CfgWeapons { 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); + model = QPATHTOF(data\Maglight.p3d); + picture = QPATHTOF(UI\xl50_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/flashlights/config.cpp b/addons/flashlights/config.cpp index b34c4b8000..2242171822 100644 --- a/addons/flashlights/config.cpp +++ b/addons/flashlights/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_Flashlight_MX991", "ACE_Flashlight_KSF1", "ACE_Flashlight_XL50"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"voiper"}; - authorUrl = "https://github.com/voiperr/"; + author = ECSTRING(common,ACETeam); + authors[] = {"voiper"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/flashlights/script_component.hpp b/addons/flashlights/script_component.hpp index 90a91c3b72..3c89c041c5 100644 --- a/addons/flashlights/script_component.hpp +++ b/addons/flashlights/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT flashlights +#define COMPONENT_BEAUTIFIED Flashlights #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_FLASHLIGHTS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/flashlights/stringtable.xml b/addons/flashlights/stringtable.xml index dad3158b38..d8719d95ae 100644 --- a/addons/flashlights/stringtable.xml +++ b/addons/flashlights/stringtable.xml @@ -21,7 +21,7 @@ Svítilna s červeným filtrem. Pro nahlédnutí do mapy. Linterna con filtro rojo. Para su uso en el mapa. Torcia con filtro rosso. Da usare in mappa. - Lampe de poche avec un filtre rouge. Pour éclairer une carte. + Lampe torche avec un filtre rouge. Pour utilisation sur carte. Maglite XL50 @@ -43,7 +43,7 @@ Bílá mini svítilna. Pro nahlédnutí do mapy. Mini linterna blanca. Para su uso en el mapa. Mini-torcia bianca. Da usare in mappa. - Lampe de poche (blanche). Pour éclairer une carte. + Mini lampe torche blanche. Pour utilisation sur carte. KSF-1 @@ -65,7 +65,7 @@ Svítilna s červeným filtrem. Pro nahlédnutí do mapy. Linterna con filtro rojo. Para su uso en el mapa. Torcia con filtro rosso. Da usare in mappa. - Lampe de poche avec un filtre rouge. Pour éclairer une carte. + Lampe torche avec un filtre rouge. Pour utilisation sur carte. - + \ No newline at end of file diff --git a/addons/flashsuppressors/CfgWeapons.hpp b/addons/flashsuppressors/CfgWeapons.hpp index ae957ba4b0..e807dc2ae9 100644 --- a/addons/flashsuppressors/CfgWeapons.hpp +++ b/addons/flashsuppressors/CfgWeapons.hpp @@ -29,32 +29,73 @@ class asdg_MuzzleSlot_45ACP_SMG: asdg_MuzzleSlot { // for .45ACP universal mount ACE_muzzle_mzls_smg_01 = 1; }; }; +class asdg_MuzzleSlot_762MG: asdg_MuzzleSlot { // for 7.62, 6.5 and 5.56 universal mount MG suppressors + class compatibleItems { + ACE_muzzle_mzls_B = 1; + }; +}; class MuzzleSlot; class CfgWeapons { - - /* MX */ - - class Rifle; - class Rifle_Base_F: Rifle { + class Rifle_Base_F; + + class Rifle_Long_Base_F: Rifle_Base_F { class WeaponSlotsInfo; }; - class arifle_MX_Base_F: Rifle_Base_F { + /* MX */ + class arifle_MX_Base_F: Rifle_Base_F { + class WeaponSlotsInfo; + }; + + class arifle_MXC_F: arifle_MX_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; + }; + }; + }; + class arifle_MX_F: arifle_MX_Base_F { + class WeaponSlotsInfo: WeaponSlotsInfo { + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; + }; + }; + }; + class arifle_MX_GL_F: arifle_MX_Base_F { + class WeaponSlotsInfo: WeaponSlotsInfo { + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; }; }; }; - class arifle_MX_SW_F: arifle_MX_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - // Shit is broken again - //compatibleItems[] += {"ACE_muzzle_mzls_H"}; - compatibleItems[] = {"muzzle_snds_H","muzzle_snds_H_SW","ACE_muzzle_mzls_H"}; + class MuzzleSlot: asdg_MuzzleSlot_762MG { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; + }; + }; + }; + class arifle_MXM_F: arifle_MX_Base_F { + class WeaponSlotsInfo: WeaponSlotsInfo { + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; }; }; }; @@ -62,41 +103,49 @@ class CfgWeapons { /* Katiba */ - class arifle_katiba_Base_F: Rifle_Base_F { + class arifle_Katiba_Base_F: Rifle_Base_F { + class WeaponSlotsInfo; + }; + class arifle_Katiba_F: arifle_Katiba_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; + }; + }; + }; + class arifle_Katiba_C_F: arifle_Katiba_Base_F { + class WeaponSlotsInfo: WeaponSlotsInfo { + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; + }; + }; + }; + class arifle_Katiba_GL_F: arifle_Katiba_Base_F { + class WeaponSlotsInfo: WeaponSlotsInfo { + class MuzzleSlot: asdg_MuzzleSlot_762 { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; }; }; }; /* Other */ - - class Rifle_Long_Base_F: Rifle_Base_F { - class WeaponSlotsInfo; - }; - - class DMR_01_base_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; - }; - }; - }; - class LMG_Mk200_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_H"}; - }; - }; - }; - - class LMG_Zafir_F: Rifle_Long_Base_F { - class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: MuzzleSlot { - compatibleItems[] += {"ACE_muzzle_mzls_B"}; + class MuzzleSlot: asdg_MuzzleSlot_762MG { + class compatibleItems: compatibleItems { + ACE_muzzle_mzls_H = 1; + ACE_muzzle_mzls_B = 0; + }; }; }; }; diff --git a/addons/flashsuppressors/config.cpp b/addons/flashsuppressors/config.cpp index b8e0c1e120..7f499bb787 100644 --- a/addons/flashsuppressors/config.cpp +++ b/addons/flashsuppressors/config.cpp @@ -2,6 +2,7 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = { "ACE_muzzle_mzls_H", @@ -14,8 +15,9 @@ class CfgPatches { }; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/flashsuppressors/script_component.hpp b/addons/flashsuppressors/script_component.hpp index cb61bb6007..cfc61f8990 100644 --- a/addons/flashsuppressors/script_component.hpp +++ b/addons/flashsuppressors/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT flashsuppressors +#define COMPONENT_BEAUTIFIED Flash Suppressors #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_FLASHSUPPRESSORS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/fonts/CfgFontFamilies.hpp b/addons/fonts/CfgFontFamilies.hpp index 963a35fa8e..80c8114624 100644 --- a/addons/fonts/CfgFontFamilies.hpp +++ b/addons/fonts/CfgFontFamilies.hpp @@ -2,38 +2,38 @@ class CfgFontFamilies { class PixelSplitterBold { - fonts[] = { PATHTOF(PixelSplitterBold\PixelSplitterBold6), - PATHTOF(PixelSplitterBold\PixelSplitterBold7), - PATHTOF(PixelSplitterBold\PixelSplitterBold8), - PATHTOF(PixelSplitterBold\PixelSplitterBold9), - PATHTOF(PixelSplitterBold\PixelSplitterBold10), - PATHTOF(PixelSplitterBold\PixelSplitterBold11), - PATHTOF(PixelSplitterBold\PixelSplitterBold12), - PATHTOF(PixelSplitterBold\PixelSplitterBold13), - PATHTOF(PixelSplitterBold\PixelSplitterBold14), - PATHTOF(PixelSplitterBold\PixelSplitterBold15), - PATHTOF(PixelSplitterBold\PixelSplitterBold16), - PATHTOF(PixelSplitterBold\PixelSplitterBold17), - PATHTOF(PixelSplitterBold\PixelSplitterBold18), - PATHTOF(PixelSplitterBold\PixelSplitterBold19), - PATHTOF(PixelSplitterBold\PixelSplitterBold20), - PATHTOF(PixelSplitterBold\PixelSplitterBold21), - PATHTOF(PixelSplitterBold\PixelSplitterBold22), - PATHTOF(PixelSplitterBold\PixelSplitterBold23), - PATHTOF(PixelSplitterBold\PixelSplitterBold24), - PATHTOF(PixelSplitterBold\PixelSplitterBold25), - PATHTOF(PixelSplitterBold\PixelSplitterBold26), - PATHTOF(PixelSplitterBold\PixelSplitterBold27), - PATHTOF(PixelSplitterBold\PixelSplitterBold28), - PATHTOF(PixelSplitterBold\PixelSplitterBold29), - PATHTOF(PixelSplitterBold\PixelSplitterBold30), - PATHTOF(PixelSplitterBold\PixelSplitterBold31), - PATHTOF(PixelSplitterBold\PixelSplitterBold34), - PATHTOF(PixelSplitterBold\PixelSplitterBold35), - PATHTOF(PixelSplitterBold\PixelSplitterBold37), - PATHTOF(PixelSplitterBold\PixelSplitterBold46) + fonts[] = { QPATHTOF(PixelSplitterBold\PixelSplitterBold6), + QPATHTOF(PixelSplitterBold\PixelSplitterBold7), + QPATHTOF(PixelSplitterBold\PixelSplitterBold8), + QPATHTOF(PixelSplitterBold\PixelSplitterBold9), + QPATHTOF(PixelSplitterBold\PixelSplitterBold10), + QPATHTOF(PixelSplitterBold\PixelSplitterBold11), + QPATHTOF(PixelSplitterBold\PixelSplitterBold12), + QPATHTOF(PixelSplitterBold\PixelSplitterBold13), + QPATHTOF(PixelSplitterBold\PixelSplitterBold14), + QPATHTOF(PixelSplitterBold\PixelSplitterBold15), + QPATHTOF(PixelSplitterBold\PixelSplitterBold16), + QPATHTOF(PixelSplitterBold\PixelSplitterBold17), + QPATHTOF(PixelSplitterBold\PixelSplitterBold18), + QPATHTOF(PixelSplitterBold\PixelSplitterBold19), + QPATHTOF(PixelSplitterBold\PixelSplitterBold20), + QPATHTOF(PixelSplitterBold\PixelSplitterBold21), + QPATHTOF(PixelSplitterBold\PixelSplitterBold22), + QPATHTOF(PixelSplitterBold\PixelSplitterBold23), + QPATHTOF(PixelSplitterBold\PixelSplitterBold24), + QPATHTOF(PixelSplitterBold\PixelSplitterBold25), + QPATHTOF(PixelSplitterBold\PixelSplitterBold26), + QPATHTOF(PixelSplitterBold\PixelSplitterBold27), + QPATHTOF(PixelSplitterBold\PixelSplitterBold28), + QPATHTOF(PixelSplitterBold\PixelSplitterBold29), + QPATHTOF(PixelSplitterBold\PixelSplitterBold30), + QPATHTOF(PixelSplitterBold\PixelSplitterBold31), + QPATHTOF(PixelSplitterBold\PixelSplitterBold34), + QPATHTOF(PixelSplitterBold\PixelSplitterBold35), + QPATHTOF(PixelSplitterBold\PixelSplitterBold37), + QPATHTOF(PixelSplitterBold\PixelSplitterBold46) }; spaceWidth = 0.5; spacing = 0.065; }; -}; \ No newline at end of file +}; diff --git a/addons/fonts/config.cpp b/addons/fonts/config.cpp index f37dba286c..a698b681a0 100644 --- a/addons/fonts/config.cpp +++ b/addons/fonts/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_main"}; - author[] = {"jaynus"}; - authorUrl = "https://github.com/jaynus/"; + author = ECSTRING(common,ACETeam); + authors[] = {"jaynus"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/fonts/script_component.hpp b/addons/fonts/script_component.hpp index 3a7589b72a..735276e31c 100644 --- a/addons/fonts/script_component.hpp +++ b/addons/fonts/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT fonts +#define COMPONENT_BEAUTIFIED Fonts #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_FONTS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/frag/CfgAmmo.hpp b/addons/frag/CfgAmmo.hpp index cd6cc64cfd..defa634102 100644 --- a/addons/frag/CfgAmmo.hpp +++ b/addons/frag/CfgAmmo.hpp @@ -1,478 +1,478 @@ -#define BASE_DRAG -0.01 -#define HD_MULT 5 -#define BASE_DRAG_HD (BASE_DRAG*HD_MULT) - -class CfgAmmo { - //class ace_arty_105mm_m1_m782_time; - //class ace_arty_105mm_m1_m782_prox: ace_arty_105mm_m1_m782_time {}; - //class ace_arty_105mm_m1_m782_delay: ace_arty_105mm_m1_m782_prox { - // GVAR(skip) = 1; - //}; - - class Bo_GBU12_LGB; - class ACE_GBU12 : Bo_GBU12_LGB { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - GVAR(metal) = 140000; - GVAR(charge) = 87000; - GVAR(gurney_c) = 2320; - GVAR(gurney_k) = 1/2; - sideAirFriction = 0.04; - airFriction = 0.04; - laserLock = 0; - }; - - class GrenadeBase; - class Grenade; - class GrenadeHand: Grenade { - GVAR(enabled) = 1; - - GVAR(skip) = 0; - GVAR(force) = 1; - // This is a good high-drag frag type for grenades. - GVAR(classes)[] = {"ACE_frag_tiny_HD"}; - /* - These values are based on the M67 Grenade, should be tweaked for - individual grenades. - */ - GVAR(metal) = 210; // metal in grams - GVAR(charge) = 185; // explosive in grams - GVAR(gurney_c) = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations - GVAR(gurney_k) = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations - }; - class GrenadeHand_stone: GrenadeHand { - GVAR(skip) = 1; - }; - class SmokeShell: GrenadeHand { - GVAR(skip) = 1; - }; - - class RocketBase; - class R_Hydra_HE: RocketBase { - // Source: http://fas.org/man/dod-101/sys/missile/hydra-70.htm - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 3850; - GVAR(charge) = 1040; - GVAR(gurney_c) = 2700; - GVAR(gurney_k) = 1/2; - }; - //class R_57mm_HE: RocketBase { - // GVAR(skip) = 1; - //}; - - class R_80mm_HE: RocketBase { - GVAR(skip) = 1; - }; - - //class R_S8T_AT: RocketBase { - // GVAR(skip) = 1; - //}; - - class BombCore; - class Bo_Mk82: BombCore { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - GVAR(metal) = 140000; - GVAR(charge) = 87000; - GVAR(gurney_c) = 2320; - GVAR(gurney_k) = 1/2; - }; - - class G_40mm_HE: GrenadeBase { - // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M441 - GVAR(enabled) = 1; - GVAR(force) = 1; - - GVAR(classes)[] = {"ACE_frag_tiny_HD"}; - GVAR(metal) = 200; - GVAR(charge) = 32; - GVAR(gurney_c) = 2700; - GVAR(gurney_k) = 1/2; - }; - class G_40mm_HEDP: G_40mm_HE { - // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M433 - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_tiny_HD"}; - GVAR(metal) = 200; - GVAR(charge) = 45; - GVAR(gurney_c) = 2830; - GVAR(gurney_k) = 1/2; - }; - - class ACE_G_40mm_HEDP: G_40mm_HEDP { - }; - class ACE_G_40mm_HE: G_40mm_HE { - }; - class ACE_G_40mm_Practice: ACE_G_40mm_HE { - GVAR(skip) = 1; - GVAR(force) = 0; - }; - class ACE_G40mm_HE_VOG25P: G_40mm_HE { - GVAR(skip) = 0; - GVAR(force) = 1; - }; - - // curator ammo entries - class ShellBase; - class Sh_125mm_HEAT; - class Sh_155mm_AMOS: ShellBase { - // Source: http://www.globalsecurity.org/military/systems/munitions/m795.htm - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - GVAR(metal) = 36000; - GVAR(charge) = 9979; - GVAR(gurney_c) = 2440; - GVAR(gurney_k) = 1/2; - }; - class Sh_82mm_AMOS : Sh_155mm_AMOS { - // Source: http://www.arsenal-bg.com/defense_police/mortar_bombs_82mm.htm - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 3200; - GVAR(charge) = 420; - GVAR(gurney_c) = 2440; - GVAR(gurney_k) = 1/2; - }; - class ModuleOrdnanceMortar_F_Ammo: Sh_82mm_AMOS { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 800; - GVAR(charge) = 4200; - GVAR(gurney_c) = 2320; - GVAR(gurney_k) = 1/2; - }; - class Sh_105mm_HEAT_MP : Sh_125mm_HEAT { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 11400; - GVAR(charge) = 7100; - GVAR(gurney_c) = 2800; - GVAR(gurney_k) = 1/2; - }; - class Sh_120mm_HE : ShellBase { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 23000; - GVAR(charge) = 3148; - GVAR(gurney_c) = 2830; - GVAR(gurney_k) = 1/2; - }; - class Sh_125mm_HE: Sh_120mm_HE { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 16000; - GVAR(charge) = 3200; - GVAR(gurney_c) = 2440; - GVAR(gurney_k) = 1/2; - }; - class ModuleOrdnanceHowitzer_F_ammo: Sh_155mm_AMOS { - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; - GVAR(metal) = 1950; - GVAR(charge) = 15800; - GVAR(gurney_c) = 2320; - GVAR(gurney_k) = 1/2; - }; - - //class R_230mm_HE; - //class ModuleOrdnanceRocket_F_ammo: R_230mm_HE { - //}; - - //class R_230mm_fly; - //class ModuleOrdnanceRocket_F_subammo: R_230mm_fly { - //}; - // end of curator ammo entries - - //class R_SMAW_HEDP; - //class R_MEEWS_HEDP : R_SMAW_HEDP { - // GVAR(force) = 1; - // GVAR(multiplier) = 1.2; - //}; - - class MissileBase; - class Missile_AGM_02_F : MissileBase { - // Source: http://fas.org/man/dod-101/sys/smart/agm-65.htm - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 56250; - GVAR(charge) = 39000; - GVAR(gurney_c) = 2700; - GVAR(gurney_k) = 1/2; - }; - class M_Hellfire_AT: MissileBase { - // Source: http://www.designation-systems.net/dusrm/m-114.html - GVAR(enabled) = 1; - - GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; - GVAR(metal) = 8000; - GVAR(charge) = 2400; - GVAR(gurney_c) = 2700; - GVAR(gurney_k) = 1/2; - }; - - /* - class B_762x51_Ball; - class ACE_frag_base: B_762x51_Ball { ////TODO: B_762x45_Ball no longer exists, is this a valid replacement? - model = "\A3\Weapons_f\ammo\shell"; - timeToLive = 12; - typicalSpeed = 800; - // Fix sounds - effectFly = "AmmoClassic"; - soundDefault1[] = {"A3\sounds_f\weapons\hits\concrete_1.wav",0.158114,1,30}; - soundDefault2[] = {"A3\sounds_f\weapons\hits\concrete_2.wav",0.158114,1,30}; - soundDefault3[] = {"A3\sounds_f\weapons\hits\concrete_3.wav",0.158114,1,30}; - soundDefault4[] = {"A3\sounds_f\weapons\hits\concrete_4.wav",0.158114,1,30}; - soundDefault5[] = {"A3\sounds_f\weapons\hits\concrete_5.wav",0.158114,1,30}; - soundDefault6[] = {"A3\sounds_f\weapons\hits\concrete_6.wav",0.158114,1,30}; - soundDefault7[] = {"A3\sounds_f\weapons\hits\concrete_7.wav",0.158114,1,30}; - soundDefault8[] = {"A3\sounds_f\weapons\hits\concrete_8.wav",0.158114,1,30}; - soundGroundSoft1[] = {"A3\sounds_f\weapons\hits\soft_ground_1.wav",0.02811705,1,30}; - soundGroundSoft2[] = {"A3\sounds_f\weapons\hits\soft_ground_2.wav",0.02811705,1,30}; - soundGroundSoft3[] = {"A3\sounds_f\weapons\hits\soft_ground_3.wav",0.02811705,1,30}; - soundGroundSoft4[] = {"A3\sounds_f\weapons\hits\soft_ground_4.wav",0.02811705,1,30}; - soundGroundSoft5[] = {"A3\sounds_f\weapons\hits\soft_ground_5.wav",0.02811705,1,30}; - soundGroundSoft6[] = {"A3\sounds_f\weapons\hits\soft_ground_6.wav",0.02811705,1,30}; - soundGroundSoft7[] = {"A3\sounds_f\weapons\hits\soft_ground_7.wav",0.02811705,1,30}; - soundGroundSoft8[] = {"A3\sounds_f\weapons\hits\soft_ground_8.wav",0.02811705,1,30}; - soundGroundHard1[] = {"A3\sounds_f\weapons\hits\hard_ground_1.wav",0.62946,1,40}; - soundGroundHard2[] = {"A3\sounds_f\weapons\hits\hard_ground_2.wav",0.62946,1,40}; - soundGroundHard3[] = {"A3\sounds_f\weapons\hits\hard_ground_3.wav",0.62946,1,40}; - soundGroundHard4[] = {"A3\sounds_f\weapons\hits\hard_ground_4.wav",0.62946,1,40}; - soundGroundHard5[] = {"A3\sounds_f\weapons\hits\hard_ground_5.wav",0.62946,1,40}; - soundGroundHard6[] = {"A3\sounds_f\weapons\hits\hard_ground_6.wav",0.62946,1,40}; - soundGroundHard7[] = {"A3\sounds_f\weapons\hits\hard_ground_7.wav",0.62946,1,40}; - soundGroundHard8[] = {"A3\sounds_f\weapons\hits\hard_ground_8.wav",0.62946,1,40}; - soundMetal1[] = {"A3\sounds_f\weapons\hits\metal_1.wav",0.158114,1,45}; - soundMetal2[] = {"A3\sounds_f\weapons\hits\metal_2.wav",0.158114,1,45}; - soundMetal3[] = {"A3\sounds_f\weapons\hits\metal_3.wav",0.158114,1,45}; - soundMetal4[] = {"A3\sounds_f\weapons\hits\metal_4.wav",0.158114,1,45}; - soundMetal5[] = {"A3\sounds_f\weapons\hits\metal_5.wav",0.158114,1,45}; - soundMetal6[] = {"A3\sounds_f\weapons\hits\metal_6.wav",0.158114,1,45}; - soundMetal7[] = {"A3\sounds_f\weapons\hits\metal_7.wav",0.158114,1,45}; - soundMetal8[] = {"A3\sounds_f\weapons\hits\metal_8.wav",0.158114,1,45}; - soundGlass1[] = {"A3\sounds_f\weapons\hits\glass_1.wav",0.177828,1,25}; - soundGlass2[] = {"A3\sounds_f\weapons\hits\glass_2.wav",0.177828,1,25}; - soundGlass3[] = {"A3\sounds_f\weapons\hits\glass_3.wav",0.177828,1,25}; - soundGlass4[] = {"A3\sounds_f\weapons\hits\glass_4.wav",0.177828,1,25}; - soundGlass5[] = {"A3\sounds_f\weapons\hits\glass_5.wav",0.177828,1,25}; - soundGlass6[] = {"A3\sounds_f\weapons\hits\glass_6.wav",0.177828,1,25}; - soundGlass7[] = {"A3\sounds_f\weapons\hits\glass_7.wav",0.177828,1,25}; - soundGlass8[] = {"A3\sounds_f\weapons\hits\glass_8.wav",0.177828,1,25}; - soundGlassArmored1[] = {"A3\sounds_f\weapons\hits\glass_arm_1.wav",0.177828,1,30}; - soundGlassArmored2[] = {"A3\sounds_f\weapons\hits\glass_arm_2.wav",0.177828,1,30}; - soundGlassArmored3[] = {"A3\sounds_f\weapons\hits\glass_arm_3.wav",0.177828,1,30}; - soundGlassArmored4[] = {"A3\sounds_f\weapons\hits\glass_arm_4.wav",0.177828,1,30}; - soundGlassArmored5[] = {"A3\sounds_f\weapons\hits\glass_arm_5.wav",0.177828,1,30}; - soundGlassArmored6[] = {"A3\sounds_f\weapons\hits\glass_arm_6.wav",0.177828,1,30}; - soundGlassArmored7[] = {"A3\sounds_f\weapons\hits\glass_arm_7.wav",0.177828,1,30}; - soundGlassArmored8[] = {"A3\sounds_f\weapons\hits\glass_arm_8.wav",0.177828,1,30}; - soundVehiclePlate1[] = {"A3\sounds_f\weapons\hits\metal_plate_1.wav",0.281170,1,40}; - soundVehiclePlate2[] = {"A3\sounds_f\weapons\hits\metal_plate_2.wav",0.281170,1,40}; - soundVehiclePlate3[] = {"A3\sounds_f\weapons\hits\metal_plate_3.wav",0.281170,1,40}; - soundVehiclePlate4[] = {"A3\sounds_f\weapons\hits\metal_plate_4.wav",0.281170,1,40}; - soundVehiclePlate5[] = {"A3\sounds_f\weapons\hits\metal_plate_5.wav",0.281170,1,40}; - soundVehiclePlate6[] = {"A3\sounds_f\weapons\hits\metal_plate_6.wav",0.281170,1,40}; - soundVehiclePlate7[] = {"A3\sounds_f\weapons\hits\metal_plate_7.wav",0.281170,1,40}; - soundVehiclePlate8[] = {"A3\sounds_f\weapons\hits\metal_plate_8.wav",0.281170,1,40}; - soundWood1[] = {"A3\sounds_f\weapons\hits\wood_1.wav",0.158114,1,30}; - soundWood2[] = {"A3\sounds_f\weapons\hits\wood_2.wav",0.158114,1,30}; - soundWood3[] = {"A3\sounds_f\weapons\hits\wood_3.wav",0.158114,1,30}; - soundWood4[] = {"A3\sounds_f\weapons\hits\wood_4.wav",0.158114,1,30}; - soundWood5[] = {"A3\sounds_f\weapons\hits\wood_5.wav",0.158114,1,30}; - soundWood6[] = {"A3\sounds_f\weapons\hits\wood_6.wav",0.158114,1,30}; - soundWood7[] = {"A3\sounds_f\weapons\hits\wood_7.wav",0.158114,1,30}; - soundWood8[] = {"A3\sounds_f\weapons\hits\wood_8.wav",0.158114,1,30}; - soundHitBody1[] = {"A3\sounds_f\weapons\hits\body_1.wav",0.0177828,1,25}; - soundHitBody2[] = {"A3\sounds_f\weapons\hits\body_2.wav",0.0177828,1,25}; - soundHitBody3[] = {"A3\sounds_f\weapons\hits\body_3.wav",0.0177828,1,25}; - soundHitBody4[] = {"A3\sounds_f\weapons\hits\body_4.wav",0.0177828,1,25}; - soundHitBody5[] = {"A3\sounds_f\weapons\hits\body_5.wav",0.0177828,1,25}; - soundHitBody6[] = {"A3\sounds_f\weapons\hits\body_6.wav",0.0177828,1,25}; - soundHitBody7[] = {"A3\sounds_f\weapons\hits\body_7.wav",0.0177828,1,25}; - soundHitBody8[] = {"A3\sounds_f\weapons\hits\body_8.wav",0.0177828,1,25}; - soundHitBuilding1[] = {"A3\sounds_f\weapons\hits\building_1.wav",0.251189,1,30}; - soundHitBuilding2[] = {"A3\sounds_f\weapons\hits\building_2.wav",0.251189,1,30}; - soundHitBuilding3[] = {"A3\sounds_f\weapons\hits\building_3.wav",0.251189,1,30}; - soundHitBuilding4[] = {"A3\sounds_f\weapons\hits\building_4.wav",0.251189,1,30}; - soundHitBuilding5[] = {"A3\sounds_f\weapons\hits\building_5.wav",0.251189,1,30}; - soundHitBuilding6[] = {"A3\sounds_f\weapons\hits\building_6.wav",0.251189,1,30}; - soundHitBuilding7[] = {"A3\sounds_f\weapons\hits\building_7.wav",0.251189,1,30}; - soundHitBuilding8[] = {"A3\sounds_f\weapons\hits\building_8.wav",0.251189,1,30}; - soundHitFoliage1[] = {"A3\sounds_f\weapons\hits\foliage_1.wav",0.177828,1,25}; - soundHitFoliage2[] = {"A3\sounds_f\weapons\hits\foliage_2.wav",0.177828,1,25}; - soundHitFoliage3[] = {"A3\sounds_f\weapons\hits\foliage_3.wav",0.177828,1,25}; - soundHitFoliage4[] = {"A3\sounds_f\weapons\hits\foliage_4.wav",0.177828,1,25}; - soundHitFoliage5[] = {"A3\sounds_f\weapons\hits\foliage_5.wav",0.177828,1,25}; - soundHitFoliage6[] = {"A3\sounds_f\weapons\hits\foliage_6.wav",0.177828,1,25}; - soundHitFoliage7[] = {"A3\sounds_f\weapons\hits\foliage_7.wav",0.177828,1,25}; - soundHitFoliage8[] = {"A3\sounds_f\weapons\hits\foliage_8.wav",0.177828,1,25}; - soundPlastic1[] = {"A3\sounds_f\weapons\hits\plastic_1.wav",0.177828,1,25}; - soundPlastic2[] = {"A3\sounds_f\weapons\hits\plastic_2.wav",0.177828,1,25}; - soundPlastic3[] = {"A3\sounds_f\weapons\hits\plastic_3.wav",0.177828,1,25}; - soundPlastic4[] = {"A3\sounds_f\weapons\hits\plastic_4.wav",0.177828,1,25}; - soundPlastic5[] = {"A3\sounds_f\weapons\hits\plastic_5.wav",0.177828,1,25}; - soundPlastic6[] = {"A3\sounds_f\weapons\hits\plastic_6.wav",0.177828,1,25}; - soundPlastic7[] = {"A3\sounds_f\weapons\hits\plastic_7.wav",0.177828,1,25}; - soundPlastic8[] = {"A3\sounds_f\weapons\hits\plastic_8.wav",0.177828,1,25}; - soundConcrete1[] = {"A3\sounds_f\weapons\hits\concrete_1.wav",0.177828,1,35}; - soundConcrete2[] = {"A3\sounds_f\weapons\hits\concrete_2.wav",0.177828,1,35}; - soundConcrete3[] = {"A3\sounds_f\weapons\hits\concrete_3.wav",0.177828,1,35}; - soundConcrete4[] = {"A3\sounds_f\weapons\hits\concrete_4.wav",0.177828,1,35}; - soundConcrete5[] = {"A3\sounds_f\weapons\hits\concrete_5.wav",0.177828,1,35}; - soundConcrete6[] = {"A3\sounds_f\weapons\hits\concrete_6.wav",0.177828,1,35}; - soundConcrete7[] = {"A3\sounds_f\weapons\hits\concrete_7.wav",0.177828,1,35}; - soundConcrete8[] = {"A3\sounds_f\weapons\hits\concrete_8.wav",0.177828,1,35}; - soundRubber1[] = {"A3\sounds_f\weapons\hits\tyre_1.wav",0.158114,1,25}; - soundRubber2[] = {"A3\sounds_f\weapons\hits\tyre_2.wav",0.158114,1,25}; - soundRubber3[] = {"A3\sounds_f\weapons\hits\tyre_3.wav",0.158114,1,25}; - soundRubber4[] = {"A3\sounds_f\weapons\hits\tyre_4.wav",0.158114,1,25}; - soundRubber5[] = {"A3\sounds_f\weapons\hits\tyre_5.wav",0.158114,1,25}; - soundRubber6[] = {"A3\sounds_f\weapons\hits\tyre_6.wav",0.158114,1,25}; - soundRubber7[] = {"A3\sounds_f\weapons\hits\tyre_7.wav",0.158114,1,25}; - soundRubber8[] = {"A3\sounds_f\weapons\hits\tyre_8.wav",0.158114,1,25}; - soundWater1[] = {"A3\sounds_f\weapons\hits\water_01.wav",0.158114,1,25}; - soundWater2[] = {"A3\sounds_f\weapons\hits\water_02.wav",0.158114,1,25}; - soundWater3[] = {"A3\sounds_f\weapons\hits\water_03.wav",0.158114,1,25}; - soundWater4[] = {"A3\sounds_f\weapons\hits\water_04.wav",0.158114,1,25}; - soundWater5[] = {"A3\sounds_f\weapons\hits\water_05.wav",0.158114,1,25}; - soundWater6[] = {"A3\sounds_f\weapons\hits\water_06.wav",0.158114,1,25}; - soundWater7[] = {"A3\sounds_f\weapons\hits\water_07.wav",0.158114,1,25}; - soundWater8[] = {"A3\sounds_f\weapons\hits\water_08.wav",0.158114,1,25}; - hitGroundSoft[] = {"soundGroundSoft1",0.2,"soundGroundSoft2",0.2,"soundGroundSoft3",0.1,"soundGroundSoft4",0.1,"soundGroundSoft5",0.1,"soundGroundSoft6",0.1,"soundGroundSoft7",0.1,"soundGroundSoft8",0.1}; - hitGroundHard[] = {"soundGroundHard1",0.2,"soundGroundHard2",0.2,"soundGroundHard3",0.1,"soundGroundHard4",0.1,"soundGroundHard5",0.1,"soundGroundHard6",0.1,"soundGroundHard7",0.1,"soundGroundHard8",0.1}; - hitMan[] = {"soundHitBody1",0.125,"soundHitBody2",0.125,"soundHitBody3",0.125,"soundHitBody4",0.125,"soundHitBody5",0.125,"soundHitBody6",0.125,"soundHitBody7",0.125,"soundHitBody8",0.125}; - hitArmor[] = {"soundVehiclePlate1",0.125,"soundVehiclePlate2",0.125,"soundVehiclePlate3",0.125,"soundVehiclePlate4",0.125,"soundVehiclePlate5",0.125,"soundVehiclePlate6",0.125,"soundVehiclePlate7",0.125,"soundVehiclePlate8",0.125}; - hitBuilding[] = {"soundHitBuilding1",0.2,"soundHitBuilding2",0.2,"soundHitBuilding3",0.1,"soundHitBuilding4",0.1,"soundHitBuilding5",0.1,"soundHitBuilding6",0.1,"soundHitBuilding7",0.1,"soundHitBuilding8",0.1}; - hitFoliage[] = {"soundHitFoliage1",0.125,"soundHitFoliage2",0.125,"soundHitFoliage3",0.125,"soundHitFoliage4",0.125,"soundHitFoliage5",0.125,"soundHitFoliage6",0.125,"soundHitFoliage7",0.125,"soundHitFoliage8",0.125}; - hitWood[] = {"soundWood1",0.125,"soundWood2",0.125,"soundWood3",0.125,"soundWood4",0.125,"soundWood5",0.125,"soundWood6",0.125,"soundWood7",0.125,"soundWood8",0.125}; - hitGlass[] = {"soundGlass1",0.125,"soundGlass2",0.125,"soundGlass3",0.125,"soundGlass4",0.125,"soundGlass5",0.125,"soundGlass6",0.125,"soundGlass7",0.125,"soundGlass8",0.125}; - hitGlassArmored[] = {"soundGlassArmored1",0.125,"soundGlassArmored2",0.125,"soundGlassArmored3",0.125,"soundGlassArmored4",0.125,"soundGlassArmored5",0.125,"soundGlassArmored6",0.125,"soundGlassArmored7",0.125,"soundGlassArmored8",0.125}; - hitConcrete[] = {"soundConcrete1",0.125,"soundConcrete2",0.125,"soundConcrete3",0.125,"soundConcrete4",0.125,"soundConcrete5",0.125,"soundConcrete6",0.125,"soundConcrete7",0.125,"soundConcrete8",0.125}; - hitRubber[] = {"soundRubber1",0.125,"soundRubber2",0.125,"soundRubber3",0.125,"soundRubber4",0.125,"soundRubber5",0.125,"soundRubber6",0.125,"soundRubber7",0.125,"soundRubber8",0.125}; - hitPlastic[] = {"soundPlastic1",0.125,"soundPlastic2",0.125,"soundPlastic3",0.125,"soundPlastic4",0.125,"soundPlastic5",0.125,"soundPlastic6",0.125,"soundPlastic7",0.125,"soundPlastic8",0.125}; - hitDefault[] = {"soundDefault1",0.2,"soundDefault2",0.2,"soundDefault3",0.1,"soundDefault4",0.1,"soundDefault5",0.1,"soundDefault6",0.1,"soundDefault7",0.1,"soundDefault8",0.1}; - hitMetal[] = {"soundMetal1",0.125,"soundMetal2",0.125,"soundMetal3",0.125,"soundMetal4",0.125,"soundMetal5",0.125,"soundMetal6",0.125,"soundMetal7",0.125,"soundMetal8",0.125}; - hitMetalplate[] = {"soundVehiclePlate1",0.125,"soundVehiclePlate2",0.125,"soundVehiclePlate3",0.125,"soundVehiclePlate4",0.125,"soundVehiclePlate5",0.125,"soundVehiclePlate6",0.125,"soundVehiclePlate7",0.125,"soundVehiclePlate8",0.125}; - hitWater[] = {"soundWater1",0.125,"soundWater2",0.125,"soundWater3",0.125,"soundWater4",0.125,"soundWater5",0.125,"soundWater6",0.125,"soundWater7",0.125,"soundWater8",0.125}; - bulletFly1[] = {"A3\sounds_f\weapons\hits\bullet_by_1.wav",1,1,35}; - bulletFly2[] = {"A3\sounds_f\weapons\hits\bullet_by_2.wav",1,1,35}; - bulletFly3[] = {"A3\sounds_f\weapons\hits\bullet_by_3.wav",1,1,35}; - bulletFly4[] = {"A3\sounds_f\weapons\hits\bullet_by_4.wav",1,1,35}; - bulletFly5[] = {"A3\sounds_f\weapons\hits\bullet_by_5.wav",1,1,35}; - bulletFly6[] = {"A3\sounds_f\weapons\hits\bullet_by_6.wav",1,1,35}; - bulletFly7[] = {"A3\sounds_f\weapons\hits\bullet_by_7.wav",1,1,35}; - bulletFly8[] = {"A3\sounds_f\weapons\hits\bullet_by_8.wav",1,1,35}; - bulletFly[] = {"bulletFly1",0.166,"bulletFly2",0.166,"bulletFly3",0.166,"bulletFly4",0.166,"bulletFly5",0.166,"bulletFly6",0.167,"bulletFly7",0.166,"bulletFly8",0.167}; - supersonicCrackNear[] = {"A3\sounds_f\weapons\hits\sscrack1.wav",1,1,35}; - supersonicCrackFar[] = {"A3\sounds_f\weapons\hits\sscrack2.wav",1,1,135}; - }; - */ - - class B_65x39_Caseless; - class ACE_frag_base: B_65x39_Caseless { - timeToLive = 12; - typicalSpeed = 1500; - deflecting = 65; - }; - - class ACE_frag_tiny: ACE_frag_base { - hit = 6; - airFriction = BASE_DRAG; - caliber = 0.75; - }; - - class ACE_frag_tiny_HD: ACE_frag_base { - hit = 6; - airFriction = BASE_DRAG_HD; - caliber = 0.75; - }; - - class ACE_frag_small: ACE_frag_base { - hit = 12; - airFriction = BASE_DRAG*0.9; - }; - - class ACE_frag_small_HD: ACE_frag_base { - hit = 12; - airFriction = BASE_DRAG_HD*0.9; - }; - - class ACE_frag_medium: ACE_frag_base { - hit = 14; - airFriction = BASE_DRAG*0.75; - caliber = 1.2; - }; - - class ACE_frag_medium_HD: ACE_frag_base { - hit = 14; - airFriction = BASE_DRAG_HD*0.75; - caliber = 1.2; - }; - - class ACE_frag_large: ACE_frag_base { - hit = 28; - indirectHit = 2; - indirectHitRange = 0.25; - airFriction = BASE_DRAG*0.65; - caliber = 2; - explosive = 0; - - }; - - class ACE_frag_large_HD: ACE_frag_large { - hit = 28; - indirectHit = 2; - indirectHitRange = 0.25; - airFriction = BASE_DRAG_HD*0.65; - caliber = 2; - - - }; - - class ACE_frag_huge: ACE_frag_large { - hit = 40; - indirectHit = 4; - indirectHitRange = 0.5; - airFriction = BASE_DRAG*0.5; - caliber = 2.8; - }; - - class ACE_frag_huge_HD: ACE_frag_large { - hit = 40; - indirectHit = 4; - indirectHitRange = 0.5; - airFriction = BASE_DRAG_HD*0.5; - caliber = 2.8; - }; - - class ACE_frag_spall_small: ACE_frag_small { - timeToLive = 0.1; - }; - - class ACE_frag_spall_medium: ACE_frag_medium { - timeToLive = 0.15; - }; - - class ACE_frag_spall_large: ACE_frag_large { - timeToLive = 0.25; - }; - - class ACE_frag_spall_huge: ACE_frag_huge { - timeToLive = 0.3; - }; - - #include "CfgAmmoReflections.hpp" -}; +#define BASE_DRAG -0.01 +#define HD_MULT 5 +#define BASE_DRAG_HD (BASE_DRAG*HD_MULT) + +class CfgAmmo { + //class ace_arty_105mm_m1_m782_time; + //class ace_arty_105mm_m1_m782_prox: ace_arty_105mm_m1_m782_time {}; + //class ace_arty_105mm_m1_m782_delay: ace_arty_105mm_m1_m782_prox { + // GVAR(skip) = 1; + //}; + + class Bo_GBU12_LGB; + class ACE_GBU12 : Bo_GBU12_LGB { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 140000; + GVAR(charge) = 87000; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; + sideAirFriction = 0.04; + airFriction = 0.04; + laserLock = 0; + }; + + class GrenadeBase; + class Grenade; + class GrenadeHand: Grenade { + GVAR(enabled) = 1; + + GVAR(skip) = 0; + GVAR(force) = 1; + // This is a good high-drag frag type for grenades. + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; + /* + These values are based on the M67 Grenade, should be tweaked for + individual grenades. + */ + GVAR(metal) = 210; // metal in grams + GVAR(charge) = 185; // explosive in grams + GVAR(gurney_c) = 2843; // Gurney velocity constant for explosive type. See: http://en.wikipedia.org/wiki/Gurney_equations + GVAR(gurney_k) = 3/5; // Gurney shape factor, in this case a sphere. See: http://en.wikipedia.org/wiki/Gurney_equations + }; + class GrenadeHand_stone: GrenadeHand { + GVAR(skip) = 1; + }; + class SmokeShell: GrenadeHand { + GVAR(skip) = 1; + }; + + class RocketBase; + class R_Hydra_HE: RocketBase { + // Source: http://fas.org/man/dod-101/sys/missile/hydra-70.htm + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 3850; + GVAR(charge) = 1040; + GVAR(gurney_c) = 2700; + GVAR(gurney_k) = 1/2; + }; + //class R_57mm_HE: RocketBase { + // GVAR(skip) = 1; + //}; + + class R_80mm_HE: RocketBase { + GVAR(skip) = 1; + }; + + //class R_S8T_AT: RocketBase { + // GVAR(skip) = 1; + //}; + + class BombCore; + class Bo_Mk82: BombCore { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 140000; + GVAR(charge) = 87000; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; + }; + + class G_40mm_HE: GrenadeBase { + // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M441 + GVAR(enabled) = 1; + GVAR(force) = 1; + + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; + GVAR(metal) = 200; + GVAR(charge) = 32; + GVAR(gurney_c) = 2700; + GVAR(gurney_k) = 1/2; + }; + class G_40mm_HEDP: G_40mm_HE { + // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M433 + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; + GVAR(metal) = 200; + GVAR(charge) = 45; + GVAR(gurney_c) = 2830; + GVAR(gurney_k) = 1/2; + }; + + class ACE_G_40mm_HEDP: G_40mm_HEDP { + }; + class ACE_G_40mm_HE: G_40mm_HE { + }; + class ACE_G_40mm_Practice: ACE_G_40mm_HE { + GVAR(skip) = 1; + GVAR(force) = 0; + }; + class ACE_G40mm_HE_VOG25P: G_40mm_HE { + GVAR(skip) = 0; + GVAR(force) = 1; + }; + + // curator ammo entries + class ShellBase; + class Sh_125mm_HEAT; + class Sh_155mm_AMOS: ShellBase { + // Source: http://www.globalsecurity.org/military/systems/munitions/m795.htm + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 36000; + GVAR(charge) = 9979; + GVAR(gurney_c) = 2440; + GVAR(gurney_k) = 1/2; + }; + class Sh_82mm_AMOS : Sh_155mm_AMOS { + // Source: http://www.arsenal-bg.com/defense_police/mortar_bombs_82mm.htm + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 3200; + GVAR(charge) = 420; + GVAR(gurney_c) = 2440; + GVAR(gurney_k) = 1/2; + }; + class ModuleOrdnanceMortar_F_Ammo: Sh_82mm_AMOS { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 800; + GVAR(charge) = 4200; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; + }; + class Sh_105mm_HEAT_MP : Sh_125mm_HEAT { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 11400; + GVAR(charge) = 7100; + GVAR(gurney_c) = 2800; + GVAR(gurney_k) = 1/2; + }; + class Sh_120mm_HE : ShellBase { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 23000; + GVAR(charge) = 3148; + GVAR(gurney_c) = 2830; + GVAR(gurney_k) = 1/2; + }; + class Sh_125mm_HE: Sh_120mm_HE { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 16000; + GVAR(charge) = 3200; + GVAR(gurney_c) = 2440; + GVAR(gurney_k) = 1/2; + }; + class ModuleOrdnanceHowitzer_F_ammo: Sh_155mm_AMOS { + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; + GVAR(metal) = 1950; + GVAR(charge) = 15800; + GVAR(gurney_c) = 2320; + GVAR(gurney_k) = 1/2; + }; + + //class R_230mm_HE; + //class ModuleOrdnanceRocket_F_ammo: R_230mm_HE { + //}; + + //class R_230mm_fly; + //class ModuleOrdnanceRocket_F_subammo: R_230mm_fly { + //}; + // end of curator ammo entries + + //class R_SMAW_HEDP; + //class R_MEEWS_HEDP : R_SMAW_HEDP { + // GVAR(force) = 1; + // GVAR(multiplier) = 1.2; + //}; + + class MissileBase; + class Missile_AGM_02_F : MissileBase { + // Source: http://fas.org/man/dod-101/sys/smart/agm-65.htm + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 56250; + GVAR(charge) = 39000; + GVAR(gurney_c) = 2700; + GVAR(gurney_k) = 1/2; + }; + class M_Hellfire_AT: MissileBase { + // Source: http://www.designation-systems.net/dusrm/m-114.html + GVAR(enabled) = 1; + + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; + GVAR(metal) = 8000; + GVAR(charge) = 2400; + GVAR(gurney_c) = 2700; + GVAR(gurney_k) = 1/2; + }; + + /* + class B_762x51_Ball; + class ACE_frag_base: B_762x51_Ball { ////TODO: B_762x45_Ball no longer exists, is this a valid replacement? + model = "\A3\Weapons_f\ammo\shell"; + timeToLive = 12; + typicalSpeed = 800; + // Fix sounds + effectFly = "AmmoClassic"; + soundDefault1[] = {"A3\sounds_f\weapons\hits\concrete_1.wav",0.158114,1,30}; + soundDefault2[] = {"A3\sounds_f\weapons\hits\concrete_2.wav",0.158114,1,30}; + soundDefault3[] = {"A3\sounds_f\weapons\hits\concrete_3.wav",0.158114,1,30}; + soundDefault4[] = {"A3\sounds_f\weapons\hits\concrete_4.wav",0.158114,1,30}; + soundDefault5[] = {"A3\sounds_f\weapons\hits\concrete_5.wav",0.158114,1,30}; + soundDefault6[] = {"A3\sounds_f\weapons\hits\concrete_6.wav",0.158114,1,30}; + soundDefault7[] = {"A3\sounds_f\weapons\hits\concrete_7.wav",0.158114,1,30}; + soundDefault8[] = {"A3\sounds_f\weapons\hits\concrete_8.wav",0.158114,1,30}; + soundGroundSoft1[] = {"A3\sounds_f\weapons\hits\soft_ground_1.wav",0.02811705,1,30}; + soundGroundSoft2[] = {"A3\sounds_f\weapons\hits\soft_ground_2.wav",0.02811705,1,30}; + soundGroundSoft3[] = {"A3\sounds_f\weapons\hits\soft_ground_3.wav",0.02811705,1,30}; + soundGroundSoft4[] = {"A3\sounds_f\weapons\hits\soft_ground_4.wav",0.02811705,1,30}; + soundGroundSoft5[] = {"A3\sounds_f\weapons\hits\soft_ground_5.wav",0.02811705,1,30}; + soundGroundSoft6[] = {"A3\sounds_f\weapons\hits\soft_ground_6.wav",0.02811705,1,30}; + soundGroundSoft7[] = {"A3\sounds_f\weapons\hits\soft_ground_7.wav",0.02811705,1,30}; + soundGroundSoft8[] = {"A3\sounds_f\weapons\hits\soft_ground_8.wav",0.02811705,1,30}; + soundGroundHard1[] = {"A3\sounds_f\weapons\hits\hard_ground_1.wav",0.62946,1,40}; + soundGroundHard2[] = {"A3\sounds_f\weapons\hits\hard_ground_2.wav",0.62946,1,40}; + soundGroundHard3[] = {"A3\sounds_f\weapons\hits\hard_ground_3.wav",0.62946,1,40}; + soundGroundHard4[] = {"A3\sounds_f\weapons\hits\hard_ground_4.wav",0.62946,1,40}; + soundGroundHard5[] = {"A3\sounds_f\weapons\hits\hard_ground_5.wav",0.62946,1,40}; + soundGroundHard6[] = {"A3\sounds_f\weapons\hits\hard_ground_6.wav",0.62946,1,40}; + soundGroundHard7[] = {"A3\sounds_f\weapons\hits\hard_ground_7.wav",0.62946,1,40}; + soundGroundHard8[] = {"A3\sounds_f\weapons\hits\hard_ground_8.wav",0.62946,1,40}; + soundMetal1[] = {"A3\sounds_f\weapons\hits\metal_1.wav",0.158114,1,45}; + soundMetal2[] = {"A3\sounds_f\weapons\hits\metal_2.wav",0.158114,1,45}; + soundMetal3[] = {"A3\sounds_f\weapons\hits\metal_3.wav",0.158114,1,45}; + soundMetal4[] = {"A3\sounds_f\weapons\hits\metal_4.wav",0.158114,1,45}; + soundMetal5[] = {"A3\sounds_f\weapons\hits\metal_5.wav",0.158114,1,45}; + soundMetal6[] = {"A3\sounds_f\weapons\hits\metal_6.wav",0.158114,1,45}; + soundMetal7[] = {"A3\sounds_f\weapons\hits\metal_7.wav",0.158114,1,45}; + soundMetal8[] = {"A3\sounds_f\weapons\hits\metal_8.wav",0.158114,1,45}; + soundGlass1[] = {"A3\sounds_f\weapons\hits\glass_1.wav",0.177828,1,25}; + soundGlass2[] = {"A3\sounds_f\weapons\hits\glass_2.wav",0.177828,1,25}; + soundGlass3[] = {"A3\sounds_f\weapons\hits\glass_3.wav",0.177828,1,25}; + soundGlass4[] = {"A3\sounds_f\weapons\hits\glass_4.wav",0.177828,1,25}; + soundGlass5[] = {"A3\sounds_f\weapons\hits\glass_5.wav",0.177828,1,25}; + soundGlass6[] = {"A3\sounds_f\weapons\hits\glass_6.wav",0.177828,1,25}; + soundGlass7[] = {"A3\sounds_f\weapons\hits\glass_7.wav",0.177828,1,25}; + soundGlass8[] = {"A3\sounds_f\weapons\hits\glass_8.wav",0.177828,1,25}; + soundGlassArmored1[] = {"A3\sounds_f\weapons\hits\glass_arm_1.wav",0.177828,1,30}; + soundGlassArmored2[] = {"A3\sounds_f\weapons\hits\glass_arm_2.wav",0.177828,1,30}; + soundGlassArmored3[] = {"A3\sounds_f\weapons\hits\glass_arm_3.wav",0.177828,1,30}; + soundGlassArmored4[] = {"A3\sounds_f\weapons\hits\glass_arm_4.wav",0.177828,1,30}; + soundGlassArmored5[] = {"A3\sounds_f\weapons\hits\glass_arm_5.wav",0.177828,1,30}; + soundGlassArmored6[] = {"A3\sounds_f\weapons\hits\glass_arm_6.wav",0.177828,1,30}; + soundGlassArmored7[] = {"A3\sounds_f\weapons\hits\glass_arm_7.wav",0.177828,1,30}; + soundGlassArmored8[] = {"A3\sounds_f\weapons\hits\glass_arm_8.wav",0.177828,1,30}; + soundVehiclePlate1[] = {"A3\sounds_f\weapons\hits\metal_plate_1.wav",0.281170,1,40}; + soundVehiclePlate2[] = {"A3\sounds_f\weapons\hits\metal_plate_2.wav",0.281170,1,40}; + soundVehiclePlate3[] = {"A3\sounds_f\weapons\hits\metal_plate_3.wav",0.281170,1,40}; + soundVehiclePlate4[] = {"A3\sounds_f\weapons\hits\metal_plate_4.wav",0.281170,1,40}; + soundVehiclePlate5[] = {"A3\sounds_f\weapons\hits\metal_plate_5.wav",0.281170,1,40}; + soundVehiclePlate6[] = {"A3\sounds_f\weapons\hits\metal_plate_6.wav",0.281170,1,40}; + soundVehiclePlate7[] = {"A3\sounds_f\weapons\hits\metal_plate_7.wav",0.281170,1,40}; + soundVehiclePlate8[] = {"A3\sounds_f\weapons\hits\metal_plate_8.wav",0.281170,1,40}; + soundWood1[] = {"A3\sounds_f\weapons\hits\wood_1.wav",0.158114,1,30}; + soundWood2[] = {"A3\sounds_f\weapons\hits\wood_2.wav",0.158114,1,30}; + soundWood3[] = {"A3\sounds_f\weapons\hits\wood_3.wav",0.158114,1,30}; + soundWood4[] = {"A3\sounds_f\weapons\hits\wood_4.wav",0.158114,1,30}; + soundWood5[] = {"A3\sounds_f\weapons\hits\wood_5.wav",0.158114,1,30}; + soundWood6[] = {"A3\sounds_f\weapons\hits\wood_6.wav",0.158114,1,30}; + soundWood7[] = {"A3\sounds_f\weapons\hits\wood_7.wav",0.158114,1,30}; + soundWood8[] = {"A3\sounds_f\weapons\hits\wood_8.wav",0.158114,1,30}; + soundHitBody1[] = {"A3\sounds_f\weapons\hits\body_1.wav",0.0177828,1,25}; + soundHitBody2[] = {"A3\sounds_f\weapons\hits\body_2.wav",0.0177828,1,25}; + soundHitBody3[] = {"A3\sounds_f\weapons\hits\body_3.wav",0.0177828,1,25}; + soundHitBody4[] = {"A3\sounds_f\weapons\hits\body_4.wav",0.0177828,1,25}; + soundHitBody5[] = {"A3\sounds_f\weapons\hits\body_5.wav",0.0177828,1,25}; + soundHitBody6[] = {"A3\sounds_f\weapons\hits\body_6.wav",0.0177828,1,25}; + soundHitBody7[] = {"A3\sounds_f\weapons\hits\body_7.wav",0.0177828,1,25}; + soundHitBody8[] = {"A3\sounds_f\weapons\hits\body_8.wav",0.0177828,1,25}; + soundHitBuilding1[] = {"A3\sounds_f\weapons\hits\building_1.wav",0.251189,1,30}; + soundHitBuilding2[] = {"A3\sounds_f\weapons\hits\building_2.wav",0.251189,1,30}; + soundHitBuilding3[] = {"A3\sounds_f\weapons\hits\building_3.wav",0.251189,1,30}; + soundHitBuilding4[] = {"A3\sounds_f\weapons\hits\building_4.wav",0.251189,1,30}; + soundHitBuilding5[] = {"A3\sounds_f\weapons\hits\building_5.wav",0.251189,1,30}; + soundHitBuilding6[] = {"A3\sounds_f\weapons\hits\building_6.wav",0.251189,1,30}; + soundHitBuilding7[] = {"A3\sounds_f\weapons\hits\building_7.wav",0.251189,1,30}; + soundHitBuilding8[] = {"A3\sounds_f\weapons\hits\building_8.wav",0.251189,1,30}; + soundHitFoliage1[] = {"A3\sounds_f\weapons\hits\foliage_1.wav",0.177828,1,25}; + soundHitFoliage2[] = {"A3\sounds_f\weapons\hits\foliage_2.wav",0.177828,1,25}; + soundHitFoliage3[] = {"A3\sounds_f\weapons\hits\foliage_3.wav",0.177828,1,25}; + soundHitFoliage4[] = {"A3\sounds_f\weapons\hits\foliage_4.wav",0.177828,1,25}; + soundHitFoliage5[] = {"A3\sounds_f\weapons\hits\foliage_5.wav",0.177828,1,25}; + soundHitFoliage6[] = {"A3\sounds_f\weapons\hits\foliage_6.wav",0.177828,1,25}; + soundHitFoliage7[] = {"A3\sounds_f\weapons\hits\foliage_7.wav",0.177828,1,25}; + soundHitFoliage8[] = {"A3\sounds_f\weapons\hits\foliage_8.wav",0.177828,1,25}; + soundPlastic1[] = {"A3\sounds_f\weapons\hits\plastic_1.wav",0.177828,1,25}; + soundPlastic2[] = {"A3\sounds_f\weapons\hits\plastic_2.wav",0.177828,1,25}; + soundPlastic3[] = {"A3\sounds_f\weapons\hits\plastic_3.wav",0.177828,1,25}; + soundPlastic4[] = {"A3\sounds_f\weapons\hits\plastic_4.wav",0.177828,1,25}; + soundPlastic5[] = {"A3\sounds_f\weapons\hits\plastic_5.wav",0.177828,1,25}; + soundPlastic6[] = {"A3\sounds_f\weapons\hits\plastic_6.wav",0.177828,1,25}; + soundPlastic7[] = {"A3\sounds_f\weapons\hits\plastic_7.wav",0.177828,1,25}; + soundPlastic8[] = {"A3\sounds_f\weapons\hits\plastic_8.wav",0.177828,1,25}; + soundConcrete1[] = {"A3\sounds_f\weapons\hits\concrete_1.wav",0.177828,1,35}; + soundConcrete2[] = {"A3\sounds_f\weapons\hits\concrete_2.wav",0.177828,1,35}; + soundConcrete3[] = {"A3\sounds_f\weapons\hits\concrete_3.wav",0.177828,1,35}; + soundConcrete4[] = {"A3\sounds_f\weapons\hits\concrete_4.wav",0.177828,1,35}; + soundConcrete5[] = {"A3\sounds_f\weapons\hits\concrete_5.wav",0.177828,1,35}; + soundConcrete6[] = {"A3\sounds_f\weapons\hits\concrete_6.wav",0.177828,1,35}; + soundConcrete7[] = {"A3\sounds_f\weapons\hits\concrete_7.wav",0.177828,1,35}; + soundConcrete8[] = {"A3\sounds_f\weapons\hits\concrete_8.wav",0.177828,1,35}; + soundRubber1[] = {"A3\sounds_f\weapons\hits\tyre_1.wav",0.158114,1,25}; + soundRubber2[] = {"A3\sounds_f\weapons\hits\tyre_2.wav",0.158114,1,25}; + soundRubber3[] = {"A3\sounds_f\weapons\hits\tyre_3.wav",0.158114,1,25}; + soundRubber4[] = {"A3\sounds_f\weapons\hits\tyre_4.wav",0.158114,1,25}; + soundRubber5[] = {"A3\sounds_f\weapons\hits\tyre_5.wav",0.158114,1,25}; + soundRubber6[] = {"A3\sounds_f\weapons\hits\tyre_6.wav",0.158114,1,25}; + soundRubber7[] = {"A3\sounds_f\weapons\hits\tyre_7.wav",0.158114,1,25}; + soundRubber8[] = {"A3\sounds_f\weapons\hits\tyre_8.wav",0.158114,1,25}; + soundWater1[] = {"A3\sounds_f\weapons\hits\water_01.wav",0.158114,1,25}; + soundWater2[] = {"A3\sounds_f\weapons\hits\water_02.wav",0.158114,1,25}; + soundWater3[] = {"A3\sounds_f\weapons\hits\water_03.wav",0.158114,1,25}; + soundWater4[] = {"A3\sounds_f\weapons\hits\water_04.wav",0.158114,1,25}; + soundWater5[] = {"A3\sounds_f\weapons\hits\water_05.wav",0.158114,1,25}; + soundWater6[] = {"A3\sounds_f\weapons\hits\water_06.wav",0.158114,1,25}; + soundWater7[] = {"A3\sounds_f\weapons\hits\water_07.wav",0.158114,1,25}; + soundWater8[] = {"A3\sounds_f\weapons\hits\water_08.wav",0.158114,1,25}; + hitGroundSoft[] = {"soundGroundSoft1",0.2,"soundGroundSoft2",0.2,"soundGroundSoft3",0.1,"soundGroundSoft4",0.1,"soundGroundSoft5",0.1,"soundGroundSoft6",0.1,"soundGroundSoft7",0.1,"soundGroundSoft8",0.1}; + hitGroundHard[] = {"soundGroundHard1",0.2,"soundGroundHard2",0.2,"soundGroundHard3",0.1,"soundGroundHard4",0.1,"soundGroundHard5",0.1,"soundGroundHard6",0.1,"soundGroundHard7",0.1,"soundGroundHard8",0.1}; + hitMan[] = {"soundHitBody1",0.125,"soundHitBody2",0.125,"soundHitBody3",0.125,"soundHitBody4",0.125,"soundHitBody5",0.125,"soundHitBody6",0.125,"soundHitBody7",0.125,"soundHitBody8",0.125}; + hitArmor[] = {"soundVehiclePlate1",0.125,"soundVehiclePlate2",0.125,"soundVehiclePlate3",0.125,"soundVehiclePlate4",0.125,"soundVehiclePlate5",0.125,"soundVehiclePlate6",0.125,"soundVehiclePlate7",0.125,"soundVehiclePlate8",0.125}; + hitBuilding[] = {"soundHitBuilding1",0.2,"soundHitBuilding2",0.2,"soundHitBuilding3",0.1,"soundHitBuilding4",0.1,"soundHitBuilding5",0.1,"soundHitBuilding6",0.1,"soundHitBuilding7",0.1,"soundHitBuilding8",0.1}; + hitFoliage[] = {"soundHitFoliage1",0.125,"soundHitFoliage2",0.125,"soundHitFoliage3",0.125,"soundHitFoliage4",0.125,"soundHitFoliage5",0.125,"soundHitFoliage6",0.125,"soundHitFoliage7",0.125,"soundHitFoliage8",0.125}; + hitWood[] = {"soundWood1",0.125,"soundWood2",0.125,"soundWood3",0.125,"soundWood4",0.125,"soundWood5",0.125,"soundWood6",0.125,"soundWood7",0.125,"soundWood8",0.125}; + hitGlass[] = {"soundGlass1",0.125,"soundGlass2",0.125,"soundGlass3",0.125,"soundGlass4",0.125,"soundGlass5",0.125,"soundGlass6",0.125,"soundGlass7",0.125,"soundGlass8",0.125}; + hitGlassArmored[] = {"soundGlassArmored1",0.125,"soundGlassArmored2",0.125,"soundGlassArmored3",0.125,"soundGlassArmored4",0.125,"soundGlassArmored5",0.125,"soundGlassArmored6",0.125,"soundGlassArmored7",0.125,"soundGlassArmored8",0.125}; + hitConcrete[] = {"soundConcrete1",0.125,"soundConcrete2",0.125,"soundConcrete3",0.125,"soundConcrete4",0.125,"soundConcrete5",0.125,"soundConcrete6",0.125,"soundConcrete7",0.125,"soundConcrete8",0.125}; + hitRubber[] = {"soundRubber1",0.125,"soundRubber2",0.125,"soundRubber3",0.125,"soundRubber4",0.125,"soundRubber5",0.125,"soundRubber6",0.125,"soundRubber7",0.125,"soundRubber8",0.125}; + hitPlastic[] = {"soundPlastic1",0.125,"soundPlastic2",0.125,"soundPlastic3",0.125,"soundPlastic4",0.125,"soundPlastic5",0.125,"soundPlastic6",0.125,"soundPlastic7",0.125,"soundPlastic8",0.125}; + hitDefault[] = {"soundDefault1",0.2,"soundDefault2",0.2,"soundDefault3",0.1,"soundDefault4",0.1,"soundDefault5",0.1,"soundDefault6",0.1,"soundDefault7",0.1,"soundDefault8",0.1}; + hitMetal[] = {"soundMetal1",0.125,"soundMetal2",0.125,"soundMetal3",0.125,"soundMetal4",0.125,"soundMetal5",0.125,"soundMetal6",0.125,"soundMetal7",0.125,"soundMetal8",0.125}; + hitMetalplate[] = {"soundVehiclePlate1",0.125,"soundVehiclePlate2",0.125,"soundVehiclePlate3",0.125,"soundVehiclePlate4",0.125,"soundVehiclePlate5",0.125,"soundVehiclePlate6",0.125,"soundVehiclePlate7",0.125,"soundVehiclePlate8",0.125}; + hitWater[] = {"soundWater1",0.125,"soundWater2",0.125,"soundWater3",0.125,"soundWater4",0.125,"soundWater5",0.125,"soundWater6",0.125,"soundWater7",0.125,"soundWater8",0.125}; + bulletFly1[] = {"A3\sounds_f\weapons\hits\bullet_by_1.wav",1,1,35}; + bulletFly2[] = {"A3\sounds_f\weapons\hits\bullet_by_2.wav",1,1,35}; + bulletFly3[] = {"A3\sounds_f\weapons\hits\bullet_by_3.wav",1,1,35}; + bulletFly4[] = {"A3\sounds_f\weapons\hits\bullet_by_4.wav",1,1,35}; + bulletFly5[] = {"A3\sounds_f\weapons\hits\bullet_by_5.wav",1,1,35}; + bulletFly6[] = {"A3\sounds_f\weapons\hits\bullet_by_6.wav",1,1,35}; + bulletFly7[] = {"A3\sounds_f\weapons\hits\bullet_by_7.wav",1,1,35}; + bulletFly8[] = {"A3\sounds_f\weapons\hits\bullet_by_8.wav",1,1,35}; + bulletFly[] = {"bulletFly1",0.166,"bulletFly2",0.166,"bulletFly3",0.166,"bulletFly4",0.166,"bulletFly5",0.166,"bulletFly6",0.167,"bulletFly7",0.166,"bulletFly8",0.167}; + supersonicCrackNear[] = {"A3\sounds_f\weapons\hits\sscrack1.wav",1,1,35}; + supersonicCrackFar[] = {"A3\sounds_f\weapons\hits\sscrack2.wav",1,1,135}; + }; + */ + + class B_65x39_Caseless; + class ACE_frag_base: B_65x39_Caseless { + timeToLive = 12; + typicalSpeed = 1500; + deflecting = 65; + }; + + class ACE_frag_tiny: ACE_frag_base { + hit = 6; + airFriction = BASE_DRAG; + caliber = 0.75; + }; + + class ACE_frag_tiny_HD: ACE_frag_base { + hit = 6; + airFriction = BASE_DRAG_HD; + caliber = 0.75; + }; + + class ACE_frag_small: ACE_frag_base { + hit = 12; + airFriction = BASE_DRAG*0.9; + }; + + class ACE_frag_small_HD: ACE_frag_base { + hit = 12; + airFriction = BASE_DRAG_HD*0.9; + }; + + class ACE_frag_medium: ACE_frag_base { + hit = 14; + airFriction = BASE_DRAG*0.75; + caliber = 1.2; + }; + + class ACE_frag_medium_HD: ACE_frag_base { + hit = 14; + airFriction = BASE_DRAG_HD*0.75; + caliber = 1.2; + }; + + class ACE_frag_large: ACE_frag_base { + hit = 28; + indirectHit = 2; + indirectHitRange = 0.25; + airFriction = BASE_DRAG*0.65; + caliber = 2; + explosive = 0; + + }; + + class ACE_frag_large_HD: ACE_frag_large { + hit = 28; + indirectHit = 2; + indirectHitRange = 0.25; + airFriction = BASE_DRAG_HD*0.65; + caliber = 2; + + + }; + + class ACE_frag_huge: ACE_frag_large { + hit = 40; + indirectHit = 4; + indirectHitRange = 0.5; + airFriction = BASE_DRAG*0.5; + caliber = 2.8; + }; + + class ACE_frag_huge_HD: ACE_frag_large { + hit = 40; + indirectHit = 4; + indirectHitRange = 0.5; + airFriction = BASE_DRAG_HD*0.5; + caliber = 2.8; + }; + + class ACE_frag_spall_small: ACE_frag_small { + timeToLive = 0.1; + }; + + class ACE_frag_spall_medium: ACE_frag_medium { + timeToLive = 0.15; + }; + + class ACE_frag_spall_large: ACE_frag_large { + timeToLive = 0.25; + }; + + class ACE_frag_spall_huge: ACE_frag_huge { + timeToLive = 0.3; + }; + + #include "CfgAmmoReflections.hpp" +}; diff --git a/addons/frag/CfgAmmoReflections.hpp b/addons/frag/CfgAmmoReflections.hpp index 0331dd41dd..fdaac6dd90 100644 --- a/addons/frag/CfgAmmoReflections.hpp +++ b/addons/frag/CfgAmmoReflections.hpp @@ -1,130 +1,130 @@ -//CfgAmmoReflections.hpp - -#define ACE_EXPLOSION_REFLECTION(range, hit)\ -class ace_explosion_reflection_##range##_##hit : ace_explosion_reflection_base {\ - indirectHitRange = range;\ - indirectHit = hit;\ - dangerRadiusHit = range*3;\ - suppressionRadiusHit = range*2;\ -} - -#define ACE_EXPLOSION_RANGE(range)\ - ACE_EXPLOSION_REFLECTION(range,10);\ - ACE_EXPLOSION_REFLECTION(range,20);\ - ACE_EXPLOSION_REFLECTION(range,30);\ - ACE_EXPLOSION_REFLECTION(range,40);\ - ACE_EXPLOSION_REFLECTION(range,50);\ - ACE_EXPLOSION_REFLECTION(range,60);\ - ACE_EXPLOSION_REFLECTION(range,70);\ - ACE_EXPLOSION_REFLECTION(range,80);\ - ACE_EXPLOSION_REFLECTION(range,90);\ - ACE_EXPLOSION_REFLECTION(range,100);\ - ACE_EXPLOSION_REFLECTION(range,110);\ - ACE_EXPLOSION_REFLECTION(range,120);\ - ACE_EXPLOSION_REFLECTION(range,130);\ - ACE_EXPLOSION_REFLECTION(range,140);\ - ACE_EXPLOSION_REFLECTION(range,150);\ - ACE_EXPLOSION_REFLECTION(range,160);\ - ACE_EXPLOSION_REFLECTION(range,170);\ - ACE_EXPLOSION_REFLECTION(range,180);\ - ACE_EXPLOSION_REFLECTION(range,190);\ - ACE_EXPLOSION_REFLECTION(range,200);\ - ACE_EXPLOSION_REFLECTION(range,210);\ - ACE_EXPLOSION_REFLECTION(range,220);\ - ACE_EXPLOSION_REFLECTION(range,230);\ - ACE_EXPLOSION_REFLECTION(range,240);\ - ACE_EXPLOSION_REFLECTION(range,250);\ - ACE_EXPLOSION_REFLECTION(range,260);\ - ACE_EXPLOSION_REFLECTION(range,270);\ - ACE_EXPLOSION_REFLECTION(range,280);\ - ACE_EXPLOSION_REFLECTION(range,290);\ - ACE_EXPLOSION_REFLECTION(range,300);\ - ACE_EXPLOSION_REFLECTION(range,310);\ - ACE_EXPLOSION_REFLECTION(range,320);\ - ACE_EXPLOSION_REFLECTION(range,330);\ - ACE_EXPLOSION_REFLECTION(range,340);\ - ACE_EXPLOSION_REFLECTION(range,350);\ - ACE_EXPLOSION_REFLECTION(range,360);\ - ACE_EXPLOSION_REFLECTION(range,370);\ - ACE_EXPLOSION_REFLECTION(range,380);\ - ACE_EXPLOSION_REFLECTION(range,390);\ - ACE_EXPLOSION_REFLECTION(range,400);\ - ACE_EXPLOSION_REFLECTION(range,410);\ - ACE_EXPLOSION_REFLECTION(range,420);\ - ACE_EXPLOSION_REFLECTION(range,430);\ - ACE_EXPLOSION_REFLECTION(range,440);\ - ACE_EXPLOSION_REFLECTION(range,450);\ - ACE_EXPLOSION_REFLECTION(range,460);\ - ACE_EXPLOSION_REFLECTION(range,470);\ - ACE_EXPLOSION_REFLECTION(range,480);\ - ACE_EXPLOSION_REFLECTION(range,490);\ - ACE_EXPLOSION_REFLECTION(range,500) - -class ace_explosion_reflection_base : Sh_120mm_HE { - CraterWaterEffects = ""; - CraterEffects = ""; - effectsMissile = ""; - ExplosionEffects = ""; - effectFlare = ""; - class HitEffects { - hitWater = ""; - }; - multiSoundHit[] = {}; - explosionTime = 0.0001; - explosive = 1; - soundFakeFall[] = {}; - typicalSpeed = 0; - model = "\A3\Weapons_F\empty.p3d"; - craterShape = "\A3\weapons_f\empty.p3d"; -}; - -ACE_EXPLOSION_RANGE(2); -ACE_EXPLOSION_RANGE(4); -ACE_EXPLOSION_RANGE(6); -ACE_EXPLOSION_RANGE(8); -ACE_EXPLOSION_RANGE(10); -ACE_EXPLOSION_RANGE(12); -ACE_EXPLOSION_RANGE(14); -ACE_EXPLOSION_RANGE(16); -ACE_EXPLOSION_RANGE(18); -ACE_EXPLOSION_RANGE(20); -ACE_EXPLOSION_RANGE(22); -ACE_EXPLOSION_RANGE(24); -ACE_EXPLOSION_RANGE(26); -ACE_EXPLOSION_RANGE(28); -ACE_EXPLOSION_RANGE(30); -ACE_EXPLOSION_RANGE(32); -ACE_EXPLOSION_RANGE(34); -ACE_EXPLOSION_RANGE(36); -ACE_EXPLOSION_RANGE(38); -ACE_EXPLOSION_RANGE(40); -ACE_EXPLOSION_RANGE(42); -ACE_EXPLOSION_RANGE(44); -ACE_EXPLOSION_RANGE(46); -ACE_EXPLOSION_RANGE(48); -ACE_EXPLOSION_RANGE(50); -ACE_EXPLOSION_RANGE(52); -ACE_EXPLOSION_RANGE(54); -ACE_EXPLOSION_RANGE(56); -ACE_EXPLOSION_RANGE(58); -ACE_EXPLOSION_RANGE(60); -ACE_EXPLOSION_RANGE(62); -ACE_EXPLOSION_RANGE(64); -ACE_EXPLOSION_RANGE(66); -ACE_EXPLOSION_RANGE(68); -ACE_EXPLOSION_RANGE(70); -ACE_EXPLOSION_RANGE(72); -ACE_EXPLOSION_RANGE(74); -ACE_EXPLOSION_RANGE(76); -ACE_EXPLOSION_RANGE(78); -ACE_EXPLOSION_RANGE(80); -ACE_EXPLOSION_RANGE(82); -ACE_EXPLOSION_RANGE(84); -ACE_EXPLOSION_RANGE(86); -ACE_EXPLOSION_RANGE(88); -ACE_EXPLOSION_RANGE(90); -ACE_EXPLOSION_RANGE(92); -ACE_EXPLOSION_RANGE(94); -ACE_EXPLOSION_RANGE(96); -ACE_EXPLOSION_RANGE(98); -ACE_EXPLOSION_RANGE(100); +//CfgAmmoReflections.hpp + +#define ACE_EXPLOSION_REFLECTION(range, hit)\ +class ace_explosion_reflection_##range##_##hit : ace_explosion_reflection_base {\ + indirectHitRange = range;\ + indirectHit = hit;\ + dangerRadiusHit = range*3;\ + suppressionRadiusHit = range*2;\ +} + +#define ACE_EXPLOSION_RANGE(range)\ + ACE_EXPLOSION_REFLECTION(range,10);\ + ACE_EXPLOSION_REFLECTION(range,20);\ + ACE_EXPLOSION_REFLECTION(range,30);\ + ACE_EXPLOSION_REFLECTION(range,40);\ + ACE_EXPLOSION_REFLECTION(range,50);\ + ACE_EXPLOSION_REFLECTION(range,60);\ + ACE_EXPLOSION_REFLECTION(range,70);\ + ACE_EXPLOSION_REFLECTION(range,80);\ + ACE_EXPLOSION_REFLECTION(range,90);\ + ACE_EXPLOSION_REFLECTION(range,100);\ + ACE_EXPLOSION_REFLECTION(range,110);\ + ACE_EXPLOSION_REFLECTION(range,120);\ + ACE_EXPLOSION_REFLECTION(range,130);\ + ACE_EXPLOSION_REFLECTION(range,140);\ + ACE_EXPLOSION_REFLECTION(range,150);\ + ACE_EXPLOSION_REFLECTION(range,160);\ + ACE_EXPLOSION_REFLECTION(range,170);\ + ACE_EXPLOSION_REFLECTION(range,180);\ + ACE_EXPLOSION_REFLECTION(range,190);\ + ACE_EXPLOSION_REFLECTION(range,200);\ + ACE_EXPLOSION_REFLECTION(range,210);\ + ACE_EXPLOSION_REFLECTION(range,220);\ + ACE_EXPLOSION_REFLECTION(range,230);\ + ACE_EXPLOSION_REFLECTION(range,240);\ + ACE_EXPLOSION_REFLECTION(range,250);\ + ACE_EXPLOSION_REFLECTION(range,260);\ + ACE_EXPLOSION_REFLECTION(range,270);\ + ACE_EXPLOSION_REFLECTION(range,280);\ + ACE_EXPLOSION_REFLECTION(range,290);\ + ACE_EXPLOSION_REFLECTION(range,300);\ + ACE_EXPLOSION_REFLECTION(range,310);\ + ACE_EXPLOSION_REFLECTION(range,320);\ + ACE_EXPLOSION_REFLECTION(range,330);\ + ACE_EXPLOSION_REFLECTION(range,340);\ + ACE_EXPLOSION_REFLECTION(range,350);\ + ACE_EXPLOSION_REFLECTION(range,360);\ + ACE_EXPLOSION_REFLECTION(range,370);\ + ACE_EXPLOSION_REFLECTION(range,380);\ + ACE_EXPLOSION_REFLECTION(range,390);\ + ACE_EXPLOSION_REFLECTION(range,400);\ + ACE_EXPLOSION_REFLECTION(range,410);\ + ACE_EXPLOSION_REFLECTION(range,420);\ + ACE_EXPLOSION_REFLECTION(range,430);\ + ACE_EXPLOSION_REFLECTION(range,440);\ + ACE_EXPLOSION_REFLECTION(range,450);\ + ACE_EXPLOSION_REFLECTION(range,460);\ + ACE_EXPLOSION_REFLECTION(range,470);\ + ACE_EXPLOSION_REFLECTION(range,480);\ + ACE_EXPLOSION_REFLECTION(range,490);\ + ACE_EXPLOSION_REFLECTION(range,500) + +class ace_explosion_reflection_base : Sh_120mm_HE { + CraterWaterEffects = ""; + CraterEffects = ""; + effectsMissile = ""; + ExplosionEffects = ""; + effectFlare = ""; + class HitEffects { + hitWater = ""; + }; + multiSoundHit[] = {}; + explosionTime = 0.0001; + explosive = 1; + soundFakeFall[] = {}; + typicalSpeed = 0; + model = "\A3\Weapons_F\empty.p3d"; + craterShape = "\A3\weapons_f\empty.p3d"; +}; + +ACE_EXPLOSION_RANGE(2); +ACE_EXPLOSION_RANGE(4); +ACE_EXPLOSION_RANGE(6); +ACE_EXPLOSION_RANGE(8); +ACE_EXPLOSION_RANGE(10); +ACE_EXPLOSION_RANGE(12); +ACE_EXPLOSION_RANGE(14); +ACE_EXPLOSION_RANGE(16); +ACE_EXPLOSION_RANGE(18); +ACE_EXPLOSION_RANGE(20); +ACE_EXPLOSION_RANGE(22); +ACE_EXPLOSION_RANGE(24); +ACE_EXPLOSION_RANGE(26); +ACE_EXPLOSION_RANGE(28); +ACE_EXPLOSION_RANGE(30); +ACE_EXPLOSION_RANGE(32); +ACE_EXPLOSION_RANGE(34); +ACE_EXPLOSION_RANGE(36); +ACE_EXPLOSION_RANGE(38); +ACE_EXPLOSION_RANGE(40); +ACE_EXPLOSION_RANGE(42); +ACE_EXPLOSION_RANGE(44); +ACE_EXPLOSION_RANGE(46); +ACE_EXPLOSION_RANGE(48); +ACE_EXPLOSION_RANGE(50); +ACE_EXPLOSION_RANGE(52); +ACE_EXPLOSION_RANGE(54); +ACE_EXPLOSION_RANGE(56); +ACE_EXPLOSION_RANGE(58); +ACE_EXPLOSION_RANGE(60); +ACE_EXPLOSION_RANGE(62); +ACE_EXPLOSION_RANGE(64); +ACE_EXPLOSION_RANGE(66); +ACE_EXPLOSION_RANGE(68); +ACE_EXPLOSION_RANGE(70); +ACE_EXPLOSION_RANGE(72); +ACE_EXPLOSION_RANGE(74); +ACE_EXPLOSION_RANGE(76); +ACE_EXPLOSION_RANGE(78); +ACE_EXPLOSION_RANGE(80); +ACE_EXPLOSION_RANGE(82); +ACE_EXPLOSION_RANGE(84); +ACE_EXPLOSION_RANGE(86); +ACE_EXPLOSION_RANGE(88); +ACE_EXPLOSION_RANGE(90); +ACE_EXPLOSION_RANGE(92); +ACE_EXPLOSION_RANGE(94); +ACE_EXPLOSION_RANGE(96); +ACE_EXPLOSION_RANGE(98); +ACE_EXPLOSION_RANGE(100); diff --git a/addons/frag/CfgEventhandlers.hpp b/addons/frag/CfgEventhandlers.hpp index 415e205fba..becf395052 100644 --- a/addons/frag/CfgEventhandlers.hpp +++ b/addons/frag/CfgEventhandlers.hpp @@ -1,18 +1,18 @@ - -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit)); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); - }; -}; + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index 977866e24e..02d27434dd 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -1,30 +1,30 @@ -#include "script_component.hpp" - -if(GVAR(EnableDebugTrace) && !isMultiplayer) then { - GVAR(traceFrags) = true; - GVAR(autoTrace) = true; -}; - -if(isServer) then { - [QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler); -}; - -["SettingsInitialized", { - //If not enabled, exit - if (!GVAR(enabled)) exitWith {}; - - // Register fire event handler - ["firedPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); - ["firedPlayerNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); - ["firedNonPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); - ["firedPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); - ["firedPlayerVehicleNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); - ["firedNonPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); - - [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; - -}] call EFUNC(common,addEventHandler); - -//Cache for ammo type configs -GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; -GVAR(cacheRoundsTypesToTrack) setText QGVAR(cacheRoundsTypesToTrack); +#include "script_component.hpp" + +if(GVAR(EnableDebugTrace) && !isMultiplayer) then { + GVAR(traceFrags) = true; + GVAR(autoTrace) = true; +}; + +if(isServer) then { + [QGVAR(frag_eh), { _this call FUNC(frago); }] call CBA_fnc_addEventHandler; +}; + +["ace_settingsInitialized", { + //If not enabled, exit + if (!GVAR(enabled)) exitWith {}; + + // Register fire event handler + ["ace_firedPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler; + ["ace_firedNonPlayer", DFUNC(fired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerVehicleNonLocal", DFUNC(fired)] call CBA_fnc_addEventHandler; + ["ace_firedNonPlayerVehicle", DFUNC(fired)] call CBA_fnc_addEventHandler; + + [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; + +}] call CBA_fnc_addEventHandler; + +//Cache for ammo type configs +GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheRoundsTypesToTrack) setText QGVAR(cacheRoundsTypesToTrack); diff --git a/addons/frag/XEH_preInit.sqf b/addons/frag/XEH_preInit.sqf index 1de9a467eb..9c03491a4e 100644 --- a/addons/frag/XEH_preInit.sqf +++ b/addons/frag/XEH_preInit.sqf @@ -1,25 +1,25 @@ -#include "script_component.hpp" - -ADDON = false; - -#include "XEH_PREP.hpp" - -GVAR(blackList) = []; -GVAR(traceFrags) = false; - -GVAR(TOTALFRAGS) = 0; - -GVAR(spallHPData) = []; -GVAR(spallIsTrackingCount) = 0; - -GVAR(autoTrace) = false; -GVAR(traceID) = -1; -GVAR(traces) = []; -GVAR(tracesStarted) = false; - -GVAR(lastIterationIndex) = 0; -GVAR(objects) = []; -GVAR(objectTypes) = []; -GVAR(arguments) = []; - -ADDON = true; +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +GVAR(blackList) = []; +GVAR(traceFrags) = false; + +GVAR(TOTALFRAGS) = 0; + +GVAR(spallHPData) = []; +GVAR(spallIsTrackingCount) = 0; + +GVAR(autoTrace) = false; +GVAR(traceID) = -1; +GVAR(traces) = []; +GVAR(tracesStarted) = false; + +GVAR(lastIterationIndex) = 0; +GVAR(objects) = []; +GVAR(objectTypes) = []; +GVAR(arguments) = []; + +ADDON = true; diff --git a/addons/frag/config.cpp b/addons/frag/config.cpp index 16af88bfc4..7ac109d29f 100644 --- a/addons/frag/config.cpp +++ b/addons/frag/config.cpp @@ -1,15 +1,18 @@ -#include "script_component.hpp" -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"Nou"}; - VERSION_CONFIG; - }; -}; - -#include "CfgEventhandlers.hpp" -#include "CfgAmmo.hpp" -#include "ACE_Settings.hpp" \ No newline at end of file +#include "script_component.hpp" +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Nou"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventhandlers.hpp" +#include "CfgAmmo.hpp" +#include "ACE_Settings.hpp" diff --git a/addons/frag/functions/fnc_addPfhRound.sqf b/addons/frag/functions/fnc_addPfhRound.sqf index 5d7857c67a..14f1e2f3ad 100644 --- a/addons/frag/functions/fnc_addPfhRound.sqf +++ b/addons/frag/functions/fnc_addPfhRound.sqf @@ -1,74 +1,74 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -private ["_enabled", "_doSpall", "_spallTrack", "_spallTrackID"]; -PARAMS_3(_gun,_type,_round); -DEFAULT_PARAM(3,_doFragTrack,false); - -if (!GVAR(enabled)) exitWith {}; - -//_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled)); -//if(_enabled < 1) exitWith {}; - -if(_round in GVAR(blackList)) exitWith { - GVAR(blackList) = GVAR(blackList) - [_round]; -}; - -// Exit on max track -if( (count GVAR(objects)) > GVAR(MaxTrack)) exitWith { }; - -if(_gun == ACE_player) then { - _doFragTrack = true; -} else { - if((gunner _gun) == ACE_player) then { - _doFragTrack = true; - } else { - if(local _gun && {!(isPlayer (gunner _gun))} && {!(isPlayer _gun)}) then { - _doFragTrack = true; - }; - }; -}; - -_doSpall = false; -if(GVAR(SpallEnabled)) then { - if(GVAR(spallIsTrackingCount) <= 0) then { - GVAR(spallHPData) = []; - }; - if(GVAR(spallIsTrackingCount) > 5) then { - // ACE_player sideChat "LIMT!"; - } else { - _doSpall = true; - GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) + 1; - }; -}; -// ACE_player sideChat format["c: %1", GVAR(spallIsTrackingCount)]; - -if(GVAR(autoTrace)) then { - [ACE_player, _round, [1,0,0,1]] call FUNC(addTrack); -}; - -// We only do the single track object check here. -// We should do an {!(_round in GVAR(objects))} -// But we leave that out here for optimization. So this cannot be a framework function -// Otherwise, it should only be added once and from the FiredEH -if(_doFragTrack && alive _round) then { - _spallTrack = []; - _spallTrackID = []; - - private["_args"]; - _args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID, - (getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))), - (getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")), - (getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")), - (getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force))), - (getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"))))) - ]; - TRACE_1("Initializing track", _round); - GVAR(objects) pushBack _round; - GVAR(arguments) pushBack _args; - - if(_doSpall) then { - [_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack); - }; - // ACE_player sideChat "WTF2"; -}; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private ["_enabled", "_doSpall", "_spallTrack", "_spallTrackID"]; +PARAMS_3(_gun,_type,_round); +DEFAULT_PARAM(3,_doFragTrack,false); + +if (!GVAR(enabled)) exitWith {}; + +//_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled)); +//if(_enabled < 1) exitWith {}; + +if(_round in GVAR(blackList)) exitWith { + GVAR(blackList) = GVAR(blackList) - [_round]; +}; + +// Exit on max track +if( (count GVAR(objects)) > GVAR(MaxTrack)) exitWith { }; + +if(_gun == ACE_player) then { + _doFragTrack = true; +} else { + if((gunner _gun) == ACE_player) then { + _doFragTrack = true; + } else { + if(local _gun && {!(isPlayer (gunner _gun))} && {!(isPlayer _gun)}) then { + _doFragTrack = true; + }; + }; +}; + +_doSpall = false; +if(GVAR(SpallEnabled)) then { + if(GVAR(spallIsTrackingCount) <= 0) then { + GVAR(spallHPData) = []; + }; + if(GVAR(spallIsTrackingCount) > 5) then { + // ACE_player sideChat "LIMT!"; + } else { + _doSpall = true; + GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) + 1; + }; +}; +// ACE_player sideChat format["c: %1", GVAR(spallIsTrackingCount)]; + +if(GVAR(autoTrace)) then { + [ACE_player, _round, [1,0,0,1]] call FUNC(addTrack); +}; + +// We only do the single track object check here. +// We should do an {!(_round in GVAR(objects))} +// But we leave that out here for optimization. So this cannot be a framework function +// Otherwise, it should only be added once and from the FiredEH +if(_doFragTrack && alive _round) then { + _spallTrack = []; + _spallTrackID = []; + + private["_args"]; + _args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID, + (getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))), + (getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")), + (getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")), + (getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force))), + (getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"))))) + ]; + TRACE_1("Initializing track", _round); + GVAR(objects) pushBack _round; + GVAR(arguments) pushBack _args; + + if(_doSpall) then { + [_round, 1, _spallTrack, _spallTrackID] call FUNC(spallTrack); + }; + // ACE_player sideChat "WTF2"; +}; diff --git a/addons/frag/functions/fnc_addTrack.sqf b/addons/frag/functions/fnc_addTrack.sqf index 680dc31c37..84304513e0 100644 --- a/addons/frag/functions/fnc_addTrack.sqf +++ b/addons/frag/functions/fnc_addTrack.sqf @@ -1,23 +1,23 @@ -#include "script_component.hpp" - -private ["_color", "_data", "_index", "_obj", "_objSpd", "_origin", "_positions"]; - -if (GVAR(autoTrace)) then { - [] call FUNC(startTracing); -}; - -// setAccTime 0.05; -_index = (count GVAR(traces)); -_obj = _this select 1; -_origin = _this select 0; -_color = [1,0,0,1]; -if((count _this) > 2) then { - _color = _this select 2; -}; -_positions = []; -_objSpd = vectorMagnitude (velocity _obj); -_positions set[(count _positions), [(getPos _obj), _objSpd]]; -_data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color]; - -GVAR(traces) set[_index, _data]; -[DFUNC(trackTrace), 0, [_obj, _index, ACE_time]] call CBA_fnc_addPerFrameHandler; +#include "script_component.hpp" + +private ["_color", "_data", "_index", "_obj", "_objSpd", "_origin", "_positions"]; + +if (GVAR(autoTrace)) then { + [] call FUNC(startTracing); +}; + +// setAccTime 0.05; +_index = (count GVAR(traces)); +_obj = _this select 1; +_origin = _this select 0; +_color = [1,0,0,1]; +if((count _this) > 2) then { + _color = _this select 2; +}; +_positions = []; +_objSpd = vectorMagnitude (velocity _obj); +_positions set[(count _positions), [(getPos _obj), _objSpd]]; +_data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color]; + +GVAR(traces) set[_index, _data]; +[DFUNC(trackTrace), 0, [_obj, _index, CBA_missionTime]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/frag/functions/fnc_doExplosions.sqf b/addons/frag/functions/fnc_doExplosions.sqf index f6daee1c06..41d546b78f 100644 --- a/addons/frag/functions/fnc_doExplosions.sqf +++ b/addons/frag/functions/fnc_doExplosions.sqf @@ -1,26 +1,26 @@ -//fnc_doExplosions.sqf -#include "script_component.hpp" - -private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"]; -_params = _this select 0; -_explosions = _params select 0; -_index = _params select 1; -for "_i" from _index to ((_index+2) min (count _explosions)) do { - _exp = _explosions select _i; - _refExp = _exp select 0; - _bpos = _exp select 1; - _hit = _exp select 2; - _distance = _exp select 3; - _indirectHitRange = _exp select 4; - _depth = _exp select 5; - _refExp createVehicle (ASLtoATL _bpos); - // if(_hit >= 150 && _distance > _indirectHitRange) then { - // [_bpos, _refExp, _depth] call FUNC(doReflections); - // }; -}; -_index = _index + 2; -if(_index >= (count _explosions)) then { - [(_this select 1)] call CBA_fnc_removePerFrameHandler; -} else { - _params set[1, _index]; -}; +//fnc_doExplosions.sqf +#include "script_component.hpp" + +private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"]; +_params = _this select 0; +_explosions = _params select 0; +_index = _params select 1; +for "_i" from _index to ((_index+2) min (count _explosions)) do { + _exp = _explosions select _i; + _refExp = _exp select 0; + _bpos = _exp select 1; + _hit = _exp select 2; + _distance = _exp select 3; + _indirectHitRange = _exp select 4; + _depth = _exp select 5; + _refExp createVehicle (ASLtoATL _bpos); + // if(_hit >= 150 && _distance > _indirectHitRange) then { + // [_bpos, _refExp, _depth] call FUNC(doReflections); + // }; +}; +_index = _index + 2; +if(_index >= (count _explosions)) then { + [(_this select 1)] call CBA_fnc_removePerFrameHandler; +} else { + _params set[1, _index]; +}; diff --git a/addons/frag/functions/fnc_doReflections.sqf b/addons/frag/functions/fnc_doReflections.sqf index 64d8ede26d..fa30aba95d 100644 --- a/addons/frag/functions/fnc_doReflections.sqf +++ b/addons/frag/functions/fnc_doReflections.sqf @@ -1,18 +1,18 @@ -//fnc_doReflections.sqf -#include "script_component.hpp" - -private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"]; - -_pos = _this select 0; -_ammo = _this select 1; -_depth = 1; -if(count _this > 2) then { - _depth = _this select 2; -}; -// TEST_ICONS pushBack [_pos, format["EXP!", _hit, _range, _hitFactor]]; -if(_depth <= 2) then { - _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"); - _indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit"); - _testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0]; - [DFUNC(findReflections), 0, _testParams] call CBA_fnc_addPerFrameHandler; -}; +//fnc_doReflections.sqf +#include "script_component.hpp" + +private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"]; + +_pos = _this select 0; +_ammo = _this select 1; +_depth = 1; +if(count _this > 2) then { + _depth = _this select 2; +}; +// TEST_ICONS pushBack [_pos, format["EXP!", _hit, _range, _hitFactor]]; +if(_depth <= 2) then { + _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"); + _indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit"); + _testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0]; + [DFUNC(findReflections), 0, _testParams] call CBA_fnc_addPerFrameHandler; +}; diff --git a/addons/frag/functions/fnc_doSpall.sqf b/addons/frag/functions/fnc_doSpall.sqf index 57b5d330c7..2c98e955eb 100644 --- a/addons/frag/functions/fnc_doSpall.sqf +++ b/addons/frag/functions/fnc_doSpall.sqf @@ -1,151 +1,151 @@ -//fnc_doSpall.sqf -#include "script_component.hpp" -// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA"; - -private ["_hitData", "_initialData", "_hpData", "_object", "_foundObjects", "_index", "_foundObjecsts", "_roundType", "_round", "_caliber", "_explosive", "_idh", "_alive", "_exit", "_vm", "_velocity", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_unitDir", "_spallPos", "_pos1", "_i", "_pos2", "_blah", "_data", "_spallPolar", "_warn", "_c", "_m", "_k", "_gC", "_fragPower", "_fragTypes", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_fragType", "_fragment", "_pos"]; - -_hitData = _this select 0; -_initialData = GVAR(spallHPData) select (_hitData select 0); -_hpData = (_hitData select 1) select (_this select 1); - - -_object = _hpData select 0; -_object removeEventHandler ["hitPart", _initialData select 0]; -_foundObjects = _initialData select 7; -_index = _foundObjects find _object; -if(_index != -1) then { - _foundObjecsts set[_index, nil]; -}; - -_roundType = (_initialData select 2); -_round = (_initialData select 3); -_object = (_initialData select 1); - -_caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber"); -_explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive"); -_idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange"); - -_alive = true; -if(!alive _round && (_initialData select 6) == 1) then { - _alive = false; -}; - -if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { - // ACE_player sideChat format["BBBB"]; - _exit = false; - _vm = 1; - _velocity = _initialData select 5; - - _oldVelocity = vectorMagnitude _velocity; - _curVelocity = vectorMagnitude (velocity _round); - - if(alive _round) then { - _diff = _velocity vectorDiff (velocity _round); - _polar = _diff call CBA_fnc_vect2polar; - // ACE_player sideChat format["polar: %1", _polar]; - if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then { - if(_caliber < 2.5) then { - // ACE_player sideChat format["exit!"]; - _exit = true; - } else { - _vm = 1-(_curVelocity/_oldVelocity); - }; - }; - }; - if(!_exit) then { - _unitDir = vectorNormalized _velocity; - _pos = _hpData select 3; - _spallPos = nil; - for "_i" from 0 to 100 do { - _pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i)); - _pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1))); - // _blah = [_object, "FIRE"] intersect [_object worldToModel (ASLtoATL _pos1), _object worldToModel (ASLtoATL _pos2)]; - // diag_log text format["b: %1", _blah]; - - // _data = [nil, nil, nil, 1, [[ASLtoATL _pos1, 1], [ASLtoATL _pos2, 1]]]; - // NOU_TRACES set[(count NOU_TRACES), _data]; - - if(!lineIntersects [_pos1, _pos2]) exitWith { - // ACE_player sideChat format["FOUND!"]; - _spallPos = _pos2; - }; - }; - if(!isNil "_spallPos") then { - _spallPolar = _velocity call CBA_fnc_vect2polar; - - if(_explosive > 0) then { - // ACE_player sideChat format["EXPLOSIVE!"]; - _warn = false; - _c = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_CHARGE"); - if(_c == 0) then { _c = 1; _warn = true;}; - _m = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_METAL"); - if(_m == 0) then { _m = 2; _warn = true;}; - _k = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_GURNEY_K"); - if(_k == 0) then { _k = 1/2; _warn = true;}; - _gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_GURNEY_C"); - if(_gC == 0) then { _gC = 2440; _warn = true;}; - - if(_warn) then { - ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_roundType); //TODO: turn this off when we get closer to release - }; - - _fragPower = (((_m/_c)+_k)^-(1/2))*_gC; - _spallPolar set[0, _fragPower*0.66]; - }; - - _fragTypes = [ - "ACE_frag_spall_small", "ACE_frag_spall_small", "ACE_frag_spall_small", - "ACE_frag_spall_small","ACE_frag_spall_medium","ACE_frag_spall_medium","ACE_frag_spall_medium", - "ACE_frag_spall_medium", "ACE_frag_spall_large", "ACE_frag_spall_large", "ACE_frag_spall_huge", - "ACE_frag_spall_huge" - - ]; - - // diag_log text format["SPALL POWER: %1", _spallPolar select 0]; - _spread = 15+(random 25); - _spallCount = 5+(random 10); - for "_i" from 1 to _spallCount do { - _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2)); - _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2)); - if(abs _elev > 90) then { - _dir = _dir + 180; - }; - _dir = _dir % 360; - _vel = (_spallPolar select 0)*0.33*_vm; - _vel = (_vel-(_vel*0.25))+(random (_vel*0.5)); - - _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect; - _fragType = round (random ((count _fragTypes)-1)); - _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; - _fragment setPosASL _spallPos; - _fragment setVelocity _spallFragVect; - - if(GVAR(traceFrags)) then { - [ACE_player, _fragment, [1,0.5,0,1]] call FUNC(addTrack); - }; - }; - _spread = 5+(random 5); - _spallCount = 3+(random 5); - for "_i" from 1 to _spallCount do { - _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2)); - _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2)); - if(abs _elev > 90) then { - _dir = _dir + 180; - }; - _dir = _dir % 360; - _vel = (_spallPolar select 0)*0.55*_vm; - _vel = (_vel-(_vel*0.25))+(random (_vel*0.5)); - - _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect; - _fragType = round (random ((count _fragTypes)-1)); - _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; - _fragment setPosASL _spallPos; - _fragment setVelocity _spallFragVect; - - if(GVAR(traceFrags)) then { - [ACE_player, _fragment, [1,0,0,1]] call FUNC(addTrack); - }; - }; - }; - }; -}; +//fnc_doSpall.sqf +#include "script_component.hpp" +// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA"; + +private ["_hitData", "_initialData", "_hpData", "_object", "_foundObjects", "_index", "_foundObjecsts", "_roundType", "_round", "_caliber", "_explosive", "_idh", "_alive", "_exit", "_vm", "_velocity", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_unitDir", "_spallPos", "_pos1", "_i", "_pos2", "_blah", "_data", "_spallPolar", "_warn", "_c", "_m", "_k", "_gC", "_fragPower", "_fragTypes", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_fragType", "_fragment", "_pos"]; + +_hitData = _this select 0; +_initialData = GVAR(spallHPData) select (_hitData select 0); +_hpData = (_hitData select 1) select (_this select 1); + + +_object = _hpData select 0; +_object removeEventHandler ["hitPart", _initialData select 0]; +_foundObjects = _initialData select 7; +_index = _foundObjects find _object; +if(_index != -1) then { + _foundObjecsts set[_index, nil]; +}; + +_roundType = (_initialData select 2); +_round = (_initialData select 3); +_object = (_initialData select 1); + +_caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber"); +_explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive"); +_idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange"); + +_alive = true; +if(!alive _round && (_initialData select 6) == 1) then { + _alive = false; +}; + +if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then { + // ACE_player sideChat format["BBBB"]; + _exit = false; + _vm = 1; + _velocity = _initialData select 5; + + _oldVelocity = vectorMagnitude _velocity; + _curVelocity = vectorMagnitude (velocity _round); + + if(alive _round) then { + _diff = _velocity vectorDiff (velocity _round); + _polar = _diff call CBA_fnc_vect2polar; + // ACE_player sideChat format["polar: %1", _polar]; + if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then { + if(_caliber < 2.5) then { + // ACE_player sideChat format["exit!"]; + _exit = true; + } else { + _vm = 1-(_curVelocity/_oldVelocity); + }; + }; + }; + if(!_exit) then { + _unitDir = vectorNormalized _velocity; + _pos = _hpData select 3; + _spallPos = nil; + for "_i" from 0 to 100 do { + _pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i)); + _pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1))); + // _blah = [_object, "FIRE"] intersect [_object worldToModel (ASLtoATL _pos1), _object worldToModel (ASLtoATL _pos2)]; + // diag_log text format["b: %1", _blah]; + + // _data = [nil, nil, nil, 1, [[ASLtoATL _pos1, 1], [ASLtoATL _pos2, 1]]]; + // NOU_TRACES set[(count NOU_TRACES), _data]; + + if(!lineIntersects [_pos1, _pos2]) exitWith { + // ACE_player sideChat format["FOUND!"]; + _spallPos = _pos2; + }; + }; + if(!isNil "_spallPos") then { + _spallPolar = _velocity call CBA_fnc_vect2polar; + + if(_explosive > 0) then { + // ACE_player sideChat format["EXPLOSIVE!"]; + _warn = false; + _c = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_CHARGE"); + if(_c == 0) then { _c = 1; _warn = true;}; + _m = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_METAL"); + if(_m == 0) then { _m = 2; _warn = true;}; + _k = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_GURNEY_K"); + if(_k == 0) then { _k = 1/2; _warn = true;}; + _gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> "ACE_frag_GURNEY_C"); + if(_gC == 0) then { _gC = 2440; _warn = true;}; + + if(_warn) then { + ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_roundType); //TODO: turn this off when we get closer to release + }; + + _fragPower = (((_m/_c)+_k)^-(1/2))*_gC; + _spallPolar set[0, _fragPower*0.66]; + }; + + _fragTypes = [ + "ACE_frag_spall_small", "ACE_frag_spall_small", "ACE_frag_spall_small", + "ACE_frag_spall_small","ACE_frag_spall_medium","ACE_frag_spall_medium","ACE_frag_spall_medium", + "ACE_frag_spall_medium", "ACE_frag_spall_large", "ACE_frag_spall_large", "ACE_frag_spall_huge", + "ACE_frag_spall_huge" + + ]; + + // diag_log text format["SPALL POWER: %1", _spallPolar select 0]; + _spread = 15+(random 25); + _spallCount = 5+(random 10); + for "_i" from 1 to _spallCount do { + _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2)); + _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2)); + if(abs _elev > 90) then { + _dir = _dir + 180; + }; + _dir = _dir % 360; + _vel = (_spallPolar select 0)*0.33*_vm; + _vel = (_vel-(_vel*0.25))+(random (_vel*0.5)); + + _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect; + _fragType = round (random ((count _fragTypes)-1)); + _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; + _fragment setPosASL _spallPos; + _fragment setVelocity _spallFragVect; + + if(GVAR(traceFrags)) then { + [ACE_player, _fragment, [1,0.5,0,1]] call FUNC(addTrack); + }; + }; + _spread = 5+(random 5); + _spallCount = 3+(random 5); + for "_i" from 1 to _spallCount do { + _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2)); + _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2)); + if(abs _elev > 90) then { + _dir = _dir + 180; + }; + _dir = _dir % 360; + _vel = (_spallPolar select 0)*0.55*_vm; + _vel = (_vel-(_vel*0.25))+(random (_vel*0.5)); + + _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect; + _fragType = round (random ((count _fragTypes)-1)); + _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; + _fragment setPosASL _spallPos; + _fragment setVelocity _spallFragVect; + + if(GVAR(traceFrags)) then { + [ACE_player, _fragment, [1,0,0,1]] call FUNC(addTrack); + }; + }; + }; + }; +}; diff --git a/addons/frag/functions/fnc_drawTraces.sqf b/addons/frag/functions/fnc_drawTraces.sqf index 494a2af727..790d53491f 100644 --- a/addons/frag/functions/fnc_drawTraces.sqf +++ b/addons/frag/functions/fnc_drawTraces.sqf @@ -1,31 +1,31 @@ -#include "script_component.hpp" - -private ["_color", "_index", "_lastPos", "_lastSpd", "_max", "_positions", "_startSpeed"]; - -{ - _positions = _x select 4; - _color = _x select 5; - _index = 0; - _max = count _positions; - _startSpeed = 0.01 max ((_positions select 0) select 1); - _lastSpd = []; - _lastPos = []; - while {_index < _max} do { - _data1 = _positions select _index; - _data2 = nil; - if(_index + ACE_TRACE_DRAW_INC >= _max) then { - _data2 = _positions select (_max - 1); - } else { - _data2 = _positions select (_index + ACE_TRACE_DRAW_INC); - }; - - _pos1 = _data1 select 0; - _pos2 = _data2 select 0; - _index = _index + ACE_TRACE_DRAW_INC; - - drawLine3D [_pos1, _pos2, _color]; - _lastPos = _pos2; - _lastSpd = _data1 select 1; - }; - // drawIcon3D ["", [1,0,0,1], _lastPos, 0, 0, 0, format["%1m/s", _lastSpd], 1, 0.05, "RobotoCondensed"]; -} forEach GVAR(traces); +#include "script_component.hpp" + +private ["_color", "_index", "_lastPos", "_lastSpd", "_max", "_positions", "_startSpeed"]; + +{ + _positions = _x select 4; + _color = _x select 5; + _index = 0; + _max = count _positions; + _startSpeed = 0.01 max ((_positions select 0) select 1); + _lastSpd = []; + _lastPos = []; + while {_index < _max} do { + _data1 = _positions select _index; + _data2 = nil; + if(_index + ACE_TRACE_DRAW_INC >= _max) then { + _data2 = _positions select (_max - 1); + } else { + _data2 = _positions select (_index + ACE_TRACE_DRAW_INC); + }; + + _pos1 = _data1 select 0; + _pos2 = _data2 select 0; + _index = _index + ACE_TRACE_DRAW_INC; + + drawLine3D [_pos1, _pos2, _color]; + _lastPos = _pos2; + _lastSpd = _data1 select 1; + }; + // drawIcon3D ["", [1,0,0,1], _lastPos, 0, 0, 0, format["%1m/s", _lastSpd], 1, 0.05, "RobotoCondensed"]; +} forEach GVAR(traces); diff --git a/addons/frag/functions/fnc_findReflections.sqf b/addons/frag/functions/fnc_findReflections.sqf index 5e069ddd58..d0c5c1ceec 100644 --- a/addons/frag/functions/fnc_findReflections.sqf +++ b/addons/frag/functions/fnc_findReflections.sqf @@ -1,128 +1,128 @@ -//fnc_findReflections.sqf -#include "script_component.hpp" - -private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"]; - -BEGIN_COUNTER(fnc_findReflections); -_params = _this select 0; -_pos = _params select 0; -_explosiveInfo = _params select 1; -_los = _params select 2; -_nlos = _params select 3; -_zIndex = _params select 4; -_depth = _params select 5; -_rand = _params select 6; - -_split = 15; -_radi = (360/_split*_depth); - -// player sideChat format["p: %1", _explosiveInfo]; -_indirectHitRange = _explosiveInfo select 0; -_indirectHit = _explosiveInfo select 1; -_distanceCount = (floor _indirectHitRange*4) min 100; - -if(_zIndex < 5) then { - _lastPos = _pos; - _zAng = _zIndex*20+2; - if(_zAng > 80) then { - _radi = 1; - _zAng = 90; - }; - for "_i" from 0 to _radi do { - _test = true; - _vec = [1, ((_i*_split)+_rand) mod 360, _zAng] call CBA_fnc_polar2vect; - for "_x" from 1 to _distanceCount do { - _testPos = _pos vectorAdd (_vec vectorMultiply _x); - // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; - _res = lineIntersectsWith [_pos, _testPos]; - if(count _res > 0) exitWith { - _test = false; - _nlos pushBack _lastPos; - // { - // _x addEventHandler ["HandleDamage", { diag_log text format["this: %1", _this]; }]; - // } forEach _res; - // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; - // TEST_PAIRS pushBack [_pos, _lastPos, [1,0,0,1]]; - - }; - // if(terrainIntersectASL [_pos, _testPos]) exitWith {}; - _lastPos = _testPos; - }; - }; - _params set[4, _zIndex+1]; -} else { - _depth = _depth + 1; - _buckets = []; - _excludes = []; - _bucketIndex = 0; - _bucketPos = nil; - _bucketList = nil; - _c = 0; - while { count(_nlos) != count(_excludes) && _c < (count _nlos) } do { - scopeName "mainSearch"; - { - if(!(_forEachIndex in _excludes)) then { - _index = _buckets pushBack [_x, [_x]]; - _excludes pushBack _forEachIndex; - _bucketPos = _x; - _bucketList = (_buckets select _index) select 1; - breakTo "mainSearch"; - }; - } forEach _nlos; - { - if(!(_forEachIndex in _excludes)) then { - _testPos = _x; - if(_testPos vectorDistanceSqr _bucketPos <= 30) then { - _bucketList pushBack _x; - _excludes pushBack _forEachIndex; - }; - }; - } forEach _nlos; - _c = _c + 1; - }; - - // player sideChat format["c: %1", count _buckets]; - _explosions = []; - { - _blist = _x select 1; - _avgX = 0; - _avgY = 0; - _avgZ = 0; - - { - _avgX = _avgX + (_x select 0); - _avgY = _avgY + (_x select 1); - _avgZ = _avgZ + (_x select 2); - } forEach _blist; - _c = count _blist; - _bpos = [_avgX/_c, _avgY/_c, _avgZ/_c]; - - _distance = _pos vectorDistance _bpos; - _hitFactor = 1-(((_distance/(_indirectHitRange*4)) min 1) max 0); - // _hitFactor = 1/(_distance^2); - _hit = _indirectHit*_hitFactor; - _hit = (floor (_hit/4)) min 500; - _hit = _hit - (_hit%10); - _range = (floor (_indirectHitRange-(_distance/4))) min 100; - _range = _range - (_range%2); - - if(_hit >= 10 && _range > 0) then { - // TEST_ICONS pushBack [_bpos, format["h: %1, r: %2, hf: %3 d: %4 ihr: %5", _hit, _range, _hitFactor, _distance, _indirectHitRange*4]]; - // TEST_PAIRS pushBack [_pos, _bpos, [1,0,0,1]]; - _refExp = format["ace_explosion_reflection_%1_%2", _range, _hit]; - // _refExp createVehicle (ASLtoATL _bpos); - // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _bpos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; - - _explosions pushBack [_refExp, _bpos, _hit, _distance, _indirectHitRange/4, _depth]; - - }; - if(count _explosions > (_radi*2)/_depth) exitWith {}; - } forEach _buckets; - // _can = "Land_Bricks_V4_F" createVehicle (ASLtoATL _pos); - // _dirvec = _pos vectorFromTo ((ATLtoASL (player modelToWorldVisual (player selectionPosition "Spine3")))); - // _dirvec = _dirvec vectorMultiply 100; - // _can setVelocity _dirvec; - [DFUNC(doExplosions), 0, [_explosions, 0]] call CBA_fnc_addPerFrameHandler; - [(_this select 1)] call CBA_fnc_removePerFrameHandler; -}; -END_COUNTER(fnc_findReflections); +//fnc_findReflections.sqf +#include "script_component.hpp" + +private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"]; + +BEGIN_COUNTER(fnc_findReflections); +_params = _this select 0; +_pos = _params select 0; +_explosiveInfo = _params select 1; +_los = _params select 2; +_nlos = _params select 3; +_zIndex = _params select 4; +_depth = _params select 5; +_rand = _params select 6; + +_split = 15; +_radi = (360/_split*_depth); + +// player sideChat format["p: %1", _explosiveInfo]; +_indirectHitRange = _explosiveInfo select 0; +_indirectHit = _explosiveInfo select 1; +_distanceCount = (floor _indirectHitRange*4) min 100; + +if(_zIndex < 5) then { + _lastPos = _pos; + _zAng = _zIndex*20+2; + if(_zAng > 80) then { + _radi = 1; + _zAng = 90; + }; + for "_i" from 0 to _radi do { + _test = true; + _vec = [1, ((_i*_split)+_rand) mod 360, _zAng] call CBA_fnc_polar2vect; + for "_x" from 1 to _distanceCount do { + _testPos = _pos vectorAdd (_vec vectorMultiply _x); + // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; + _res = lineIntersectsWith [_pos, _testPos]; + if(count _res > 0) exitWith { + _test = false; + _nlos pushBack _lastPos; + // { + // _x addEventHandler ["HandleDamage", { diag_log text format["this: %1", _this]; }]; + // } forEach _res; + // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _testPos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; + // TEST_PAIRS pushBack [_pos, _lastPos, [1,0,0,1]]; + + }; + // if(terrainIntersectASL [_pos, _testPos]) exitWith {}; + _lastPos = _testPos; + }; + }; + _params set[4, _zIndex+1]; +} else { + _depth = _depth + 1; + _buckets = []; + _excludes = []; + _bucketIndex = 0; + _bucketPos = nil; + _bucketList = nil; + _c = 0; + while { count(_nlos) != count(_excludes) && _c < (count _nlos) } do { + scopeName "mainSearch"; + { + if(!(_forEachIndex in _excludes)) then { + _index = _buckets pushBack [_x, [_x]]; + _excludes pushBack _forEachIndex; + _bucketPos = _x; + _bucketList = (_buckets select _index) select 1; + breakTo "mainSearch"; + }; + } forEach _nlos; + { + if(!(_forEachIndex in _excludes)) then { + _testPos = _x; + if(_testPos vectorDistanceSqr _bucketPos <= 30) then { + _bucketList pushBack _x; + _excludes pushBack _forEachIndex; + }; + }; + } forEach _nlos; + _c = _c + 1; + }; + + // player sideChat format["c: %1", count _buckets]; + _explosions = []; + { + _blist = _x select 1; + _avgX = 0; + _avgY = 0; + _avgZ = 0; + + { + _avgX = _avgX + (_x select 0); + _avgY = _avgY + (_x select 1); + _avgZ = _avgZ + (_x select 2); + } forEach _blist; + _c = count _blist; + _bpos = [_avgX/_c, _avgY/_c, _avgZ/_c]; + + _distance = _pos vectorDistance _bpos; + _hitFactor = 1-(((_distance/(_indirectHitRange*4)) min 1) max 0); + // _hitFactor = 1/(_distance^2); + _hit = _indirectHit*_hitFactor; + _hit = (floor (_hit/4)) min 500; + _hit = _hit - (_hit%10); + _range = (floor (_indirectHitRange-(_distance/4))) min 100; + _range = _range - (_range%2); + + if(_hit >= 10 && _range > 0) then { + // TEST_ICONS pushBack [_bpos, format["h: %1, r: %2, hf: %3 d: %4 ihr: %5", _hit, _range, _hitFactor, _distance, _indirectHitRange*4]]; + // TEST_PAIRS pushBack [_pos, _bpos, [1,0,0,1]]; + _refExp = format["ace_explosion_reflection_%1_%2", _range, _hit]; + // _refExp createVehicle (ASLtoATL _bpos); + // drop ["\a3\data_f\Cl_basic","","Billboard",1,15,ASLtoATL _bpos,[0,0,0],1,1.275,1.0,0.0,[1],[[1,0,0,1]],[0],0.0,2.0,"","",""]; + + _explosions pushBack [_refExp, _bpos, _hit, _distance, _indirectHitRange/4, _depth]; + + }; + if(count _explosions > (_radi*2)/_depth) exitWith {}; + } forEach _buckets; + // _can = "Land_Bricks_V4_F" createVehicle (ASLtoATL _pos); + // _dirvec = _pos vectorFromTo ((ATLtoASL (player modelToWorldVisual (player selectionPosition "Spine3")))); + // _dirvec = _dirvec vectorMultiply 100; + // _can setVelocity _dirvec; + [DFUNC(doExplosions), 0, [_explosions, 0]] call CBA_fnc_addPerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; +}; +END_COUNTER(fnc_findReflections); diff --git a/addons/frag/functions/fnc_frago.sqf b/addons/frag/functions/fnc_frago.sqf index 8c72ae8bac..ca0a9c2fc8 100644 --- a/addons/frag/functions/fnc_frago.sqf +++ b/addons/frag/functions/fnc_frago.sqf @@ -1,218 +1,218 @@ -//fnc_frago.sqf -// #define DEBUG_MODE_FULL -#include "script_component.hpp" - -#define FRAG_VEC_VAR 0.004 - -#define MAX_FRAG_COUNT 50 - -if(!isServer) exitWith { }; - -BEGIN_COUNTER(frago); -// _startTime = ACE_diagTime; - -private ["_startTime", "_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "_warn", "_atlPos", "_isArmed", "_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"]; - -_round = _this select 0; -_lastPos = _this select 1; -_lastVel = _this select 2; -_shellType = _this select 3; -_gun = nil; -if((count _this) > 5) then { - _gun = _this select 5; -}; - -_fragTypes = [ - "ACE_frag_tiny", "ACE_frag_tiny", "ACE_frag_tiny", - "ACE_frag_tiny_HD", "ACE_frag_tiny_HD", "ACE_frag_tiny_HD", - "ACE_frag_small","ACE_frag_small","ACE_frag_small","ACE_frag_small", - "ACE_frag_small_HD","ACE_frag_small_HD","ACE_frag_small_HD","ACE_frag_small_HD", - "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD" - ]; - -_warn = false; -if(isArray (configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CLASSES")) then { - _fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CLASSES"); -} else { - _warn = true; -}; - -_atlPos = ASLtoATL _lastPos; - -_isArmed = true; -if(!isNil "_gun") then { - _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance"); - _isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist); -}; - -_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange"); -_fragRange = 20*_indirectHitRange*4; -// _c = 185; // grams of comp-b -// _m = 210; // grams of fragmentating metal -// _k = 3/5; // spherical K factor -// _gC = 2843; // Gurney constant of comp-b in /ms - -// _c = 429; // grams of tritonal -// _m = 496; // grams of fragmentating metal -// _k = 1/2; // spherical K factor -// _gC = 2320; // Gurney constant of tritonal in /ms - - -_c = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CHARGE"); -if(_c == 0) then { _c = 1; _warn = true;}; -_m = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_METAL"); -if(_m == 0) then { _m = 2; _warn = true;}; -_k = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_GURNEY_K"); -if(_k == 0) then { _k = 1/2; _warn = true;}; -_gC = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_GURNEY_C"); -if(_gC == 0) then { _gC = 2440; _warn = true;}; - -if(_warn) then { - ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_shellType); //TODO: turn this off when we get closer to release -}; - -_fragPower = (((_m/_c)+_k)^-(1/2))*_gC; -_fragPower = _fragPower*0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation - -_fragPowerRandom = _fragPower*0.5; -if((_atlPos select 2) < 0.5) then { - _lastPos set[2, (_lastPos select 2)+0.5]; -}; - -// _manObjects = _atlPos nearEntities ["CaManBase", _fragRange]; - -// setAccTime 0.01; - -//_objects = nearestObjects [_atlPos, ["AllVehicles"], _fragRange]; // Not sure if tracking "ReammoBox" is required, if so revert this change for _objects -_objects = _atlPos nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange]; - -// _objects = _manObjects; -// Target also people inside vehicles or manning weapons -_crew = []; -{ - { - _crew set [count _crew,_x] - } forEach (crew _x); -} forEach _objects; - -_objects = _objects - _crew; -_objects = _objects + _crew; - -_fragCount = 0; - -_fragArcs = []; -_fragArcs set[360, 0]; - -#ifdef DEBUG_MODE_FULL - ACE_player sideChat format["_fragRange: %1", _fragRange]; - ACE_player sideChat format["_objects: %1", _objects]; -#endif -_doRandom = true; -if(_isArmed && (count _objects) > 0) then { - if (GVAR(ReflectionsEnabled)) then { - [_lastPos, _shellType] call FUNC(doReflections); - }; - { - //if(random(1) > 0.5) then { - _target = _x; - if(alive _target) then { - _boundingBox = boundingBox _target; - _targetPos = (getPosASL _target); - _distance = _targetPos distance _lastPos; - _add = (((_boundingBox select 1) select 2)/2)+((((_distance-(_fragpower/8)) max 0)/_fragPower)*10); - _bbX = (abs((_boundingBox select 0) select 0))+((_boundingBox select 1) select 0); - _bbY = (abs((_boundingBox select 0) select 1))+((_boundingBox select 1) select 1); - _bbZ = (abs((_boundingBox select 0) select 2))+((_boundingBox select 1) select 2); - _cubic = _bbX*_bbY*_bbZ; - if(_cubic > 1) then { - _doRandom = true; - - _targetVel = (velocity _target); - - - _targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))]; - _targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))]; - _targetPos set[2, (_targetPos select 2)+_add]; - - _baseVec = _lastPos vectorFromTo _targetPos; - - _dir = floor(_baseVec call CBA_fnc_vectDir); - _currentCount = _fragArcs select _dir; - if(isNil "_currentCount") then { - _currentCount = 0; - }; - if(_currentCount < 20) then { - _count = ceil(random(sqrt(_m/1000))); - _vecVar = FRAG_VEC_VAR; - if(!(_target isKindOf "Man")) then { - _vecVar = ((sqrt _cubic)/2000)+FRAG_VEC_VAR; - if((count (crew _target)) == 0 && _count > 0) then { - _count = 0 max (_count/2); - }; - }; - for "_i" from 1 to _count do { - _vec = +_baseVec; - - _vec set[0, (_vec select 0)-(_vecVar/2)+(random _vecVar)]; - _vec set[1, (_vec select 1)-(_vecVar/2)+(random _vecVar)]; - _vec set[2, (_vec select 2)-(_vecVar/2)+(random _vecVar)]; - - _fp = (_fragPower-(random (_fragPowerRandom))); - _vel = _vec vectorMultiply _fp; - - _fragType = round (random ((count _fragTypes)-1)); - _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; - // diag_log text format["fp: %1 %2", _fp, typeOf _fragObj]; - _fragObj setPosASL _lastPos; - _fragObj setVectorDir _vec; - _fragObj setVelocity _vel; - if(GVAR(traceFrags)) then { - GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; - [ACE_player, _fragObj, [1,0,0,1]] call FUNC(addTrack); - }; - _fragCount = _fragCount + 1; - _currentCount = _currentCount + 1; - }; - _fragArcs set[_dir, _currentCount]; - }; - }; - }; - //}; - if(_fragCount > MAX_FRAG_COUNT) exitWith {}; - } forEach _objects; - if(_fragCount > MAX_FRAG_COUNT) exitWith {}; - _randomCount = ((ceil((MAX_FRAG_COUNT-_fragCount)*0.1)) max 0)+20; - _sectorSize = 360 / (_randomCount max 1); - // _doRandom = false; - if(_doRandom) then { - for "_i" from 1 to _randomCount do { - // Distribute evenly - _sectorOffset = 360 * (_i - 1) / (_randomCount max 1); - _randomDir = random(_sectorSize); - _vec = [cos(_sectorOffset + _randomDir), sin(_sectorOffset + _randomDir), sin(30 - (random 45))]; - - _fp = (_fragPower-(random (_fragPowerRandom))); - - _vel = _vec vectorMultiply _fp; - - _fragType = round (random ((count _fragTypes)-1)); - _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; - _fragObj setPosASL _lastPos; - _fragObj setVectorDir _vec; - _fragObj setVelocity _vel; - - if(GVAR(traceFrags)) then { - GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; - [ACE_player, _fragObj, [1,0.5,0,1]] call FUNC(addTrack); - }; - _fragCount = _fragCount + 1; - }; - }; - -}; -// #ifdef DEBUG_MODE_FULL - // ACE_player sideChat format["total frags: %1", GVAR(TOTALFRAGS)]; - // ACE_player sideChat format["tracks: %1", (count GVAR(trackedObjects))]; -// #endif -// _endTime = ACE_diagTime; +//fnc_frago.sqf +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define FRAG_VEC_VAR 0.004 + +#define MAX_FRAG_COUNT 50 + +if(!isServer) exitWith { }; + +BEGIN_COUNTER(frago); +// _startTime = diag_tickTime; + +private ["_startTime", "_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "_warn", "_atlPos", "_isArmed", "_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"]; + +_round = _this select 0; +_lastPos = _this select 1; +_lastVel = _this select 2; +_shellType = _this select 3; +_gun = nil; +if((count _this) > 5) then { + _gun = _this select 5; +}; + +_fragTypes = [ + "ACE_frag_tiny", "ACE_frag_tiny", "ACE_frag_tiny", + "ACE_frag_tiny_HD", "ACE_frag_tiny_HD", "ACE_frag_tiny_HD", + "ACE_frag_small","ACE_frag_small","ACE_frag_small","ACE_frag_small", + "ACE_frag_small_HD","ACE_frag_small_HD","ACE_frag_small_HD","ACE_frag_small_HD", + "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD", "ACE_frag_medium_HD" + ]; + +_warn = false; +if(isArray (configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CLASSES")) then { + _fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CLASSES"); +} else { + _warn = true; +}; + +_atlPos = ASLtoATL _lastPos; + +_isArmed = true; +if(!isNil "_gun") then { + _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance"); + _isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist); +}; + +_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange"); +_fragRange = 20*_indirectHitRange*4; +// _c = 185; // grams of comp-b +// _m = 210; // grams of fragmentating metal +// _k = 3/5; // spherical K factor +// _gC = 2843; // Gurney constant of comp-b in /ms + +// _c = 429; // grams of tritonal +// _m = 496; // grams of fragmentating metal +// _k = 1/2; // spherical K factor +// _gC = 2320; // Gurney constant of tritonal in /ms + + +_c = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_CHARGE"); +if(_c == 0) then { _c = 1; _warn = true;}; +_m = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_METAL"); +if(_m == 0) then { _m = 2; _warn = true;}; +_k = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_GURNEY_K"); +if(_k == 0) then { _k = 1/2; _warn = true;}; +_gC = getNumber(configFile >> "CfgAmmo" >> _shellType >> "ACE_frag_GURNEY_C"); +if(_gC == 0) then { _gC = 2440; _warn = true;}; + +if(_warn) then { + ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_shellType); //TODO: turn this off when we get closer to release +}; + +_fragPower = (((_m/_c)+_k)^-(1/2))*_gC; +_fragPower = _fragPower*0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation + +_fragPowerRandom = _fragPower*0.5; +if((_atlPos select 2) < 0.5) then { + _lastPos set[2, (_lastPos select 2)+0.5]; +}; + +// _manObjects = _atlPos nearEntities ["CaManBase", _fragRange]; + +// setAccTime 0.01; + +//_objects = nearestObjects [_atlPos, ["AllVehicles"], _fragRange]; // Not sure if tracking "ReammoBox" is required, if so revert this change for _objects +_objects = _atlPos nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange]; + +// _objects = _manObjects; +// Target also people inside vehicles or manning weapons +_crew = []; +{ + { + _crew set [count _crew,_x] + } forEach (crew _x); +} forEach _objects; + +_objects = _objects - _crew; +_objects = _objects + _crew; + +_fragCount = 0; + +_fragArcs = []; +_fragArcs set[360, 0]; + +#ifdef DEBUG_MODE_FULL + ACE_player sideChat format["_fragRange: %1", _fragRange]; + ACE_player sideChat format["_objects: %1", _objects]; +#endif +_doRandom = true; +if(_isArmed && (count _objects) > 0) then { + if (GVAR(ReflectionsEnabled)) then { + [_lastPos, _shellType] call FUNC(doReflections); + }; + { + //if(random(1) > 0.5) then { + _target = _x; + if(alive _target) then { + _boundingBox = boundingBox _target; + _targetPos = (getPosASL _target); + _distance = _targetPos distance _lastPos; + _add = (((_boundingBox select 1) select 2)/2)+((((_distance-(_fragpower/8)) max 0)/_fragPower)*10); + _bbX = (abs((_boundingBox select 0) select 0))+((_boundingBox select 1) select 0); + _bbY = (abs((_boundingBox select 0) select 1))+((_boundingBox select 1) select 1); + _bbZ = (abs((_boundingBox select 0) select 2))+((_boundingBox select 1) select 2); + _cubic = _bbX*_bbY*_bbZ; + if(_cubic > 1) then { + _doRandom = true; + + _targetVel = (velocity _target); + + + _targetPos set[0, (_targetPos select 0)+((_targetVel select 0)*(_distance/_fragPower))]; + _targetPos set[1, (_targetPos select 1)+((_targetVel select 1)*(_distance/_fragPower))]; + _targetPos set[2, (_targetPos select 2)+_add]; + + _baseVec = _lastPos vectorFromTo _targetPos; + + _dir = floor(_baseVec call CBA_fnc_vectDir); + _currentCount = _fragArcs select _dir; + if(isNil "_currentCount") then { + _currentCount = 0; + }; + if(_currentCount < 20) then { + _count = ceil(random(sqrt(_m/1000))); + _vecVar = FRAG_VEC_VAR; + if(!(_target isKindOf "Man")) then { + _vecVar = ((sqrt _cubic)/2000)+FRAG_VEC_VAR; + if((count (crew _target)) == 0 && _count > 0) then { + _count = 0 max (_count/2); + }; + }; + for "_i" from 1 to _count do { + _vec = +_baseVec; + + _vec set[0, (_vec select 0)-(_vecVar/2)+(random _vecVar)]; + _vec set[1, (_vec select 1)-(_vecVar/2)+(random _vecVar)]; + _vec set[2, (_vec select 2)-(_vecVar/2)+(random _vecVar)]; + + _fp = (_fragPower-(random (_fragPowerRandom))); + _vel = _vec vectorMultiply _fp; + + _fragType = round (random ((count _fragTypes)-1)); + _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; + // diag_log text format["fp: %1 %2", _fp, typeOf _fragObj]; + _fragObj setPosASL _lastPos; + _fragObj setVectorDir _vec; + _fragObj setVelocity _vel; + if(GVAR(traceFrags)) then { + GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; + [ACE_player, _fragObj, [1,0,0,1]] call FUNC(addTrack); + }; + _fragCount = _fragCount + 1; + _currentCount = _currentCount + 1; + }; + _fragArcs set[_dir, _currentCount]; + }; + }; + }; + //}; + if(_fragCount > MAX_FRAG_COUNT) exitWith {}; + } forEach _objects; + if(_fragCount > MAX_FRAG_COUNT) exitWith {}; + _randomCount = ((ceil((MAX_FRAG_COUNT-_fragCount)*0.1)) max 0)+20; + _sectorSize = 360 / (_randomCount max 1); + // _doRandom = false; + if(_doRandom) then { + for "_i" from 1 to _randomCount do { + // Distribute evenly + _sectorOffset = 360 * (_i - 1) / (_randomCount max 1); + _randomDir = random(_sectorSize); + _vec = [cos(_sectorOffset + _randomDir), sin(_sectorOffset + _randomDir), sin(30 - (random 45))]; + + _fp = (_fragPower-(random (_fragPowerRandom))); + + _vel = _vec vectorMultiply _fp; + + _fragType = round (random ((count _fragTypes)-1)); + _fragObj = (_fragTypes select _fragType) createVehicleLocal [0,0,10000]; + _fragObj setPosASL _lastPos; + _fragObj setVectorDir _vec; + _fragObj setVelocity _vel; + + if(GVAR(traceFrags)) then { + GVAR(TOTALFRAGS) = GVAR(TOTALFRAGS) + 1; + [ACE_player, _fragObj, [1,0.5,0,1]] call FUNC(addTrack); + }; + _fragCount = _fragCount + 1; + }; + }; + +}; +// #ifdef DEBUG_MODE_FULL + // ACE_player sideChat format["total frags: %1", GVAR(TOTALFRAGS)]; + // ACE_player sideChat format["tracks: %1", (count GVAR(trackedObjects))]; +// #endif +// _endTime = diag_tickTime; END_COUNTER(frago); \ No newline at end of file diff --git a/addons/frag/functions/fnc_masterPFH.sqf b/addons/frag/functions/fnc_masterPFH.sqf index 637cc02f81..6af62e3f21 100644 --- a/addons/frag/functions/fnc_masterPFH.sqf +++ b/addons/frag/functions/fnc_masterPFH.sqf @@ -1,50 +1,50 @@ -/* - * Author: jaynus - * - * Master single PFH abstraction for all rounds being tracked by frag/spall - * - * Arguments: - * - * - * Return Value: - * None - */ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -//PARAMS_2(_pfhArgs,_handle); - -if (!GVAR(enabled)) exitWith {}; - -private["_gcIndex", "_iter"]; -_gcIndex = []; - -_iter = 0; -while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do { - private["_object", "_args"]; - if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then { - GVAR(lastIterationIndex) = 0; - }; - _object = GVAR(objects) select GVAR(lastIterationIndex); - - if(!isNil "_object") then { - _args = GVAR(arguments) select GVAR(lastIterationIndex); - - if(!(_args call FUNC(pfhRound))) then { - _gcIndex pushBack GVAR(lastIterationIndex); // Add it to the GC if it returns false - }; - }; - _iter = _iter + 1; - GVAR(lastIterationIndex) = GVAR(lastIterationIndex) + 1; -}; - -// clean up dead object references -private["_deletionCount", "_deleteIndex"]; -_deletionCount = 0; -{ - TRACE_1("GC Projectile", _x); - _deleteIndex = _x - _deletionCount; - GVAR(objects) deleteAt _deleteIndex; - GVAR(arguments) deleteAt _deleteIndex; - - _deletionCount = _deletionCount + 1; -} forEach _gcIndex; +/* + * Author: jaynus + * + * Master single PFH abstraction for all rounds being tracked by frag/spall + * + * Arguments: + * + * + * Return Value: + * None + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +//PARAMS_2(_pfhArgs,_handle); + +if (!GVAR(enabled)) exitWith {}; + +private["_gcIndex", "_iter"]; +_gcIndex = []; + +_iter = 0; +while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do { + private["_object", "_args"]; + if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then { + GVAR(lastIterationIndex) = 0; + }; + _object = GVAR(objects) select GVAR(lastIterationIndex); + + if(!isNil "_object") then { + _args = GVAR(arguments) select GVAR(lastIterationIndex); + + if(!(_args call FUNC(pfhRound))) then { + _gcIndex pushBack GVAR(lastIterationIndex); // Add it to the GC if it returns false + }; + }; + _iter = _iter + 1; + GVAR(lastIterationIndex) = GVAR(lastIterationIndex) + 1; +}; + +// clean up dead object references +private["_deletionCount", "_deleteIndex"]; +_deletionCount = 0; +{ + TRACE_1("GC Projectile", _x); + _deleteIndex = _x - _deletionCount; + GVAR(objects) deleteAt _deleteIndex; + GVAR(arguments) deleteAt _deleteIndex; + + _deletionCount = _deletionCount + 1; +} forEach _gcIndex; diff --git a/addons/frag/functions/fnc_pfhRound.sqf b/addons/frag/functions/fnc_pfhRound.sqf index 8aa2303c0d..4163549fd3 100644 --- a/addons/frag/functions/fnc_pfhRound.sqf +++ b/addons/frag/functions/fnc_pfhRound.sqf @@ -1,50 +1,50 @@ -#include "script_component.hpp" -private ["_round", "_lastPos", "_lastVel", "_type", "_firedFrame", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"]; -_round = _this select 0; -_lastPos = _this select 1; -_lastVel = _this select 2; -_type = _this select 3; -_firedFrame = _this select 4; -_doSpall = _this select 6; -_spallTrack = _this select 7; -_foundObjectHPIds = _this select 8; -_skip = _this select 9; -_explosive = _this select 10; -_indirectRange = _this select 11; -_force = _this select 12; -_fragPower = _this select 13; - -if(_round in GVAR(blackList)) exitWith { - false -}; - -if (!alive _round) exitWith { - if((diag_frameno - _firedFrame) > 1) then { //skip if deleted within a single frame - if(_skip == 0) then { - if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then { - [QGVAR(frag_eh), _this] call EFUNC(common,serverEvent); - }; - }; - }; - if(_doSpall) then { - GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) - 1; - // diag_log text format["F: %1", _foundObjectHPIds]; - { - if(!isNil "_x") then { - _x removeEventHandler ["hitPart", _foundObjectHPIds select _forEachIndex]; - }; - } forEach _spallTrack; - }; - false -}; - -_this set[1, (getPosASL _round)]; -_this set[2, (velocity _round)]; - -if(_doSpall) then { - private["_scale"]; - _scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1; - [_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack); -}; - -true +#include "script_component.hpp" +private ["_round", "_lastPos", "_lastVel", "_type", "_firedFrame", "_doSpall", "_spallTrack", "_foundObjectHPIds", "_skip", "_explosive", "_indirectRange", "_force", "_fragPower"]; +_round = _this select 0; +_lastPos = _this select 1; +_lastVel = _this select 2; +_type = _this select 3; +_firedFrame = _this select 4; +_doSpall = _this select 6; +_spallTrack = _this select 7; +_foundObjectHPIds = _this select 8; +_skip = _this select 9; +_explosive = _this select 10; +_indirectRange = _this select 11; +_force = _this select 12; +_fragPower = _this select 13; + +if(_round in GVAR(blackList)) exitWith { + false +}; + +if (!alive _round) exitWith { + if((diag_frameno - _firedFrame) > 1) then { //skip if deleted within a single frame + if(_skip == 0) then { + if((_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}) || {_force == 1} ) then { + [QGVAR(frag_eh), _this] call CBA_fnc_serverEvent; + }; + }; + }; + if(_doSpall) then { + GVAR(spallIsTrackingCount) = GVAR(spallIsTrackingCount) - 1; + // diag_log text format["F: %1", _foundObjectHPIds]; + { + if(!isNil "_x") then { + _x removeEventHandler ["hitPart", _foundObjectHPIds select _forEachIndex]; + }; + } forEach _spallTrack; + }; + false +}; + +_this set[1, (getPosASL _round)]; +_this set[2, (velocity _round)]; + +if(_doSpall) then { + private["_scale"]; + _scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1; + [_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack); +}; + +true diff --git a/addons/frag/functions/fnc_removePfhRound.sqf b/addons/frag/functions/fnc_removePfhRound.sqf index 92b09aad6d..d186da1e17 100644 --- a/addons/frag/functions/fnc_removePfhRound.sqf +++ b/addons/frag/functions/fnc_removePfhRound.sqf @@ -1,11 +1,11 @@ -#include "script_component.hpp" - -// THIS FUNCTION SHOULD NOT BE USED BECAUSE IT CAUSES AN SEARCH AND REBUILD - -PARAMS_1(_round); - -if(_round in GVAR(blackList)) then { - GVAR(blackList) = GVAR(blackList) - [_round]; -}; - -GVAR(objects) = GVAR(objects) - [_round]; +#include "script_component.hpp" + +// THIS FUNCTION SHOULD NOT BE USED BECAUSE IT CAUSES AN SEARCH AND REBUILD + +PARAMS_1(_round); + +if(_round in GVAR(blackList)) then { + GVAR(blackList) = GVAR(blackList) - [_round]; +}; + +GVAR(objects) = GVAR(objects) - [_round]; diff --git a/addons/frag/functions/fnc_removeTrack.sqf b/addons/frag/functions/fnc_removeTrack.sqf index d14b55b172..914a90602c 100644 --- a/addons/frag/functions/fnc_removeTrack.sqf +++ b/addons/frag/functions/fnc_removeTrack.sqf @@ -1,14 +1,14 @@ -#include "script_component.hpp" - -private ["_ret"]; -_ret = true; -if(IS_ARRAY((_this select 0))) then { - _ret = false; -} else { - if((_this select 0) in GVAR(trackedObjects)) then { - GVAR(trackedObjects) = GVAR(trackedObjects) - [(_this select 0)]; - } else { - _ret = false; - }; -}; -_ret +#include "script_component.hpp" + +private ["_ret"]; +_ret = true; +if(IS_ARRAY((_this select 0))) then { + _ret = false; +} else { + if((_this select 0) in GVAR(trackedObjects)) then { + GVAR(trackedObjects) = GVAR(trackedObjects) - [(_this select 0)]; + } else { + _ret = false; + }; +}; +_ret diff --git a/addons/frag/functions/fnc_spallHP.sqf b/addons/frag/functions/fnc_spallHP.sqf index 3756bb1416..5bdde6eee9 100644 --- a/addons/frag/functions/fnc_spallHP.sqf +++ b/addons/frag/functions/fnc_spallHP.sqf @@ -1,29 +1,29 @@ -#include "script_component.hpp" - -private ["_initialData", "_hpData", "_round", "_hpRound", "_hpDirect"]; -//player sideChat format["f: %1 c: %2", (_this select 0), (count GVAR(spallHPData))]; - -if ((_this select 0) <= (count GVAR(spallHPData))) then { - _initialData = GVAR(spallHPData) select (_this select 0); - if (!isNil "_initialData") then { - _hpRound = ((_this select 1) select 0) select 2; - _round = _initialData select 3; - _hpDirect = ((_this select 1) select 0) select 10; - if (_hpDirect && {_round == _hpRound}) then { - { - _hpData = _x; - _round = _initialData select 3; - // diag_log text format["HPDUMP-------------------------------------"]; - // { - // _hp = _x; - // diag_log text format["%1 --", _forEachIndex]; - // { - // diag_log text format["%1: %2", _forEachIndex, _x]; - // } forEach _hp; - // } forEach (_this select 1); - [DFUNC(doSpall), [_this, _forEachIndex]] call EFUNC(common,execNextFrame); - // player sideChat "WEEE"; - } forEach (_this select 1); - }; - }; -}; +#include "script_component.hpp" + +private ["_initialData", "_hpData", "_round", "_hpRound", "_hpDirect"]; +//player sideChat format["f: %1 c: %2", (_this select 0), (count GVAR(spallHPData))]; + +if ((_this select 0) <= (count GVAR(spallHPData))) then { + _initialData = GVAR(spallHPData) select (_this select 0); + if (!isNil "_initialData") then { + _hpRound = ((_this select 1) select 0) select 2; + _round = _initialData select 3; + _hpDirect = ((_this select 1) select 0) select 10; + if (_hpDirect && {_round == _hpRound}) then { + { + _hpData = _x; + _round = _initialData select 3; + // diag_log text format["HPDUMP-------------------------------------"]; + // { + // _hp = _x; + // diag_log text format["%1 --", _forEachIndex]; + // { + // diag_log text format["%1: %2", _forEachIndex, _x]; + // } forEach _hp; + // } forEach (_this select 1); + [DFUNC(doSpall), [_this, _forEachIndex]] call CBA_fnc_execNextFrame; + // player sideChat "WEEE"; + } forEach (_this select 1); + }; + }; +}; diff --git a/addons/frag/functions/fnc_spallTrack.sqf b/addons/frag/functions/fnc_spallTrack.sqf index afe4bc1931..dd369380b3 100644 --- a/addons/frag/functions/fnc_spallTrack.sqf +++ b/addons/frag/functions/fnc_spallTrack.sqf @@ -1,32 +1,32 @@ -//fnc_spallTrack.sqf -#include "script_component.hpp" - -private ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_hpId", "_data"]; -_round = _this select 0; -_multiplier = _this select 1; -_foundObjects = _this select 2; -_foundObjectHPIds = _this select 3; - -_delta = (1/diag_fps) * _multiplier; -_curPos = getPosASL _round; -_velocity = velocity _round; - -_velocityStep = _velocity vectorMultiply _delta; -_forwardPos = _curPos vectorAdd _velocityStep; - -_intersectsWith = lineIntersectsWith [_curPos, _forwardPos]; - -if (count _intersectsWith > 0) then { - // player sideChat format["inter: %1", _intersectsWith]; - { - if(!(_x in _foundObjects)) then { - // diag_log text format["Adding HP: %1", _x]; - _index = (count GVAR(spallHPData)); - _hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QUOTE(FUNC(spallHP)), _index]]; - _foundObjects set[(count _foundObjects), _x]; - _foundObjectHPIds set[(count _foundObjectHPIds), _hpId]; - _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds]; - GVAR(spallHPData) set[_index, _data]; - }; - } forEach _intersectsWith; -}; +//fnc_spallTrack.sqf +#include "script_component.hpp" + +private ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_hpId", "_data"]; +_round = _this select 0; +_multiplier = _this select 1; +_foundObjects = _this select 2; +_foundObjectHPIds = _this select 3; + +_delta = (1/diag_fps) * _multiplier; +_curPos = getPosASL _round; +_velocity = velocity _round; + +_velocityStep = _velocity vectorMultiply _delta; +_forwardPos = _curPos vectorAdd _velocityStep; + +_intersectsWith = lineIntersectsWith [_curPos, _forwardPos]; + +if (count _intersectsWith > 0) then { + // player sideChat format["inter: %1", _intersectsWith]; + { + if(!(_x in _foundObjects)) then { + // diag_log text format["Adding HP: %1", _x]; + _index = (count GVAR(spallHPData)); + _hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QFUNC(spallHP), _index]]; + _foundObjects set[(count _foundObjects), _x]; + _foundObjectHPIds set[(count _foundObjectHPIds), _hpId]; + _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds]; + GVAR(spallHPData) set[_index, _data]; + }; + } forEach _intersectsWith; +}; diff --git a/addons/frag/functions/fnc_startTracing.sqf b/addons/frag/functions/fnc_startTracing.sqf index 5c0c8aaf77..ca9aa8c84e 100644 --- a/addons/frag/functions/fnc_startTracing.sqf +++ b/addons/frag/functions/fnc_startTracing.sqf @@ -1,5 +1,5 @@ -#include "script_component.hpp" -if(!GVAR(tracesStarted)) then { - GVAR(tracesStarted) = true; - GVAR(traceID) = [FUNC(drawTraces), 0, []] call CBA_fnc_addPerFrameHandler; -}; +#include "script_component.hpp" +if(!GVAR(tracesStarted)) then { + GVAR(tracesStarted) = true; + GVAR(traceID) = [FUNC(drawTraces), 0, []] call CBA_fnc_addPerFrameHandler; +}; diff --git a/addons/frag/functions/fnc_stopTracing.sqf b/addons/frag/functions/fnc_stopTracing.sqf index f8ddf42084..b58352c897 100644 --- a/addons/frag/functions/fnc_stopTracing.sqf +++ b/addons/frag/functions/fnc_stopTracing.sqf @@ -1,5 +1,5 @@ -#include "script_component.hpp" -if(GVAR(tracesStarted)) then { - GVAR(tracesStarted) = false; - [GVAR(traceID)] call CBA_fnc_removePerFrameHandler; -}; +#include "script_component.hpp" +if(GVAR(tracesStarted)) then { + GVAR(tracesStarted) = false; + [GVAR(traceID)] call CBA_fnc_removePerFrameHandler; +}; diff --git a/addons/frag/functions/fnc_trackTrace.sqf b/addons/frag/functions/fnc_trackTrace.sqf index 24910db163..d9407c3f8d 100644 --- a/addons/frag/functions/fnc_trackTrace.sqf +++ b/addons/frag/functions/fnc_trackTrace.sqf @@ -1,14 +1,14 @@ -#include "script_component.hpp" - -private ["_params", "_tracerObj", "_index", "_positions", "_data"]; -_params = _this select 0; -_tracerObj = _params select 0; -_index = _params select 1; - -if (alive _tracerObj && (count GVAR(traces)) > 0) then { - _data = GVAR(traces) select _index; - _positions = _data select 4; - _positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]]; -} else { - [(_this select 1)] call CBA_fnc_removePerFrameHandler; -}; +#include "script_component.hpp" + +private ["_params", "_tracerObj", "_index", "_positions", "_data"]; +_params = _this select 0; +_tracerObj = _params select 0; +_index = _params select 1; + +if (alive _tracerObj && (count GVAR(traces)) > 0) then { + _data = GVAR(traces) select _index; + _positions = _data select 4; + _positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]]; +} else { + [(_this select 1)] call CBA_fnc_removePerFrameHandler; +}; diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index 1faa440294..73655e84e5 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -1,20 +1,21 @@ -#define COMPONENT frag -#include "\z\ace\addons\main\script_mod.hpp" - -//#define DEBUG_ENABLED_FRAG -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_FRAG - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_FRAG - #define DEBUG_SETTINGS DEBUG_SETTINGS_FRAG -#endif - -#include "\z\ace\addons\main\script_macros.hpp" - -#define ACE_TRACE_DRAW_INC 1 \ No newline at end of file +#define COMPONENT frag +#define COMPONENT_BEAUTIFIED Frag +#include "\z\ace\addons\main\script_mod.hpp" + +//#define DEBUG_ENABLED_FRAG +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_FRAG + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_FRAG + #define DEBUG_SETTINGS DEBUG_SETTINGS_FRAG +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define ACE_TRACE_DRAW_INC 1 diff --git a/addons/frag/stringtable.xml b/addons/frag/stringtable.xml index 4191a405d3..c7afb23097 100644 --- a/addons/frag/stringtable.xml +++ b/addons/frag/stringtable.xml @@ -68,6 +68,7 @@ Druckwellensimulation Activar simulación de reflexiones Simulation de la réflection des explosions. + Simulação de reflexo de explosão Enable the ACE Explosion Reflection Simulation @@ -76,6 +77,7 @@ Aktiviere die ACE-Druckwellensimulation Activa la simulación de reflexiones para las explosiones. Activer la simulation de la réfléction des explosions ACE. + Ativa a simulação de reflexo de explosão do ACE Maximum Projectiles Tracked diff --git a/addons/gestures/CfgMovesBasic.hpp b/addons/gestures/CfgMovesBasic.hpp index 50a835abe6..30e2d4d2dd 100644 --- a/addons/gestures/CfgMovesBasic.hpp +++ b/addons/gestures/CfgMovesBasic.hpp @@ -126,75 +126,75 @@ class CfgGesturesMale { }; class GVAR(forward): GVAR(Base) { - file = QUOTE(PATHTOF(anim\ace_forward.rtm)); + file = QPATHTOF(anim\ace_forward.rtm); speed = 1; }; class GVAR(forwardStandLowered): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_forward_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_forward_stand_lowered.rtm); }; class GVAR(freeze): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_freeze.rtm)); + file = QPATHTOF(anim\ace_freeze.rtm); speed = 0.6; }; class GVAR(freezeStandLowered): GVAR(freeze) { - file = QUOTE(PATHTOF(anim\ace_freeze_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_freeze_stand_lowered.rtm); }; class GVAR(cover): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_cover.rtm)); + file = QPATHTOF(anim\ace_cover.rtm); speed = 0.8; }; class GVAR(coverStandLowered): GVAR(cover) { - file = QUOTE(PATHTOF(anim\ace_cover_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_cover_stand_lowered.rtm); }; class GVAR(regroup): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_regroup.rtm)); + file = QPATHTOF(anim\ace_regroup.rtm); speed = 0.8; }; class GVAR(regroupStandLowered): GVAR(regroup) { - file = QUOTE(PATHTOF(anim\ace_regroup_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_regroup_stand_lowered.rtm); }; class GVAR(engage): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_engage.rtm)); + file = QPATHTOF(anim\ace_engage.rtm); speed = 0.9; }; class GVAR(engageStandLowered): GVAR(engage) { - file = QUOTE(PATHTOF(anim\ace_engage_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_engage_stand_lowered.rtm); }; class GVAR(point): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_point.rtm)); + file = QPATHTOF(anim\ace_point.rtm); speed = 0.8; }; class GVAR(pointStandLowered): GVAR(point) { - file = QUOTE(PATHTOF(anim\ace_point_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_point_stand_lowered.rtm); }; class GVAR(hold): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_hold.rtm)); + file = QPATHTOF(anim\ace_hold.rtm); speed = 0.8; }; class GVAR(holdStandLowered): GVAR(hold) { - file = QUOTE(PATHTOF(anim\ace_hold_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_hold_stand_lowered.rtm); }; class GVAR(warning): GVAR(forward) { - file = QUOTE(PATHTOF(anim\ace_warning.rtm)); + file = QPATHTOF(anim\ace_warning.rtm); speed = 0.8; }; class GVAR(warningStandLowered): GVAR(warning) { - file = QUOTE(PATHTOF(anim\ace_warning_stand_lowered.rtm)); + file = QPATHTOF(anim\ace_warning_stand_lowered.rtm); }; }; }; diff --git a/addons/gestures/CfgVehicles.hpp b/addons/gestures/CfgVehicles.hpp index 8294f43759..2c099bcc45 100644 --- a/addons/gestures/CfgVehicles.hpp +++ b/addons/gestures/CfgVehicles.hpp @@ -9,7 +9,7 @@ class CfgVehicles { statement = ""; showDisabled = 1; priority = 3.5; - icon = PATHTOF(UI\gestures_ca.paa); + icon = QPATHTOF(UI\gestures_ca.paa); class GVAR(Advance) { displayName = CSTRING(Advance); diff --git a/addons/gestures/XEH_missionDisplayLoad.sqf b/addons/gestures/XEH_missionDisplayLoad.sqf index 17ddf32557..856f361d3a 100644 --- a/addons/gestures/XEH_missionDisplayLoad.sqf +++ b/addons/gestures/XEH_missionDisplayLoad.sqf @@ -25,7 +25,7 @@ _display displayAddEventHandler ["KeyDown", { }; TRACE_2("Reloading, blocking gestures",_weapon,_duration); - [{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute); + [{GVAR(ReloadMutex) = true;}, [], _duration] call CBA_fnc_waitAndExecute; }; }; false diff --git a/addons/gestures/config.cpp b/addons/gestures/config.cpp index ce60d26545..a33e149df6 100644 --- a/addons/gestures/config.cpp +++ b/addons/gestures/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interact_menu"}; - author[] = {"joko // Jonas", "Emperias", "Zigomarvin"}; - authorUrl = "https://github.com/jokoho48"; + author = ECSTRING(common,ACETeam); + authors[] = {"joko // Jonas", "Emperias", "Zigomarvin"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/gestures/script_component.hpp b/addons/gestures/script_component.hpp index 96ca2cf680..ddf7ddb401 100644 --- a/addons/gestures/script_component.hpp +++ b/addons/gestures/script_component.hpp @@ -1,4 +1,5 @@ -#define COMPONENT Gestures +#define COMPONENT gestures +#define COMPONENT_BEAUTIFIED Gestures #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/gestures/stringtable.xml b/addons/gestures/stringtable.xml index 56b77e97e9..fdb772462d 100644 --- a/addons/gestures/stringtable.xml +++ b/addons/gestures/stringtable.xml @@ -6,7 +6,7 @@ ACE Gesten ACE Gesty ACE Posunky - ACE Signaux + ACE Gestes ACE Kézjelek ACE Gesti ACE Gestos @@ -19,7 +19,7 @@ Gestos Gesty Posunky - Signaux + Gestes Жесты Kézjelek Gestos @@ -79,7 +79,7 @@ Alto el fuego Wstrzymać ogień Zastavit palbu - Halte au feu + Cesser le feu Прекратить огонь Tüzet szüntess Cessar Fogo @@ -114,7 +114,7 @@ Cubrirse Do osłony Krýt se - A couvert + À couvert Укрыться Fedezékbe Proteger-se @@ -193,7 +193,8 @@ Pokaż gesty w menu interakcji Mostra Gesti su Menù Interazione Mostrar gestos en el menú de interacción - Afficher les gestes au menu d'interaction. + Afficher les gestes dans le menu d'interaction. + Mostrar gestos no menu de interação Show gestures on the self interaction menu, or just use keybinds, or disable completely @@ -203,6 +204,7 @@ Mostra Gesti nel Menù Interazione Personale, o usa solamente Hotkey, o disabilita completamente Muestror los gestos en el menú de interacción propia, utilizar solo combinación de teclas o desactivarlos completamente Afficher les gestes dans le menu d'interaction personnel, ou seulement utiliser les touches, ou desactiver complètement. + Mostra gestos no menu de interação, ou utilize um dos atalhos de teclado ou desative completamente Just Keybinds @@ -212,6 +214,7 @@ Solo Hotkey Solo mediante teclas Seulement les touches + Somente atalhos de teclado Keybinds + Interaction Menu @@ -221,6 +224,7 @@ Hotkey + Menù Interazione Teclas y Menú de Interacción Touches + menu d'interaction + Atalhos + Menu de Interação - + \ No newline at end of file diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index d1df112606..9eb049c9f5 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -4,7 +4,7 @@ if (!hasInterface) exitWith {}; GVAR(pfID) = -1; -["SettingsInitialized", { +["ace_settingsInitialized", { TRACE_1("SettingsInitialized eh",GVAR(enabledFor)); if (GVAR(enabledFor) == 0) exitWith {}; //Module has no effect if enabledFor is "None" @@ -19,7 +19,7 @@ GVAR(pfID) = -1; [] call FUNC(addPFEH); TRACE_1("adding temp PFEH [start in]",GVAR(pfID)); }; - ["playerVehicleChanged", { + ["vehicle", { params ["", "_vehicle"]; TRACE_2("playerVehicleChanged",_vehicle,typeOf _vehicle); if (_vehicle isKindOf "Air") then { @@ -35,5 +35,5 @@ GVAR(pfID) = -1; GVAR(pfID) = -1; }; }; - }] call EFUNC(common,addEventHandler); -}] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addPlayerEventHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/gforces/config.cpp b/addons/gforces/config.cpp index 6c40f4ce1c..e05f582d08 100644 --- a/addons/gforces/config.cpp +++ b/addons/gforces/config.cpp @@ -2,18 +2,22 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi", "esteldunedain"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi", "esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; + + // this prevents any patched class from requiring this addon + addonRootClass = "A3_Characters_F"; }; }; +#include "ACE_Settings.hpp" #include "CfgEventHandlers.hpp" - #include "CfgWeapons.hpp" - #include "CfgVehicles.hpp" diff --git a/addons/gforces/functions/fnc_addPFEH.sqf b/addons/gforces/functions/fnc_addPFEH.sqf index 50311c3a06..9bd4d7fa1a 100644 --- a/addons/gforces/functions/fnc_addPFEH.sqf +++ b/addons/gforces/functions/fnc_addPFEH.sqf @@ -2,10 +2,10 @@ * Author: KoffeinFlummi and esteldunedain * Adds the PFEH * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index dc6f11ee39..48370c2431 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -2,11 +2,11 @@ * Author: KoffeinFlummi and esteldunedain * Calculates average g-forces and triggers g-effects * - * Argument: + * Arguments: * 0: Arguments * 1: pfh_id * - * Return value: + * Return Value: * None * * Public: No @@ -14,8 +14,8 @@ #include "script_component.hpp" // Update the g-forces at constant mission time intervals (taking accTime into account) -if ((ACE_time - GVAR(lastUpdateTime)) < INTERVAL) exitWith {}; -GVAR(lastUpdateTime) = ACE_time; +if ((CBA_missionTime - GVAR(lastUpdateTime)) < INTERVAL) exitWith {}; +GVAR(lastUpdateTime) = CBA_missionTime; if (isNull ACE_player || !(alive ACE_player)) exitWith {}; diff --git a/addons/gforces/script_component.hpp b/addons/gforces/script_component.hpp index c017eb4a62..6adfb95cf6 100644 --- a/addons/gforces/script_component.hpp +++ b/addons/gforces/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT gforces +#define COMPONENT_BEAUTIFIED G-Forces #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/gforces/stringtable.xml b/addons/gforces/stringtable.xml index f5d5f1b12d..b28ffcdac9 100644 --- a/addons/gforces/stringtable.xml +++ b/addons/gforces/stringtable.xml @@ -6,12 +6,16 @@ Gforces Effekte Efectos Gforces G Force efekty + Efeitos de ForçaG + Effets de force gravitationnelle Only Aircraft Nur Luftfahrzeug Sólo Aeronave Pouze letadla + Somente Aeronave + Avions seulement \ No newline at end of file diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 37edd7184b..ea610afff0 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -31,7 +31,6 @@ GVAR(EffectsActive) = false; SETGLASSES(ace_player,GLASSESDEFAULT); -GVAR(EyesDamageScript) = -1; GVAR(FrameEvent) = [false, [false, 20]]; GVAR(PostProcessEyes_Enabled) = false; GVAR(DustHandler) = -1; @@ -44,19 +43,19 @@ GVAR(surfaceCacheIsDust) = false; // init GlassesChanged eventhandler GVAR(OldGlasses) = ""; -["playerInventoryChanged", { +["loadout", { params ["_unit"]; private _currentGlasses = goggles _unit; if (GVAR(OldGlasses) != _currentGlasses) then { - ["GlassesChanged", [_unit, _currentGlasses]] call EFUNC(common,localEvent); + ["ace_glassesChanged", [_unit, _currentGlasses]] call CBA_fnc_localEvent; GVAR(OldGlasses) = _currentGlasses; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; // add glasses eventhandlers -["GlassesChanged", { +["ace_glassesChanged", { params ["_unit", "_glasses"]; SETGLASSES(_unit,GLASSESDEFAULT); @@ -68,9 +67,9 @@ GVAR(OldGlasses) = ""; } else { call FUNC(removeGlassesEffect); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["GlassesCracked", { +["ace_glassesCracked", { params ["_unit"]; _unit setVariable ["ACE_EyesDamaged", true]; @@ -83,18 +82,18 @@ GVAR(OldGlasses) = ""; GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [1, 1, 1, 1], [1, 1, 1, 0]]; GVAR(PostProcessEyes) ppEffectCommit 5; - GVAR(EyesDamageScript) = [{ + [{ params ["_unit"]; GVAR(PostProcessEyes) ppEffectEnable false; _unit setVariable ["ACE_EyesDamaged", false]; - }, _this, 5] call EFUNC(common,waitAndExecute); + }, _this, 5] call CBA_fnc_waitAndExecute; - }, _unit, 25] call EFUNC(common,waitAndExecute); + }, _unit, 25] call CBA_fnc_waitAndExecute; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // check goggles private _fnc_checkGoggles = { @@ -111,8 +110,8 @@ private _fnc_checkGoggles = { }; }; -["cameraViewChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler); -["activeCameraChanged", _fnc_checkGoggles] call EFUNC(common,addEventHandler); +["cameraView", _fnc_checkGoggles] call CBA_fnc_addPlayerEventHandler; +["ace_activeCameraChanged", _fnc_checkGoggles] call CBA_fnc_addEventHandler; // goggles effects main PFH [{ @@ -135,4 +134,4 @@ private _fnc_checkGoggles = { }, 0.5, []] call CBA_fnc_addPerFrameHandler; // Register fire event handler -["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler; diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp index 0812200a87..8341caa9f4 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -3,20 +3,22 @@ #define COLOUR 8.0 class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "http://garth.snakebiteink.co.za/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Garth 'L-H' de Wet"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" -#define COMBAT_GOGGLES ACE_Overlay = QUOTE(PATHTOF(textures\HUD\CombatGoggles.paa)); \ - ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\CombatGogglesCracked.paa)); \ +#define COMBAT_GOGGLES ACE_Overlay = QPATHTOF(textures\HUD\CombatGoggles.paa); \ + ACE_OverlayCracked = QPATHTOF(textures\HUD\CombatGogglesCracked.paa); \ ACE_Resistance = 2; \ ACE_Protection = 1; @@ -26,10 +28,10 @@ class CfgGlasses { ACE_TintAmount=0; ACE_Overlay = ""; ACE_OverlayDirt = "A3\Ui_f\data\igui\rsctitles\HealthTextures\dust_upper_ca.paa"; - ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\Cracked.paa)); + ACE_OverlayCracked = QPATHTOF(textures\HUD\Cracked.paa); ACE_Resistance = 0; ACE_Protection = 0; - ACE_DustPath = QUOTE(PATHTOF(textures\fx\dust\%1.paa)); + ACE_DustPath = QPATHTOF(textures\fx\dust\%1.paa); }; class G_Combat:None { @@ -37,8 +39,8 @@ class CfgGlasses { }; class G_Diving { - ACE_Overlay = QUOTE(PATHTOF(textures\HUD\DivingGoggles.paa)); - ACE_OverlayCracked = QUOTE(PATHTOF(textures\HUD\DivingGogglesCracked.paa)); + ACE_Overlay = QPATHTOF(textures\HUD\DivingGoggles.paa); + ACE_OverlayCracked = QPATHTOF(textures\HUD\DivingGogglesCracked.paa); ACE_Resistance = 2; ACE_Protection = 1; }; @@ -209,7 +211,7 @@ class CfgGesturesMale { class States { class GestureFreezeStand; class GestureWipeFace: GestureFreezeStand { - file = QUOTE(PATHTOF(anim\WipeGlasses.rtm)); + file = QPATHTOF(anim\WipeGlasses.rtm); canPullTrigger = 0; }; }; @@ -268,3 +270,8 @@ class CfgCloudlets { destroyOnWaterSurface = 1; }; }; + +class ACE_newEvents { + GlassesChanged = "ace_glassesChanged"; + GlassesCracked = "ace_glassesCracked"; +}; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf index 4b5ee13a0f..46f079dc38 100644 --- a/addons/goggles/functions/fnc_applyDirtEffect.sqf +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -32,6 +32,10 @@ if ([_unit] call FUNC(isGogglesVisible)) then { if (_dirtImage != "") then { GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 0.1, false]; (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetText _dirtImage; + + private _effectBrightness = linearConversion [0,1,([] call EFUNC(common,ambientBrightness)),0.25,1]; + (GETUVAR(GVAR(DisplayEffects),displayNull) displayCtrl 10660) ctrlSetTextColor [_effectBrightness, _effectBrightness, _effectBrightness, 1]; + TRACE_1("dirt",_effectBrightness); }; }; diff --git a/addons/goggles/functions/fnc_applyDustEffect.sqf b/addons/goggles/functions/fnc_applyDustEffect.sqf index 944b98f127..6277d34c21 100644 --- a/addons/goggles/functions/fnc_applyDustEffect.sqf +++ b/addons/goggles/functions/fnc_applyDustEffect.sqf @@ -26,6 +26,10 @@ if ([_unit] call FUNC(isGogglesVisible)) exitWith { ((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetText format [getText (configFile >> "CfgGlasses" >> goggles _unit >> "ACE_DustPath"), GETDUSTT(DAMOUNT) + 1]; + private _effectBrightness = linearConversion [0,1,([] call EFUNC(common,ambientBrightness)),0.25,1]; + ((GETUVAR(GVAR(DisplayEffects),displayNull)) displayCtrl 10662) ctrlSetTextColor [_effectBrightness, _effectBrightness, _effectBrightness, 1]; + TRACE_1("dust",_effectBrightness); + SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,1)); SETDUST(DBULLETS,0); }; @@ -50,7 +54,7 @@ SETDUST(DBULLETS,0); GVAR(DustHandler) = -1; GVAR(DustHandler) = [{ - if (ACE_diagTime >= GETDUSTT(DTIME) + 3) then { + if (diag_tickTime >= GETDUSTT(DTIME) + 3) then { SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT)-1,0,2)); private _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); @@ -71,7 +75,7 @@ GVAR(DustHandler) = [{ if (GVAR(DustHandler) == -1) then { GVAR(PostProcessEyes) ppEffectEnable false }; - }, [], 2] call EFUNC(common,waitAndExecute); + }, [], 2] call CBA_fnc_waitAndExecute; [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; GVAR(DustHandler) = -1; diff --git a/addons/goggles/functions/fnc_applyRotorWashEffect.sqf b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf index bc8d0bafbf..7a883ab7e7 100644 --- a/addons/goggles/functions/fnc_applyRotorWashEffect.sqf +++ b/addons/goggles/functions/fnc_applyRotorWashEffect.sqf @@ -50,7 +50,7 @@ if !(_rotorWash select 0) exitWith { if (GVAR(DustHandler) == -1) then { GVAR(PostProcessEyes) ppEffectEnable false; } - }, [], 2] call EFUNC(common,waitAndExecute); + }, [], 2] call CBA_fnc_waitAndExecute; [GVAR(DustHandler)] call CBA_fnc_removePerFrameHandler; GVAR(DustHandler) = -1; diff --git a/addons/goggles/functions/fnc_clearGlasses.sqf b/addons/goggles/functions/fnc_clearGlasses.sqf index e7d5584938..f1622c8680 100644 --- a/addons/goggles/functions/fnc_clearGlasses.sqf +++ b/addons/goggles/functions/fnc_clearGlasses.sqf @@ -34,7 +34,7 @@ if ((stance _unit != "PRONE") && {primaryWeapon _unit != ""} && {currentWeapon _ if (cameraView == "INTERNAL") then { addCamShake [5, 1.75, 2]; }; -}, [], 0.3] call EFUNC(common,waitAndExecute); +}, [], 0.3] call CBA_fnc_waitAndExecute; call FUNC(removeDirtEffect); call FUNC(removeRainEffect); diff --git a/addons/goggles/functions/fnc_handleExplosion.sqf b/addons/goggles/functions/fnc_handleExplosion.sqf index b5c71a3d94..44be6ab6c1 100644 --- a/addons/goggles/functions/fnc_handleExplosion.sqf +++ b/addons/goggles/functions/fnc_handleExplosion.sqf @@ -27,7 +27,7 @@ _config = configFile >> "CfgGlasses" >> goggles _unit; if ((_this select 1) call FUNC(GetExplosionIndex) < getNumber (_config >> "ACE_Resistance")) exitWith {true}; if !([_unit] call FUNC(isGogglesVisible)) exitWith { - ["GlassesCracked", [_unit]] call EFUNC(common,localEvent); + ["ace_glassesCracked", [_unit]] call CBA_fnc_localEvent; true }; @@ -46,5 +46,5 @@ if (getText (_config >> "ACE_OverlayCracked") != "") then { (GLASSDISPLAY displayCtrl 10650) ctrlSetText getText (_config >> "ACE_OverlayCracked"); }; -["GlassesCracked", [_unit]] call EFUNC(common,localEvent); +["ace_glassesCracked", [_unit]] call CBA_fnc_localEvent; true diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf index dcfcc51bec..066bc040f7 100644 --- a/addons/goggles/functions/fnc_handleFired.sqf +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -60,14 +60,14 @@ if (!GVAR(surfaceCacheIsDust)) exitWith {true}; // increment dust value with type bullet _bullets = GETDUSTT(DBULLETS); -if (ACE_diagTime - GETDUSTT(DTIME) > 1) then { +if (diag_tickTime - GETDUSTT(DTIME) > 1) then { _bullets = 0; }; _bullets = _bullets + 1; SETDUST(DBULLETS,_bullets); -SETDUST(DTIME,ACE_diagTime); +SETDUST(DTIME,diag_tickTime); // apply dust effect if the amount of fired bullets is over the threshold if (GETDUSTT(DAMOUNT) < 2) then { diff --git a/addons/goggles/script_component.hpp b/addons/goggles/script_component.hpp index 23dc4f428f..3074c10b81 100644 --- a/addons/goggles/script_component.hpp +++ b/addons/goggles/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT goggles +#define COMPONENT_BEAUTIFIED Goggles #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp index 5aa33284c8..a5971044f9 100644 --- a/addons/grenades/CfgAmmo.hpp +++ b/addons/grenades/CfgAmmo.hpp @@ -81,7 +81,7 @@ class CfgAmmo { class ACE_G_M84: SmokeShell { GVAR(flashbang) = 1; - model = PATHTOF(models\ACE_m84_thrown.p3d); + model = QPATHTOF(models\ACE_m84_thrown.p3d); dangerRadiusHit = -1; suppressionRadiusHit = 20; typicalSpeed = 22; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index 16dd9929ff..d1d9127fa4 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -59,8 +59,8 @@ class CfgMagazines { displayname = CSTRING(M84_Name); descriptionshort = CSTRING(M84_Description); displayNameShort = "M84"; - model = PATHTOF(models\ACE_m84.p3d); - picture = PATHTOF(UI\ACE_m84_x_ca.paa); + model = QPATHTOF(models\ACE_m84.p3d); + picture = QPATHTOF(UI\ACE_m84_x_ca.paa); ammo = "ACE_G_M84"; mass = 4; }; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf index d4cc01f06f..e47734c53e 100644 --- a/addons/grenades/XEH_postInit.sqf +++ b/addons/grenades/XEH_postInit.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" -["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler); +["ace_flashbangExploded", {_this call FUNC(flashbangExplosionEH)}] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith {}; @@ -25,6 +25,6 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; // Register fire event handler -["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); -["firedPlayerNonLocal", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); -["firedNonPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(throwGrenade)] call CBA_fnc_addEventHandler; +["ace_firedPlayerNonLocal", DFUNC(throwGrenade)] call CBA_fnc_addEventHandler; +["ace_firedNonPlayer", DFUNC(throwGrenade)] call CBA_fnc_addEventHandler; diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index 2f9e631fe1..6fc14ece0c 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -19,3 +21,7 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "Effects.hpp" + +class ACE_newEvents { + flashbangExplosion = "ace_flashbangExploded"; +}; diff --git a/addons/grenades/functions/fnc_flare.sqf b/addons/grenades/functions/fnc_flare.sqf index 74360e39b9..be2b4ce952 100644 --- a/addons/grenades/functions/fnc_flare.sqf +++ b/addons/grenades/functions/fnc_flare.sqf @@ -36,4 +36,4 @@ _light setLightDayLight true; _light lightAttachObject [_projectile, [0,0,0]]; //_light attachTo [_projectile, [0,0,0]]; -[{deleteVehicle _this}, _light, _timeToLive, 1] call EFUNC(common,waitAndExecute); +[{deleteVehicle _this}, _light, _timeToLive, 1] call CBA_fnc_waitAndExecute; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index c708f3a3cf..0d0779ccef 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -36,8 +36,8 @@ if (hasInterface) then { [{ params ["_light"]; deleteVehicle _light; - }, [_light], 0.2] call EFUNC(common,waitAndExecute); - }, [_light], 0.1] call EFUNC(common,waitAndExecute); + }, [_light], 0.2] call CBA_fnc_waitAndExecute; + }, [_light], 0.1] call CBA_fnc_waitAndExecute; }; // Affect local AI @@ -67,7 +67,7 @@ _affected = _affected - [ACE_player]; }; _unit setSkill (skill _unit * 50); - }, [_x], 7 * _strength] call EFUNC(common,waitAndExecute); + }, [_x], 7 * _strength] call CBA_fnc_waitAndExecute; }; } count _affected; @@ -126,12 +126,12 @@ if (hasInterface && {!isNull ACE_player} && {alive ACE_player}) then { GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); - }, [_strength], 7 * _strength] call EFUNC(common,waitAndExecute); + }, [_strength], 7 * _strength] call CBA_fnc_waitAndExecute; //FULLRECOVERY - end effect [{ GVAR(flashbangPPEffectCC) ppEffectEnable false; - }, [], 17 * _strength] call EFUNC(common,waitAndExecute); + }, [], 17 * _strength] call CBA_fnc_waitAndExecute; }; if (_strength > 0.2) then { diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index 73c10997ba..5c05abc9a3 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -21,5 +21,5 @@ TRACE_1("params",_projectile); if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - ["flashbangExplosion", [getPosASL _projectile]] call EFUNC(common,globalEvent); + ["ace_flashbangExploded", [getPosASL _projectile]] call CBA_fnc_globalEvent; }; diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index 284c573c2e..e603dd8743 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -32,7 +32,7 @@ if (local _unit) then { if (getNumber (_config >> QGVAR(flashbang)) == 1) then { private _fuzeTime = getNumber (_config >> "explosionTime"); - [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call EFUNC(common,waitAndExecute); + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call CBA_fnc_waitAndExecute; }; }; @@ -42,7 +42,7 @@ if (getNumber (_config >> QGVAR(flare)) == 1) then { private _color = getArray (_config >> QGVAR(color)); private _intensity = _color deleteAt 3; - [FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute); + [FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call CBA_fnc_waitAndExecute; }; // handle throw modes diff --git a/addons/grenades/script_component.hpp b/addons/grenades/script_component.hpp index 67a958b27e..299a1cd69a 100644 --- a/addons/grenades/script_component.hpp +++ b/addons/grenades/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT grenades +#define COMPONENT_BEAUTIFIED Grenades #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/grenades/stringtable.xml b/addons/grenades/stringtable.xml index 44d9e7ad47..aadd1432d2 100644 --- a/addons/grenades/stringtable.xml +++ b/addons/grenades/stringtable.xml @@ -89,7 +89,7 @@ Also known as flashbang. Causes immediate flash blindness, deafness, tinnitus, and inner ear disturbance. Verursacht temporäre Blind- und Taubheit. Tambien conocida como granada cegadora. Produce de manera inmediata ceguera, sordera, tinitus y afecta el oído interior. - Les grenades incapacitantes servent à désorienter ou distraire une menace pendant quelques secondes. + Aussi connu en tant que "Flashbang". Explose en causant cécité, surdité, bourdonnements d'oreilles et perturbation de l'oreille interne. Znany też jako flashbang. Powoduje natychmiastową tymczasową ślepotę, głuchotę, dzwonienie w uszach i inne zaburzenia ucha wewnętrznego. Omračující granát je taktická nesmrtící zbraň používaná při záchraně rukojmí a zvládání davu. XM84 (M84) - граната нелетального действия, и предназначена для отвлечения и временного вывода из строя, либо дезориентации противника. Основное использование нашла при освобождении заложников, захвате преступников и террористов, а также проведении диверсионных миссий. diff --git a/addons/gunbag/$PBOPREFIX$ b/addons/gunbag/$PBOPREFIX$ new file mode 100644 index 0000000000..36c8e332ef --- /dev/null +++ b/addons/gunbag/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\gunbag \ No newline at end of file diff --git a/addons/gunbag/CfgEventHandlers.hpp b/addons/gunbag/CfgEventHandlers.hpp new file mode 100644 index 0000000000..be284a9d70 --- /dev/null +++ b/addons/gunbag/CfgEventHandlers.hpp @@ -0,0 +1,12 @@ + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/gunbag/CfgVehicles.hpp b/addons/gunbag/CfgVehicles.hpp new file mode 100644 index 0000000000..1377a8f84d --- /dev/null +++ b/addons/gunbag/CfgVehicles.hpp @@ -0,0 +1,101 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_MainActions { + class GVAR(weaponTo) { + displayName = CSTRING(ToGunbag); + condition = QUOTE(([_target] call FUNC(hasGunbag)) && {[ARR_2(_player,_target)] call FUNC(canInteract) == 0}); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(toGunbag)); + showDisabled = 0; + priority = 1; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + class GVAR(weaponOff) { + displayName = CSTRING(OffGunbag); + condition = QUOTE(([_target] call FUNC(hasGunbag)) && {[ARR_2(_player,_target)] call FUNC(canInteract) == 1}); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(offGunbag)); + showDisabled = 0; + priority = 1; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + class GVAR(status) { + displayName = CSTRING(Status); + condition = QUOTE([_target] call FUNC(hasGunbag)); + statement = QUOTE([_target] call FUNC(status)); + showDisabled = 0; + priority = 2; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + }; + }; + + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(actions) { + displayName = CSTRING(Displayname); + condition = QUOTE([_player] call FUNC(hasGunbag)); + showDisabled = 0; + priority = 0.1; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + + class GVAR(weaponTo) { + displayName = CSTRING(ToGunbag); + condition = QUOTE([ARR_2(_player,_player)] call FUNC(canInteract) == 0); + statement = QUOTE([ARR_2(_player,_player)] call FUNC(toGunbag)); + showDisabled = 0; + priority = 1; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + class GVAR(weaponOff) { + displayName = CSTRING(OffGunbag); + condition = QUOTE([ARR_2(_player,_player)] call FUNC(canInteract) == 1); + statement = QUOTE([ARR_2(_player,_player)] call FUNC(offGunbag)); + showDisabled = 0; + priority = 1; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + class GVAR(status) { + displayName = CSTRING(Status); + condition = QUOTE([_player] call FUNC(hasGunbag)); + statement = QUOTE([_player] call FUNC(status)); + showDisabled = 0; + priority = 2; + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + }; + }; + }; + }; + }; + + class Bag_Base; + class ADDON: Bag_Base { + _generalMacro = QUOTE(ADDON); + author = "Ir0n1E"; + scope = 2; + displayName = CSTRING(Displayname); + model = QPATHTOF(data\ace_gunbag.p3d); + picture = QPATHTOF(ui\gunbag_ca.paa); + icon = QPATHTOF(ui\gunbag_icon_ca.paa); + hiddenSelections[] = {"Camo", "insignia"}; + hiddenSelectionsTextures[] = {QPATHTOF(data\gunbag_co.paa)}; + maximumLoad = 80; + mass = 11; + }; + + class GVAR(Tan): ADDON { + _generalMacro = QGVAR(Tan); + author = "Ir0n1E"; + displayName = CSTRING(Displayname_Tan); + picture = QPATHTOF(ui\gunbag_tan_ca.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\gunbag_tan_co.paa)}; + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportBackpacks { + MACRO_ADDBACKPACK(ADDON,3); + MACRO_ADDBACKPACK(GVAR(Tan),3); + }; + }; +}; diff --git a/addons/gunbag/CfgWeapons.hpp b/addons/gunbag/CfgWeapons.hpp new file mode 100644 index 0000000000..31ffb64c79 --- /dev/null +++ b/addons/gunbag/CfgWeapons.hpp @@ -0,0 +1,41 @@ +class CfgWeapons { + class Rifle_Long_Base_F; + + /* Long Rifles */ + + class GM6_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class LRR_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_06_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_05_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_04_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_03_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_02_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class DMR_01_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; + + class EBR_base_F: Rifle_Long_Base_F { + GVAR(allowGunbag) = 1; + }; +}; diff --git a/addons/gunbag/README.md b/addons/gunbag/README.md new file mode 100644 index 0000000000..734c18f3c5 --- /dev/null +++ b/addons/gunbag/README.md @@ -0,0 +1,11 @@ +ace_gunbag +=============== + +Adds a gunbag for DMRs. + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [commy2](https://github.com/commy2) diff --git a/addons/gunbag/XEH_PREP.hpp b/addons/gunbag/XEH_PREP.hpp new file mode 100644 index 0000000000..df84b594bf --- /dev/null +++ b/addons/gunbag/XEH_PREP.hpp @@ -0,0 +1,9 @@ + +PREP(toGunbag); +PREP(toGunbagCallback); +PREP(offGunbag); +PREP(offGunbagCallback); +PREP(status); +PREP(canInteract); +PREP(calculateMass); +PREP(hasGunbag); diff --git a/addons/gunbag/XEH_preInit.sqf b/addons/gunbag/XEH_preInit.sqf new file mode 100644 index 0000000000..73b1a7ea75 --- /dev/null +++ b/addons/gunbag/XEH_preInit.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +// restore gunbag info after respawn +["CAManBase", "respawn", { + [{ + params ["_unit", "_corpse"]; + + private _newBackpack = backpackContainer _unit; + private _oldBackpack = backpackContainer _corpse; + + if !(typeOf _newBackpack isEqualTo typeOf _oldBackpack) exitWith {}; + + private _state = _oldBackpack getVariable [QGVAR(gunbagWeapon), []]; + + if !(_state isEqualTo []) then { + _newBackpack setVariable [QGVAR(gunbagWeapon), _state, true]; + }; + }, _this] call CBA_fnc_execNextFrame; +}] call CBA_fnc_addClassEventHandler; + +ADDON = true; diff --git a/addons/gunbag/XEH_preStart.sqf b/addons/gunbag/XEH_preStart.sqf new file mode 100644 index 0000000000..022888575e --- /dev/null +++ b/addons/gunbag/XEH_preStart.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" diff --git a/addons/gunbag/config.cpp b/addons/gunbag/config.cpp new file mode 100644 index 0000000000..87fcd84f1c --- /dev/null +++ b/addons/gunbag/config.cpp @@ -0,0 +1,19 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {QUOTE(ADDON), QGVAR(Tan)}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction", "ace_movement"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Ir0n1E"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/gunbag/data/ace_gunbag.p3d b/addons/gunbag/data/ace_gunbag.p3d new file mode 100644 index 0000000000..22658bb93d Binary files /dev/null and b/addons/gunbag/data/ace_gunbag.p3d differ diff --git a/addons/gunbag/data/gunbag.rvmat b/addons/gunbag/data/gunbag.rvmat new file mode 100644 index 0000000000..8e64f7d703 --- /dev/null +++ b/addons/gunbag/data/gunbag.rvmat @@ -0,0 +1,89 @@ +class StageTI +{ + texture="a3\characters_f_beta\indep\data\officer_ti_ca.paa"; +}; +ambient[]={0.69999999,0.69999999,0.69999999,1}; +diffuse[]={0.69999999,0.69999999,0.69999999,1}; +forcedDiffuse[]={0.30000001,0.30000001,0.30000001,0}; +emmisive[]={0,0,0,1}; +specular[]={0.2,0.2,0.2,1}; +specularPower=100; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\gunbag\data\gunbag_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,0.5,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,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ACE\addons\gunbag\data\gunbag_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(1,0.3)"; + uvSource="none"; +}; +class Stage7 +{ + texture="a3\data_f\env_co.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/gunbag/data/gunbag_co.paa b/addons/gunbag/data/gunbag_co.paa new file mode 100644 index 0000000000..efccc50363 Binary files /dev/null and b/addons/gunbag/data/gunbag_co.paa differ diff --git a/addons/gunbag/data/gunbag_nohq.paa b/addons/gunbag/data/gunbag_nohq.paa new file mode 100644 index 0000000000..9b12a0453c Binary files /dev/null and b/addons/gunbag/data/gunbag_nohq.paa differ diff --git a/addons/gunbag/data/gunbag_smdi.paa b/addons/gunbag/data/gunbag_smdi.paa new file mode 100644 index 0000000000..17633ac84d Binary files /dev/null and b/addons/gunbag/data/gunbag_smdi.paa differ diff --git a/addons/gunbag/data/gunbag_tan_co.paa b/addons/gunbag/data/gunbag_tan_co.paa new file mode 100644 index 0000000000..ef6d6c1f7c Binary files /dev/null and b/addons/gunbag/data/gunbag_tan_co.paa differ diff --git a/addons/gunbag/data/model.cfg b/addons/gunbag/data/model.cfg new file mode 100644 index 0000000000..894edab2ac --- /dev/null +++ b/addons/gunbag/data/model.cfg @@ -0,0 +1,148 @@ +class CfgSkeletons { + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; + class OFP2_ManSkeleton { + isDiscrete = 0; + skeletonInherit = ""; + skeletonBones[] = { + "Pelvis","", + "Spine","Pelvis", + "Spine1","Spine", + "Spine2","Spine1", + "Spine3","Spine2", + "Camera","Pelvis", + "weapon","Spine1", + "launcher","Spine1", + //Head skeleton in hierarchy + "neck","Spine3", + "neck1","neck", + "head","neck1", + //New facial features + "Face_Hub","head", + "Face_Jawbone","Face_Hub", + "Face_Jowl","Face_Jawbone", + "Face_chopRight","Face_Jawbone", + "Face_chopLeft","Face_Jawbone", + "Face_LipLowerMiddle","Face_Jawbone", + "Face_LipLowerLeft","Face_Jawbone", + "Face_LipLowerRight","Face_Jawbone", + "Face_Chin","Face_Jawbone", + "Face_Tongue","Face_Jawbone", + "Face_CornerRight","Face_Hub", + "Face_CheekSideRight","Face_CornerRight", + "Face_CornerLeft","Face_Hub", + "Face_CheekSideLeft","Face_CornerLeft", + "Face_CheekFrontRight","Face_Hub", + "Face_CheekFrontLeft","Face_Hub", + "Face_CheekUpperRight","Face_Hub", + "Face_CheekUpperLeft","Face_Hub", + "Face_LipUpperMiddle","Face_Hub", + "Face_LipUpperRight","Face_Hub", + "Face_LipUpperLeft","Face_Hub", + "Face_NostrilRight","Face_Hub", + "Face_NostrilLeft","Face_Hub", + "Face_Forehead","Face_Hub", + "Face_BrowFrontRight","Face_Forehead", + "Face_BrowFrontLeft","Face_Forehead", + "Face_BrowMiddle","Face_Forehead", + "Face_BrowSideRight","Face_Forehead", + "Face_BrowSideLeft","Face_Forehead", + "Face_Eyelids","Face_Hub", + "Face_EyelidUpperRight","Face_Hub", + "Face_EyelidUpperLeft","Face_Hub", + "Face_EyelidLowerRight","Face_Hub", + "Face_EyelidLowerLeft","Face_Hub", + "EyeLeft","Face_Hub", + "EyeRight","Face_Hub", + //Left upper side + "LeftShoulder","Spine3", + "LeftArm","LeftShoulder", + "LeftArmRoll","LeftArm", + "LeftForeArm","LeftArmRoll", + "LeftForeArmRoll","LeftForeArm", + "LeftHand","LeftForeArmRoll", + "LeftHandRing","LeftHand", + "LeftHandRing1","LeftHandRing", + "LeftHandRing2","LeftHandRing1", + "LeftHandRing3","LeftHandRing2", + "LeftHandPinky1","LeftHandRing", + "LeftHandPinky2","LeftHandPinky1", + "LeftHandPinky3","LeftHandPinky2", + "LeftHandMiddle1","LeftHand", + "LeftHandMiddle2","LeftHandMiddle1", + "LeftHandMiddle3","LeftHandMiddle2", + "LeftHandIndex1","LeftHand", + "LeftHandIndex2","LeftHandIndex1", + "LeftHandIndex3","LeftHandIndex2", + "LeftHandThumb1","LeftHand", + "LeftHandThumb2","LeftHandThumb1", + "LeftHandThumb3","LeftHandThumb2", + //Right upper side + "RightShoulder","Spine3", + "RightArm","RightShoulder", + "RightArmRoll","RightArm", + "RightForeArm","RightArmRoll", + "RightForeArmRoll","RightForeArm", + "RightHand","RightForeArmRoll", + "RightHandRing","RightHand", + "RightHandRing1","RightHandRing", + "RightHandRing2","RightHandRing1", + "RightHandRing3","RightHandRing2", + "RightHandPinky1","RightHandRing", + "RightHandPinky2","RightHandPinky1", + "RightHandPinky3","RightHandPinky2", + "RightHandMiddle1","RightHand", + "RightHandMiddle2","RightHandMiddle1", + "RightHandMiddle3","RightHandMiddle2", + "RightHandIndex1","RightHand", + "RightHandIndex2","RightHandIndex1", + "RightHandIndex3","RightHandIndex2", + "RightHandThumb1","RightHand", + "RightHandThumb2","RightHandThumb1", + "RightHandThumb3","RightHandThumb2", + //Left lower side + "LeftUpLeg","Pelvis", + "LeftUpLegRoll","LeftUpLeg", + "LeftLeg","LeftUpLegRoll", + "LeftLegRoll","LeftLeg", + "LeftFoot","LeftLegRoll", + "LeftToeBase","LeftFoot", + //Right lower side + "RightUpLeg","Pelvis", + "RightUpLegRoll","RightUpLeg", + "RightLeg","RightUpLegRoll", + "RightLegRoll","RightLeg", + "RightFoot","RightLegRoll", + "RightToeBase","RightFoot" + }; + // location of pivot points (local axes) for hierarchical animation + pivotsModel="A3\anims_f\data\skeleton\SkeletonPivots.p3d"; + }; +}; + +class CfgModels { + class Default { + sectionsInherit=""; + sections[] = {}; + skeletonName = ""; + }; + class ArmaMan: Default { + htMin = 60; // Minimum half-cooling time (in seconds) + htMax = 1800; // Maximum half-cooling time (in seconds) + afMax = 30; // Maximum temperature in case the model is alive (in celsius) + mfMax = 0; // Maximum temperature when the model is moving (in celsius) + mFact = 1; // Metabolism factor - number from interval <0, 1> (0 - metabolism has no influence, 1 - metabolism has full influence (no other temperature source will be considered)). + tBody = 37; // Metabolism temperature of the model (in celsius) + + sections[] = { + "osobnost","Head_Injury","Body_Injury","l_leg_injury","l_arm_injury","r_arm_injury","r_leg_injury","injury_body", "injury_legs", "injury_hands", + "clan","clan_sign","Camo","CamoB","Camo1","Camo2","personality","hl", "injury_head", "insignia" + }; + skeletonName = "OFP2_ManSkeleton"; + }; + + class ace_gunbag: ArmaMan {}; +}; diff --git a/addons/gunbag/functions/fnc_calculateMass.sqf b/addons/gunbag/functions/fnc_calculateMass.sqf new file mode 100644 index 0000000000..e365930d16 --- /dev/null +++ b/addons/gunbag/functions/fnc_calculateMass.sqf @@ -0,0 +1,32 @@ +/* + * Author: Ir0n1E + * Calculate mass of weapon an items. + * + * Arguments: + * 0: Weapon + * 1: Items + * 2: Magazines + * + * Return Value: + * Mass + * + * Example: + * ["weapon", ["item1", "item2"], ["mag1", "mag2"]] call ace_gunbag_fnc_calculateMass + * + * Public: No + */ +#include "script_component.hpp" + +params ["_weapon", "_items", "_magazines"]; + +private _mass = getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass"); + +{ + _mass = _mass + getNumber (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "mass"); +} foreach _items; + +{ + _mass = _mass + getNumber (configFile >> "CfgWeapons" >> _x >> "mass"); +} forEach _magazines; + +_mass diff --git a/addons/gunbag/functions/fnc_canInteract.sqf b/addons/gunbag/functions/fnc_canInteract.sqf new file mode 100644 index 0000000000..b24533f632 --- /dev/null +++ b/addons/gunbag/functions/fnc_canInteract.sqf @@ -0,0 +1,32 @@ +/* + * Author: Ir0n1E + * Check if client able to interact with gunbag. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * -1: can't interact 0: empty gunbag 1: full gunbag + * + * Example: + * _canInteract = [player, target] call ace_gunbag_fnc_canInteract + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +private _result = -1; +private _gunbag = backpackContainer _target; + +if ((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo [] && {primaryWeapon _unit != ""} && {getNumber (configFile >> "CfgWeapons" >> primaryWeapon _unit >> QGVAR(allowGunbag)) == 1}) then { + _result = 0; +}; + +if (!((_gunbag getVariable [QGVAR(gunbagWeapon), []]) isEqualTo []) && {primaryWeapon _unit == ""}) then { + _result = 1; +}; + +_result diff --git a/addons/gunbag/functions/fnc_hasGunbag.sqf b/addons/gunbag/functions/fnc_hasGunbag.sqf new file mode 100644 index 0000000000..8c8fdd6147 --- /dev/null +++ b/addons/gunbag/functions/fnc_hasGunbag.sqf @@ -0,0 +1,20 @@ +/* + * Author: Ir0n1E + * Switches gunbag full/empty for mass calculation. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Has Gunbag + * + * Example: + * [player] call ace_gunbag_fnc_hasGunbag + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +(backpackContainer _unit) isKindOf QUOTE(ADDON) diff --git a/addons/gunbag/functions/fnc_offGunbag.sqf b/addons/gunbag/functions/fnc_offGunbag.sqf new file mode 100644 index 0000000000..a46d49675d --- /dev/null +++ b/addons/gunbag/functions/fnc_offGunbag.sqf @@ -0,0 +1,34 @@ +/* + * Author: Ir0n1E + * Get weapon out of gunbag. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Example: + * [player, target] call ace_gunbag_fnc_toGunbag + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +private _gunbag = backpackContainer _target; + +_unit call EFUNC(common,goKneeling); + +// play sound +if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then { + [_target, _gunbag] call EFUNC(backpacks,backpackOpened); +}; + +[PROGRESSBAR_TIME, _this, { + (_this select 0) call FUNC(offGunbagCallback) +}, {}, localize LSTRING(offGunbag), { + (_this select 0) call FUNC(canInteract) == 1 +}] call EFUNC(common,progressBar); diff --git a/addons/gunbag/functions/fnc_offGunbagCallback.sqf b/addons/gunbag/functions/fnc_offGunbagCallback.sqf new file mode 100644 index 0000000000..5d548d0e9c --- /dev/null +++ b/addons/gunbag/functions/fnc_offGunbagCallback.sqf @@ -0,0 +1,51 @@ +/* + * Author: Ir0n1E + * Get weapon out of gunbag. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Example: + * [player, target] call ace_gunbag_fnc_offGunbagCallback + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +private _gunbag = backpackContainer _target; + +private _state = _gunbag getVariable [QGVAR(gunbagWeapon), []]; + +if (_state isEqualTo []) exitWith { + [localize LSTRING(empty)] call EFUNC(common,displayTextStructured); +}; + +_state params ["_weapon", "_items", "_magazines"]; + +_unit addWeapon _weapon; +removeAllPrimaryWeaponItems _unit; + +{ + _unit addWeaponItem [_weapon, _x]; +} forEach (_items + _magazines); + +_unit selectWeapon _weapon; + +_magazines = _magazines apply {_x select 0}; + +private _mass = [_weapon, _items, _magazines] call FUNC(calculateMass); + +// remove virtual load +[_target, _gunbag, -_mass] call EFUNC(movement,addLoadToUnitContainer); +_gunbag setVariable [QGVAR(gunbagWeapon), [], true]; + +// play sound +if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then { + [_target, _gunbag] call EFUNC(backpacks,backpackOpened); +}; diff --git a/addons/gunbag/functions/fnc_status.sqf b/addons/gunbag/functions/fnc_status.sqf new file mode 100644 index 0000000000..33c30ec0e1 --- /dev/null +++ b/addons/gunbag/functions/fnc_status.sqf @@ -0,0 +1,31 @@ +/* + * Author: Ir0n1E + * Check gunbag status full/empty. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [player] call ace_gunbag_fnc_status + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +private _state = (backpackContainer _unit) getVariable [QGVAR(gunbagWeapon), []]; + +if (_state isEqualTo []) then { + [localize LSTRING(empty)] call EFUNC(common,displayTextStructured); +} else { + _state params ["_weapon"]; + + [ + getText (configFile >> "CfgWeapons" >> _weapon >> "displayname"), + getText (configFile >> "CfgWeapons" >> _weapon >> "picture") + ] call EFUNC(common,displayTextPicture); +}; diff --git a/addons/gunbag/functions/fnc_toGunbag.sqf b/addons/gunbag/functions/fnc_toGunbag.sqf new file mode 100644 index 0000000000..8851e5610b --- /dev/null +++ b/addons/gunbag/functions/fnc_toGunbag.sqf @@ -0,0 +1,34 @@ +/* + * Author: Ir0n1E + * Put weapon into gunbag. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Example: + * [player, target] call ace_gunbag_fnc_toGunbag + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +private _gunbag = backpackContainer _target; + +_unit call EFUNC(common,goKneeling); + +// play sound +if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then { + [_target, _gunbag] call EFUNC(backpacks,backpackOpened); +}; + +[PROGRESSBAR_TIME, _this, { + (_this select 0) call FUNC(toGunbagCallback) +}, {}, localize LSTRING(toGunbag), { + (_this select 0) call FUNC(canInteract) == 0 +}] call EFUNC(common,progressBar); diff --git a/addons/gunbag/functions/fnc_toGunbagCallback.sqf b/addons/gunbag/functions/fnc_toGunbagCallback.sqf new file mode 100644 index 0000000000..3587c9e6b8 --- /dev/null +++ b/addons/gunbag/functions/fnc_toGunbagCallback.sqf @@ -0,0 +1,48 @@ +/* + * Author: Ir0n1E + * Put weapon into gunbag. + * + * Arguments: + * 0: Unit + * 1: Target + * + * Return Value: + * None + * + * Example: + * [player, target] call ace_gunbag_fnc_toGunbagCallback + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_target"]; + +private _weapon = primaryWeapon _unit; +private _gunbag = backpackContainer _target; + +private _state = [_unit, _weapon] call EFUNC(common,getWeaponState); + +/* + * example return value _state + * [["","","optic_Aco",""],["arifle_MX_GL_ACO_F","GL_3GL_F"],["30Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell"],[30,1]] + */ + +_state params ["_items", "", "_magazines", "_ammo"]; + +private _mass = [_weapon, _items, _magazines] call FUNC(calculateMass); + +{ + _magazines set [_forEachIndex, [_x, _ammo select _forEachIndex]]; +} forEach _magazines; + +_unit removeWeapon _weapon; + +// add virtual load +[_target, _gunbag, _mass] call EFUNC(movement,addLoadToUnitContainer); +_gunbag setVariable [QGVAR(gunbagWeapon), [_weapon, _items, _magazines], true]; + +// play sound +if (["ace_backpacks"] call EFUNC(common,isModLoaded)) then { + [_target, _gunbag] call EFUNC(backpacks,backpackOpened); +}; diff --git a/addons/gunbag/functions/script_component.hpp b/addons/gunbag/functions/script_component.hpp new file mode 100644 index 0000000000..4e342e3b04 --- /dev/null +++ b/addons/gunbag/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\gunbag\script_component.hpp" diff --git a/addons/gunbag/script_component.hpp b/addons/gunbag/script_component.hpp new file mode 100644 index 0000000000..5627e1048b --- /dev/null +++ b/addons/gunbag/script_component.hpp @@ -0,0 +1,20 @@ +#define COMPONENT gunbag +#define COMPONENT_BEAUTIFIED Gunbag +#include "\z\ace\addons\main\script_mod.hpp" + +//#define DEBUG_ENABLED_GUNBAG +//#define DISABLE_COMPILE_CACHE +//#define CBA_DEBUG_SYNCHRONOUS +//#define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_GUNBAG + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_GUNBAG + #define DEBUG_SETTINGS DEBUG_SETTINGS_GUNBAG +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define PROGRESSBAR_TIME 5 diff --git a/addons/gunbag/stringtable.xml b/addons/gunbag/stringtable.xml new file mode 100644 index 0000000000..50a4ebfc0c --- /dev/null +++ b/addons/gunbag/stringtable.xml @@ -0,0 +1,35 @@ + + + + + Gunbag + Waffentasche + Housse d'arme + + + Gunbag (Tan) + Waffentasche (Tan) + Housse d'arme (marron clair) + + + Put weapon into gunbag + Lege Waffe in Waffentasche + Placer l'arme dans la housse d'arme + + + Get weapon out of gunbag + Hole Waffe aus Waffentasche + Sortir l'arme hors de la housse + + + Status + Status + Status + + + Gunbag Empty + Waffentasche leer + Housse d'arme vide + + + \ No newline at end of file diff --git a/addons/gunbag/ui/gunbag_ca.paa b/addons/gunbag/ui/gunbag_ca.paa new file mode 100644 index 0000000000..4398e5e910 Binary files /dev/null and b/addons/gunbag/ui/gunbag_ca.paa differ diff --git a/addons/gunbag/ui/gunbag_icon_ca.paa b/addons/gunbag/ui/gunbag_icon_ca.paa new file mode 100644 index 0000000000..c32b17c87e Binary files /dev/null and b/addons/gunbag/ui/gunbag_icon_ca.paa differ diff --git a/addons/gunbag/ui/gunbag_tan_ca.paa b/addons/gunbag/ui/gunbag_tan_ca.paa new file mode 100644 index 0000000000..bfe79b2999 Binary files /dev/null and b/addons/gunbag/ui/gunbag_tan_ca.paa differ diff --git a/addons/hearing/CfgSounds.hpp b/addons/hearing/CfgSounds.hpp index 0a1bc82ed1..6df1b39193 100644 --- a/addons/hearing/CfgSounds.hpp +++ b/addons/hearing/CfgSounds.hpp @@ -1,34 +1,34 @@ class CfgSounds { class ACE_EarRinging_Weak { - sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_weak.wav)),8,1.7}; + sound[] = {QPATHTOF(sounds\ACE_earringing_weak.wav),8,1.7}; titles[] = {}; }; class ACE_EarRinging_Medium { - sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_medium.wav)),8,1.7}; + sound[] = {QPATHTOF(sounds\ACE_earringing_medium.wav),8,1.7}; titles[] = {}; }; class ACE_EarRinging_Heavy { - sound[] = {QUOTE(PATHTOF(sounds\ACE_earringing_heavy.wav)),8,1.7}; + sound[] = {QPATHTOF(sounds\ACE_earringing_heavy.wav),8,1.7}; titles[] = {}; }; class ACE_Combat_Deafness_Heavy { - sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),8,1}; + sound[] = {QPATHTOF(sounds\deafness.ogg),8,1}; titles[] = {}; }; class ACE_Combat_Deafness_Medium { - sound[] = {QUOTE(PATHTOF(sounds\deafness.ogg)),3,1}; + sound[] = {QPATHTOF(sounds\deafness.ogg),3,1}; titles[] = {}; }; class ACE_Combat_Deafness_Heavy_NoRing { - sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),8,1}; + sound[] = {QPATHTOF(sounds\deafness_noring.ogg),8,1}; titles[] = {}; }; class ACE_Combat_Deafness_Medium_NoRing { - sound[] = {QUOTE(PATHTOF(sounds\deafness_noring.ogg)),3,1}; + sound[] = {QPATHTOF(sounds\deafness_noring.ogg),3,1}; titles[] = {}; }; class ACE_Ring_Backblast { - sound[] = {QUOTE(PATHTOF(sounds\backblast_ring.ogg)),1,1}; + sound[] = {QPATHTOF(sounds\backblast_ring.ogg),1,1}; titles[] = {}; }; }; diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 17dec1641b..760ed95a03 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { statement = QUOTE( [_player] call FUNC(putInEarPlugs) ); showDisabled = 0; priority = 2.5; - icon = PATHTOF(UI\ACE_earplugs_x_ca.paa); + icon = QPATHTOF(UI\ACE_earplugs_x_ca.paa); }; class ACE_RemoveEarplugs { displayName = CSTRING(EarPlugs_Off); @@ -19,7 +19,7 @@ class CfgVehicles { statement = QUOTE( [_player] call FUNC(removeEarPlugs) ); showDisabled = 0; priority = 2.5; - icon = PATHTOF(UI\ACE_earplugs_x_ca.paa); + icon = QPATHTOF(UI\ACE_earplugs_x_ca.paa); }; }; }; @@ -100,7 +100,7 @@ class CfgVehicles { scope = 2; isGlobal = 1; isSingular = 1; - icon = PATHTOF(UI\Icon_Module_Hearing_ca.paa); + icon = QPATHTOF(UI\Icon_Module_Hearing_ca.paa); class Arguments { class EnableCombatDeafness { displayName = CSTRING(EnableCombatDeafness_DisplayName); diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index af7b7d4cb3..c063c0e896 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -5,8 +5,8 @@ class CfgWeapons { class ACE_EarPlugs: ACE_ItemCore { displayName = CSTRING(EarPlugs_Name); descriptionShort = CSTRING(EarPlugs_Description); - model = QUOTE(PATHTOF(data\ace_earplugs.p3d)); - picture = PATHTOF(UI\ACE_earplugs_x_ca.paa); + model = QPATHTOF(data\ace_earplugs.p3d); + picture = QPATHTOF(UI\ACE_earplugs_x_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index fdd61ccfde..34664525da 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -12,7 +12,7 @@ GVAR(time3) = 0; GVAR(damageCoefficent) = 1; GVAR(volumeAttenuation) = 1; -["SettingsInitialized", { +["ace_settingsInitialized", { TRACE_1("settingInit",GVAR(EnableCombatDeafness)); // Only run PFEH and install event handlers if combat deafness is enabled if (!GVAR(EnableCombatDeafness)) exitWith {}; @@ -20,7 +20,7 @@ GVAR(volumeAttenuation) = 1; //Add XEH: ["CAManBase", "FiredNear", FUNC(firedNear)] call CBA_fnc_addClassEventHandler; ["CAManBase", "Explosion", FUNC(explosionNear)] call CBA_fnc_addClassEventHandler; - + // Update hearing protection now: [] call FUNC(updateHearingProtection); @@ -28,18 +28,18 @@ GVAR(volumeAttenuation) = 1; [FUNC(updateVolume), 1, [false]] call CBA_fnc_addPerFrameHandler; // Update veh attunation when player veh changes - ["playerVehicleChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); - ["playerTurretChanged", {_this call FUNC(updatePlayerVehAttenuation);}] call EFUNC(common,addEventHandler); + ["vehicle", FUNC(updatePlayerVehAttenuation)] call CBA_fnc_addPlayerEventHandler; + ["turret", FUNC(updatePlayerVehAttenuation)] call CBA_fnc_addPlayerEventHandler; // Reset deafness on respawn (or remote control player switch) - ["playerChanged", { + ["unit", { GVAR(deafnessDV) = 0; GVAR(deafnessPrior) = 0; ACE_player setVariable [QGVAR(deaf), false]; GVAR(time3) = 0; [] call FUNC(updateHearingProtection); - }] call EFUNC(common,addEventhandler); + }] call CBA_fnc_addPlayerEventHandler; // Update protection on possible helmet change - ["playerInventoryChanged", {[] call FUNC(updateHearingProtection);}] call EFUNC(common,addEventhandler); -}] call EFUNC(common,addEventHandler); + ["loadout", FUNC(updateHearingProtection)] call CBA_fnc_addPlayerEventHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/hearing/config.cpp b/addons/hearing/config.cpp index 5d130e589a..79ab61cb8b 100644 --- a/addons/hearing/config.cpp +++ b/addons/hearing/config.cpp @@ -2,24 +2,21 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_EarPlugs"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction", "A3_Characters_F", "A3_Characters_F_Kart"}; - author[] = {"KoffeinFlummi", "esteldunedain", "HopeJ", "commy2", "Rocko", "Rommel", "Ruthberg"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi", "esteldunedain", "HopeJ", "commy2", "Rocko", "Rommel", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - #include "CfgVehicles.hpp" - #include "CfgSounds.hpp" - #include "CfgWeapons.hpp" - #include "CfgAmmo.hpp" - #include "ACE_Settings.hpp" diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf index 2212bd6222..01ab58ef76 100644 --- a/addons/hearing/functions/fnc_updateVolume.sqf +++ b/addons/hearing/functions/fnc_updateVolume.sqf @@ -33,8 +33,8 @@ if (!_justUpdateVolume) then { if (GVAR(deafnessDV) - GVAR(deafnessPrior) > 1 || GVAR(deafnessDV) > 10) then { - if (ACE_time - GVAR(time3) < 3) exitWith {}; - GVAR(time3) = ACE_time; + if (CBA_missionTime - GVAR(time3) < 3) exitWith {}; + GVAR(time3) = CBA_missionTime; if (GVAR(deafnessDV) > 19.75) then { playSound (["ACE_Combat_Deafness_Heavy", "ACE_Combat_Deafness_Heavy_NoRing"] select GVAR(DisableEarRinging)); diff --git a/addons/hearing/script_component.hpp b/addons/hearing/script_component.hpp index de1ff267e4..7c0413898f 100644 --- a/addons/hearing/script_component.hpp +++ b/addons/hearing/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT hearing +#define COMPONENT_BEAUTIFIED Hearing #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index e92229cdd4..e2f1977e70 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -20,7 +20,7 @@ Stopery do uszu umożliwiają użytkownikowi przebywać w pobliżu głośnej broni bez poniesienia konsekwencji jaką jest utrata słuchu. Ochranné špunty umožňují uživateli, aby neutrpěl zranění jeho sluchu v blízkosti hlasitých zbraní. Беруши позволяют носителю находиться возле громкого вооружения без потери слуха. - Bouchons Anti-Bruits pour la prévention des traumatismes sonores aigüs. + Bouchons Anti-Bruits permettant au porteur d'être près d'arme bruyante sans risque d'endommager son ouïe. Erősebb hanghatásoktól védő füldugó, megakadályozza a nagy hanggal járó fegyverzettől való halláskárosodást. Protetor para ouvidos permitem que o usuário esteja próximo a ruídos sem danificar sua audição. Proteggono l'apparato uditivo, permettendo a chi li indossa di resistere ai suoni particolarmente forti senza alcun danno. @@ -32,7 +32,7 @@ Włóż stopery Dát špunty do uší Надеть беруши - Bouchons mis + Mettre les bouchons Füldugó berakva Protetores colocados Indossa i tappi auricolari @@ -44,7 +44,7 @@ Wyjmij stopery Vyndat špunty z uší Снять беруши - Bouchons enlevés + Enlever les bouchons Füldugó kivéve Protetores retirados Levati i tappi auricolari @@ -116,6 +116,7 @@ Usuń szum w uszach przy chwilowej utracie słuchu. Enlève les acouphènes quand le joueur prend des dommages auditifs. Quando il giocatore riceve danni all'udito, non fa sentire i fischi nelle orecchie + Remove o efeito de zunido quando o jogador recebe dano na audição Hearing @@ -173,7 +174,7 @@ Efecto Zeus RC Vliv na Zeus RC Effetto Zeus RC - Effets Zeus RC + Effet sur le CàD du Zeus Allow zeus remote controlled units to be able to take hearing damage. @@ -184,7 +185,7 @@ Permitir a las unidades por control remoto de zeus que puedan tener daños auditivos. Aktivovat efekt ztráty sluchu pro vzdáleně ovládané jednotky. Consenti alle unità controllate in remoto da Zeus di ricevere danni all'udito. - Autoriser le Zeus contrôlé à distance de prendre des dommages auditifs. + Permet aux unités controlées à distance de subir des traumatismes sonores. Add earplugs to units @@ -195,7 +196,7 @@ Přidat špunty jednotce Aggiungi Tappi per Orecchie alle unità Agregar tapones de oida a la unidad - Ajouter des bouchons anti-bruits aux unités. + Ajouter des bouchons anti-bruits aux unités Add the `ACE_EarPlugs` item to all units that have loud weapons. Can disable if using custom loadouts. @@ -206,7 +207,7 @@ Přidat `ACE_EarPlugs` všem jednotkám které mají zbraň. Můžete vypnout, pokud používáte vlastní výbavu. Aggiungi l'oggetto 'ACE_EarPlugs' a tutte le unità che hanno armi rumorose. Può essere disabilitato se vengono usati loadout personalizzati. Agregar el item `ACE_EarPlugs` a todas las unidades equipadas con armas muy ruidosas. Desactivar si quieren utilizarse equipamientos personalizados. - Ajouter l'item "ACE_EarPlugs" à toutes les unités qui ont des armes lourdes. Peut être desactivé si des équipements personnels sont utilisés. + Ajoute l'objet "Ace_EarPlugs" à toutes les unités ayant des armes bruyantes. Peut être désactivé par des loadouts personalisés. - \ No newline at end of file + diff --git a/addons/hitreactions/config.cpp b/addons/hitreactions/config.cpp index 77b68b77f5..3d066e6af1 100644 --- a/addons/hitreactions/config.cpp +++ b/addons/hitreactions/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/hitreactions/functions/fnc_fallDown.sqf b/addons/hitreactions/functions/fnc_fallDown.sqf index 9ed43ae14f..03484438eb 100644 --- a/addons/hitreactions/functions/fnc_fallDown.sqf +++ b/addons/hitreactions/functions/fnc_fallDown.sqf @@ -31,7 +31,7 @@ if (_unit == ACE_player) then { }; // play scream sound -if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then { +if (!isNil QEFUNC(medical,playInjuredSound)) then { [_unit] call EFUNC(medical,playInjuredSound); }; diff --git a/addons/hitreactions/script_component.hpp b/addons/hitreactions/script_component.hpp index f445ce3f8d..9252f1bca0 100644 --- a/addons/hitreactions/script_component.hpp +++ b/addons/hitreactions/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT hitreactions +#define COMPONENT_BEAUTIFIED Hit Reactions #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_HITREACTIONS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/huntir/CfgAmmo.hpp b/addons/huntir/CfgAmmo.hpp index 33328094b2..a9cd260d0f 100644 --- a/addons/huntir/CfgAmmo.hpp +++ b/addons/huntir/CfgAmmo.hpp @@ -1,7 +1,7 @@ class CfgAmmo { class FlareBase; class F_HuntIR: FlareBase { - model = PATHTOF(data\ace_m1070_armed.p3d); + model = QPATHTOF(data\ace_m1070_armed.p3d); lightColor[] = {0, 0, 0, 0}; smokeColor[] = {0, 0, 0, 0}; timeToLive = 6; @@ -26,6 +26,7 @@ class CfgAmmo { soundHit6[] = {"",3.16228,1,2000}; soundHit7[] = {"",3.16228,1,2000}; soundHit8[] = {"",3.16228,1,2000}; + SoundSetExplosion[] = {}; multiSoundHit[] = {}; class HitEffects {}; soundFakeFall0[] = {"",3.16228,1,1000}; diff --git a/addons/huntir/CfgMagazines.hpp b/addons/huntir/CfgMagazines.hpp index c11f81a98c..62ae785333 100644 --- a/addons/huntir/CfgMagazines.hpp +++ b/addons/huntir/CfgMagazines.hpp @@ -5,7 +5,7 @@ class CfgMagazines { displayName = CSTRING(magazine_displayName); displayNameShort = "HuntIR"; descriptionShort = ""; - picture = PATHTOF(data\m_m1070_ca.paa); + picture = QPATHTOF(data\m_m1070_ca.paa); ammo = "F_HuntIR"; }; }; diff --git a/addons/huntir/CfgVehicles.hpp b/addons/huntir/CfgVehicles.hpp index 3b6486aaf7..cd5054a2da 100644 --- a/addons/huntir/CfgVehicles.hpp +++ b/addons/huntir/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(huntir)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\w_huntir_monitor_ca.paa); + icon = QPATHTOF(UI\w_huntir_monitor_ca.paa); exceptions[] = {}; }; }; @@ -23,7 +23,7 @@ class CfgVehicles { castDriverShadow = 0; destrType = "DestructDefault"; displayName = "HuntIR"; - model = PATHTOF(data\huntir.p3d); + model = QPATHTOF(data\huntir.p3d); scope = 1; soundCrash[] = {"", db-30, 1 }; soundEnviron[] = {"z\ace\addons\apl\sounds\padak_let", 0.316228, 1, 80}; @@ -73,7 +73,7 @@ class CfgVehicles { class ReammoBox_F; class ACE_HuntIR_Box: ReammoBox_F { - model = PATHTOF(data\ace_huntirbox.p3d); + model = QPATHTOF(data\ace_huntirbox.p3d); displayName = $STR_DN_ACE_HUNTIRBOX; class TransportItems { MACRO_ADDITEM(ACE_HuntIR_monitor,5); diff --git a/addons/huntir/CfgWeapons.hpp b/addons/huntir/CfgWeapons.hpp index 6d74cbfba9..979fc8875c 100644 --- a/addons/huntir/CfgWeapons.hpp +++ b/addons/huntir/CfgWeapons.hpp @@ -6,9 +6,9 @@ class CfgWeapons { class ACE_HuntIR_monitor: ACE_ItemCore { scope = 2; displayName = CSTRING(monitor_displayName); - picture = PATHTOF(UI\w_huntir_monitor_ca.paa); + picture = QPATHTOF(UI\w_huntir_monitor_ca.paa); descriptionShort = CSTRING(monitor_displayName); - model = PATHTOF(data\ace_huntir_monitor.p3d); + model = QPATHTOF(data\ace_huntir_monitor.p3d); class ItemInfo: InventoryItem_Base_F { mass = 20; diff --git a/addons/huntir/Dialog.hpp b/addons/huntir/Dialog.hpp index 8281bccae3..c4d3143506 100644 --- a/addons/huntir/Dialog.hpp +++ b/addons/huntir/Dialog.hpp @@ -154,7 +154,7 @@ class ace_huntir_cam_dialog { w = __W; h = __H + 0.2; border = 0; - text = PATHTOF(UI\ace_huntir_monitor_on.paa); + text = QPATHTOF(UI\ace_huntir_monitor_on.paa); }; class CAM_HEIGHT { type = CT_STATIC; @@ -311,7 +311,7 @@ class ace_huntir_cam_dialog_off: ace_huntir_cam_dialog_inactive { class RIGHT_BORDER: RIGHT_BORDER {}; class PRESS_HELP: PRESS_HELP {}; class HELP_DIALOG: HELP_DIALOG {}; - class CAM_BG: CAM_BG { text = PATHTOF(UI\ace_huntir_monitor_off.paa); }; + class CAM_BG: CAM_BG { text = QPATHTOF(UI\ace_huntir_monitor_off.paa); }; }; //ACTIVE PARA CAMERA DIALOG class ace_huntir_help_dialog: ace_huntir_cam_dialog { diff --git a/addons/huntir/XEH_postInit.sqf b/addons/huntir/XEH_postInit.sqf index 0c518dfcea..5ad798a62d 100644 --- a/addons/huntir/XEH_postInit.sqf +++ b/addons/huntir/XEH_postInit.sqf @@ -10,5 +10,4 @@ GVAR(ELEVAT) = 0.01; // Register fire event handler // Don't run for non players, as they are too dumb to launch huntirs anyway -["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); -["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler; diff --git a/addons/huntir/config.cpp b/addons/huntir/config.cpp index 5fb106ad2d..0adf9670a0 100644 --- a/addons/huntir/config.cpp +++ b/addons/huntir/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_HuntIR", "ACE_HuntIRBox"}; weapons[] = {"ACE_HuntIR_monitor"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Norrin", "Rocko", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Norrin", "Rocko", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index 2eb7611a6a..80d5e33043 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -145,7 +145,7 @@ GVAR(no_cams) sort true; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; - _cam_time = ACE_time - (GVAR(huntIR) getVariable [QGVAR(startTime), ACE_time]); + _cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]); ctrlSetText [3, format["%1 s", round(_cam_time)]]; _cam_pos = getPosVisual GVAR(huntIR); _cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)]; diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 551b9975b6..b7e8c2a010 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -1,7 +1,7 @@ /* * Author: Norrin, Rocko, Ruthberg * - * Handles HuntIR projectiles. Called from the unified fired EH for all CAManBase. + * Handles HuntIR projectiles. Called from the unified fired EH for the local player. * * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) @@ -34,7 +34,7 @@ if (!hasInterface) exitWith {}; params ["_position"]; _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; _huntir setPosATL _position; - _huntir setVariable [QGVAR(startTime), ACE_time, true]; + _huntir setVariable [QGVAR(startTime), CBA_missionTime, true]; [{ params ["_args", "_idPFH"]; _args params ["_huntir"]; @@ -50,5 +50,5 @@ if (!hasInterface) exitWith {}; _huntir setVectorUp [0, 0, 1]; }; }, 0, [_huntir]] call CBA_fnc_addPerFrameHandler; - }, [getPosATL _projectile vectorAdd [0, 0, 50]], 2, 0] call EFUNC(common,waitAndExecute); -}, [_projectile], 5, 0] call EFUNC(common,waitAndExecute); + }, [getPosATL _projectile vectorAdd [0, 0, 50]], 2, 0] call CBA_fnc_waitAndExecute; +}, [_projectile], 5, 0] call CBA_fnc_waitAndExecute; diff --git a/addons/huntir/functions/fnc_huntir.sqf b/addons/huntir/functions/fnc_huntir.sqf index e06ada87ea..72a0ecee64 100644 --- a/addons/huntir/functions/fnc_huntir.sqf +++ b/addons/huntir/functions/fnc_huntir.sqf @@ -30,7 +30,7 @@ createDialog "ace_huntir_cam_dialog_off"; createDialog "ace_huntir_cam_dialog_inactive"; uiNameSpace setVariable ["ace_huntir_monitor", findDisplay 18881]; [{ - GVAR(startTime) = ACE_time; + GVAR(startTime) = CBA_missionTime; GVAR(done) = false; GVAR(connectionDelay) = 5; GVAR(state) = "searching"; @@ -44,7 +44,7 @@ createDialog "ace_huntir_cam_dialog_off"; }; private ["_elapsedTime", "_nearestHuntIRs"]; - _elapsedTime = ACE_time - GVAR(startTime); + _elapsedTime = CBA_missionTime - GVAR(startTime); _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE]; if ((!dialog) || GVAR(done)) exitWith { @@ -90,9 +90,9 @@ createDialog "ace_huntir_cam_dialog_off"; GVAR(done) = true; closedialog 0; HUNTIR_BACKGROUND_LAYER_ID cutText ["", "PLAIN"]; - }, [], 3, 0] call EFUNC(common,waitAndExecute); + }, [], 3, 0] call CBA_fnc_waitAndExecute; }; }; }, __TYPE_WRITER_DELAY, []] call CBA_fnc_addPerFrameHandler; - }, [], 0.5, 0] call EFUNC(common,waitAndExecute); -}, [], 1, 0] call EFUNC(common,waitAndExecute); + }, [], 0.5, 0] call CBA_fnc_waitAndExecute; +}, [], 1, 0] call CBA_fnc_waitAndExecute; diff --git a/addons/huntir/script_component.hpp b/addons/huntir/script_component.hpp index 5c99e04d46..01b4f92fec 100644 --- a/addons/huntir/script_component.hpp +++ b/addons/huntir/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT huntir +#define COMPONENT_BEAUTIFIED HuntIR #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/huntir/stringtable.xml b/addons/huntir/stringtable.xml index 8648f58ea9..8db0e6afd1 100644 --- a/addons/huntir/stringtable.xml +++ b/addons/huntir/stringtable.xml @@ -9,7 +9,7 @@ Ящик с HuntIR HuntIR Transport Box Skrzynia HuntIR - HuntIR Transport Box + Boite de transport HuntIR HuntIR Transport Box Caixa de transporte do HuntIR @@ -45,7 +45,7 @@ Включить HuntIR монитор Activate HuntIR monitor Włącz odbiornik HuntIR - Allumer écran HuntIR + Allumer l'écran du HuntIR HuntIR monitor aktiválása Ativar monitor do HuntIR @@ -57,7 +57,7 @@ Камера: Camera: Kamera: - Caméra: + Caméra : Kamera: Câmera: @@ -69,7 +69,7 @@ Высота: Altitude: Wysokość: - Altitude: + Altitude : Magasság: Altitude: @@ -81,7 +81,7 @@ Время записи: Recording Time: Czas nagrywania: - Temps d'enregistrement: + Temps d'enregistrement : Felvételi idő: Tempo de gravação: @@ -93,7 +93,7 @@ Нажмите ESC чтобы выйти из режима камеры Press ESC to quit camera Wciśnij ESC by wyjść z widoku kamery - Appuyer sur ESC pour quitter camera + Appuyer sur ESC pour quitter la camera Nyomj ESC-ket a kamerából való kilépéshez Pressione ESC para sair da câmera @@ -117,7 +117,7 @@ A/D - Приближение A/D - Cycle zoom A/D - powiększenie - A/D - Changement zoom + Q/D - Changement de zoom A/D - Nagyítás A/D - Troca zoom @@ -129,7 +129,7 @@ W/S - Выбрать камеру W/S - Select camera W/S - wybór kamery - W/S - Sélectionner caméra + Z/S - Sélectionner la caméra W/S - Kamera váltás W/S - Seleciona câmera @@ -141,7 +141,7 @@ Влево/Вправо - Вращать камеру Left/Right - Rotate camera Lewo/Prawo - obrót kamery w poziomie - Gauche/Droite - Rotation caméra + Gauche/Droite - Rotation de la caméra Jobb/Bal - Kamera forgatás Esquerda/Direita - Rotaciona câmera @@ -153,7 +153,7 @@ Вверх/Вниз - Поднять/Опустить камеру Up/Down - Elevate/lower camera Góra/Dół - obrót kamery w pionie - Haut/Bas - Monter/descendre caméra + Haut/Bas - Monter/descendre la caméra Fel/Le - Kamera döntése/süllyesztése Acima/Abaixo - Eleva/Abaixa a câmera @@ -177,7 +177,7 @@ R - Сбросить настройки камеры R - Reset camera R - resetuj kamerę - R - Reset caméra + R - Reset de la caméra R - Kamera visszaállítása R - Redefine a câmera @@ -194,4 +194,4 @@ Esc - Sai do Ajuda - + \ No newline at end of file diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 4e4e6025a3..e4b7655efc 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -1,67 +1,67 @@ -//XEH_clientInit.sqf -#include "script_component.hpp" - -if (!hasInterface) exitWith {}; - -GVAR(cachedBuildingTypes) = []; -GVAR(cachedBuildingActionPairs) = []; - -GVAR(ParsedTextCached) = []; - -["SettingChanged", { - params ["_name"]; - if (({_x == _name} count [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) == 1) then { - [] call FUNC(setupTextColors); - }; -}] call EFUNC(common,addEventhandler); - -["SettingsInitialized", { - //Setup text/shadow/size/color settings matrix - [] call FUNC(setupTextColors); - // Install the render EH on the main display - addMissionEventHandler ["Draw3D", DFUNC(render)]; -}] call EFUNC(common,addEventHandler); - -//Add Actions to Houses: -["interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call EFUNC(common,addEventHandler); - -["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)), -{ - // Statement - [0] call FUNC(keyDown) -},{[0,false] call FUNC(keyUp)}, -[219, [false, false, false]], false] call CBA_fnc_addKeybind; //Left Windows Key - -["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)), -{ - // Statement - [1] call FUNC(keyDown) -},{[1,false] call FUNC(keyUp)}, -[219, [false, true, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + Ctrl/Strg - - -// Listens for the falling unconscious event, just in case the menu needs to be closed -["medical_onUnconscious", { - // If no menu is open just quit - if (GVAR(openedMenuType) < 0) exitWith {}; - - params ["_unit", "_isUnconscious"]; - - if (_unit != ACE_player || !_isUnconscious) exitWith {}; - - GVAR(actionSelected) = false; - [GVAR(openedMenuType), false] call FUNC(keyUp); -}] call EFUNC(common,addEventhandler); - -// disable firing while the interact menu is is is opened -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventHandler); - -// background options -["interactMenuOpened", { - if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);}; - if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];}; -}] call EFUNC(common,addEventHandler); -["interactMenuClosed", { - if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);}; - if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; -}] call EFUNC(common,addEventHandler); +//XEH_clientInit.sqf +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +GVAR(cachedBuildingTypes) = []; +GVAR(cachedBuildingActionPairs) = []; + +GVAR(ParsedTextCached) = []; + +["ace_settingChanged", { + params ["_name"]; + if (({_x == _name} count [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) == 1) then { + [] call FUNC(setupTextColors); + }; +}] call CBA_fnc_addEventHandler; + +["ace_settingsInitialized", { + //Setup text/shadow/size/color settings matrix + [] call FUNC(setupTextColors); + // Install the render EH on the main display + addMissionEventHandler ["Draw3D", DFUNC(render)]; +}] call CBA_fnc_addEventHandler; + +//Add Actions to Houses: +["ace_interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call CBA_fnc_addEventHandler; + +["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)), +{ + // Statement + [0] call FUNC(keyDown) +},{[0,false] call FUNC(keyUp)}, +[219, [false, false, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + +["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)), +{ + // Statement + [1] call FUNC(keyDown) +},{[1,false] call FUNC(keyUp)}, +[219, [false, true, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + Ctrl/Strg + + +// Listens for the falling unconscious event, just in case the menu needs to be closed +["ace_unconscious", { + // If no menu is open just quit + if (GVAR(openedMenuType) < 0) exitWith {}; + + params ["_unit", "_isUnconscious"]; + + if (_unit != ACE_player || !_isUnconscious) exitWith {}; + + GVAR(actionSelected) = false; + [GVAR(openedMenuType), false] call FUNC(keyUp); +}] call CBA_fnc_addEventHandler; + +// disable firing while the interact menu is is is opened +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; + +// background options +["ace_interactMenuOpened", { + if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);}; + if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];}; +}] call CBA_fnc_addEventHandler; +["ace_interactMenuClosed", { + if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);}; + if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; +}] call CBA_fnc_addEventHandler; diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index fae8843a4e..8711f8c180 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -27,7 +27,7 @@ GVAR(keyDownSelfAction) = false; GVAR(keyDownTime) = 0; GVAR(openedMenuType) = -1; -GVAR(lastTime) = ACE_diagTime; +GVAR(lastTime) = diag_tickTime; GVAR(rotationAngle) = 0; GVAR(selectedAction) = [[],[]]; @@ -43,8 +43,8 @@ GVAR(lastPath) = []; GVAR(expanded) = false; -GVAR(startHoverTime) = ACE_diagTime; -GVAR(expandedTime) = ACE_diagTime; +GVAR(startHoverTime) = diag_tickTime; +GVAR(expandedTime) = diag_tickTime; // reset on mission load addMissionEventHandler ["Loaded", { diff --git a/addons/interact_menu/config.cpp b/addons/interact_menu/config.cpp index 8909c3d685..95561f4579 100644 --- a/addons/interact_menu/config.cpp +++ b/addons/interact_menu/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"NouberNou", "esteldunedain"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"NouberNou", "esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -23,3 +25,9 @@ class CfgPatches { class ACE_Extensions { extensions[] += {"ace_break_line", "ace_parse_imagepath"}; }; + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; + clearConditionCaches = QGVAR(clearConditionCaches); + interactMenuClosed = "ace_interactMenuClosed"; +}; diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index 56ae64e5f9..32c086f692 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -3,13 +3,13 @@ * Insert an ACE action to a class, under a certain path * Note: This function is NOT global. * - * Argument: + * Arguments: * 0: TypeOf of the class * 1: Type of action, 0 for actions, 1 for self-actions * 2: Parent path of the new action * 3: Action * - * Return value: + * Return Value: * The entry full path, which can be used to remove the entry, or add children entries . * * Example: diff --git a/addons/interact_menu/functions/fnc_addActionToObject.sqf b/addons/interact_menu/functions/fnc_addActionToObject.sqf index 31e15ae7aa..d307f8b9ad 100644 --- a/addons/interact_menu/functions/fnc_addActionToObject.sqf +++ b/addons/interact_menu/functions/fnc_addActionToObject.sqf @@ -3,13 +3,13 @@ * Insert an ACE action to an object, under a certain config path * Note: This function is NOT global. * - * Argument: + * Arguments: * 0: Object the action should be assigned to * 1: Type of action, 0 for actions, 1 for self-actions * 2: Parent path of the new action * 3: Action * - * Return value: + * Return Value: * The entry full path, which can be used to remove the entry, or add children entries . * * Example: diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf index 4370f4d2ee..43273ef967 100644 --- a/addons/interact_menu/functions/fnc_addMainAction.sqf +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -2,11 +2,11 @@ * Author: Jonpas, PabstMirror * Makes sure there is a ACE_MainActions on the object type * - * Argument: + * Arguments: * 0: Object classname * 1: Type of action, 0 for actions, 1 for self-actions * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf index 42fcf96cc7..ae066576f7 100644 --- a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -2,13 +2,13 @@ * Author: esteldunedain * Collect a entire tree of active actions * - * Argument: + * Arguments: * 0: Object * 1: Original action tree * 2: Parent path * 3: Distance to base point (will be 0 for self/zeus/in-vehicle) * - * Return value: + * Return Value: * Active children * * Public: No diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 7f2ca38540..4cf657a3bc 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Compile the action menu from config for an object's class * - * Argument: + * Arguments: * 0: Object or class name or * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index eb9727a072..0c5e236f0b 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Compile the self action menu from config for an object's class * - * Argument: + * Arguments: * 0: Object or class name or * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf index 6026735154..c0797269e6 100644 --- a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf @@ -2,10 +2,10 @@ * Author: SilentSpike * Compile the zeus action menu (only to be done once) * - * Argument: + * Arguments: * nil * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index db31200c47..b7616b9718 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -3,7 +3,7 @@ * Creates an isolated ACE action * Note: This function is NOT global. * - * Argument: + * Arguments: * 0: Action name * 1: Name of the action shown in the menu * 2: Icon @@ -16,7 +16,7 @@ * 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] (Optional) * 10: Modifier function (Optional) * - * Return value: + * Return Value: * Action * * Example: diff --git a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf index 1c4e535d66..38e5a42460 100644 --- a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf +++ b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf @@ -2,12 +2,12 @@ * Author: commy2 * Sets the controls structured text if it isn't already set. * - * Argument: + * Arguments: * 0: Structured Text Ctrl * 1: Index * 2: Text * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_findActionNode.sqf b/addons/interact_menu/functions/fnc_findActionNode.sqf index edd0cace04..c328e03f39 100644 --- a/addons/interact_menu/functions/fnc_findActionNode.sqf +++ b/addons/interact_menu/functions/fnc_findActionNode.sqf @@ -3,11 +3,11 @@ * Return action point from path * Note: This function is NOT global. * - * Argument: + * Arguments: * 0: List of Action Tree * 1: Path * - * Return value: + * Return Value: * Action node or if not found * * Example: diff --git a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index d8ad91c434..f995ffa454 100644 --- a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -2,11 +2,11 @@ * Author: commy2 * Disables firing while the menu is opened. Called from playerChanged eh. * - * Argument: + * Arguments: * 0: New unit to add the addAction eh * 1: Old unit to remove the addAction eh * - * Return value: + * Return Value: * None */ #include "script_component.hpp" diff --git a/addons/interact_menu/functions/fnc_isSubPath.sqf b/addons/interact_menu/functions/fnc_isSubPath.sqf index 53d88eb9d1..5933e2c462 100644 --- a/addons/interact_menu/functions/fnc_isSubPath.sqf +++ b/addons/interact_menu/functions/fnc_isSubPath.sqf @@ -2,11 +2,11 @@ * Author: esteldunedain * Check if the first path is a subpath of the other * - * Argument: + * Arguments: * 0: LongPath * 1: ShortPath * - * Return value: + * Return Value: * Bool * * Example: diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index b71130a248..1aa9b4c653 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Handle interactions key down * - * Argument: + * Arguments: * 0: Type of key: 0 interaction / 1 self interaction * - * Return value: + * Return Value: * true * * Public: No @@ -32,7 +32,7 @@ if (_menuType == 0) then { GVAR(keyDown) = false; GVAR(keyDownSelfAction) = true; }; -GVAR(keyDownTime) = ACE_diagTime; +GVAR(keyDownTime) = diag_tickTime; GVAR(openedMenuType) = _menuType; GVAR(lastTimeSearchedActions) = -1000; GVAR(ParsedTextCached) = []; @@ -83,25 +83,25 @@ if (GVAR(openedMenuType) == 0) then { if (vehicle ACE_player != ACE_player) then { GVAR(menuDepthPath) = [["ACE_SelfActions", (vehicle ACE_player)]]; GVAR(expanded) = true; - GVAR(expandedTime) = ACE_diagTime; + GVAR(expandedTime) = diag_tickTime; GVAR(lastPath) = +GVAR(menuDepthPath); GVAR(startHoverTime) = -1000; }; } else { GVAR(menuDepthPath) = [["ACE_ZeusActions", (getAssignedCuratorLogic player)]]; GVAR(expanded) = true; - GVAR(expandedTime) = ACE_diagTime; + GVAR(expandedTime) = diag_tickTime; GVAR(lastPath) = +GVAR(menuDepthPath); GVAR(startHoverTime) = -1000; }; } else { GVAR(menuDepthPath) = [["ACE_SelfActions", ACE_player]]; GVAR(expanded) = true; - GVAR(expandedTime) = ACE_diagTime; + GVAR(expandedTime) = diag_tickTime; GVAR(lastPath) = +GVAR(menuDepthPath); GVAR(startHoverTime) = -1000; }; -["interactMenuOpened", [_menuType]] call EFUNC(common,localEvent); +["ace_interactMenuOpened", [_menuType]] call CBA_fnc_localEvent; true diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index b6eae6f527..ce96250552 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Handle interactions key up * - * Argument: + * Arguments: * 0: Type of key: 0 interaction / 1 self interaction * - * Return value: + * Return Value: * true * * Public: No @@ -28,7 +28,7 @@ if(GVAR(actionSelected)) then { private _target = GVAR(selectedTarget); // Clear the conditions caches - ["clearConditionCaches", []] call EFUNC(common,localEvent); + [QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent; // exit scope if selecting an action on key release is disabled if (!(GVAR(actionOnKeyRelease)) && !_calledByClicking) exitWith {}; @@ -40,11 +40,11 @@ if(GVAR(actionSelected)) then { [_target, _player, _actionData select 6] call (_actionData select 3); // Clear the conditions caches again if the action was performed - ["clearConditionCaches", []] call EFUNC(common,localEvent); + [QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent; }; }; -["interactMenuClosed", [GVAR(openedMenuType)]] call EFUNC(common,localEvent); +["ace_interactMenuClosed", [GVAR(openedMenuType)]] call CBA_fnc_localEvent; GVAR(keyDown) = false; GVAR(keyDownSelfAction) = false; diff --git a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf index a01078ad3b..f3db5fc8c3 100644 --- a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf +++ b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf @@ -2,12 +2,12 @@ * Author: esteldunedain * Removes an action from a class * - * Argument: + * Arguments: * 0: TypeOf of the class * 1: Type of action, 0 for actions, 1 for self-actions * 2: Full path of the new action * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/interact_menu/functions/fnc_removeActionFromObject.sqf b/addons/interact_menu/functions/fnc_removeActionFromObject.sqf index e630bf4ad1..3b720d3c71 100644 --- a/addons/interact_menu/functions/fnc_removeActionFromObject.sqf +++ b/addons/interact_menu/functions/fnc_removeActionFromObject.sqf @@ -2,12 +2,12 @@ * Author: commy2, NouberNou and esteldunedain * Removes an action from an object * - * Argument: + * Arguments: * 0: Object the action is assigned to * 1: Type of action, 0 for actions, 1 for self-actions * 2: Full path of the action to remove * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 117a828b0b..1c3ed50c92 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Render all available nearby interactions * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -51,12 +51,12 @@ if (GVAR(openedMenuType) >= 0) then { private _closest = GVAR(currentOptions) select _closestSelection; _closest params ["_action", "_sPos", "_hoverPath"]; - private _cTime = ACE_diagTime; + private _cTime = diag_tickTime; private _delta = _cTime - GVAR(lastTime); GVAR(lastTime) = _cTime; GVAR(rotationAngle) = (GVAR(rotationAngle) + (270*_delta)) mod 360; - [_sPos, format [QUOTE(PATHTOF(ui\selector%1.paa)), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]] call FUNC(renderSelector); + [_sPos, format [QPATHTOF(ui\selector%1.paa), floor (((abs GVAR(rotationAngle)) mod 90) / 6)]] call FUNC(renderSelector); _foundTarget = true; GVAR(actionSelected) = true; @@ -65,17 +65,17 @@ if (GVAR(openedMenuType) >= 0) then { private _misMatch = !(GVAR(lastPath) isEqualTo _hoverPath); - if(_misMatch && {ACE_diagTime-GVAR(expandedTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { - GVAR(startHoverTime) = ACE_diagTime; + if(_misMatch && {diag_tickTime-GVAR(expandedTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { + GVAR(startHoverTime) = diag_tickTime; GVAR(lastPath) = _hoverPath; GVAR(expanded) = false; } else { - if(!GVAR(expanded) && {ACE_diagTime-GVAR(startHoverTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { + if(!GVAR(expanded) && {diag_tickTime-GVAR(startHoverTime) > linearConversion [0, 2, GVAR(menuAnimationSpeed), 0.25, 0.08333333]}) then { GVAR(expanded) = true; // Start the expanding menu animation only if the user is not going up the menu if !([GVAR(menuDepthPath),GVAR(lastPath)] call FUNC(isSubPath)) then { - GVAR(expandedTime) = ACE_diagTime; + GVAR(expandedTime) = diag_tickTime; }; GVAR(menuDepthPath) = +GVAR(lastPath); @@ -97,7 +97,7 @@ if (GVAR(openedMenuType) >= 0) then { private _target = GVAR(selectedTarget); // Clear the conditions caches - ["clearConditionCaches", []] call EFUNC(common,localEvent); + [QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent; // Check the action conditions private _actionData = GVAR(selectedAction) select 0; @@ -106,7 +106,7 @@ if (GVAR(openedMenuType) >= 0) then { [_target, _player, _actionData select 6] call (_actionData select 3); // Clear the conditions caches again if the action was performed - ["clearConditionCaches", []] call EFUNC(common,localEvent); + [QGVAR(clearConditionCaches), []] call CBA_fnc_localEvent; }; }; }; diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index c99688564a..e30ee55c10 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -2,10 +2,10 @@ * Author: NouberNou and esteldunedain * Render all action points * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Public: No @@ -16,15 +16,15 @@ GVAR(currentOptions) = []; private _player = ACE_player; -private _cameraPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]); -private _cameraDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff _cameraPosASL; +GVAR(cameraPosASL) = AGLtoASL (positionCameraToWorld [0, 0, 0]); +GVAR(cameraDir) = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff GVAR(cameraPosASL); private _fnc_renderNearbyActions = { // Render all nearby interaction menus #define MAXINTERACTOBJECTS 3 GVAR(foundActions) = []; - GVAR(lastTimeSearchedActions) = ACE_diagTime; + GVAR(lastTimeSearchedActions) = diag_tickTime; private _numInteractObjects = 0; private _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; @@ -32,7 +32,7 @@ private _fnc_renderNearbyActions = { private _target = _x; // Quick oclussion test. Skip objects more than 1 m behind the camera plane - private _lambda = ((getPosASL _x) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir; + private _lambda = ((getPosASL _x) vectorDiff GVAR(cameraPosASL)) vectorDotProduct GVAR(cameraDir); if ((_lambda > -1) && {!isObjectHidden _target}) then { private _numInteractions = 0; // Prevent interacting with yourself or your own vehicle @@ -128,7 +128,7 @@ GVAR(collectedActionPoints) resize 0; if (GVAR(openedMenuType) == 0) then { if (isNull curatorCamera) then { if (vehicle ACE_player == ACE_player) then { - if (ACE_diagTime > GVAR(lastTimeSearchedActions) + 0.20) then { + if (diag_tickTime > GVAR(lastTimeSearchedActions) + 0.20) then { // Once every 0.2 secs, collect nearby objects active and visible action points and render them call _fnc_renderNearbyActions; } else { diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index 57ded33be0..852c2b332f 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -2,12 +2,12 @@ * Author: NouberNou and esteldunedain * Render the interaction menu for a base action * - * Argument: + * Arguments: * 0: Object * 1: Action node * 2: 3D position or 2D position (Optional) * - * Return value: + * Return Value: * Was the menu rendered * * Public: No @@ -90,9 +90,8 @@ if (_activeActionTree isEqualTo []) exitWith {false}; BEGIN_COUNTER(fnc_renderMenus); -// IGNORE_PRIVATE_WARNING(_cameraPosASL,_cameraDir); if (count _pos > 2) then { - _sPos pushBack (((AGLtoASL _pos) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir); + _sPos pushBack (((AGLtoASL _pos) vectorDiff GVAR(cameraPosASL)) vectorDotProduct GVAR(cameraDir)); } else { _sPos pushBack 0; }; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 9ead5c65cf..ceeeb9991d 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -2,13 +2,13 @@ * Author: NouberNou and esteldunedain * Render a single interaction icon * - * Argument: + * Arguments: * 0: Text * 1: Icon * 2: 2d position * 3: Text Settings * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 6abb980620..687c56d2c3 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -2,13 +2,13 @@ * Author: NouberNou and esteldunedain * Render an interaction menu and it's children recursively * - * Argument: + * Arguments: * 0: Parent path * 1: Action data * 2: 2D position * 3: Angle range available for rendering * - * Return value: + * Return Value: * None * * Public: No @@ -99,8 +99,8 @@ if (GVAR(UseListMenu)) then { // Animate menu scale if (_menuInSelectedPath && {_menuDepth == count _path}) then { - _scaleX = _scaleX * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); - _scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); + _scaleX = _scaleX * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); + _scaleY = _scaleY * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); }; private _target = _actionObject; diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 69f8a81b95..ef10456b5a 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -2,11 +2,11 @@ * Author: esteldunedain * Render a single interaction icon * - * Argument: + * Arguments: * 0: 2d position * 1: Icon * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf index cbdd56fb07..120c5b18e3 100644 --- a/addons/interact_menu/functions/fnc_setupTextColors.sqf +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -2,10 +2,10 @@ * Author: PabstMirror * Builds color strings needed for displaying interaction text * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/interact_menu/functions/fnc_splitPath.sqf b/addons/interact_menu/functions/fnc_splitPath.sqf index ba07dc1d9e..eba203aa6f 100644 --- a/addons/interact_menu/functions/fnc_splitPath.sqf +++ b/addons/interact_menu/functions/fnc_splitPath.sqf @@ -2,10 +2,10 @@ * Author: esteldunedain * Take full path and split it between parent path and action name * - * Argument: + * Arguments: * Full path of the action to remove * - * Return value: + * Return Value: * 0: Parent path * 1: Action name * diff --git a/addons/interact_menu/script_component.hpp b/addons/interact_menu/script_component.hpp index 6a2f4e86f3..1d38d205d7 100644 --- a/addons/interact_menu/script_component.hpp +++ b/addons/interact_menu/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT interact_menu +#define COMPONENT_BEAUTIFIED Interact Menu #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index aac120ddbc..d44252e8e1 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -321,7 +321,7 @@ Rychlost animace interakce Velocità Animazioni Interazioni Velocidad de animación del menú de interacción - Vitesse des animations du menu d'interaction + Vitesse de l'aniamtion d'interaction Makes menu animations faster and decreases the time needed to hover to show sub actions @@ -332,7 +332,7 @@ Zrychlí animaci menu a sníží tak čas potřebný pro plné zobrazení podmenu Rende le animazioni Menù più veloci e diminuisce il tempo richiesto per mostrare sotto-azioni Hace la animación del menú más rápida, reduciendo el tiempo necesario para abrir sub-acciones. - Rendre le menu d'interaction plus rapide et reduire le temps nécessaire de survol d'une action pour afficher les sous-actions. + Rend les animations de menu plus rapide et réduit le temps nécessaire à l'affichage des sous menus d'action \ No newline at end of file diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 437b84c3a6..0aa65cd762 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -11,7 +11,7 @@ class CfgVehicles { scope = 2; isGlobal = 1; isSingular = 1; - icon = PATHTOF(UI\Icon_Module_Interaction_ca.paa); + icon = QPATHTOF(UI\Icon_Module_Interaction_ca.paa); class Arguments { class EnableTeamManagement { displayName = CSTRING(EnableTeamManagement_DisplayName); @@ -68,14 +68,14 @@ class CfgVehicles { statement = ""; showDisabled = 0; priority = 3.2; - icon = PATHTOF(UI\team\team_management_ca.paa); + icon = QPATHTOF(UI\team\team_management_ca.paa); class ACE_AssignTeamRed { displayName = CSTRING(AssignTeamRed); condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); showDisabled = 1; - icon = PATHTOF(UI\team\team_red_ca.paa); + icon = QPATHTOF(UI\team\team_red_ca.paa); priority = 2.4; }; class ACE_AssignTeamGreen { @@ -83,7 +83,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); showDisabled = 1; - icon = PATHTOF(UI\team\team_green_ca.paa); + icon = QPATHTOF(UI\team\team_green_ca.paa); priority = 2.3; }; class ACE_AssignTeamBlue { @@ -91,7 +91,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); showDisabled = 1; - icon = PATHTOF(UI\team\team_blue_ca.paa); + icon = QPATHTOF(UI\team\team_blue_ca.paa); priority = 2.2; }; class ACE_AssignTeamYellow { @@ -99,7 +99,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam)); statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); showDisabled = 1; - icon = PATHTOF(UI\team\team_yellow_ca.paa); + icon = QPATHTOF(UI\team\team_yellow_ca.paa); priority = 2.1; }; class ACE_UnassignTeam { @@ -107,7 +107,7 @@ class CfgVehicles { condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {assignedTeam _target != 'MAIN'}); statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); showDisabled = 1; - icon = PATHTOF(UI\team\team_white_ca.paa); + icon = QPATHTOF(UI\team\team_white_ca.paa); priority = 2.5; }; }; @@ -118,7 +118,7 @@ class CfgVehicles { statement = QUOTE([_player] joinSilent group _target); showDisabled = 0; priority = 2.6; - icon = PATHTOF(UI\team\team_management_ca.paa); + icon = QPATHTOF(UI\team\team_management_ca.paa); }; class ACE_GetDown { displayName = CSTRING(GetDown); @@ -223,7 +223,7 @@ class CfgVehicles { statement = ""; showDisabled = 1; priority = 3.2; - icon = PATHTOF(UI\team\team_management_ca.paa); + icon = QPATHTOF(UI\team\team_management_ca.paa); class ACE_JoinTeamRed { displayName = CSTRING(JoinTeamRed); @@ -232,7 +232,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'RED')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.4; - icon = PATHTOF(UI\team\team_red_ca.paa); + icon = QPATHTOF(UI\team\team_red_ca.paa); }; class ACE_JoinTeamGreen { displayName = CSTRING(JoinTeamGreen); @@ -241,7 +241,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'GREEN')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.3; - icon = PATHTOF(UI\team\team_green_ca.paa); + icon = QPATHTOF(UI\team\team_green_ca.paa); }; class ACE_JoinTeamBlue { displayName = CSTRING(JoinTeamBlue); @@ -250,7 +250,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'BLUE')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.2; - icon = PATHTOF(UI\team\team_blue_ca.paa); + icon = QPATHTOF(UI\team\team_blue_ca.paa); }; class ACE_JoinTeamYellow { displayName = CSTRING(JoinTeamYellow); @@ -259,7 +259,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'YELLOW')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.1; - icon = PATHTOF(UI\team\team_yellow_ca.paa); + icon = QPATHTOF(UI\team\team_yellow_ca.paa); }; class ACE_LeaveTeam { displayName = CSTRING(LeaveTeam); @@ -268,7 +268,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'MAIN')] call DFUNC(joinTeam)); showDisabled = 1; priority = 2.5; - icon = PATHTOF(UI\team\team_white_ca.paa); + icon = QPATHTOF(UI\team\team_white_ca.paa); }; class ACE_BecomeLeader { displayName = CSTRING(BecomeLeader); @@ -277,7 +277,7 @@ class CfgVehicles { statement = QUOTE(_this call DFUNC(doBecomeLeader)); showDisabled = 1; priority = 1.0; - icon = PATHTOF(UI\team\team_white_ca.paa); + icon = QPATHTOF(UI\team\team_white_ca.paa); }; class ACE_LeaveGroup { displayName = CSTRING(LeaveGroup); @@ -286,7 +286,7 @@ class CfgVehicles { statement = QUOTE(_oldGroup = units group _player; _newGroup = createGroup side _player; [_player] joinSilent _newGroup; {_player reveal _x} forEach _oldGroup;); showDisabled = 1; priority = 1.2; - icon = PATHTOF(UI\team\team_management_ca.paa); + icon = QPATHTOF(UI\team\team_management_ca.paa); }; }; @@ -307,8 +307,9 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); + position = QUOTE(call DFUNC(getVehiclePos)); selection = ""; - distance = 10; + distance = 4; condition = "true"; class ACE_Passengers { displayName = CSTRING(Passengers); @@ -333,8 +334,9 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); + position = QUOTE(call DFUNC(getVehiclePos)); selection = ""; - distance = 10; + distance = 4; condition = "true"; class ACE_Passengers { displayName = CSTRING(Passengers); @@ -386,8 +388,9 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); + position = QUOTE(call DFUNC(getVehiclePos)); selection = ""; - distance = 10; + distance = 4; condition = "true"; class ACE_Passengers { displayName = CSTRING(Passengers); @@ -413,7 +416,7 @@ class CfgVehicles { class ACE_MainActions { displayName = CSTRING(MainAction); selection = ""; - distance = 10; + distance = 4; condition = "true"; class ACE_Passengers { displayName = CSTRING(Passengers); @@ -439,8 +442,9 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); + position = QUOTE(call DFUNC(getVehiclePos)); selection = ""; - distance = 10; + distance = 4; condition = "true"; class ACE_Push { @@ -475,7 +479,7 @@ class CfgVehicles { class ACE_MainActions { displayName = CSTRING(MainAction); selection = "gunnerview"; - distance = 2; + distance = 4; condition = "true"; class ACE_Passengers { displayName = CSTRING(Passengers); @@ -496,14 +500,6 @@ class CfgVehicles { }; }; - class Pod_Heli_Transport_04_base_F: StaticWeapon { - class ACE_Actions: ACE_Actions { - class ACE_MainActions: ACE_MainActions { - distance = 5; - }; - }; - }; - class StaticMGWeapon: StaticWeapon {}; class HMG_01_base_F: StaticMGWeapon {}; @@ -552,6 +548,14 @@ class CfgVehicles { class ACE_SelfActions {}; }; + class Slingload_base_F: ReammoBox_F {}; + class Pod_Heli_Transport_04_base_F: Slingload_base_F { + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + distance = 5; + }; + }; + }; class ACE_RepairItem_Base: ThingX { class ACE_Actions { diff --git a/addons/interaction/RscTitles.hpp b/addons/interaction/RscTitles.hpp index d03d3e0f36..71070b1715 100644 --- a/addons/interaction/RscTitles.hpp +++ b/addons/interaction/RscTitles.hpp @@ -170,7 +170,7 @@ class RscTitles { class controls { class SelectIcon: RscInteractionHelperIcon{ idc = 1200; - text = PATHTOF(UI\mouse_left_ca.paa); + text = QPATHTOF(UI\mouse_left_ca.paa); y = 17.5 * GUI_GRID_H; }; class SelectText: RscInteractionText{ @@ -180,7 +180,7 @@ class RscTitles { }; class GoBackIcon: RscInteractionHelperIcon{ idc = 1201; - text = PATHTOF(UI\mouse_right_ca.paa); + text = QPATHTOF(UI\mouse_right_ca.paa); y = 19.5 * GUI_GRID_H; }; class GoBackText: RscInteractionText{ @@ -190,7 +190,7 @@ class RscTitles { }; class ScrollIcon: RscInteractionHelperIcon{ idc = 1202; - text = PATHTOF(UI\mouse_scroll_ca.paa); + text = QPATHTOF(UI\mouse_scroll_ca.paa); y = 18.5 * GUI_GRID_H; }; class ScrollText: RscInteractionText{ diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index be6158cdd5..db6b1d3298 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -2,6 +2,7 @@ // interaction menu PREP(addPassengerActions); PREP(addPassengersActions); +PREP(getVehiclePos); PREP(getWeaponPos); PREP(moduleInteraction); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 66e0cb1341..9aa9cfb157 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -3,36 +3,36 @@ ACE_Modifier = 0; -["pardon", {(_this select 0) addRating -rating (_this select 0)}] call EFUNC(common,addEventHandler); +[QGVAR(pardon), {(_this select 0) addRating -rating (_this select 0)}] call CBA_fnc_addEventHandler; -["getDown", { +[QGVAR(getDown), { params ["_target"]; _target setUnitPos "DOWN"; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["sendAway", { +[QGVAR(sendAway), { params ["_unit", "_position"]; _unit setUnitPos "AUTO"; _unit doMove _position; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["lampTurnOn", { +[QGVAR(setLampOn), { params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"]; {if((_x select 1) == _disabledLampDMG) then {_lamp setHit [_x select 0, 0];};nil} count _hitPointsDamage; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["lampTurnOff", { +[QGVAR(setLampOff), { params ["_lamp", "_hitPointsDamage", "_disabledLampDMG"]; {_lamp setHit [_x select 0, (_x select 1) max _disabledLampDMG];nil} count _hitPointsDamage; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith {}; GVAR(isOpeningDoor) = false; -["tapShoulder", { +[QGVAR(tapShoulder), { params ["_unit", "_shoulderNum"]; if (_unit == ACE_player) then { @@ -40,7 +40,7 @@ GVAR(isOpeningDoor) = false; private _message = parseText format ([["%1 >", localize LSTRING(YouWereTappedRight)], ["< %1", localize LSTRING(YouWereTappedLeft)]] select (_shoulderNum == 1)); [_message] call EFUNC(common,displayTextStructured); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // add keybinds ["ACE3 Common", QGVAR(openDoor), localize LSTRING(OpenDoor), { diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 2413256bf4..c6aff730cf 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interact_menu"}; - author[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578", "dixon13"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578", "dixon13"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,12 @@ class CfgPatches { #include "RscTitles.hpp" #include "ACE_Settings.hpp" #include "ACE_ZeusActions.hpp" + +class ACE_newEvents { + getDown = QGVAR(getDown); + pardon = QGVAR(pardon); + tapShoulder = QGVAR(tapShoulder); + sendAway = QGVAR(sendAway); + lampTurnOff = QGVAR(setLampOff); + lampTurnOn = QGVAR(setLampOn); +}; diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 8ee95b7eb9..7b8ad69ee0 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -34,7 +34,7 @@ _actions = []; ] select (([driver _vehicle, gunner _vehicle, commander _vehicle] find _unit) + 1); if (_unit getVariable [QEGVAR(captives,isHandcuffed), false]) then { - _icon = QUOTE(PATHTOEF(captives,UI\handcuff_ca.paa)); + _icon = QPATHTOEF(captives,UI\handcuff_ca.paa); }; _actions pushBack [ diff --git a/addons/interaction/functions/fnc_canJoinTeam.sqf b/addons/interaction/functions/fnc_canJoinTeam.sqf index b91a5abd5c..7732e164e7 100644 --- a/addons/interaction/functions/fnc_canJoinTeam.sqf +++ b/addons/interaction/functions/fnc_canJoinTeam.sqf @@ -6,7 +6,7 @@ * 0: Player * 1: Target * - * Return value: + * Return Value: * Able to join a team * * Example: diff --git a/addons/interaction/functions/fnc_doBecomeLeader.sqf b/addons/interaction/functions/fnc_doBecomeLeader.sqf index b2a423e0c0..8c8663b03b 100644 --- a/addons/interaction/functions/fnc_doBecomeLeader.sqf +++ b/addons/interaction/functions/fnc_doBecomeLeader.sqf @@ -17,4 +17,4 @@ params ["_unit"]; -["selectLeader", units group _unit, [group _unit, _unit]] call EFUNC(common,targetEvent); +[QEGVAR(common,selectLeader), [group _unit, _unit], units group _unit] call CBA_fnc_targetEvent; diff --git a/addons/interaction/functions/fnc_getDown.sqf b/addons/interaction/functions/fnc_getDown.sqf index 2dc9711e2c..af0a9da38c 100644 --- a/addons/interaction/functions/fnc_getDown.sqf +++ b/addons/interaction/functions/fnc_getDown.sqf @@ -27,7 +27,7 @@ _chance = [0.5, 0.8] select (count weapons _unit > 0); { if (count weapons _x == 0 && {random 1 < _chance}) then { - ["getDown", [_x], [_x]] call EFUNC(common,targetEvent); + [QGVAR(getDown), [_x], [_x]] call CBA_fnc_targetEvent; }; false } count (_target nearEntities ["Civilian", SEND_RADIUS]); diff --git a/addons/interaction/functions/fnc_getVehiclePos.sqf b/addons/interaction/functions/fnc_getVehiclePos.sqf new file mode 100644 index 0000000000..1b8ebc69f6 --- /dev/null +++ b/addons/interaction/functions/fnc_getVehiclePos.sqf @@ -0,0 +1,81 @@ +/* + * Author: esteldunedain + * Return a suitable position for the action point for the given target vehicle + * + * Arguments: + * None (uses local variable _target) + * + * Return value: + * Children actions + * + * Example: + * call ace_interaction_fnc_getVehiclePos + * + * Public: No + */ +#include "script_component.hpp" +// IGNORE_PRIVATE_WARNING(_target); + +private _bb = boundingBoxReal _target; +(_bb select 0) params ["_bbX", "_bbY", "_bbZ"]; + +//Helicopter's rotors distort the bounding box, assume a max of 3 meters width for the body +if (_target isKindOf "Helicopter") then {_bbX = (_bbx min 3) max -3;}; + +private _relPos = _target worldToModelVisual ASLToAGL EGVAR(interact_menu,cameraPosASL); +#ifdef DEBUG_MODE_FULL + _relPos = _target worldToModelVisual ASLToAGL eyePos ACE_player; +#endif +_relPos params ["_dx", "_dy", "_dz"]; + +private _ndx = (abs _dx) / ((abs (_bbx)) - 1); +private _ndy = (abs _dy) / ((abs (_bbY)) - 1); +private _ndz = (abs _dz) / ((abs (_bbZ)) - 1); + +private "_pos"; +if (_ndx > _ndy) then { + if (_ndx > _ndz) then { + // _ndx is greater, will colide with x plane first + _pos = _relPos vectorMultiply ((1 / _ndx) min 0.8); + } else { + // _ndz is greater, will colide with z plane first + _pos = _relPos vectorMultiply ((1 / _ndz) min 0.8); + }; +} else { + if (_ndy > _ndz) then { + // _ndy is greater, will colide with y plane first + _pos = _relPos vectorMultiply ((1 / _ndy) min 0.8); + } else { + // _ndz is greater, will colide with z plane first + _pos = _relPos vectorMultiply ((1 / _ndz) min 0.8); + }; +}; +//Set max height at player's eye level (prevent very high interactin point on choppers) +_pos set [2, (_pos select 2) min _dz]; +TRACE_4("",_bb,_bbX,_relPos, _pos); +_pos + +/////////////////// +// The code belows works very well for cursor mode, but not at all in normal mode +// maybe it could be enabled by default only for that mode +/* +if (cursorObject isEqualTo _target) exitWith { + private _dest = EGVAR(interact_menu,cameraPosASL) vectorAdd (EGVAR(interact_menu,cameraDir) vectorMultiply 50); + private _origin = EGVAR(interact_menu,cameraPosASL); + //private _origin = EGVAR(interact_menu,cameraPosASL) vectorAdd [0, 0, -0.35] vectorDiff (EGVAR(interact_menu,cameraDir) vectorMultiply 1.5); + //private _dest = AGLtoASL (_target modelToWorldVisual [0,0,0]); + private _results = lineIntersectsSurfaces [_origin, _dest, ACE_player, objNull, true, 5]; + private _finalPos = [0,0,0]; + { + _x params ["_pos", "", "_obj"]; + TRACE_3("",_forEachIndex,_obj,_target); + if (_obj isEqualTo _target) exitWith { + _finalPos = _target worldToModelVisual ASLtoAGL (_pos vectorAdd (EGVAR(interact_menu,cameraDir) vectorMultiply 1.0)); + }; + } forEach _results; + _finalPos +}; +[0,0,0] +*/ +/////////////////// + diff --git a/addons/interaction/functions/fnc_getWeaponPos.sqf b/addons/interaction/functions/fnc_getWeaponPos.sqf index 58c8756076..d0db3cee77 100644 --- a/addons/interaction/functions/fnc_getWeaponPos.sqf +++ b/addons/interaction/functions/fnc_getWeaponPos.sqf @@ -5,7 +5,7 @@ * Arguments: * None (uses local variable _target) * - * Return value: + * Return Value: * Children actions * * Example: diff --git a/addons/interaction/functions/fnc_hideMouseHint.sqf b/addons/interaction/functions/fnc_hideMouseHint.sqf index 709b798fed..757fe952e5 100644 --- a/addons/interaction/functions/fnc_hideMouseHint.sqf +++ b/addons/interaction/functions/fnc_hideMouseHint.sqf @@ -5,7 +5,7 @@ * Arguments: * None * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/interaction/functions/fnc_joinTeam.sqf b/addons/interaction/functions/fnc_joinTeam.sqf index 1ada3843c1..dfbb2b9070 100644 --- a/addons/interaction/functions/fnc_joinTeam.sqf +++ b/addons/interaction/functions/fnc_joinTeam.sqf @@ -31,5 +31,5 @@ if (_unit == ACE_player) then { _message = format [localize LSTRING(JoinedTeam), _team]; }; - ["displayTextStructured", _message] call EFUNC(common,localEvent); + [_message] call EFUNC(common,displayTextStructured); }; diff --git a/addons/interaction/functions/fnc_openDoor.sqf b/addons/interaction/functions/fnc_openDoor.sqf index b2249d1589..180c01fba9 100644 --- a/addons/interaction/functions/fnc_openDoor.sqf +++ b/addons/interaction/functions/fnc_openDoor.sqf @@ -62,10 +62,10 @@ GVAR(usedScrollWheel) = false; }; // this allows for holding the door in it's current state. - if (ACE_time > _time && {diag_frameno > _frame}) then { + if (CBA_missionTime > _time && {diag_frameno > _frame}) then { GVAR(usedScrollWheel) = true; }; // do incremental door opening {_house animate [_x, GVAR(doorTargetPhase)]; false} count _animations; -}, 0.1, [_house, _animations, getPosASL ACE_player, ACE_time + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler; +}, 0.1, [_house, _animations, getPosASL ACE_player, CBA_missionTime + 0.2, diag_frameno + 2]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/interaction/functions/fnc_pardon.sqf b/addons/interaction/functions/fnc_pardon.sqf index 00fe2f6d17..e11a92e7db 100644 --- a/addons/interaction/functions/fnc_pardon.sqf +++ b/addons/interaction/functions/fnc_pardon.sqf @@ -15,4 +15,4 @@ params ["", "_target"]; -["pardon", [_target], [_target]] call EFUNC(common,targetEvent); +[QGVAR(pardon), [_target], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf index 7e2f7b9356..5016215c39 100644 --- a/addons/interaction/functions/fnc_passMagazine.sqf +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -6,7 +6,7 @@ * 0: Unit that passes the magazine * 1: Unit to pass the magazine to * 2: Weapon classname - * + * * Return Value: * None * @@ -51,4 +51,4 @@ _target addMagazine [_magToPassClassName, _magToPassAmmoCount]; _playerName = [_player] call EFUNC(common,getName); _magToPassDisplayName = getText (configFile >> "CfgMagazines" >> _magToPassClassName >> "displayName"); -["displayTextStructured", [_target], [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target]] call EFUNC(common,targetEvent); \ No newline at end of file +[QEGVAR(common,displayTextStructured), [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/interaction/functions/fnc_push.sqf b/addons/interaction/functions/fnc_push.sqf index bdeaf29012..97534e2c68 100644 --- a/addons/interaction/functions/fnc_push.sqf +++ b/addons/interaction/functions/fnc_push.sqf @@ -22,4 +22,4 @@ private _newVelocity = vectorDir _unit; _newVelocity set [2, 0.25]; _newVelocity = _newVelocity vectorMultiply 2; -["setVelocity", [_boat], [_boat, _newVelocity]] call EFUNC(common,targetEvent); +[QEGVAR(common,setVelocity), [_boat, _newVelocity], [_boat]] call CBA_fnc_targetEvent; diff --git a/addons/interaction/functions/fnc_sendAway.sqf b/addons/interaction/functions/fnc_sendAway.sqf index 546ab9ba3f..c200587f2b 100644 --- a/addons/interaction/functions/fnc_sendAway.sqf +++ b/addons/interaction/functions/fnc_sendAway.sqf @@ -31,7 +31,7 @@ _chance = [0.5, 0.8] select (count weapons _unit > 0); _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE); _position set [2, 0]; - ["sendAway", [_x], [_x, _position]] call EFUNC(common,targetEvent); + [QGVAR(sendAway), [_x, _position], [_x]] call CBA_fnc_targetEvent; }; false } count (_unit nearEntities ["Civilian", SEND_RADIUS]); diff --git a/addons/interaction/functions/fnc_showMouseHint.sqf b/addons/interaction/functions/fnc_showMouseHint.sqf index 57c8a7bf50..821abda14e 100644 --- a/addons/interaction/functions/fnc_showMouseHint.sqf +++ b/addons/interaction/functions/fnc_showMouseHint.sqf @@ -7,7 +7,7 @@ * 1: Right Click Text * 2: Scroll Text (Optional) * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/interaction/functions/fnc_switchLamp.sqf b/addons/interaction/functions/fnc_switchLamp.sqf index 20a2d45dea..f1d9509de8 100644 --- a/addons/interaction/functions/fnc_switchLamp.sqf +++ b/addons/interaction/functions/fnc_switchLamp.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Lamp * - * Return value: + * Return Value: * None * * Example: @@ -29,10 +29,7 @@ private _hitPointsDamage = []; } count _reflectors; //if lamp is on turn it off -private _eventName = ["lampTurnOn", "lampTurnOff"] select _isOn; -if(local _lamp) then { - [_eventName, [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,localEvent); -} else { - [_eventName, [_lamp], [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG]] call EFUNC(common,targetEvent); -}; +private _eventName = [QGVAR(setLampOn), QGVAR(setLampOff)] select _isOn; +[_eventName, [_lamp, _hitPointsDamage, DISABLED_LAMP_DMG], [_lamp]] call CBA_fnc_targetEvent; + _lamp setVariable ["ACE_lampOn", !_isOn, true]; diff --git a/addons/interaction/functions/fnc_tapShoulder.sqf b/addons/interaction/functions/fnc_tapShoulder.sqf index 2061f1806f..d6621d2c07 100644 --- a/addons/interaction/functions/fnc_tapShoulder.sqf +++ b/addons/interaction/functions/fnc_tapShoulder.sqf @@ -25,4 +25,4 @@ if (_unit == ACE_player) then { _unit playActionNow "PutDown"; -["tapShoulder", [_target], [_target, _shoulderNum]] call EFUNC(common,targetEvent); +[QGVAR(tapShoulder), [_target, _shoulderNum], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/interaction/script_component.hpp b/addons/interaction/script_component.hpp index fd6ce8ce58..460550300d 100644 --- a/addons/interaction/script_component.hpp +++ b/addons/interaction/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT interaction +#define COMPONENT_BEAUTIFIED Interaction #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 812964bbb7..b92e2a6dd7 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -127,7 +127,7 @@ Abrir / Cerrar puerta Otwórz / Zamknij drzwi Otevřít / Zavřít dveře - Ouvrir / Fermer Portes + Ouvrir / Fermer la porte Открыть / Закрыть двери Ajtó nyitása / zárása Abrir / Fechar Porta @@ -137,7 +137,7 @@ Lock Door Tür sperren Bloquear puerta - Verrouiller Porte + Verrouiller la porte Blocca la porta Заблокировать дверь Trancar Porta @@ -149,7 +149,7 @@ Unlock Door Tür entsperren Desbloquear puerta - Déverrouiller Porte + Déverrouiller la porte Sblocca la porta Разблокировать дверь Destrancar Porta @@ -161,7 +161,7 @@ Locked Door Tür gesperrt Puerta bloqueada - Porte Verrouillée + Porte verrouillée Porta bloccata Дверь заблокирована Porta Trancada @@ -173,7 +173,7 @@ Unlocked Door Tür entsperrt Puerta desbloqueada - Porte Déverrouillée + Porte déverrouillée Porta sbloccata Дверь разблокирована Porta Destrancada @@ -187,7 +187,7 @@ Unirse al grupo Dołącz do grupy Přidat se do skupiny - Rejoindre Groupe + Rejoindre le groupe Вступить в группу Csatlakozás a csoporthoz Unir-se ao grupo @@ -199,7 +199,7 @@ Dejar grupo Opuść grupę Opustit skupinu - Quitter Groupe + Quitter le groupe Выйти из группы Csoport elhagyása Deixar grupo @@ -211,7 +211,7 @@ Asumir el liderazgo Przejmij dowodzenie Stát se velitelem - Devenir Chef de groupe + Devenir chef de groupe Стать лидером Vezetés átvétele Tornar-se Líder @@ -223,7 +223,7 @@ BAILAR! TAŃCZ! TANCUJ! - Danse! + Danser ! ТАНЦЕВАТЬ! TÁNC! DANCE! @@ -281,7 +281,7 @@ You were tapped on the RIGHT shoulder Te tocaron el hombro DERECHO Dir wurde auf die rechte Schulter geklopft - On te tape sur l'épaule droite + On vous tape sur l'épaule droite Zostałeś klepnięty w prawe ramię Megveregették a JOBB válladat. Někdo tě poklepal na PRAVÉ rameno @@ -293,7 +293,7 @@ You were tapped on the LEFT shoulder. Te tocaron el hombro IZQUIERDO. Dir wurde auf die linke Schulter geklopft - On te tape sur l'épaule gauche + On vous tape sur l'épaule gauche Zostałeś klepnięty w lewe ramię Megveregették a BAL válladat. Někdo tě poklepal na LEVÉ rameno @@ -331,7 +331,7 @@ Aléjate! Odejdź! Jděte pryč! - Allez-vous-en! + Allez-vous-en ! Уходите отсюда! Tűnés! Vá Embora! @@ -343,7 +343,7 @@ Al suelo! Padnij! K zemi! - A terre! + A terre ! A földre! Ложись! Abaixe-se! @@ -356,7 +356,6 @@ Aussteigen! Sal del vehículo! Sortez ! - Vystupte Team Management @@ -518,7 +517,7 @@ You joined Team %1 Du bist Gruppe %1 beigetreten Te has unido al equipo %1 - Tu as rejoint l'équipe %1 + Vous avez rejoint l'équipe %1 Dołączyłeś do %1 Připojili jste se do %1 týmu Вы присоединились к группе %1 @@ -542,7 +541,7 @@ You left the Team Du hast die Gruppe verlassen Has dejado el equipo - Tu as quitté l'équipe + Vous avez quitté l'équipe Opuściłeś drużynę Opustili jste tým Вы покинули группу @@ -555,7 +554,7 @@ Begnadigen Perdonar Przebacz - Pardon + Pardonner Pardon Извините Perdão @@ -589,7 +588,7 @@ Not in Range Außer Reichweite - Hors de portée. + Hors de portée Fuera de rango Слишком далеко Fora do Alcançe @@ -677,7 +676,7 @@ Aktiviere Gruppenverwaltung Povolit správu týmu Управление группами - Active la gestion d'équipe + Activer la gestion d'équipe Csapatkezelés engedélyezése Habilitar gestão de equipes Abilità Management Squadra @@ -689,7 +688,7 @@ Sollen Spieler das Gruppenverwaltungsmenü verwenden dürfen? Standard: Ja Mohou hráči použít menu správy týmu? Výchozí: Ano Разрешить ли игрокам использовать меню управления группами? По-умолчани: Да - Permettre aux joueurs d'utiliser la gestion de groupe? Défaut: oui + Permettre aux joueurs d'utiliser la gestion de groupe? Défaut : oui A játékosoknak engedélyezve legyen a csapatkezelő menü? Alapértelmezett: Igen Devem os jogadores ter permissão de usar o menu de gestão de equipes? Padrão: Sim Possono i giocatori usare il Menù Managment Squadra? Default: Si @@ -714,6 +713,7 @@ Allumer Accendi Zapnout + Ligar Turn off @@ -723,6 +723,7 @@ Eteindre Spegni Vypnout + Desligar Pass magazine @@ -733,7 +734,7 @@ Podat zásobník Passa caricatore Pasar cargador - Donner un chargeur + Passer un chargeur Primary magazine @@ -744,7 +745,7 @@ Zásobník do primární zbraně Caricatore Primario Cargador primario - Chargeur d'arme principale + Chargeur de l'arme principale Pistol magazine @@ -755,7 +756,7 @@ Zásobník do pistole Caricatore Pistola Cargador de pistola - Chargeur d'arme secondaire + Chargeur de pistolet %1 passed you a %2 magazine. @@ -766,7 +767,7 @@ %1 ti podal zásobník %2. %1 ti ha passato un caricatore %2 . %1 te pasó un cargador %2. - %1 vous a passé un chargeur %2. + %1 vous a passé un chargeur de %2. Show "pass magazine" interaction @@ -777,7 +778,7 @@ Zobrazit "interakci "podat zásobník" Mostra interazione "passa caricatore" Mostrar "Pasar cargador" en el menú de interacción - Montrer l'interaction "donner un chargeur". + Montrer l'interaction "Passer un chargeur" \ No newline at end of file diff --git a/addons/inventory/config.cpp b/addons/inventory/config.cpp index f0982a46b4..bc0d4291f8 100644 --- a/addons/inventory/config.cpp +++ b/addons/inventory/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Pabst Mirror, commy2"}; - authorUrl = "https://github.com/PabstMirror/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Pabst Mirror, commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf b/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf index ab23701760..0e1daa4a52 100644 --- a/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf +++ b/addons/inventory/functions/fnc_inventoryDisplayLoad.sqf @@ -53,7 +53,7 @@ _filter ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChanged)}]; // readd "All" filter to last position and select it _index = _filter lbAdd _nameAll; _filter lbSetCurSel _index; -}, [_filter]] call EFUNC(common,execNextFrame); +}, [_filter]] call CBA_fnc_execNextFrame; // monitor changes that can happen and force our update private _dummyControl = _display ctrlCreate ["RscMapControl", -1]; diff --git a/addons/inventory/functions/fnc_onLBSelChanged.sqf b/addons/inventory/functions/fnc_onLBSelChanged.sqf index 61e4b12b10..5ae49049fe 100644 --- a/addons/inventory/functions/fnc_onLBSelChanged.sqf +++ b/addons/inventory/functions/fnc_onLBSelChanged.sqf @@ -24,4 +24,4 @@ GVAR(selectedFilterIndex) = _index; params ["_display"]; [_display] call FUNC(forceItemListUpdate); -}, [ctrlParent _filter]] call EFUNC(common,execNextFrame); +}, [ctrlParent _filter]] call CBA_fnc_execNextFrame; diff --git a/addons/inventory/script_component.hpp b/addons/inventory/script_component.hpp index e95ad43b83..defacb991a 100644 --- a/addons/inventory/script_component.hpp +++ b/addons/inventory/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT inventory +#define COMPONENT_BEAUTIFIED Inventory #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index 6384c11641..42a86b2133 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -20,7 +20,7 @@ Обычно, размер окна инвентаря зависит от размеров пользовательского интерфейса. Эта настройка позволяет увеличить размер окна инвентаря, не увеличивая размеры шрифтов, так что отображется большее количество строк. Normálně se velikost invetáře škáluje s velikostí UI. Toto nastavení dovoluje škálování velikost inventáře ale nežvětšuje velikost fontu. To dovoluje zobrazení více řad v inventáři. Ekwipunek skalowany jest poprzez rozmiar UI. Ta opcja pozwala powiększyć rozmiar UI ekwipunku, lecz nie zwiększa rozmiaru fontu pozwalając na wyświetlanie większej ilości wierszy. - L'inventaire est normalement affiché en fonction de la taille de l'UI. Cette option permet d'agrandir l'affichage de l'inventaire, mais n'a aucun effet sur la taille des polices permettant d'afficher plus de ligne + L'inventaire est normalement affiché en fonction de la taille de l'UI. Cette option permet d'agrandir l'affichage de l'inventaire, mais n'a aucun effet sur la taille des polices permettant d'afficher plus de lignes. Alaphelyzetben a kezelőfelület mérete skálázza a felszerelési menüt. Ez az opció engedélyezi a menü felskálázását, de megtartja a betűméreteket, így növelve a láthatóságot. Normalmente il menù inventario è scalato in base alle dimensioni interfaccia. Questa opzione di permette di ingrandirlo ulteriormente ma senza aumentare la dimensione del testo. Normalmente o tamanho da tela do inventário é ditada pelo tamanho da UI. Isso permite aumentar o tamanho da tela de inventário, mas não aumenta o tamanho da fonte, permitindo que mais linhas sejam visualizadas. @@ -33,6 +33,7 @@ Zaini Mochilas Sacs à dos + Mochilas Headgear @@ -41,7 +42,8 @@ Hełmy Copricapi Cascos - Equipement de tête + Couvre-chefs + Capacetes Glasses @@ -51,6 +53,7 @@ Occhiali Gafas Lunettes + Óculos Uniforms @@ -60,6 +63,7 @@ Uniformi Uniformes Uniformes + Uniformes Vests @@ -68,7 +72,8 @@ Kamizelki Vests Chalecos - Gilets + Vestes + Coletes Grenades @@ -78,6 +83,7 @@ Granate Granadas Grenades + Granadas Medical @@ -87,6 +93,7 @@ Medico Médico Médical + Médico \ No newline at end of file diff --git a/addons/javelin/CfgEventhandlers.hpp b/addons/javelin/CfgEventhandlers.hpp index 9c0c367ba6..7b76e00d43 100644 --- a/addons/javelin/CfgEventhandlers.hpp +++ b/addons/javelin/CfgEventhandlers.hpp @@ -1,25 +1,25 @@ - -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); - }; -}; - -class Extended_FiredBIS_EventHandlers { - class All { - ADDON = QUOTE(_this call FUNC(onFired)); - }; -}; + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class All { + ADDON = QUOTE(_this call FUNC(onFired)); + }; +}; diff --git a/addons/javelin/CfgSounds.hpp b/addons/javelin/CfgSounds.hpp index a5002409ff..9cd2627fa2 100644 --- a/addons/javelin/CfgSounds.hpp +++ b/addons/javelin/CfgSounds.hpp @@ -1,13 +1,13 @@ - -class CfgSounds { - class ACE_Javelin_Locking { - name = "ACE_Javelin_Locking"; - sound[] = {PATHTOF(data\sounds\javelin_locking.ogg), db+0, 1.0}; - titles[] = {}; - }; - class ACE_Javelin_Locked { - name = "ACE_Javelin_Locked"; - sound[] = {PATHTOF(data\sounds\javelin_locked.ogg), db+0, 1.0}; - titles[] = {}; - }; -}; + +class CfgSounds { + class ACE_Javelin_Locking { + name = "ACE_Javelin_Locking"; + sound[] = {PATHTOF(data\sounds\javelin_locking.ogg), db+0, 1.0}; + titles[] = {}; + }; + class ACE_Javelin_Locked { + name = "ACE_Javelin_Locked"; + sound[] = {PATHTOF(data\sounds\javelin_locked.ogg), db+0, 1.0}; + titles[] = {}; + }; +}; diff --git a/addons/javelin/CfgVehicles.hpp b/addons/javelin/CfgVehicles.hpp index 74863ef08f..a30489ad14 100644 --- a/addons/javelin/CfgVehicles.hpp +++ b/addons/javelin/CfgVehicles.hpp @@ -1,68 +1,68 @@ -class CfgVehicles { - class LandVehicle; - class StaticWeapon : LandVehicle { - class Turrets; - }; - - class StaticMGWeapon : StaticWeapon { - class Turrets : Turrets { - class MainTurret; - }; - }; - class AT_01_base_F: StaticMGWeapon {}; - - class B_static_AT_F: AT_01_base_F { - class Turrets : Turrets { - class MainTurret : MainTurret { - weapons[] = { QGVAR(Titan_Static) }; - magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; - - turretInfoType = "ACE_RscOptics_javelin"; - gunnerOpticsModel = PATHTOF(data\reticle_titan.p3d); - opticsZoomMin = 0.08333; - opticsZoomMax = 0.04167; - opticsZoomInit = 0.08333; - opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; - opticsFlare = 0; - discretefov[] = {0.08333,0.04167}; - discreteInitIndex = 0; - }; - }; - }; - class O_static_AT_F: AT_01_base_F { - class Turrets : Turrets { - class MainTurret : MainTurret { - weapons[] = { QGVAR(Titan_Static) }; - magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; - - turretInfoType = "ACE_RscOptics_javelin"; - gunnerOpticsModel = PATHTOF(data\reticle_titan.p3d); - opticsZoomMin = 0.08333; - opticsZoomMax = 0.04167; - opticsZoomInit = 0.08333; - opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; - opticsFlare = 0; - discretefov[] = {0.08333,0.04167}; - discreteInitIndex = 0; - }; - }; - }; - class I_static_AT_F: AT_01_base_F { - class Turrets : Turrets { - class MainTurret : MainTurret { - weapons[] = { QGVAR(Titan_Static) }; - magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; - - turretInfoType = "ACE_RscOptics_javelin"; - gunnerOpticsModel = PATHTOF(data\reticle_titan.p3d); - opticsZoomMin = 0.08333; - opticsZoomMax = 0.04167; - opticsZoomInit = 0.08333; - opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; - opticsFlare = 0; - discretefov[] = {0.08333,0.04167}; - discreteInitIndex = 0; - }; - }; - }; -}; +class CfgVehicles { + class LandVehicle; + class StaticWeapon : LandVehicle { + class Turrets; + }; + + class StaticMGWeapon : StaticWeapon { + class Turrets : Turrets { + class MainTurret; + }; + }; + class AT_01_base_F: StaticMGWeapon {}; + + class B_static_AT_F: AT_01_base_F { + class Turrets : Turrets { + class MainTurret : MainTurret { + weapons[] = { QGVAR(Titan_Static) }; + magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; + + turretInfoType = "ACE_RscOptics_javelin"; + gunnerOpticsModel = QPATHTOF(data\reticle_titan.p3d); + opticsZoomMin = 0.08333; + opticsZoomMax = 0.04167; + opticsZoomInit = 0.08333; + opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; + opticsFlare = 0; + discretefov[] = {0.08333,0.04167}; + discreteInitIndex = 0; + }; + }; + }; + class O_static_AT_F: AT_01_base_F { + class Turrets : Turrets { + class MainTurret : MainTurret { + weapons[] = { QGVAR(Titan_Static) }; + magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; + + turretInfoType = "ACE_RscOptics_javelin"; + gunnerOpticsModel = QPATHTOF(data\reticle_titan.p3d); + opticsZoomMin = 0.08333; + opticsZoomMax = 0.04167; + opticsZoomInit = 0.08333; + opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; + opticsFlare = 0; + discretefov[] = {0.08333,0.04167}; + discreteInitIndex = 0; + }; + }; + }; + class I_static_AT_F: AT_01_base_F { + class Turrets : Turrets { + class MainTurret : MainTurret { + weapons[] = { QGVAR(Titan_Static) }; + magazines[] = {"1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles","1Rnd_GAT_missiles"}; + + turretInfoType = "ACE_RscOptics_javelin"; + gunnerOpticsModel = QPATHTOF(data\reticle_titan.p3d); + opticsZoomMin = 0.08333; + opticsZoomMax = 0.04167; + opticsZoomInit = 0.08333; + opticsPPEffects[] = {"OpticsCHAbera1","OpticsBlur1"}; + opticsFlare = 0; + discretefov[] = {0.08333,0.04167}; + discreteInitIndex = 0; + }; + }; + }; +}; diff --git a/addons/javelin/CfgWeapons.hpp b/addons/javelin/CfgWeapons.hpp index 1e32752145..868b77c36c 100644 --- a/addons/javelin/CfgWeapons.hpp +++ b/addons/javelin/CfgWeapons.hpp @@ -1,72 +1,72 @@ -class CfgWeapons { - class Launcher; - class MissileLauncher; - - class Launcher_Base_F : Launcher { - class WeaponSlotsInfo; - }; - - // @TODO: AA by default, motherfuckers - class missiles_titan : MissileLauncher { - - }; - - class missiles_titan_at : missiles_titan { }; - class GVAR(Titan_Static) : missiles_titan_at { - GVAR(enabled) = 1; - weaponInfoType = "ACE_RscOptics_javelin"; - modelOptics = PATHTOF(data\reticle_titan.p3d); - - canLock = 0; - magazines[] = {"1Rnd_GAT_missiles"}; - lockingTargetSound[] = {"",0,1}; - lockedTargetSound[] = {"",0,1}; - }; - - // @TODO: AA by default, motherfuckers - class launch_Titan_base : Launcher_Base_F {}; - - class launch_Titan_short_base : launch_Titan_base { }; - - class launch_B_Titan_short_F: launch_Titan_short_base { - GVAR(enabled) = 1; - weaponInfoType = "ACE_RscOptics_javelin"; - modelOptics = PATHTOF(data\reticle_titan.p3d); - - canLock = 0; - - lockingTargetSound[] = {"",0,1}; - lockedTargetSound[] = {"",0,1}; - }; - class launch_I_Titan_short_F: launch_Titan_short_base { - GVAR(enabled) = 1; - weaponInfoType = "ACE_RscOptics_javelin"; - modelOptics = PATHTOF(data\reticle_titan.p3d); - - canLock = 0; - - lockingTargetSound[] = {"",0,1}; - lockedTargetSound[] = {"",0,1}; - }; - class launch_O_Titan_short_F: launch_Titan_short_base { - GVAR(enabled) = 1; - weaponInfoType = "ACE_RscOptics_javelin"; - modelOptics = PATHTOF(data\reticle_titan.p3d); - - canLock = 0; - - - lockingTargetSound[] = {"",0,1}; - lockedTargetSound[] = {"",0,1}; - }; - class launch_Titan_short_F: launch_Titan_short_base { - GVAR(enabled) = 1; - weaponInfoType = "ACE_RscOptics_javelin"; - modelOptics = PATHTOF(data\reticle_titan.p3d); - - canLock = 0; - - lockingTargetSound[] = {"",0,1}; - lockedTargetSound[] = {"",0,1}; - }; -}; +class CfgWeapons { + class Launcher; + class MissileLauncher; + + class Launcher_Base_F : Launcher { + class WeaponSlotsInfo; + }; + + // @TODO: AA by default, motherfuckers + class missiles_titan : MissileLauncher { + + }; + + class missiles_titan_at : missiles_titan { }; + class GVAR(Titan_Static) : missiles_titan_at { + GVAR(enabled) = 1; + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = QPATHTOF(data\reticle_titan.p3d); + + canLock = 0; + magazines[] = {"1Rnd_GAT_missiles"}; + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; + + // @TODO: AA by default, motherfuckers + class launch_Titan_base : Launcher_Base_F {}; + + class launch_Titan_short_base : launch_Titan_base { }; + + class launch_B_Titan_short_F: launch_Titan_short_base { + GVAR(enabled) = 1; + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = QPATHTOF(data\reticle_titan.p3d); + + canLock = 0; + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; + class launch_I_Titan_short_F: launch_Titan_short_base { + GVAR(enabled) = 1; + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = QPATHTOF(data\reticle_titan.p3d); + + canLock = 0; + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; + class launch_O_Titan_short_F: launch_Titan_short_base { + GVAR(enabled) = 1; + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = QPATHTOF(data\reticle_titan.p3d); + + canLock = 0; + + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; + class launch_Titan_short_F: launch_Titan_short_base { + GVAR(enabled) = 1; + weaponInfoType = "ACE_RscOptics_javelin"; + modelOptics = QPATHTOF(data\reticle_titan.p3d); + + canLock = 0; + + lockingTargetSound[] = {"",0,1}; + lockedTargetSound[] = {"",0,1}; + }; +}; diff --git a/addons/javelin/RscInGameUI.hpp b/addons/javelin/RscInGameUI.hpp index d3fff71db0..d780a4749f 100644 --- a/addons/javelin/RscInGameUI.hpp +++ b/addons/javelin/RscInGameUI.hpp @@ -1,454 +1,454 @@ -class RscOpticsValue; -class RscControlsGroup; -class RscPicture; -class RscMapControl; -class VScrollbar; -class HScrollbar; -class RscLine; - - -// Taken from AGM for optics management. - -class RscInGameUI { - class ACE_RscOptics_javelin { - idd = 300; - controls[] = { "ACE_javelin_elements_group", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; - onLoad = QUOTE(_this call FUNC(onOpticLoad)); - onUnload = QUOTE(_this call FUNC(onOpticUnload)); - - class ACE_javelin_elements_group: RscControlsGroup - { - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW"; - h = "SafezoneH"; - idc = 170; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class CA_Distance: RscOpticsValue { - idc = 151; - sizeEx = "0"; - colorText[] = {0,0,0,0}; - x = 0; - y = 0; - w = 0; - h = 0; - }; - - class ACE_javelin_Day_mode_off: RscPicture { - idc = 1001; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.03/4)*3*SafezoneH - SafezoneX"; - y = "SafezoneY+SafezoneH*0.031 - SafezoneY"; - w = "0.1045752* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; - h = "SafezoneH*0.1045752"; - colorText[] = {0.2941,0.2941,0.2941,1}; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\day_co.paa"; - }; - class ACE_javelin_Day_mode: ACE_javelin_Day_mode_off { - idc = 160; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class CA_Javelin_WFOV_mode_off : ACE_javelin_Day_mode_off { - idc = 1004; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\wfov_co.paa"; - }; - class ACE_javelin_WFOV_mode_group: RscControlsGroup { - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW"; - h = "SafezoneH"; - idc = 163; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class StadiaL: RscLine { - x = "0.4899*SafezoneW - SafezoneX"; - y = "0.171*SafezoneH - SafezoneY"; - w = 0; - h = "0.049*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class StadiaR: RscLine { - x = "0.5109*SafezoneW- SafezoneX"; - y = "0.171*SafezoneH - SafezoneY"; - w = 0; - h = "0.049*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class BracketL: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.293/4)*3*SafezoneH - SafezoneX"; - y = "0.4677*SafezoneH - SafezoneY"; - w = 0; - h = "0.0646*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class BracketR: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.70/4)*3*SafezoneH - SafezoneX"; - y = "0.4677*SafezoneH - SafezoneY"; - w = 0; - h = "0.0646*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class BracketT: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX"; - y = "0.3535*SafezoneH - SafezoneY"; - w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; - h = 0; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class BracketB: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX"; - y = "0.6465*SafezoneH - SafezoneY"; - w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; - h = 0; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - - }; - }; - class CA_Javelin_NFOV_mode_off: ACE_javelin_Day_mode_off { - idc = 1003; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.586/4)*3*SafezoneH - SafezoneX"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\nfov_co.paa"; - }; - class ACE_javelin_NFOV_mode_group: RscControlsGroup { - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; - idc = 162; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class StadiaL: RscLine { - x = "0.4788*SafezoneW - SafezoneX"; - y = "0.171*SafezoneH - SafezoneY"; - w = 0; - h = "0.049*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class StadiaR: RscLine { - x = "0.5212*SafezoneW - SafezoneX"; - y = "0.171*SafezoneH - SafezoneY"; - w = 0; - h = "0.049*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class LineHL: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.01/4)*3*SafezoneH - SafezoneX"; - y = "SafezoneH*0.5 - SafezoneY"; - w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; - h = "SafezoneH*0.0"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class LineHR: RscLine { - x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.695/4)*3*SafezoneH - SafezoneX"; - y = "SafezoneH*0.5 - SafezoneY"; - w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; - h = "SafezoneH*0.0"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class LineVT: RscLine { - x = "0.5*SafezoneW - SafezoneX"; - y = "0.171*SafezoneH - SafezoneY"; - w = 0; - h = "0.1825*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class LineVB: RscLine { - x = "0.5*SafezoneW - SafezoneX"; - y = "0.6465*SafezoneH - SafezoneY"; - w = 0; - h = "0.1895*SafezoneH"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - - }; - }; - - class ACE_javelin_SEEK_off: ACE_javelin_Day_mode_off { - idc = 699000; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\seek_co.paa"; - }; - class ACE_javelin_SEEK: ACE_javelin_SEEK_off { - idc = 166; - colorText[] = {0.2941,0.8745,0.2157,0}; - }; - class ACE_javelin_Missle_off: ACE_javelin_Day_mode_off { - idc = 1032; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX"; - y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY"; - colorText[] = {0.2941,0.2941,0.2941,1}; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\missle_co.paa"; - }; - class ACE_javelin_Missle: ACE_javelin_Missle_off { - idc = 167; - colorText[] = {0.9255,0.5216,0.1216,0}; - }; - class ACE_javelin_CLU_off: ACE_javelin_Missle_off { - idc = 1027; - y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa"; - }; - class ACE_javelin_HangFire_off: ACE_javelin_Missle_off { - idc = 1028; - y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa"; - }; - class ACE_javelin_TOP_off: ACE_javelin_Day_mode_off { - idc = 699001; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; - y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\top_co.paa"; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - class ACE_javelin_DIR: ACE_javelin_Day_mode { - idc = 699002; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; - y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\dir_co.paa"; - colorText[] = {0.2941,0.2941,0.2941,1}; - }; - class ACE_javelin_FLTR_mode_off: ACE_javelin_Day_mode_off { - idc = 1002; - x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; - y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\fltr_co.paa"; - }; - class ACE_javelin_FLTR_mode: ACE_javelin_FLTR_mode_off { - idc = 161; - colorText[] = {0.2941,0.8745,0.2157,1}; - }; - }; - }; - class ACE_Targeting : RscControlsGroup { - idc = 6999; - - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW"; - h = "SafezoneH"; - - enabled = 0; - class Controls { - class ACE_TargetingConstrains: RscControlsGroup { - x = "SafezoneX"; - y = "SafezoneY"; - w = "SafezoneW-SafezoneX"; - h = "SafezoneH-SafezoneY"; - - enabled = 0; - class VScrollbar { - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - color[] = {1,1,1,0}; - width = 0.001; - }; - class HScrollbar { - color[] = {1,1,1,0}; - height = 0.001; - }; - class Controls { - class Top: RscPicture { - idc = 699101; - text = "#(argb,8,8,3)color(1,1,1,1)"; - colorText[] = {0.2941,0.2941,0.2941,1}; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0.21*SafezoneH"; - }; - class Bottom: Top { - idc = 699102; - y = "0.64*SafezoneH-SafezoneY"; - }; - class Left: Top { - idc = 699103; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.36*SafezoneH-SafezoneY"; - w = "0.31*(3/4)*SafezoneH"; - h = "0.28*SafezoneH"; - }; - class Right: Left { - idc = 699104; - x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; - }; - class OpticsBorders: RscPicture { - idc = 699105; - text = PATHTOF(data\javelin_ui_border_ca.paa); - colorText[] = {0,0,0,1}; - x = "((SafezoneW -(3.1/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH-SafezoneY"; - w = "(3.1/4)*SafezoneH"; - h = "0.7*SafezoneH"; - }; - }; - }; - - class ACE_TargetingGate : ACE_TargetingConstrains { - idc = 699200; - class Controls { - class TargetingGateTL: ACE_TargetingConstrains { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699201; - class Controls { - class LineH: RscLine { - idc = 699210; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699211; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateTR: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.15*SafezoneH - SafezoneY"; - idc = 699202; - class Controls { - class LineH: RscLine { - idc = 699220; - x = "0"; - y = "0"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - idc = 699221; - x = "0.025*(3/4)*SafezoneH"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBL: TargetingGateTL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699203; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - class TargetingGateBR: TargetingGateBL { - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; - y = "0.825*SafezoneH - SafezoneY"; - idc = 699204; - class Controls { - class LineH: RscLine { - x = "0"; - y = "0.025*SafezoneH"; - w = "0.025*(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: LineH { - x = "0.025*(3/4)*SafezoneH"; - y = "0"; - w = "0"; - h = "0.025*SafezoneH"; - }; - }; - }; - }; - }; - - - class ACE_TargetingLines: ACE_TargetingConstrains { - idc = 699300; - class Controls { - class LineH: RscLine { - idc = 699301; - x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; - y = "0.5*SafezoneH - SafezoneY"; - w = "(3/4)*SafezoneH"; - h = "0"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - class LineV: RscLine { - idc = 699302; - x = "0.5*SafezoneW - SafezoneX"; - y = "0.15*SafezoneH - SafezoneY"; - w = "0"; - h = "0.7*SafezoneH"; - colorText[] = {0.8745,0.8745,0.8745,1}; - }; - }; - }; - }; - }; - }; -}; - -// on colorText[] = {0.2941, 0.8745, 0.2157, 1.0}; -// off colorText[] = {0.2941, 0.2941, 0.2941, 1.0}; -// orange colorText[] = {0.9255, 0.5216, 0.1216, 1.0}; - -/* -ACE_Titan_elements_group: 170 -ACE_Titan_Day_mode_off: 1001 -ACE_Titan_Day_mode: 160 -ACE_Titan_WFOV_mode_off: 1004 -ACE_Titan_WFOV_mode_group: 163 -ACE_Titan_NFOV_mode_off: 1003 -ACE_Titan_NFOV_mode_group: 162 -ACE_Titan_SEEK_off: 1005 //1001 -ACE_Titan_SEEK: 166 -ACE_Titan_Missle_off: 1032 -ACE_Titan_Missle: 167 -ACE_Titan_CLU_off: 1027 -ACE_Titan_HangFire_off: 1028 -ACE_Titan_TOP_off: 1006 -ACE_Titan_DIR: 1007 -ACE_Titan_FLTR_mode_off: 1002 -ACE_Titan_FLTR_mode: 161 -*/ +class RscOpticsValue; +class RscControlsGroup; +class RscPicture; +class RscMapControl; +class VScrollbar; +class HScrollbar; +class RscLine; + + +// Taken from AGM for optics management. + +class RscInGameUI { + class ACE_RscOptics_javelin { + idd = 300; + controls[] = { "ACE_javelin_elements_group", "ACE_Targeting" }; //, "ACE_TargetingConstrains", "ACE_TargetingGate", "ACE_TargetingLines"}; + onLoad = QUOTE(_this call FUNC(onOpticLoad)); + onUnload = QUOTE(_this call FUNC(onOpticUnload)); + + class ACE_javelin_elements_group: RscControlsGroup + { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW"; + h = "SafezoneH"; + idc = 170; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class CA_Distance: RscOpticsValue { + idc = 151; + sizeEx = "0"; + colorText[] = {0,0,0,0}; + x = 0; + y = 0; + w = 0; + h = 0; + }; + + class ACE_javelin_Day_mode_off: RscPicture { + idc = 1001; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.03/4)*3*SafezoneH - SafezoneX"; + y = "SafezoneY+SafezoneH*0.031 - SafezoneY"; + w = "0.1045752* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; + h = "SafezoneH*0.1045752"; + colorText[] = {0.2941,0.2941,0.2941,1}; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\day_co.paa"; + }; + class ACE_javelin_Day_mode: ACE_javelin_Day_mode_off { + idc = 160; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class CA_Javelin_WFOV_mode_off : ACE_javelin_Day_mode_off { + idc = 1004; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.307/4)*3*SafezoneH - SafezoneX"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\wfov_co.paa"; + }; + class ACE_javelin_WFOV_mode_group: RscControlsGroup { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW"; + h = "SafezoneH"; + idc = 163; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class StadiaL: RscLine { + x = "0.4899*SafezoneW - SafezoneX"; + y = "0.171*SafezoneH - SafezoneY"; + w = 0; + h = "0.049*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class StadiaR: RscLine { + x = "0.5109*SafezoneW- SafezoneX"; + y = "0.171*SafezoneH - SafezoneY"; + w = 0; + h = "0.049*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class BracketL: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.293/4)*3*SafezoneH - SafezoneX"; + y = "0.4677*SafezoneH - SafezoneY"; + w = 0; + h = "0.0646*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class BracketR: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.70/4)*3*SafezoneH - SafezoneX"; + y = "0.4677*SafezoneH - SafezoneY"; + w = 0; + h = "0.0646*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class BracketT: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX"; + y = "0.3535*SafezoneH - SafezoneY"; + w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; + h = 0; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class BracketB: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.467/4)*3*SafezoneH - SafezoneX"; + y = "0.6465*SafezoneH - SafezoneY"; + w = "0.065* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; + h = 0; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + + }; + }; + class CA_Javelin_NFOV_mode_off: ACE_javelin_Day_mode_off { + idc = 1003; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.586/4)*3*SafezoneH - SafezoneX"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\nfov_co.paa"; + }; + class ACE_javelin_NFOV_mode_group: RscControlsGroup { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; + idc = 162; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class StadiaL: RscLine { + x = "0.4788*SafezoneW - SafezoneX"; + y = "0.171*SafezoneH - SafezoneY"; + w = 0; + h = "0.049*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class StadiaR: RscLine { + x = "0.5212*SafezoneW - SafezoneX"; + y = "0.171*SafezoneH - SafezoneY"; + w = 0; + h = "0.049*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class LineHL: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.01/4)*3*SafezoneH - SafezoneX"; + y = "SafezoneH*0.5 - SafezoneY"; + w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; + h = "SafezoneH*0.0"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class LineHR: RscLine { + x = "((SafezoneW -SafezoneH*3/4)/2)+ (0.695/4)*3*SafezoneH - SafezoneX"; + y = "SafezoneH*0.5 - SafezoneY"; + w = "0.29* (((SafezoneW*3)/4)/SafezoneW)/(1/SafezoneH)"; + h = "SafezoneH*0.0"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class LineVT: RscLine { + x = "0.5*SafezoneW - SafezoneX"; + y = "0.171*SafezoneH - SafezoneY"; + w = 0; + h = "0.1825*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class LineVB: RscLine { + x = "0.5*SafezoneW - SafezoneX"; + y = "0.6465*SafezoneH - SafezoneY"; + w = 0; + h = "0.1895*SafezoneH"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + + }; + }; + + class ACE_javelin_SEEK_off: ACE_javelin_Day_mode_off { + idc = 699000; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (0.863/4)*3*SafezoneH - SafezoneX"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\seek_co.paa"; + }; + class ACE_javelin_SEEK: ACE_javelin_SEEK_off { + idc = 166; + colorText[] = {0.2941,0.8745,0.2157,0}; + }; + class ACE_javelin_Missle_off: ACE_javelin_Day_mode_off { + idc = 1032; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (-0.134/4)*3*SafezoneH - SafezoneX"; + y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY"; + colorText[] = {0.2941,0.2941,0.2941,1}; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\missle_co.paa"; + }; + class ACE_javelin_Missle: ACE_javelin_Missle_off { + idc = 167; + colorText[] = {0.9255,0.5216,0.1216,0}; + }; + class ACE_javelin_CLU_off: ACE_javelin_Missle_off { + idc = 1027; + y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\clu_co.paa"; + }; + class ACE_javelin_HangFire_off: ACE_javelin_Missle_off { + idc = 1028; + y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\hangfire_co.paa"; + }; + class ACE_javelin_TOP_off: ACE_javelin_Day_mode_off { + idc = 699001; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; + y = "(SafezoneY + 0.208*SafezoneH) - SafezoneY"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\top_co.paa"; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + class ACE_javelin_DIR: ACE_javelin_Day_mode { + idc = 699002; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; + y = "(SafezoneY + 0.436*SafezoneH) - SafezoneY"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\dir_co.paa"; + colorText[] = {0.2941,0.2941,0.2941,1}; + }; + class ACE_javelin_FLTR_mode_off: ACE_javelin_Day_mode_off { + idc = 1002; + x = "(SafezoneX+(SafezoneW -SafezoneH*3/4)/2)+ (1.023/4)*3*SafezoneH - SafezoneX"; + y = "(SafezoneY + 0.669*SafezoneH) - SafezoneY"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics_titan\fltr_co.paa"; + }; + class ACE_javelin_FLTR_mode: ACE_javelin_FLTR_mode_off { + idc = 161; + colorText[] = {0.2941,0.8745,0.2157,1}; + }; + }; + }; + class ACE_Targeting : RscControlsGroup { + idc = 6999; + + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW"; + h = "SafezoneH"; + + enabled = 0; + class Controls { + class ACE_TargetingConstrains: RscControlsGroup { + x = "SafezoneX"; + y = "SafezoneY"; + w = "SafezoneW-SafezoneX"; + h = "SafezoneH-SafezoneY"; + + enabled = 0; + class VScrollbar { + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + color[] = {1,1,1,0}; + width = 0.001; + }; + class HScrollbar { + color[] = {1,1,1,0}; + height = 0.001; + }; + class Controls { + class Top: RscPicture { + idc = 699101; + text = "#(argb,8,8,3)color(1,1,1,1)"; + colorText[] = {0.2941,0.2941,0.2941,1}; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0.21*SafezoneH"; + }; + class Bottom: Top { + idc = 699102; + y = "0.64*SafezoneH-SafezoneY"; + }; + class Left: Top { + idc = 699103; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.36*SafezoneH-SafezoneY"; + w = "0.31*(3/4)*SafezoneH"; + h = "0.28*SafezoneH"; + }; + class Right: Left { + idc = 699104; + x = "((SafezoneW -(3/4)*SafezoneH)/2)+ 0.69*(3/4)*SafezoneH - SafezoneX"; + }; + class OpticsBorders: RscPicture { + idc = 699105; + text = QPATHTOF(data\javelin_ui_border_ca.paa); + colorText[] = {0,0,0,1}; + x = "((SafezoneW -(3.1/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH-SafezoneY"; + w = "(3.1/4)*SafezoneH"; + h = "0.7*SafezoneH"; + }; + }; + }; + + class ACE_TargetingGate : ACE_TargetingConstrains { + idc = 699200; + class Controls { + class TargetingGateTL: ACE_TargetingConstrains { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699201; + class Controls { + class LineH: RscLine { + idc = 699210; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699211; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateTR: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.15*SafezoneH - SafezoneY"; + idc = 699202; + class Controls { + class LineH: RscLine { + idc = 699220; + x = "0"; + y = "0"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + idc = 699221; + x = "0.025*(3/4)*SafezoneH"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBL: TargetingGateTL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699203; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + class TargetingGateBR: TargetingGateBL { + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX + 0.975*(3/4)*SafezoneH"; + y = "0.825*SafezoneH - SafezoneY"; + idc = 699204; + class Controls { + class LineH: RscLine { + x = "0"; + y = "0.025*SafezoneH"; + w = "0.025*(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: LineH { + x = "0.025*(3/4)*SafezoneH"; + y = "0"; + w = "0"; + h = "0.025*SafezoneH"; + }; + }; + }; + }; + }; + + + class ACE_TargetingLines: ACE_TargetingConstrains { + idc = 699300; + class Controls { + class LineH: RscLine { + idc = 699301; + x = "((SafezoneW -(3/4)*SafezoneH)/2) - SafezoneX"; + y = "0.5*SafezoneH - SafezoneY"; + w = "(3/4)*SafezoneH"; + h = "0"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + class LineV: RscLine { + idc = 699302; + x = "0.5*SafezoneW - SafezoneX"; + y = "0.15*SafezoneH - SafezoneY"; + w = "0"; + h = "0.7*SafezoneH"; + colorText[] = {0.8745,0.8745,0.8745,1}; + }; + }; + }; + }; + }; + }; +}; + +// on colorText[] = {0.2941, 0.8745, 0.2157, 1.0}; +// off colorText[] = {0.2941, 0.2941, 0.2941, 1.0}; +// orange colorText[] = {0.9255, 0.5216, 0.1216, 1.0}; + +/* +ACE_Titan_elements_group: 170 +ACE_Titan_Day_mode_off: 1001 +ACE_Titan_Day_mode: 160 +ACE_Titan_WFOV_mode_off: 1004 +ACE_Titan_WFOV_mode_group: 163 +ACE_Titan_NFOV_mode_off: 1003 +ACE_Titan_NFOV_mode_group: 162 +ACE_Titan_SEEK_off: 1005 //1001 +ACE_Titan_SEEK: 166 +ACE_Titan_Missle_off: 1032 +ACE_Titan_Missle: 167 +ACE_Titan_CLU_off: 1027 +ACE_Titan_HangFire_off: 1028 +ACE_Titan_TOP_off: 1006 +ACE_Titan_DIR: 1007 +ACE_Titan_FLTR_mode_off: 1002 +ACE_Titan_FLTR_mode: 161 +*/ diff --git a/addons/javelin/XEH_clientInit.sqf b/addons/javelin/XEH_clientInit.sqf index 38b006ca24..1286be3697 100644 --- a/addons/javelin/XEH_clientInit.sqf +++ b/addons/javelin/XEH_clientInit.sqf @@ -1,5 +1,5 @@ -#include "script_component.hpp" - -if (!hasInterface) exitWith {}; - +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + #include "initKeybinds.sqf" \ No newline at end of file diff --git a/addons/javelin/XEH_post_init.sqf b/addons/javelin/XEH_post_init.sqf index dc30361926..6eccf9d1dd 100644 --- a/addons/javelin/XEH_post_init.sqf +++ b/addons/javelin/XEH_post_init.sqf @@ -1,2 +1,2 @@ -#include "script_component.hpp" - +#include "script_component.hpp" + diff --git a/addons/javelin/XEH_pre_init.sqf b/addons/javelin/XEH_pre_init.sqf index 045e4a46aa..b092e92359 100644 --- a/addons/javelin/XEH_pre_init.sqf +++ b/addons/javelin/XEH_pre_init.sqf @@ -1,10 +1,10 @@ -#include "script_component.hpp" - -ADDON = false; - -#include "XEH_PREP.hpp" - -GVAR(isLockKeyDown) = false; -GVAR(pfehID) = -1; - -ADDON = true; +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +GVAR(isLockKeyDown) = false; +GVAR(pfehID) = -1; + +ADDON = true; diff --git a/addons/javelin/config.cpp b/addons/javelin/config.cpp index 8dfc970902..92f2f2d969 100644 --- a/addons/javelin/config.cpp +++ b/addons/javelin/config.cpp @@ -1,18 +1,21 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_common", "ace_missileguidance" }; - VERSION_CONFIG; - }; -}; - -#include "CfgEventhandlers.hpp" -#include "RscInGameUI.hpp" -#include "CfgSounds.hpp" -#include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" -#include "CfgMagazines.hpp" +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_main", "ace_common", "ace_missileguidance"}; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventhandlers.hpp" +#include "RscInGameUI.hpp" +#include "CfgSounds.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" +#include "CfgMagazines.hpp" diff --git a/addons/javelin/functions/fnc_cycleFireMode.sqf b/addons/javelin/functions/fnc_cycleFireMode.sqf index 2245bb71e5..d14c0cdee5 100644 --- a/addons/javelin/functions/fnc_cycleFireMode.sqf +++ b/addons/javelin/functions/fnc_cycleFireMode.sqf @@ -1,13 +1,13 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -private["_player", "_currentFireMode"]; - -_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "JAV_TOP"]; -if(_currentFireMode == "JAV_DIR") then { - _currentFireMode = "JAV_TOP"; -} else { - _currentFireMode = "JAV_DIR"; -}; -ACE_player setVariable["ace_missileguidance_attackProfile", _currentFireMode, false]; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +private["_player", "_currentFireMode"]; + +_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "JAV_TOP"]; +if(_currentFireMode == "JAV_DIR") then { + _currentFireMode = "JAV_TOP"; +} else { + _currentFireMode = "JAV_DIR"; +}; +ACE_player setVariable["ace_missileguidance_attackProfile", _currentFireMode, false]; diff --git a/addons/javelin/functions/fnc_lockKeyDown.sqf b/addons/javelin/functions/fnc_lockKeyDown.sqf index 2a537e2ae9..3eabbd9c28 100644 --- a/addons/javelin/functions/fnc_lockKeyDown.sqf +++ b/addons/javelin/functions/fnc_lockKeyDown.sqf @@ -1,3 +1,3 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" +//#define DEBUG_MODE_FULL +#include "script_component.hpp" TRACE_1("enter", _this); \ No newline at end of file diff --git a/addons/javelin/functions/fnc_lockKeyUp.sqf b/addons/javelin/functions/fnc_lockKeyUp.sqf index 2a537e2ae9..3eabbd9c28 100644 --- a/addons/javelin/functions/fnc_lockKeyUp.sqf +++ b/addons/javelin/functions/fnc_lockKeyUp.sqf @@ -1,3 +1,3 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" +//#define DEBUG_MODE_FULL +#include "script_component.hpp" TRACE_1("enter", _this); \ No newline at end of file diff --git a/addons/javelin/functions/fnc_onFired.sqf b/addons/javelin/functions/fnc_onFired.sqf index fce170fde9..9cc8b95ad4 100644 --- a/addons/javelin/functions/fnc_onFired.sqf +++ b/addons/javelin/functions/fnc_onFired.sqf @@ -1,17 +1,17 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -PARAMS_2(_shooter,_weapon); - -// Bail on not missile or javelin PFEH not running -if ((_shooter != ACE_player) || {(GVAR(pfehID) == -1)}) exitWith { false }; - -private ["_configs"]; - -_configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; -if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith {}; - -__JavelinIGUITargeting ctrlShow false; -__JavelinIGUITargetingGate ctrlShow false; -__JavelinIGUITargetingLines ctrlShow false; -__JavelinIGUITargetingConstraints ctrlShow false; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +PARAMS_2(_shooter,_weapon); + +// Bail on not missile or javelin PFEH not running +if ((_shooter != ACE_player) || {(GVAR(pfehID) == -1)}) exitWith { false }; + +private ["_configs"]; + +_configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; +if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith {}; + +__JavelinIGUITargeting ctrlShow false; +__JavelinIGUITargetingGate ctrlShow false; +__JavelinIGUITargetingLines ctrlShow false; +__JavelinIGUITargetingConstraints ctrlShow false; diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 67e337291b..20606dc4dd 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -1,313 +1,313 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -#define __TRACKINTERVAL 0 // how frequent the check should be. -#define __LOCKONTIME 3 // Lock on won't occur sooner - -private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"]; -private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"]; -private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"]; -private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"]; -private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"]; - -_currentShooter = (vehicle ACE_player); - -#define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5 -#define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 - -// Reset arguments if we havnt rendered in over a second -_args = uiNamespace getVariable[QGVAR(arguments), [] ]; -if( (count _args) > 0) then { - _lastTick = _args select 0; - if(ACE_diagTime - _lastTick > 1) then { - [] call FUNC(onOpticLoad); - }; -}; - -TRACE_1("Running", "Running"); - -// Pull the arguments -_currentTarget = _args select 1; -_runTime = _args select 2; -_lockTime = _args select 3; -_soundTime = _args select 4; -_randomLockInterval = _args select 5; -_fireDisabledEH = _args select 6; - -private["_ammo", "_magazineConfig", "_weaponConfig"]; -_weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; -_magazineConfig = if ((currentMagazine _currentShooter) != "") then { - _ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo"); - configProperties [(configFile >> "CfgAmmo" >> _ammo), "(configName _x) == 'ace_missileguidance'", false]; -} else { - [] -}; - -//If weapon does not have "javelin enabled", then exit PFEH -if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1}) exitWith { - __JavelinIGUITargeting ctrlShow false; - __JavelinIGUITargetingGate ctrlShow false; - __JavelinIGUITargetingLines ctrlShow false; - __JavelinIGUITargetingConstraints ctrlShow false; - - if(!isNil "_fireDisabledEH") then { - _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); - }; - - [(_this select 1)] call CBA_fnc_removePerFrameHandler; - GVAR(pfehID) = -1; -}; - -// Find a target within the optic range -_newTarget = objNull; - -// Bail on fast movement -if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. - ACE_player switchCamera "INTERNAL"; - if (player != ACE_player) then { - TRACE_2("Zeus, manually reseting RC after switchCamera",player,ACE_player); - player remoteControl ACE_player; - }; -}; - -// Refresh the firemode -[] call FUNC(showFireMode); - -_ammo = _currentShooter ammo (currentWeapon _currentShooter); -// not loaded or not "javelin enabled" for magazine, hide targeting and enable firing -if ((_ammo == 0) || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith { - __JavelinIGUITargeting ctrlShow false; - __JavelinIGUITargetingGate ctrlShow false; - __JavelinIGUITargetingLines ctrlShow false; - __JavelinIGUITargetingConstraints ctrlShow false; - - if(!isNil "_fireDisabledEH") then { - _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); - }; -}; - -_range = parseNumber (ctrlText __JavelinIGUIRangefinder); -TRACE_1("Viewing range", _range); -if (_range > 50 && {_range < 2500}) then { - _pos = positionCameraToWorld [0,0,_range]; - _targetArray = _pos nearEntities ["AllVehicles", _range/100]; - TRACE_1("Searching at range", _targetArray); - if (count (_targetArray) > 0) then { - _newTarget = _targetArray select 0; - }; -}; - -if ((isNull _newTarget) && {cursorObject isKindOf "AllVehicles"}) then { - private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorObject, ace_player, cursorObject, true, 1]; - if (_intersectionsToCursorTarget isEqualTo []) then { - _newTarget = cursorObject; - }; -}; -if ((isNull _newTarget) && {cursorTarget isKindOf "AllVehicles"}) then { - private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1]; - if (_intersectionsToCursorTarget isEqualTo []) then { - _newTarget = cursorTarget; - }; -}; - -// Create constants -_constraintTop = __ConstraintTop; -_constraintLeft = __ConstraintLeft; -_constraintBottom = __ConstraintBottom; -_constraintRight = __ConstraintRight; - -_offsetX = __OffsetX; -_offsetY = __OffsetY; - -__JavelinIGUITargeting ctrlShow true; -__JavelinIGUITargetingConstrains ctrlShow true; - -_zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"}; -_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)]; - -_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds); - -_aposX = 0; -_aposY = 0; -if (count _apos < 2) then { - _aposX = 1; - _aposY = 0; -} else { - _aposX = (_apos select 0) + _offsetX; - _aposY = (_apos select 1) + _offsetY; -}; - -if((call CBA_fnc_getFoV) select 1 > 9) then { - __JavelinIGUINFOV ctrlSetTextColor __ColorGreen; - __JavelinIGUIWFOV ctrlSetTextColor __ColorGray; -} else { - __JavelinIGUINFOV ctrlSetTextColor __ColorGray; - __JavelinIGUIWFOV ctrlSetTextColor __ColorGreen; -}; - -FUNC(disableFire) = { - _firedEH = _this select 0; - - if(_firedEH < 0 && difficulty > 0) then { - _firedEH = [ACE_player, "DefaultAction", {true}, { - _canFire = (_this select 1) getVariable["ace_missileguidance_target", nil]; - if(!isNil "_canFire") exitWith { false }; - true - }] call EFUNC(common,addActionEventHandler); - }; - _firedEH -}; -FUNC(enableFire) = { - _firedEH = _this select 0; - - if(_firedEH > 0 && difficulty > 0) then { - [ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler); - }; - -1 -}; - -if (isNull _newTarget) then { - // No targets found - _currentTarget = objNull; - _lockTime = 0; - - __JavelinIGUISeek ctrlSetTextColor __ColorGray; - __JavelinIGUITargeting ctrlShow false; - __JavelinIGUITargetingGate ctrlShow false; - __JavelinIGUITargetingLines ctrlShow false; - __JavelinIGUITargetingConstraints ctrlShow false; - - _currentShooter setVariable ["ace_missileguidance_target",nil, false]; - - // Disallow fire - _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); -} else { - _fov = [] call CBA_fnc_getFoV; - TRACE_1("FOV", _fov); - if (_newTarget distance ACE_player < 2500 - && {(call CBA_fnc_getFoV) select 1 > 9} - && { (currentVisionMode ACE_player == 2)} - && GVAR(isLockKeyDown) - ) then { - // Lock on after 3 seconds - if(_currentTarget != _newTarget) then { - TRACE_1("New Target, reseting locking", _newTarget); - _lockTime = ACE_diagTime; - _currentTarget = _newTarget; - - playSound "ACE_Javelin_Locking"; - } else { - if(ACE_diagTime - _lockTime > __LOCKONTIME + _randomLockInterval) then { - TRACE_2("LOCKED!", _currentTarget, _lockTime); - - __JavelinIGUISeek ctrlSetTextColor __ColorGreen; - - __JavelinIGUITargeting ctrlShow true; - __JavelinIGUITargetingConstrains ctrlShow false; - __JavelinIGUITargetingGate ctrlShow true; - __JavelinIGUITargetingLines ctrlShow true; - - // Move target marker to coords. - //__JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1]; - //__JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY]; - //{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV]; - - _boundsInput = if (_currentTarget isKindOf "CAManBase") then { - [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; - } else { - [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"]; - }; - - _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); - - _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; - _minY = ((_bpos select 1) + _offsetY) max _constraintTop; - _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); - _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); - - TRACE_4("", _boundsInput, _bpos, _minX, _minY); - - __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; - __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; - __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; - __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; - - {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; - - _currentShooter setVariable["ace_missileguidance_target", _currentTarget, false]; - - // Allow fire - _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); - - if(ACE_diagTime > _soundTime) then { - playSound "ACE_Javelin_Locked"; - _soundTime = ACE_diagTime + 0.25; - }; - } else { - __JavelinIGUITargeting ctrlShow true; - __JavelinIGUITargetingGate ctrlShow true; - __JavelinIGUITargetingConstrains ctrlShow true; - __JavelinIGUITargetingLines ctrlShow false; - - _currentShooter setVariable["ace_missileguidance_target", nil, false]; - - _boundsInput = if (_currentTarget isKindOf "CAManBase") then { - [_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; - } else { - [_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"]; - }; - - _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); - - _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; - _minY = ((_bpos select 1) + _offsetY) max _constraintTop; - _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); - _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); - - TRACE_4("", _boundsInput, _bpos, _minX, _minY); - - __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; - __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; - __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; - __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; - - {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; - - if(ACE_diagTime > _soundTime) then { - playSound "ACE_Javelin_Locking"; - _soundTime = ACE_diagTime + 0.25; - }; - // Disallow fire - _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); - }; - }; - } else { - // No targets found - _currentTarget = objNull; - _lockTime = 0; - - __JavelinIGUISeek ctrlSetTextColor __ColorGray; - __JavelinIGUITargeting ctrlShow false; - __JavelinIGUITargetingGate ctrlShow false; - __JavelinIGUITargetingLines ctrlShow false; - __JavelinIGUITargetingConstraints ctrlShow false; - - _currentShooter setVariable ["ace_missileguidance_target",nil, false]; - - // Disallow fire - _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); - }; -}; - -//TRACE_2("", _newTarget, _currentTarget); - -// Save arguments for next run -_args set[0, ACE_diagTime]; -_args set[1, _currentTarget]; -_args set[2, _runTime]; -_args set[3, _lockTime]; -_args set[4, _soundTime]; -_args set[6, _fireDisabledEH]; - -uiNamespace setVariable[QGVAR(arguments), _args ]; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +#define __TRACKINTERVAL 0 // how frequent the check should be. +#define __LOCKONTIME 3 // Lock on won't occur sooner + +private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"]; +private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"]; +private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"]; +private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"]; +private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"]; + +_currentShooter = (vehicle ACE_player); + +#define __OffsetX ((ctrlPosition __JavelinIGUITargetingLineV) select 0) - 0.5 +#define __OffsetY ((ctrlPosition __JavelinIGUITargetingLineH) select 1) - 0.5 + +// Reset arguments if we havnt rendered in over a second +_args = uiNamespace getVariable[QGVAR(arguments), [] ]; +if( (count _args) > 0) then { + _lastTick = _args select 0; + if(diag_tickTime - _lastTick > 1) then { + [] call FUNC(onOpticLoad); + }; +}; + +TRACE_1("Running", "Running"); + +// Pull the arguments +_currentTarget = _args select 1; +_runTime = _args select 2; +_lockTime = _args select 3; +_soundTime = _args select 4; +_randomLockInterval = _args select 5; +_fireDisabledEH = _args select 6; + +private["_ammo", "_magazineConfig", "_weaponConfig"]; +_weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; +_magazineConfig = if ((currentMagazine _currentShooter) != "") then { + _ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo"); + configProperties [(configFile >> "CfgAmmo" >> _ammo), "(configName _x) == 'ace_missileguidance'", false]; +} else { + [] +}; + +//If weapon does not have "javelin enabled", then exit PFEH +if (((count _weaponConfig) < 1) || {(getNumber (_weaponConfig select 0)) != 1}) exitWith { + __JavelinIGUITargeting ctrlShow false; + __JavelinIGUITargetingGate ctrlShow false; + __JavelinIGUITargetingLines ctrlShow false; + __JavelinIGUITargetingConstraints ctrlShow false; + + if(!isNil "_fireDisabledEH") then { + _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); + }; + + [(_this select 1)] call CBA_fnc_removePerFrameHandler; + GVAR(pfehID) = -1; +}; + +// Find a target within the optic range +_newTarget = objNull; + +// Bail on fast movement +if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. + ACE_player switchCamera "INTERNAL"; + if (player != ACE_player) then { + TRACE_2("Zeus, manually reseting RC after switchCamera",player,ACE_player); + player remoteControl ACE_player; + }; +}; + +// Refresh the firemode +[] call FUNC(showFireMode); + +_ammo = _currentShooter ammo (currentWeapon _currentShooter); +// not loaded or not "javelin enabled" for magazine, hide targeting and enable firing +if ((_ammo == 0) || {(count _magazineConfig) < 1} || {(getNumber ((_magazineConfig select 0) >> "enabled")) != 1}) exitWith { + __JavelinIGUITargeting ctrlShow false; + __JavelinIGUITargetingGate ctrlShow false; + __JavelinIGUITargetingLines ctrlShow false; + __JavelinIGUITargetingConstraints ctrlShow false; + + if(!isNil "_fireDisabledEH") then { + _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); + }; +}; + +_range = parseNumber (ctrlText __JavelinIGUIRangefinder); +TRACE_1("Viewing range", _range); +if (_range > 50 && {_range < 2500}) then { + _pos = positionCameraToWorld [0,0,_range]; + _targetArray = _pos nearEntities ["AllVehicles", _range/100]; + TRACE_1("Searching at range", _targetArray); + if (count (_targetArray) > 0) then { + _newTarget = _targetArray select 0; + }; +}; + +if ((isNull _newTarget) && {cursorObject isKindOf "AllVehicles"}) then { + private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorObject, ace_player, cursorObject, true, 1]; + if (_intersectionsToCursorTarget isEqualTo []) then { + _newTarget = cursorObject; + }; +}; +if ((isNull _newTarget) && {cursorTarget isKindOf "AllVehicles"}) then { + private _intersectionsToCursorTarget = lineIntersectsSurfaces [(AGLtoASL positionCameraToWorld [0,0,0]), aimPos cursorTarget, ace_player, cursorTarget, true, 1]; + if (_intersectionsToCursorTarget isEqualTo []) then { + _newTarget = cursorTarget; + }; +}; + +// Create constants +_constraintTop = __ConstraintTop; +_constraintLeft = __ConstraintLeft; +_constraintBottom = __ConstraintBottom; +_constraintRight = __ConstraintRight; + +_offsetX = __OffsetX; +_offsetY = __OffsetY; + +__JavelinIGUITargeting ctrlShow true; +__JavelinIGUITargetingConstrains ctrlShow true; + +_zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"}; +_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)]; + +_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds); + +_aposX = 0; +_aposY = 0; +if (count _apos < 2) then { + _aposX = 1; + _aposY = 0; +} else { + _aposX = (_apos select 0) + _offsetX; + _aposY = (_apos select 1) + _offsetY; +}; + +if((call CBA_fnc_getFoV) select 1 > 9) then { + __JavelinIGUINFOV ctrlSetTextColor __ColorGreen; + __JavelinIGUIWFOV ctrlSetTextColor __ColorGray; +} else { + __JavelinIGUINFOV ctrlSetTextColor __ColorGray; + __JavelinIGUIWFOV ctrlSetTextColor __ColorGreen; +}; + +FUNC(disableFire) = { + _firedEH = _this select 0; + + if(_firedEH < 0 && difficulty > 0) then { + _firedEH = [ACE_player, "DefaultAction", {true}, { + _canFire = (_this select 1) getVariable["ace_missileguidance_target", nil]; + if(!isNil "_canFire") exitWith { false }; + true + }] call EFUNC(common,addActionEventHandler); + }; + _firedEH +}; +FUNC(enableFire) = { + _firedEH = _this select 0; + + if(_firedEH > 0 && difficulty > 0) then { + [ACE_player, "DefaultAction", _firedEH] call EFUNC(common,removeActionEventHandler); + }; + -1 +}; + +if (isNull _newTarget) then { + // No targets found + _currentTarget = objNull; + _lockTime = 0; + + __JavelinIGUISeek ctrlSetTextColor __ColorGray; + __JavelinIGUITargeting ctrlShow false; + __JavelinIGUITargetingGate ctrlShow false; + __JavelinIGUITargetingLines ctrlShow false; + __JavelinIGUITargetingConstraints ctrlShow false; + + _currentShooter setVariable ["ace_missileguidance_target",nil, false]; + + // Disallow fire + _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); +} else { + _fov = [] call CBA_fnc_getFoV; + TRACE_1("FOV", _fov); + if (_newTarget distance ACE_player < 2500 + && {(call CBA_fnc_getFoV) select 1 > 9} + && { (currentVisionMode ACE_player == 2)} + && GVAR(isLockKeyDown) + ) then { + // Lock on after 3 seconds + if(_currentTarget != _newTarget) then { + TRACE_1("New Target, reseting locking", _newTarget); + _lockTime = diag_tickTime; + _currentTarget = _newTarget; + + playSound "ACE_Javelin_Locking"; + } else { + if(diag_tickTime - _lockTime > __LOCKONTIME + _randomLockInterval) then { + TRACE_2("LOCKED!", _currentTarget, _lockTime); + + __JavelinIGUISeek ctrlSetTextColor __ColorGreen; + + __JavelinIGUITargeting ctrlShow true; + __JavelinIGUITargetingConstrains ctrlShow false; + __JavelinIGUITargetingGate ctrlShow true; + __JavelinIGUITargetingLines ctrlShow true; + + // Move target marker to coords. + //__JavelinIGUITargetingLineV ctrlSetPosition [_aposX,ctrlPosition __JavelinIGUITargetingLineV select 1]; + //__JavelinIGUITargetingLineH ctrlSetPosition [ctrlPosition __JavelinIGUITargetingLineH select 0,_aposY]; + //{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingLineH,__JavelinIGUITargetingLineV]; + + _boundsInput = if (_currentTarget isKindOf "CAManBase") then { + [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; + } else { + [_currentTarget,[-1,-1,-2],_currentTarget selectionPosition "zamerny"]; + }; + + _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); + + _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; + _minY = ((_bpos select 1) + _offsetY) max _constraintTop; + _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); + _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); + + TRACE_4("", _boundsInput, _bpos, _minX, _minY); + + __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; + __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; + __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; + __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; + + {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; + + _currentShooter setVariable["ace_missileguidance_target", _currentTarget, false]; + + // Allow fire + _fireDisabledEH = [_fireDisabledEH] call FUNC(enableFire); + + if(diag_tickTime > _soundTime) then { + playSound "ACE_Javelin_Locked"; + _soundTime = diag_tickTime + 0.25; + }; + } else { + __JavelinIGUITargeting ctrlShow true; + __JavelinIGUITargetingGate ctrlShow true; + __JavelinIGUITargetingConstrains ctrlShow true; + __JavelinIGUITargetingLines ctrlShow false; + + _currentShooter setVariable["ace_missileguidance_target", nil, false]; + + _boundsInput = if (_currentTarget isKindOf "CAManBase") then { + [_newTarget,[-1,-1,-2],_currentTarget selectionPosition "body"]; + } else { + [_newTarget,[-1,-1,-1],_currentTarget selectionPosition "zamerny"]; + }; + + _bpos = _boundsInput call EFUNC(common,worldToScreenBounds); + + _minX = ((_bpos select 0) + _offsetX) max _constraintLeft; + _minY = ((_bpos select 1) + _offsetY) max _constraintTop; + _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); + _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); + + TRACE_4("", _boundsInput, _bpos, _minX, _minY); + + __JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; + __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; + __JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; + __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; + + {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; + + if(diag_tickTime > _soundTime) then { + playSound "ACE_Javelin_Locking"; + _soundTime = diag_tickTime + 0.25; + }; + // Disallow fire + _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); + }; + }; + } else { + // No targets found + _currentTarget = objNull; + _lockTime = 0; + + __JavelinIGUISeek ctrlSetTextColor __ColorGray; + __JavelinIGUITargeting ctrlShow false; + __JavelinIGUITargetingGate ctrlShow false; + __JavelinIGUITargetingLines ctrlShow false; + __JavelinIGUITargetingConstraints ctrlShow false; + + _currentShooter setVariable ["ace_missileguidance_target",nil, false]; + + // Disallow fire + _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); + }; +}; + +//TRACE_2("", _newTarget, _currentTarget); + +// Save arguments for next run +_args set[0, diag_tickTime]; +_args set[1, _currentTarget]; +_args set[2, _runTime]; +_args set[3, _lockTime]; +_args set[4, _soundTime]; +_args set[6, _fireDisabledEH]; + +uiNamespace setVariable[QGVAR(arguments), _args ]; diff --git a/addons/javelin/functions/fnc_onOpticLoad.sqf b/addons/javelin/functions/fnc_onOpticLoad.sqf index cb4eac74f9..b75f391112 100644 --- a/addons/javelin/functions/fnc_onOpticLoad.sqf +++ b/addons/javelin/functions/fnc_onOpticLoad.sqf @@ -1,37 +1,37 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -#define __LOCKONTIMERANDOM 2 // Deviation in lock on time - -if((count _this) > 0) then { - uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0]; -}; - -ACE_player setVariable ["ace_missileguidance_target",nil, false]; - -__JavelinIGUISeek ctrlSetTextColor __ColorGray; -__JavelinIGUINFOV ctrlSetTextColor __ColorGray; - -__JavelinIGUITargeting ctrlShow false; -__JavelinIGUITargetingConstrains ctrlShow false; -__JavelinIGUITargetingGate ctrlShow false; -__JavelinIGUITargetingLines ctrlShow false; - -if(GVAR(pfehID) != -1) then { - [] call FUNC(onOpticUnload); // Unload optic if it was already loaded -}; - -uiNameSpace setVariable [QGVAR(arguments), - [ - ACE_diagTime, // Last runtime - objNull, // currentTargetObject - 0, // Run Time - 0, // Lock Time - 0, // Sound timer - (random __LOCKONTIMERANDOM), // random lock time addition - -1 - ] -]; - -GVAR(pfehID) = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +#define __LOCKONTIMERANDOM 2 // Deviation in lock on time + +if((count _this) > 0) then { + uiNameSpace setVariable ['ACE_RscOptics_javelin',_this select 0]; +}; + +ACE_player setVariable ["ace_missileguidance_target",nil, false]; + +__JavelinIGUISeek ctrlSetTextColor __ColorGray; +__JavelinIGUINFOV ctrlSetTextColor __ColorGray; + +__JavelinIGUITargeting ctrlShow false; +__JavelinIGUITargetingConstrains ctrlShow false; +__JavelinIGUITargetingGate ctrlShow false; +__JavelinIGUITargetingLines ctrlShow false; + +if(GVAR(pfehID) != -1) then { + [] call FUNC(onOpticUnload); // Unload optic if it was already loaded +}; + +uiNameSpace setVariable [QGVAR(arguments), + [ + diag_tickTime, // Last runtime + objNull, // currentTargetObject + 0, // Run Time + 0, // Lock Time + 0, // Sound timer + (random __LOCKONTIMERANDOM), // random lock time addition + -1 + ] +]; + +GVAR(pfehID) = [FUNC(onOpticDraw), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/javelin/functions/fnc_onOpticUnload.sqf b/addons/javelin/functions/fnc_onOpticUnload.sqf index 714a3e7748..ef5394cb6c 100644 --- a/addons/javelin/functions/fnc_onOpticUnload.sqf +++ b/addons/javelin/functions/fnc_onOpticUnload.sqf @@ -1,20 +1,20 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); -private["_args", "_disableFireEH"]; - -// uiNameSpace setVariable ['ACE_RscOptics_javelin',nil]; - -if(GVAR(pfehID) != -1) then { - [GVAR(pfehID)] call CBA_fnc_removePerFrameHandler; - GVAR(pfehID) = -1; -}; - -_args = uiNamespace getVariable[QGVAR(arguments), nil ]; -if(!isNil "_args") then { - _disableFireEH = _args select 6; - if(_disableFireEH > 0 && difficulty > 0) then { - [ACE_player, "DefaultAction", _disableFireEH] call EFUNC(common,removeActionEventHandler); - }; - uiNameSpace setVariable [QGVAR(arguments),nil]; -}; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); +private["_args", "_disableFireEH"]; + +// uiNameSpace setVariable ['ACE_RscOptics_javelin',nil]; + +if(GVAR(pfehID) != -1) then { + [GVAR(pfehID)] call CBA_fnc_removePerFrameHandler; + GVAR(pfehID) = -1; +}; + +_args = uiNamespace getVariable[QGVAR(arguments), nil ]; +if(!isNil "_args") then { + _disableFireEH = _args select 6; + if(_disableFireEH > 0 && difficulty > 0) then { + [ACE_player, "DefaultAction", _disableFireEH] call EFUNC(common,removeActionEventHandler); + }; + uiNameSpace setVariable [QGVAR(arguments),nil]; +}; diff --git a/addons/javelin/functions/fnc_showFireMode.sqf b/addons/javelin/functions/fnc_showFireMode.sqf index 88374548c0..5b4f8d7814 100644 --- a/addons/javelin/functions/fnc_showFireMode.sqf +++ b/addons/javelin/functions/fnc_showFireMode.sqf @@ -1,14 +1,14 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -private["_player", "_currentFireMode"]; - -_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "JAV_TOP"]; -if(_currentFireMode == "JAV_TOP") then { - __JavelinIGUITop ctrlSetTextColor __ColorGreen; - __JavelinIGUIDir ctrlSetTextColor __ColorGray; -} else { - __JavelinIGUITop ctrlSetTextColor __ColorGray; - __JavelinIGUIDir ctrlSetTextColor __ColorGreen; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +private["_player", "_currentFireMode"]; + +_currentFireMode = ACE_player getVariable["ace_missileguidance_attackProfile", "JAV_TOP"]; +if(_currentFireMode == "JAV_TOP") then { + __JavelinIGUITop ctrlSetTextColor __ColorGreen; + __JavelinIGUIDir ctrlSetTextColor __ColorGray; +} else { + __JavelinIGUITop ctrlSetTextColor __ColorGray; + __JavelinIGUIDir ctrlSetTextColor __ColorGreen; }; \ No newline at end of file diff --git a/addons/javelin/initKeybinds.sqf b/addons/javelin/initKeybinds.sqf index 10b5e2813d..cbfafa326d 100644 --- a/addons/javelin/initKeybinds.sqf +++ b/addons/javelin/initKeybinds.sqf @@ -1,30 +1,30 @@ -// by commy2 - -["ACE3 Weapons", QGVAR(lockTarget), localize LSTRING(LockTarget), -{ - if (GETGVAR(isLockKeyDown,false)) exitWith {false}; - - GVAR(isLockKeyDown) = true; - - // Statement - [ACE_player] call FUNC(lockKeyDown); - // Return false so it doesn't block the rest weapon action - false -}, -{ - // prevent holding down - GVAR(isLockKeyDown) = false; - - // Statement - [ACE_player] call FUNC(lockKeyUp); - false -}, -[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key - -["ACE3 Weapons", QGVAR(cycleFireMode), localize LSTRING(CycleFireMode), -{ false }, -{ - [ACE_player] call FUNC(cycleFireMode); - false -}, +// by commy2 + +["ACE3 Weapons", QGVAR(lockTarget), localize LSTRING(LockTarget), +{ + if (GETGVAR(isLockKeyDown,false)) exitWith {false}; + + GVAR(isLockKeyDown) = true; + + // Statement + [ACE_player] call FUNC(lockKeyDown); + // Return false so it doesn't block the rest weapon action + false +}, +{ + // prevent holding down + GVAR(isLockKeyDown) = false; + + // Statement + [ACE_player] call FUNC(lockKeyUp); + false +}, +[15, [false, false, false]], false] call CBA_fnc_addKeybind; //Tab Key + +["ACE3 Weapons", QGVAR(cycleFireMode), localize LSTRING(CycleFireMode), +{ false }, +{ + [ACE_player] call FUNC(cycleFireMode); + false +}, [15, [false, true, false]], false] call CBA_fnc_addKeybind; //Ctrl+Tab Key \ No newline at end of file diff --git a/addons/javelin/script_component.hpp b/addons/javelin/script_component.hpp index e252ed1cbb..11bb4a5a33 100644 --- a/addons/javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -1,67 +1,68 @@ -#define COMPONENT javelin -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_JAVELIN - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_JAVELIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_JAVELIN -#endif - -#include "\z\ace\addons\main\script_macros.hpp" - -#define ACE_JAV_FIREMODE_DIR 1 -#define ACE_JAV_FIREMODE_TOP 2 - - -// Javelin IGUI defines -#define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin") - -// Custom controls -#define __JavelinIGUITargeting (__JavelinIGUI displayCtrl 6999) - -#define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000) -#define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001) -#define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002) -#define __JavelinIGUINFOV (__JavelinIGUI displayCtrl 1003) -#define __JavelinIGUIWFOV (__JavelinIGUI displayCtrl 1004) -#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151) - -// Constrains -#define __JavelinIGUITargetingConstrains (__JavelinIGUI displayCtrl 699100) -#define __JavelinIGUITargetingConstrainTop (__JavelinIGUI displayCtrl 699101) -#define __JavelinIGUITargetingConstrainBottom (__JavelinIGUI displayCtrl 699102) -#define __JavelinIGUITargetingConstrainLeft (__JavelinIGUI displayCtrl 699103) -#define __JavelinIGUITargetingConstrainRight (__JavelinIGUI displayCtrl 699104) - -// Targeting gate -#define __JavelinIGUITargetingGate (__JavelinIGUI displayCtrl 699200) -#define __JavelinIGUITargetingGateTL (__JavelinIGUI displayCtrl 699201) -#define __JavelinIGUITargetingGateTR (__JavelinIGUI displayCtrl 699202) -#define __JavelinIGUITargetingGateBL (__JavelinIGUI displayCtrl 699203) -#define __JavelinIGUITargetingGateBR (__JavelinIGUI displayCtrl 699204) - -// Rangefinder -#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151) - -// Targeting lines -#define __JavelinIGUITargetingLines (__JavelinIGUI displayCtrl 699300) -#define __JavelinIGUITargetingLineH (__JavelinIGUI displayCtrl 699301) -#define __JavelinIGUITargetingLineV (__JavelinIGUI displayCtrl 699302) - -#define __ConstraintTop (((ctrlPosition __JavelinIGUITargetingConstrainTop) select 1) + ((ctrlPosition (__JavelinIGUITargetingConstrainTop)) select 3)) -#define __ConstraintBottom ((ctrlPosition __JavelinIGUITargetingConstrainBottom) select 1) -#define __ConstraintLeft (((ctrlPosition __JavelinIGUITargetingConstrainLeft) select 0) + ((ctrlPosition (__JavelinIGUITargetingConstrainLeft)) select 2)) -#define __ConstraintRight ((ctrlPosition __JavelinIGUITargetingConstrainRight) select 0) - -// Colors for controls -#define __ColorOrange [0.9255,0.5216,0.1216,1] -#define __ColorGreen [0.2941,0.8745,0.2157,1] -#define __ColorGray [0.2941,0.2941,0.2941,1] -#define __ColorNull [0,0,0,0] \ No newline at end of file +#define COMPONENT javelin +#define COMPONENT_BEAUTIFIED Javelin +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_JAVELIN + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_JAVELIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_JAVELIN +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define ACE_JAV_FIREMODE_DIR 1 +#define ACE_JAV_FIREMODE_TOP 2 + + +// Javelin IGUI defines +#define __JavelinIGUI (uinamespace getVariable "ACE_RscOptics_javelin") + +// Custom controls +#define __JavelinIGUITargeting (__JavelinIGUI displayCtrl 6999) + +#define __JavelinIGUISeek (__JavelinIGUI displayCtrl 699000) +#define __JavelinIGUITop (__JavelinIGUI displayCtrl 699001) +#define __JavelinIGUIDir (__JavelinIGUI displayCtrl 699002) +#define __JavelinIGUINFOV (__JavelinIGUI displayCtrl 1003) +#define __JavelinIGUIWFOV (__JavelinIGUI displayCtrl 1004) +#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151) + +// Constrains +#define __JavelinIGUITargetingConstrains (__JavelinIGUI displayCtrl 699100) +#define __JavelinIGUITargetingConstrainTop (__JavelinIGUI displayCtrl 699101) +#define __JavelinIGUITargetingConstrainBottom (__JavelinIGUI displayCtrl 699102) +#define __JavelinIGUITargetingConstrainLeft (__JavelinIGUI displayCtrl 699103) +#define __JavelinIGUITargetingConstrainRight (__JavelinIGUI displayCtrl 699104) + +// Targeting gate +#define __JavelinIGUITargetingGate (__JavelinIGUI displayCtrl 699200) +#define __JavelinIGUITargetingGateTL (__JavelinIGUI displayCtrl 699201) +#define __JavelinIGUITargetingGateTR (__JavelinIGUI displayCtrl 699202) +#define __JavelinIGUITargetingGateBL (__JavelinIGUI displayCtrl 699203) +#define __JavelinIGUITargetingGateBR (__JavelinIGUI displayCtrl 699204) + +// Rangefinder +#define __JavelinIGUIRangefinder (__JavelinIGUI displayCtrl 151) + +// Targeting lines +#define __JavelinIGUITargetingLines (__JavelinIGUI displayCtrl 699300) +#define __JavelinIGUITargetingLineH (__JavelinIGUI displayCtrl 699301) +#define __JavelinIGUITargetingLineV (__JavelinIGUI displayCtrl 699302) + +#define __ConstraintTop (((ctrlPosition __JavelinIGUITargetingConstrainTop) select 1) + ((ctrlPosition (__JavelinIGUITargetingConstrainTop)) select 3)) +#define __ConstraintBottom ((ctrlPosition __JavelinIGUITargetingConstrainBottom) select 1) +#define __ConstraintLeft (((ctrlPosition __JavelinIGUITargetingConstrainLeft) select 0) + ((ctrlPosition (__JavelinIGUITargetingConstrainLeft)) select 2)) +#define __ConstraintRight ((ctrlPosition __JavelinIGUITargetingConstrainRight) select 0) + +// Colors for controls +#define __ColorOrange [0.9255,0.5216,0.1216,1] +#define __ColorGreen [0.2941,0.8745,0.2157,1] +#define __ColorGray [0.2941,0.2941,0.2941,1] +#define __ColorNull [0,0,0,0] diff --git a/addons/kestrel4500/CfgVehicles.hpp b/addons/kestrel4500/CfgVehicles.hpp index 9ca6510928..ccc4fa3bd2 100644 --- a/addons/kestrel4500/CfgVehicles.hpp +++ b/addons/kestrel4500/CfgVehicles.hpp @@ -9,7 +9,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(createKestrelDialog)); showDisabled = 0; priority = 0.1; - icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa)); + icon = QPATHTOF(UI\Kestrel4500_Icon.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; class GVAR(show) { displayName = CSTRING(ShowKestrel); @@ -17,7 +17,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(displayKestrel)); showDisabled = 0; priority = 0.2; - icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa)); + icon = QPATHTOF(UI\Kestrel4500_Icon.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; class GVAR(hide) { @@ -26,7 +26,7 @@ class CfgVehicles { statement = QUOTE(call FUNC(displayKestrel)); showDisabled = 0; priority = 0.3; - icon = QUOTE(PATHTOF(UI\Kestrel4500_Icon.paa)); + icon = QPATHTOF(UI\Kestrel4500_Icon.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; diff --git a/addons/kestrel4500/CfgWeapons.hpp b/addons/kestrel4500/CfgWeapons.hpp index c31b736ac6..8b318994a2 100644 --- a/addons/kestrel4500/CfgWeapons.hpp +++ b/addons/kestrel4500/CfgWeapons.hpp @@ -8,8 +8,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(Name); descriptionShort = CSTRING(Description); - model = PATHTOF(data\kestrel4500.p3d); - picture = PATHTOF(UI\Kestrel4500.paa); + model = QPATHTOF(data\kestrel4500.p3d); + picture = QPATHTOF(UI\Kestrel4500.paa); icon = "iconObject_circle"; mapSize = 0.034; diff --git a/addons/kestrel4500/RscTitles.hpp b/addons/kestrel4500/RscTitles.hpp index 7046918935..276e8c4392 100644 --- a/addons/kestrel4500/RscTitles.hpp +++ b/addons/kestrel4500/RscTitles.hpp @@ -348,25 +348,25 @@ class RscTitles { fadeout = 0; class controls { class Preload_0 { - text = PATHTOF(UI\Kestrel4500_0.paa); + text = QPATHTOF(UI\Kestrel4500_0.paa); }; class Preload_1 { - text = PATHTOF(UI\Kestrel4500_1.paa); + text = QPATHTOF(UI\Kestrel4500_1.paa); }; class Preload_2 { - text = PATHTOF(UI\Kestrel4500_2.paa); + text = QPATHTOF(UI\Kestrel4500_2.paa); }; class Preload_3 { - text = PATHTOF(UI\Kestrel4500_3.paa); + text = QPATHTOF(UI\Kestrel4500_3.paa); }; class Preload_4 { - text = PATHTOF(UI\Kestrel4500_4.paa); + text = QPATHTOF(UI\Kestrel4500_4.paa); }; class Preload_5 { - text = PATHTOF(UI\Kestrel4500_5.paa); + text = QPATHTOF(UI\Kestrel4500_5.paa); }; class Preload_6 { - text = PATHTOF(UI\Kestrel4500_6.paa); + text = QPATHTOF(UI\Kestrel4500_6.paa); }; }; }; diff --git a/addons/kestrel4500/XEH_postInit.sqf b/addons/kestrel4500/XEH_postInit.sqf index f22fc2228f..9511041bd2 100644 --- a/addons/kestrel4500/XEH_postInit.sqf +++ b/addons/kestrel4500/XEH_postInit.sqf @@ -11,7 +11,7 @@ GVAR(MinAvgMax) = false; GVAR(MinAvgMaxMode) = 0; GVAR(referenceHeadingMenu) = 0; GVAR(referenceHeadingAutoSet) = true; -GVAR(manualSetCooldown) = ACE_diagTime; +GVAR(manualSetCooldown) = diag_tickTime; GVAR(headingSetDisplayTimer) = 0; GVAR(Menu) = 1; diff --git a/addons/kestrel4500/config.cpp b/addons/kestrel4500/config.cpp index 95a533fd9f..11bc51f801 100644 --- a/addons/kestrel4500/config.cpp +++ b/addons/kestrel4500/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_Kestrel4500"}; weapons[] = {"ACE_Kestrel4500"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_common", "ACE_weather"}; - author[] = {ECSTRING(common,ACETeam), "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {ECSTRING(common,ACETeam), "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/kestrel4500/functions/fnc_buttonPressed.sqf b/addons/kestrel4500/functions/fnc_buttonPressed.sqf index 83c471092a..a051f6b1b6 100644 --- a/addons/kestrel4500/functions/fnc_buttonPressed.sqf +++ b/addons/kestrel4500/functions/fnc_buttonPressed.sqf @@ -33,12 +33,12 @@ switch (_this) do { case 2: { // Auto set GVAR(RefHeading) = (getDir ACE_player) % 360; GVAR(referenceHeadingMenu) = 0; - GVAR(headingSetDisplayTimer) = ACE_diagTime; + GVAR(headingSetDisplayTimer) = diag_tickTime; }; case 3: { // Manual set GVAR(RefHeading) = GVAR(TmpHeading); GVAR(referenceHeadingMenu) = 0; - GVAR(headingSetDisplayTimer) = ACE_diagTime; + GVAR(headingSetDisplayTimer) = diag_tickTime; }; }; }; @@ -73,13 +73,13 @@ switch (_this) do { GVAR(MinAvgMax) = !GVAR(MinAvgMax); } else { if (GVAR(referenceHeadingMenu) == 3) then { - if (ACE_diagTime - GVAR(manualSetCooldown) < 0.2) then { + if (diag_tickTime - GVAR(manualSetCooldown) < 0.2) then { GVAR(TmpHeading) = GVAR(TmpHeading) - 10; } else { GVAR(TmpHeading) = GVAR(TmpHeading) - 1; }; GVAR(TmpHeading) = (GVAR(TmpHeading) + 360) % 360; - GVAR(manualSetCooldown) = ACE_diagTime; + GVAR(manualSetCooldown) = diag_tickTime; }; }; }; @@ -88,13 +88,13 @@ switch (_this) do { GVAR(MinAvgMax) = !GVAR(MinAvgMax); } else { if (GVAR(referenceHeadingMenu) == 3) then { - if (ACE_diagTime - GVAR(manualSetCooldown) < 0.2) then { + if (diag_tickTime - GVAR(manualSetCooldown) < 0.2) then { GVAR(TmpHeading) = GVAR(TmpHeading) + 10; } else { GVAR(TmpHeading) = GVAR(TmpHeading) + 1; }; GVAR(TmpHeading) = (GVAR(TmpHeading) + 360) % 360; - GVAR(manualSetCooldown) = ACE_diagTime; + GVAR(manualSetCooldown) = diag_tickTime; }; }; }; diff --git a/addons/kestrel4500/functions/fnc_displayKestrel.sqf b/addons/kestrel4500/functions/fnc_displayKestrel.sqf index 64d06fea1c..28de70a13d 100644 --- a/addons/kestrel4500/functions/fnc_displayKestrel.sqf +++ b/addons/kestrel4500/functions/fnc_displayKestrel.sqf @@ -59,8 +59,8 @@ GVAR(Overlay) = true; [_this select 1] call CBA_fnc_removePerFrameHandler; }; - if (ACE_diagTime > GVAR(updateTimer)) then { - GVAR(updateTimer) = ACE_diagTime + 1; + if (diag_tickTime > GVAR(updateTimer)) then { + GVAR(updateTimer) = diag_tickTime + 1; private ["_outputData"]; _outputData = [] call FUNC(generateOutputData); @@ -126,7 +126,7 @@ GVAR(Overlay) = true; }; call FUNC(updateImpellerState); - __ctrlKestrel4500 ctrlSetText format [QUOTE(PATHTOF(UI\Kestrel4500_%1.paa)), floor(GVAR(ImpellerState) % 7)]; + __ctrlKestrel4500 ctrlSetText format [QPATHTOF(UI\Kestrel4500_%1.paa), floor(GVAR(ImpellerState) % 7)]; }, 0.01, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 016baebef7..c3bce5efa2 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -31,7 +31,7 @@ */ #include "script_component.hpp" -if (ACE_diagTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]}; +if (diag_tickTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]}; private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"]; diff --git a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf index 2474f30d94..f8531f0e39 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf @@ -1,19 +1,19 @@ -/* - * Author: Ruthberg - * Called if Kestrel Dialog is closed - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_kestrel4500_fnc_onCloseDialog - * - * Public: No - */ -#include "script_component.hpp" - -uiNamespace setVariable ['Kestrel4500_Display', nil]; -GVAR(Kestrel4500) = false; +/* + * Author: Ruthberg + * Called if Kestrel Dialog is closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_kestrel4500_fnc_onCloseDialog + * + * Public: No + */ +#include "script_component.hpp" + +uiNamespace setVariable ['Kestrel4500_Display', nil]; +GVAR(Kestrel4500) = false; diff --git a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf index bdc701ddb1..549c22e275 100644 --- a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf +++ b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf @@ -1,19 +1,19 @@ -/* - * Author: Ruthberg - * Called if Kestrel Display is closed - * - * Arguments: - * None - * - * Return Value: - * None - * - * Example: - * call ace_kestrel4500_fnc_onCloseDisplay - * - * Public: No - */ -#include "script_component.hpp" - -uiNamespace setVariable ['RscKestrel4500', nil]; -GVAR(Overlay) = false; +/* + * Author: Ruthberg + * Called if Kestrel Display is closed + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_kestrel4500_fnc_onCloseDisplay + * + * Public: No + */ +#include "script_component.hpp" + +uiNamespace setVariable ['RscKestrel4500', nil]; +GVAR(Overlay) = false; diff --git a/addons/kestrel4500/initKeybinds.sqf b/addons/kestrel4500/initKeybinds.sqf index 581ab1a1ae..8c99271970 100644 --- a/addons/kestrel4500/initKeybinds.sqf +++ b/addons/kestrel4500/initKeybinds.sqf @@ -56,4 +56,4 @@ _closeCode = { closeDialog 0; }; }; -[(localize LSTRING(Name)), QUOTE(PATHTOF(UI\Kestrel4500.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); +[(localize LSTRING(Name)), QPATHTOF(UI\Kestrel4500.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); diff --git a/addons/kestrel4500/script_component.hpp b/addons/kestrel4500/script_component.hpp index 87a0c0b594..f098cd2a57 100644 --- a/addons/kestrel4500/script_component.hpp +++ b/addons/kestrel4500/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT kestrel4500 +#define COMPONENT_BEAUTIFIED Kestrel 4500 #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/kestrel4500/stringtable.xml b/addons/kestrel4500/stringtable.xml index 3ad9e8824f..88f0e90363 100644 --- a/addons/kestrel4500/stringtable.xml +++ b/addons/kestrel4500/stringtable.xml @@ -30,7 +30,7 @@ Otwórz Kestrel 4500 Kestrel 4500 elővétele Открыть Kestrel 4500NV - Ouvrir Kestrel 4500 + Ouvrir le Kestrel 4500 Accendi Kestrel 4500 Abrir Kestrel 4500 Kestrel 4500 öffnen @@ -41,7 +41,7 @@ Show Kestrel 4500 Pokaż Kestrel 4500 Показать Kestrel 4500NV - Afficher Kestrel 4500 + Afficher le Kestrel 4500 Mostra Kestrel 4500 Mostrar Kestrel 4500 Kestrel 4500 anzeigen @@ -53,7 +53,7 @@ Hide Kestrel 4500 Ukryj Kestrel 4500 Убрать Kestrel 4500NV - Cacher Kestrel 4500 + Cacher le Kestrel 4500 Nascondi Kestrel 4500 Ocultar Kestrel 4500 Kestrel 4500 wegstecken @@ -65,7 +65,7 @@ Open Kestrel 4500 Otwórz Kestrel 4500 Открыть Kestrel 4500NV - Ouvrir Kestrel 4500 + Ouvrir le Kestrel 4500 Accendi Kestrel 4500 Abrir Kestrel 4500 Kestrel 4500 öffnen @@ -77,7 +77,7 @@ Show Kestrel 4500 Pokaż Kestrel 4500 Показать Kestrel 4500NV - Afficher Kestrel 4500 + Afficher le Kestrel 4500 Mostra Kestrel 4500 Mostrar Kestrel 4500 Kestrel 4500 anzeigen diff --git a/addons/laser/CfgEventhandlers.hpp b/addons/laser/CfgEventhandlers.hpp index 2abad68362..e8fb763b8b 100644 --- a/addons/laser/CfgEventhandlers.hpp +++ b/addons/laser/CfgEventhandlers.hpp @@ -1,26 +1,26 @@ - -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - }; -}; - -class Extended_Init_EventHandlers { - class LaserTargetBase { - class ADDON { - init = QUOTE(_this call DFUNC(laser_init)); - }; - }; -}; + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + }; +}; + +class Extended_Init_EventHandlers { + class LaserTargetBase { + class ADDON { + init = QUOTE(_this call DFUNC(laser_init)); + }; + }; +}; diff --git a/addons/laser/CfgVehicles.hpp b/addons/laser/CfgVehicles.hpp index 780107fdf7..ed752cee42 100644 --- a/addons/laser/CfgVehicles.hpp +++ b/addons/laser/CfgVehicles.hpp @@ -1,45 +1,45 @@ -class CfgVehicles { - class All; - - class LaserTarget: All { - // @TODO: Changing the model and simulation hides it, but THEN IT DOESNT SPAWN WTF!? - model = "\A3\Weapons_F\empty.p3d"; - destrType = "DestructNo"; - simulation = "LaserTarget"; - - class EventHandlers { - init = QUOTE(_this call FUNC(laser_init)); - }; - }; - - // Visual laserTarget override - class ACE_LaserTarget_Visual : LaserTarget { - simulation = "LaserTarget"; - model = "\A3\Weapons_f\laserTgt.p3d"; - }; - - // Vehicle lockable configurations - - class AllVehicles; - class Air: AllVehicles { - class Turrets; - }; - - class Helicopter: Air { - class Turrets { - class MainTurret; - }; - }; - - class Helicopter_Base_F: Helicopter {}; - - class Heli_Attack_01_base_F: Helicopter_Base_F {}; - - class B_Heli_Attack_01_F: Heli_Attack_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - GVAR(CanLockLaser) = 1; // Enable laser locking selection - }; - }; - }; -}; +class CfgVehicles { + class All; + + class LaserTarget: All { + // @TODO: Changing the model and simulation hides it, but THEN IT DOESNT SPAWN WTF!? + model = "\A3\Weapons_F\empty.p3d"; + destrType = "DestructNo"; + simulation = "LaserTarget"; + + class EventHandlers { + init = QUOTE(_this call FUNC(laser_init)); + }; + }; + + // Visual laserTarget override + class ACE_LaserTarget_Visual : LaserTarget { + simulation = "LaserTarget"; + model = "\A3\Weapons_f\laserTgt.p3d"; + }; + + // Vehicle lockable configurations + + class AllVehicles; + class Air: AllVehicles { + class Turrets; + }; + + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + }; + + class Helicopter_Base_F: Helicopter {}; + + class Heli_Attack_01_base_F: Helicopter_Base_F {}; + + class B_Heli_Attack_01_F: Heli_Attack_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(CanLockLaser) = 1; // Enable laser locking selection + }; + }; + }; +}; diff --git a/addons/laser/CfgWeapons.hpp b/addons/laser/CfgWeapons.hpp index 6dff36a4e8..385f842a59 100644 --- a/addons/laser/CfgWeapons.hpp +++ b/addons/laser/CfgWeapons.hpp @@ -1,7 +1,7 @@ - -class CfgWeapons { - class Binocular; - class Laserdesignator : Binocular { - visionMode[] = {"Normal","NVG"}; - }; -}; + +class CfgWeapons { + class Binocular; + class Laserdesignator : Binocular { + visionMode[] = {"Normal","NVG"}; + }; +}; diff --git a/addons/laser/RscInGameUI.hpp b/addons/laser/RscInGameUI.hpp index 08f0a794be..ca57f56f6f 100644 --- a/addons/laser/RscInGameUI.hpp +++ b/addons/laser/RscInGameUI.hpp @@ -1,143 +1,143 @@ -class RscControlsGroup; -class VScrollbar; -class HScrollbar; -class RscText; -class RscMapControl; - -class RscInGameUI { - class RscOptics_LaserDesignator { - idd = 300; - controls[] = {"CA_IGUI_elements_group"}; - - onLoad = "uiNameSpace setVariable ['ACE_RscOptics_LaserDesignator',(_this select 0)];"; - onUnload = "uiNameSpace setVariable ['ACE_RscOptics_LaserDesignator',nil];"; - - class CA_IGUI_elements_group: RscControlsGroup { - idc = 170; - - x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; - y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; - w = "53.5 * (0.01875 * SafezoneH)"; - h = "40 * (0.025 * SafezoneH)"; - class VScrollbar: VScrollbar { - width = 0; - }; - class HScrollbar: HScrollbar { - height = 0; - }; - class controls { - class CA_OpticsZoom: RscText { - idc = 180; - style = 1; - colorText[] = {0.706,0.0745,0.0196,1}; - sizeEx = "0.038*SafezoneH"; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "4.5"; - x = "43.85 * (0.01875 * SafezoneH)"; - y = "19.6 * (0.025 * SafezoneH)"; - w = "4.5 * (0.01875 * SafezoneH)"; - h = "1.1 * (0.025 * SafezoneH)"; - }; - class ACE_Distance: RscText { - idc = 123002; - style = 0; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "2456"; - x = "24.6 * (0.01875 * SafezoneH)"; - y = "3 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.5 * (0.025 * SafezoneH)"; - }; - class CA_Distance: RscText { - idc = 151; - style = 0; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "2456"; - x = 0; - y = 0; - w = 0; - h = 0; - }; - class CA_Elev: RscText { - idc = 175; - style = 1; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "80.5"; - x = "32.7 * (0.01875 * SafezoneH)"; - y = "3 * (0.025 * SafezoneH)"; - w = "5 * (0.01875 * SafezoneH)"; - h = "1.5 * (0.025 * SafezoneH)"; - }; - class CA_VisionMode: RscText { - idc = 179; - style = 0; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "VIS"; - x = "6.5 * (0.01875 * SafezoneH)"; - y = "19.6 * (0.025 * SafezoneH)"; - w = "4 * (0.01875 * SafezoneH)"; - h = "1.1 * (0.025 * SafezoneH)"; - }; - class CA_Laser: RscText { - idc = 158; - style = "0x30 + 0x800"; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics\laser_designator_iconLaserOn.paa"; - x = "29.2 * (0.01875 * SafezoneH)"; - y = "3 * (0.025 * SafezoneH)"; - w = "3.5 * (0.01875 * SafezoneH)"; - h = "1.5 * (0.025 * SafezoneH)"; - }; - class CA_Heading: RscText { - idc = 156; - style = 0; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "023"; - x = "16.1 * (0.01875 * SafezoneH)"; - y = "3 * (0.025 * SafezoneH)"; - w = "3.5 * (0.01875 * SafezoneH)"; - h = "1.6 * (0.025 * SafezoneH)"; - }; - - class ACE_LaserCode_Helper : RscMapControl { - idc = -1; - onDraw = QUOTE(_this call FUNC(onLaserDesignatorDraw)); - w = 0; - h = 0; - }; - class ACE_LaserCode : RscText { - idc = 123001; - style = 0; - sizeEx = "0.038*SafezoneH"; - colorText[] = {0.706,0.0745,0.0196,1}; - shadow = 0; - font = "EtelkaMonospacePro"; - text = "Code: 1001"; - x = "32.7 * (0.01875 * SafezoneH)"; - y = "35.5 * (0.025 * SafezoneH)"; - w = "12 * (0.01875 * SafezoneH)"; - h = "1.6 * (0.025 * SafezoneH)"; - }; - }; - }; - }; -}; +class RscControlsGroup; +class VScrollbar; +class HScrollbar; +class RscText; +class RscMapControl; + +class RscInGameUI { + class RscOptics_LaserDesignator { + idd = 300; + controls[] = {"CA_IGUI_elements_group"}; + + onLoad = "uiNameSpace setVariable ['ACE_RscOptics_LaserDesignator',(_this select 0)];"; + onUnload = "uiNameSpace setVariable ['ACE_RscOptics_LaserDesignator',nil];"; + + class CA_IGUI_elements_group: RscControlsGroup { + idc = 170; + + x = "0 * (0.01875 * SafezoneH) + (SafezoneX + ((SafezoneW - SafezoneH) / 2))"; + y = "0 * (0.025 * SafezoneH) + (SafezoneY)"; + w = "53.5 * (0.01875 * SafezoneH)"; + h = "40 * (0.025 * SafezoneH)"; + class VScrollbar: VScrollbar { + width = 0; + }; + class HScrollbar: HScrollbar { + height = 0; + }; + class controls { + class CA_OpticsZoom: RscText { + idc = 180; + style = 1; + colorText[] = {0.706,0.0745,0.0196,1}; + sizeEx = "0.038*SafezoneH"; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "4.5"; + x = "43.85 * (0.01875 * SafezoneH)"; + y = "19.6 * (0.025 * SafezoneH)"; + w = "4.5 * (0.01875 * SafezoneH)"; + h = "1.1 * (0.025 * SafezoneH)"; + }; + class ACE_Distance: RscText { + idc = 123002; + style = 0; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "2456"; + x = "24.6 * (0.01875 * SafezoneH)"; + y = "3 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.5 * (0.025 * SafezoneH)"; + }; + class CA_Distance: RscText { + idc = 151; + style = 0; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "2456"; + x = 0; + y = 0; + w = 0; + h = 0; + }; + class CA_Elev: RscText { + idc = 175; + style = 1; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "80.5"; + x = "32.7 * (0.01875 * SafezoneH)"; + y = "3 * (0.025 * SafezoneH)"; + w = "5 * (0.01875 * SafezoneH)"; + h = "1.5 * (0.025 * SafezoneH)"; + }; + class CA_VisionMode: RscText { + idc = 179; + style = 0; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "VIS"; + x = "6.5 * (0.01875 * SafezoneH)"; + y = "19.6 * (0.025 * SafezoneH)"; + w = "4 * (0.01875 * SafezoneH)"; + h = "1.1 * (0.025 * SafezoneH)"; + }; + class CA_Laser: RscText { + idc = 158; + style = "0x30 + 0x800"; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "\A3\ui_f\data\igui\rscingameui\rscoptics\laser_designator_iconLaserOn.paa"; + x = "29.2 * (0.01875 * SafezoneH)"; + y = "3 * (0.025 * SafezoneH)"; + w = "3.5 * (0.01875 * SafezoneH)"; + h = "1.5 * (0.025 * SafezoneH)"; + }; + class CA_Heading: RscText { + idc = 156; + style = 0; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "023"; + x = "16.1 * (0.01875 * SafezoneH)"; + y = "3 * (0.025 * SafezoneH)"; + w = "3.5 * (0.01875 * SafezoneH)"; + h = "1.6 * (0.025 * SafezoneH)"; + }; + + class ACE_LaserCode_Helper : RscMapControl { + idc = -1; + onDraw = QUOTE(_this call FUNC(onLaserDesignatorDraw)); + w = 0; + h = 0; + }; + class ACE_LaserCode : RscText { + idc = 123001; + style = 0; + sizeEx = "0.038*SafezoneH"; + colorText[] = {0.706,0.0745,0.0196,1}; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "Code: 1001"; + x = "32.7 * (0.01875 * SafezoneH)"; + y = "35.5 * (0.025 * SafezoneH)"; + w = "12 * (0.01875 * SafezoneH)"; + h = "1.6 * (0.025 * SafezoneH)"; + }; + }; + }; + }; +}; diff --git a/addons/laser/XEH_post_init.sqf b/addons/laser/XEH_post_init.sqf index a9f0e82be3..51473ceba6 100644 --- a/addons/laser/XEH_post_init.sqf +++ b/addons/laser/XEH_post_init.sqf @@ -1,7 +1,7 @@ -#include "script_component.hpp" - -#include "initKeybinds.sqf" - -["laser_laserOn", {_this call DFUNC(handleLaserOn)}] call EFUNC(common,addEventHandler); -["laser_laserOff", {_this call DFUNC(handleLaserOff)}] call EFUNC(common,addEventHandler); - +#include "script_component.hpp" + +#include "initKeybinds.sqf" + +["ace_laserOn", {_this call DFUNC(handleLaserOn)}] call CBA_fnc_addEventHandler; +["ace_laserOff", {_this call DFUNC(handleLaserOff)}] call CBA_fnc_addEventHandler; + diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index 502f47a9dc..b13ea4b665 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -1,16 +1,16 @@ -#include "script_component.hpp" - -ADDON = false; - -#include "XEH_PREP.hpp" - -GVAR(VanillaLasers) = []; - -// Laser default variables -ACE_DEFAULT_LASER_CODE = 1001; -ACE_DEFAULT_LASER_WAVELENGTH = 1550; -ACE_DEFAULT_LASER_BEAMSPREAD = 1; - -GVAR(laserEmitters) = HASH_CREATE; - -ADDON = true; +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +GVAR(VanillaLasers) = []; + +// Laser default variables +ACE_DEFAULT_LASER_CODE = 1001; +ACE_DEFAULT_LASER_WAVELENGTH = 1550; +ACE_DEFAULT_LASER_BEAMSPREAD = 1; + +GVAR(laserEmitters) = HASH_CREATE; + +ADDON = true; diff --git a/addons/laser/config.cpp b/addons/laser/config.cpp index ad368cdc2d..d989c4f85b 100644 --- a/addons/laser/config.cpp +++ b/addons/laser/config.cpp @@ -1,16 +1,24 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_common" }; - VERSION_CONFIG; - }; -}; - -#include "CfgEventhandlers.hpp" -#include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" -#include "RscInGameUI.hpp" \ No newline at end of file +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventhandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "RscInGameUI.hpp" + +class ACE_newEvents { + laser_laserOff = "ace_laserOff"; + laser_laserOn = "ace_laserOn"; +}; diff --git a/addons/laser/functions/fnc_checkLos.sqf b/addons/laser/functions/fnc_checkLos.sqf index 9888642a80..0cbeffaea2 100644 --- a/addons/laser/functions/fnc_checkLos.sqf +++ b/addons/laser/functions/fnc_checkLos.sqf @@ -1,31 +1,31 @@ -#include "script_component.hpp" - -private ["_pos1", "_pos2", "_spacing", "_vectorTo", "_x", "_y", "_z", "_distance", "_count", "_return", "_alt", "_pos", "_designator", "_seeker"]; -_pos1 = _this select 0; -_pos2 = _this select 1; -_designator = _this select 2; -_seeker = _this select 3; -_spacing = 100; -if((count _this) > 4) then { - _spacing = _this select 4; -}; - -_return = true; -_vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY; - -_x = (_vectorTo select 0)*0.25; -_y = (_vectorTo select 1)*0.25; -_z = (_vectorTo select 2)*0.25; - -_pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z]; - -// player sideChat format["new los check"]; -if(terrainIntersect [_pos2, _pos1]) then { - _return = false; -} else { - if(lineIntersects [_pos2, _pos1]) then { // should take as arguments and add to this command objects to exclude - target and observer - // player sideChat format["with: %1", lineIntersectsWith [_pos1, _pos2]]; - _return = false; - }; -}; +#include "script_component.hpp" + +private ["_pos1", "_pos2", "_spacing", "_vectorTo", "_x", "_y", "_z", "_distance", "_count", "_return", "_alt", "_pos", "_designator", "_seeker"]; +_pos1 = _this select 0; +_pos2 = _this select 1; +_designator = _this select 2; +_seeker = _this select 3; +_spacing = 100; +if((count _this) > 4) then { + _spacing = _this select 4; +}; + +_return = true; +_vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY; + +_x = (_vectorTo select 0)*0.25; +_y = (_vectorTo select 1)*0.25; +_z = (_vectorTo select 2)*0.25; + +_pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z]; + +// player sideChat format["new los check"]; +if(terrainIntersect [_pos2, _pos1]) then { + _return = false; +} else { + if(lineIntersects [_pos2, _pos1]) then { // should take as arguments and add to this command objects to exclude - target and observer + // player sideChat format["with: %1", lineIntersectsWith [_pos1, _pos2]]; + _return = false; + }; +}; _return; \ No newline at end of file diff --git a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf index 8cdb497267..2f73236454 100644 --- a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf +++ b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf @@ -1,9 +1,9 @@ -// This is a debug function for displaying visible lasers for ourselves -#include "script_component.hpp" - -ACE_LOGINFO("Laser Emitter Dump"); - -{ - ACE_LOGINFO_1(" %1", _x); - ACE_LOGINFO_1(" %1",HASH_GET(GVAR(laserEmitters),_x)); -} forEach GVAR(laserEmitters) select 0; +// This is a debug function for displaying visible lasers for ourselves +#include "script_component.hpp" + +ACE_LOGINFO("Laser Emitter Dump"); + +{ + ACE_LOGINFO_1(" %1", _x); + ACE_LOGINFO_1(" %1",HASH_GET(GVAR(laserEmitters),_x)); +} forEach GVAR(laserEmitters) select 0; diff --git a/addons/laser/functions/fnc_findStrongestRay.sqf b/addons/laser/functions/fnc_findStrongestRay.sqf index 811b75d351..cd29768fd3 100644 --- a/addons/laser/functions/fnc_findStrongestRay.sqf +++ b/addons/laser/functions/fnc_findStrongestRay.sqf @@ -1,49 +1,49 @@ -#include "script_component.hpp" -private["_checkPos", "_i", "_largest", "_largestSpot", "_list", "_outliers", "_remainingSpots", "_samplePos", "_spot", "_spots", "_testPos"]; -_list = _this select 0; -_checkPos = _this select 1; -_spots = []; -_outliers = []; -_spot = []; -_testPos = (_list select 0) select 0; -{ - _samplePos = _x select 0; - if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then { - if(_samplePos distance _testPos < 2) then { - _spot pushBack _samplePos; - } else { - _outliers pushBack _samplePos; - }; - }; -} forEach _list; -_spots pushBack _spot; - -if(count _outliers > 0) then { - for "_i" from 1 to 3 do { - _remainingSpots = _outliers; - _outliers = []; - _spot = []; - _testPos = (_remainingSpots select 0); - { - _samplePos = _x; - if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then { - if(_samplePos distance _testPos < 2) then { - _spot pushBack _samplePos; - } else { - _outliers pushBack _samplePos; - }; - }; - } forEach _remainingSpots; - _spots pushBack _spot; - }; -}; -_largest = 0; -_largestSpot = []; -{ - if((count _x) > _largest) then { - _largest = (count _x); - _largestSpot = _x; - }; -} forEach _spots; -// player sideChat format["g: %1", _spots]; +#include "script_component.hpp" +private["_checkPos", "_i", "_largest", "_largestSpot", "_list", "_outliers", "_remainingSpots", "_samplePos", "_spot", "_spots", "_testPos"]; +_list = _this select 0; +_checkPos = _this select 1; +_spots = []; +_outliers = []; +_spot = []; +_testPos = (_list select 0) select 0; +{ + _samplePos = _x select 0; + if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then { + if(_samplePos distance _testPos < 2) then { + _spot pushBack _samplePos; + } else { + _outliers pushBack _samplePos; + }; + }; +} forEach _list; +_spots pushBack _spot; + +if(count _outliers > 0) then { + for "_i" from 1 to 3 do { + _remainingSpots = _outliers; + _outliers = []; + _spot = []; + _testPos = (_remainingSpots select 0); + { + _samplePos = _x; + if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then { + if(_samplePos distance _testPos < 2) then { + _spot pushBack _samplePos; + } else { + _outliers pushBack _samplePos; + }; + }; + } forEach _remainingSpots; + _spots pushBack _spot; + }; +}; +_largest = 0; +_largestSpot = []; +{ + if((count _x) > _largest) then { + _largest = (count _x); + _largestSpot = _x; + }; +} forEach _spots; +// player sideChat format["g: %1", _spots]; _largestSpot select (random (floor(count _largestSpot))); \ No newline at end of file diff --git a/addons/laser/functions/fnc_handleLaserOff.sqf b/addons/laser/functions/fnc_handleLaserOff.sqf index 573bd8197b..73235592a1 100644 --- a/addons/laser/functions/fnc_handleLaserOff.sqf +++ b/addons/laser/functions/fnc_handleLaserOff.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" private ["_uuid"]; -_uuid = _this select 0; -if(HASH_HASKEY(GVAR(laserEmitters), _uuid)) then { - HASH_REM(GVAR(laserEmitters), _uuid); -}; +_uuid = _this select 0; +if(HASH_HASKEY(GVAR(laserEmitters), _uuid)) then { + HASH_REM(GVAR(laserEmitters), _uuid); +}; diff --git a/addons/laser/functions/fnc_handleLaserOn.sqf b/addons/laser/functions/fnc_handleLaserOn.sqf index bac53a8957..0fe2b0fa44 100644 --- a/addons/laser/functions/fnc_handleLaserOn.sqf +++ b/addons/laser/functions/fnc_handleLaserOn.sqf @@ -2,6 +2,6 @@ #include "script_component.hpp" private ["_uuid", "_args"]; -_uuid = _this select 0; -_args = _this select 1; -HASH_SET(GVAR(laserEmitters), _uuid, _args); +_uuid = _this select 0; +_args = _this select 1; +HASH_SET(GVAR(laserEmitters), _uuid, _args); diff --git a/addons/laser/functions/fnc_keyLaserCodeDown.sqf b/addons/laser/functions/fnc_keyLaserCodeDown.sqf index f833c477c6..d428a3b81c 100644 --- a/addons/laser/functions/fnc_keyLaserCodeDown.sqf +++ b/addons/laser/functions/fnc_keyLaserCodeDown.sqf @@ -1,12 +1,12 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -private["_oldLaserCode", "_laserCode"]; - -_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; -if(_oldLaserCode > ACE_DEFAULT_LASER_CODE) then { - _laserCode = _oldLaserCode - 1; - ACE_player setVariable [QGVAR(code), _laserCode, false]; -}; -if(_laserCode != _oldLaserCode) then { - [format ["%1: %2", localize LSTRING(laserCode), _laserCode]] call EFUNC(common,displayTextStructured); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +private["_oldLaserCode", "_laserCode"]; + +_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; +if(_oldLaserCode > ACE_DEFAULT_LASER_CODE) then { + _laserCode = _oldLaserCode - 1; + ACE_player setVariable [QGVAR(code), _laserCode, false]; +}; +if(_laserCode != _oldLaserCode) then { + [format ["%1: %2", localize LSTRING(laserCode), _laserCode]] call EFUNC(common,displayTextStructured); }; \ No newline at end of file diff --git a/addons/laser/functions/fnc_keyLaserCodeUp.sqf b/addons/laser/functions/fnc_keyLaserCodeUp.sqf index 5357cec14c..926bce5c26 100644 --- a/addons/laser/functions/fnc_keyLaserCodeUp.sqf +++ b/addons/laser/functions/fnc_keyLaserCodeUp.sqf @@ -1,10 +1,10 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -private["_oldLaserCode", "_laserCode"]; - -_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; -_laserCode = _oldLaserCode + 1; -ACE_player setVariable [QGVAR(code), _laserCode, false]; -if(_laserCode != _oldLaserCode) then { -[format ["%1: %2", localize LSTRING(laserCode), _laserCode]] call EFUNC(common,displayTextStructured); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +private["_oldLaserCode", "_laserCode"]; + +_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; +_laserCode = _oldLaserCode + 1; +ACE_player setVariable [QGVAR(code), _laserCode, false]; +if(_laserCode != _oldLaserCode) then { +[format ["%1: %2", localize LSTRING(laserCode), _laserCode]] call EFUNC(common,displayTextStructured); }; \ No newline at end of file diff --git a/addons/laser/functions/fnc_laserOff.sqf b/addons/laser/functions/fnc_laserOff.sqf index 7899ec1253..9a3e663d14 100644 --- a/addons/laser/functions/fnc_laserOff.sqf +++ b/addons/laser/functions/fnc_laserOff.sqf @@ -5,12 +5,12 @@ * Arguments: * 0: UUID (from laserOn) * - * Return value: + * Return Value: * None */ #include "script_component.hpp" private ["_uuid"]; -_uuid = _this select 0; -["laser_laserOff", [_uuid]] call EFUNC(common,globalEvent); +_uuid = _this select 0; +["ace_laserOff", [_uuid]] call CBA_fnc_globalEvent; diff --git a/addons/laser/functions/fnc_laserOn.sqf b/addons/laser/functions/fnc_laserOn.sqf index 901fa04b9a..a9e5a00d4c 100644 --- a/addons/laser/functions/fnc_laserOn.sqf +++ b/addons/laser/functions/fnc_laserOn.sqf @@ -10,14 +10,14 @@ * 4: Laser code * 5: Beam divergence (in mils off beam center). * - * Return value: + * Return Value: * String, UUID for sending to laserOff function. */ #include "script_component.hpp" private ["_uuid", "_args"]; -_uuid = format["%1%2%3", floor ACE_diagTime, floor random 1000, floor random 10000]; -_args = [_uuid, _this]; -["laser_laserOn", _args] call EFUNC(common,globalEvent); -_uuid; +_uuid = format["%1%2%3", floor diag_tickTime, floor random 1000, floor random 10000]; +_args = [_uuid, _this]; +["ace_laserOn", _args] call CBA_fnc_globalEvent; +_uuid; diff --git a/addons/laser/functions/fnc_laserTargetPFH.sqf b/addons/laser/functions/fnc_laserTargetPFH.sqf index 8726ce4201..ba3df3376a 100644 --- a/addons/laser/functions/fnc_laserTargetPFH.sqf +++ b/addons/laser/functions/fnc_laserTargetPFH.sqf @@ -1,30 +1,30 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -private["_args", "_laserTarget", "_pos", "_shooter", "_uuid"]; -//TRACE_1("enter", _this); -_args = _this select 0; -_laserTarget = _args select 0; -_shooter = _args select 1; -_uuid = _args select 2; - -if(isNull _laserTarget || !alive _shooter) exitWith { - [(_this select 1)] call CBA_fnc_removePerFrameHandler; - REM(GVAR(VanillaLasers), _laserTarget); - - // Remove laseron - [_uuid] call FUNC(laserOff); -}; - -#ifdef DEBUG_MODE_FULL -// Iconize the location of the actual laserTarget -_pos = getPosASL _laserTarget; -drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], (ASLtoATL _pos), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"]; - -{ - drawLine3D [ASLtoATL (_x select 0), ASLtoATL (_x select 1), (_x select 2)]; - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", (_x select 2), ASLtoATL (_x select 1), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"]; -} forEach DRAW_LINES; -DRAW_LINES = []; -#endif +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +private["_args", "_laserTarget", "_pos", "_shooter", "_uuid"]; +//TRACE_1("enter", _this); +_args = _this select 0; +_laserTarget = _args select 0; +_shooter = _args select 1; +_uuid = _args select 2; + +if(isNull _laserTarget || !alive _shooter) exitWith { + [(_this select 1)] call CBA_fnc_removePerFrameHandler; + REM(GVAR(VanillaLasers), _laserTarget); + + // Remove laseron + [_uuid] call FUNC(laserOff); +}; + +#ifdef DEBUG_MODE_FULL +// Iconize the location of the actual laserTarget +_pos = getPosASL _laserTarget; +drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\select_target_ca.paa", [1,0,0,1], (ASLtoATL _pos), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"]; + +{ + drawLine3D [ASLtoATL (_x select 0), ASLtoATL (_x select 1), (_x select 2)]; + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", (_x select 2), ASLtoATL (_x select 1), 0.75, 0.75, 0, "", 0.5, 0.025, "TahomaB"]; +} forEach DRAW_LINES; +DRAW_LINES = []; +#endif diff --git a/addons/laser/functions/fnc_laser_init.sqf b/addons/laser/functions/fnc_laser_init.sqf index 304cd5938a..2e61eb3587 100644 --- a/addons/laser/functions/fnc_laser_init.sqf +++ b/addons/laser/functions/fnc_laser_init.sqf @@ -1,33 +1,33 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -TRACE_1("enter", _this); - -PARAMS_1(_laserTarget); -private["_uuid"]; - -// Add the target to the global targets array -// Everyone tracks them -// Add the laser localized to the laser array, and give it the default localized code -PUSH(GVAR(VanillaLasers), _laserTarget); - -// Check the vehicle, otherwise use the default -_laserTarget setVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE, false]; -_laserTarget setVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD, false]; -_laserTarget setVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH, false]; - -// Clean the lasers of any null objects while we are here -REM(GVAR(VanillaLasers), objNull); - -if(!(local _laserTarget)) exitWith { }; - -// The target is local, so its on this client -if(!isDedicated) then { - // @TODO: Get ownership variables and set them on the vehicle - - _uuid = [(vehicle ACE_player), ACE_player, QFUNC(vanillaLaserSeekerHandler), ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_CODE, ACE_DEFAULT_LASER_BEAMSPREAD] call FUNC(laserOn); - _laserTarget setVariable [QGVAR(uuid), _uuid, false]; - [FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player, _uuid]] call CBA_fnc_addPerFrameHandler; -} else { - // server side ownership of laser - _laserTarget setVariable [QGVAR(owner), nil, true]; -}; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +TRACE_1("enter", _this); + +PARAMS_1(_laserTarget); +private["_uuid"]; + +// Add the target to the global targets array +// Everyone tracks them +// Add the laser localized to the laser array, and give it the default localized code +PUSH(GVAR(VanillaLasers), _laserTarget); + +// Check the vehicle, otherwise use the default +_laserTarget setVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE, false]; +_laserTarget setVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD, false]; +_laserTarget setVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH, false]; + +// Clean the lasers of any null objects while we are here +REM(GVAR(VanillaLasers), objNull); + +if(!(local _laserTarget)) exitWith { }; + +// The target is local, so its on this client +if(!isDedicated) then { + // @TODO: Get ownership variables and set them on the vehicle + + _uuid = [(vehicle ACE_player), ACE_player, QFUNC(vanillaLaserSeekerHandler), ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_CODE, ACE_DEFAULT_LASER_BEAMSPREAD] call FUNC(laserOn); + _laserTarget setVariable [QGVAR(uuid), _uuid, false]; + [FUNC(laserTargetPFH), 0, [_laserTarget, ACE_player, _uuid]] call CBA_fnc_addPerFrameHandler; +} else { + // server side ownership of laser + _laserTarget setVariable [QGVAR(owner), nil, true]; +}; diff --git a/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf b/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf index 7f8537ab9b..8c60cd3c33 100644 --- a/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf +++ b/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf @@ -1,15 +1,15 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -private["_laserCode"]; - -_laserCode = ACE_player getVariable[QGVAR(code), ACE_DEFAULT_LASER_CODE]; -if(!isNil "_laserCode") then { - __LaserDesignatorIGUI_LaserCode ctrlSetText format["Code: %1", [_laserCode, 4, 0, false] call CBA_fnc_formatNumber]; -}; - -if(! (ctrlShown __LaserDesignatorIGUI_LaserOn) ) then { - // TODO: hide distance - __LaserDesignatorIGUI_ACE_Distance ctrlSetText "----"; -} else { - __LaserDesignatorIGUI_ACE_Distance ctrlSetText (ctrlText __LaserDesignatorIGUI_CA_Distance); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +private["_laserCode"]; + +_laserCode = ACE_player getVariable[QGVAR(code), ACE_DEFAULT_LASER_CODE]; +if(!isNil "_laserCode") then { + __LaserDesignatorIGUI_LaserCode ctrlSetText format["Code: %1", [_laserCode, 4, 0, false] call CBA_fnc_formatNumber]; +}; + +if(! (ctrlShown __LaserDesignatorIGUI_LaserOn) ) then { + // TODO: hide distance + __LaserDesignatorIGUI_ACE_Distance ctrlSetText "----"; +} else { + __LaserDesignatorIGUI_ACE_Distance ctrlSetText (ctrlText __LaserDesignatorIGUI_CA_Distance); }; \ No newline at end of file diff --git a/addons/laser/functions/fnc_rotateVectLine.sqf b/addons/laser/functions/fnc_rotateVectLine.sqf index 8bae491c4e..f748975dab 100644 --- a/addons/laser/functions/fnc_rotateVectLine.sqf +++ b/addons/laser/functions/fnc_rotateVectLine.sqf @@ -1,36 +1,36 @@ -#include "script_component.hpp" -private["_d", "_map", "_p", "_theta", "_u"]; -_map = _this select 0; -_theta = _this select 1; - -_p = _map select 0; -_p1 = _map select 1; -_p2 = _map select 2; - -_q1 = +(_map select 3); -_q2 = +(_map select 4); -_u = _map select 5; -_d = _map select 6; - -/* Step 4 */ -_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; -_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; -_q2 set[2, (_q1 select 2)]; - -/* Inverse of step 3 */ -_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -/* Inverse of step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Inverse of step 1 */ -_q1 = _q2 vectorAdd _p1; +#include "script_component.hpp" +private["_d", "_map", "_p", "_theta", "_u"]; +_map = _this select 0; +_theta = _this select 1; + +_p = _map select 0; +_p1 = _map select 1; +_p2 = _map select 2; + +_q1 = +(_map select 3); +_q2 = +(_map select 4); +_u = _map select 5; +_d = _map select 6; + +/* Step 4 */ +_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; +_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; +_q2 set[2, (_q1 select 2)]; + +/* Inverse of step 3 */ +_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; +_q1 set[1, (_q2 select 1)]; +_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; + +/* Inverse of step 2 */ +if (_d != 0) then { + _q2 set[0, (_q1 select 0)]; + _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; + _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; +} else { + _q2 = _q1; +}; + +/* Inverse of step 1 */ +_q1 = _q2 vectorAdd _p1; _q1; \ No newline at end of file diff --git a/addons/laser/functions/fnc_rotateVectLineGetMap.sqf b/addons/laser/functions/fnc_rotateVectLineGetMap.sqf index dc4b1b54c3..53ee35a288 100644 --- a/addons/laser/functions/fnc_rotateVectLineGetMap.sqf +++ b/addons/laser/functions/fnc_rotateVectLineGetMap.sqf @@ -1,30 +1,30 @@ -#include "script_component.hpp" - -private ["_p", "_theta", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; -_p = _this select 0; -_p1 = _this select 1; -_p2 = _this select 2; - -_q2 = []; - -/* Step 1 */ -_q1 = _p vectorDiff _p1; -_u = _p2 vectorDiff _p1; -_u = vectorNormalized _u; -_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); - -/* Step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Step 3 */ -_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - +#include "script_component.hpp" + +private ["_p", "_theta", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; +_p = _this select 0; +_p1 = _this select 1; +_p2 = _this select 2; + +_q2 = []; + +/* Step 1 */ +_q1 = _p vectorDiff _p1; +_u = _p2 vectorDiff _p1; +_u = vectorNormalized _u; +_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); + +/* Step 2 */ +if (_d != 0) then { + _q2 set[0, (_q1 select 0)]; + _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; + _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; +} else { + _q2 = _q1; +}; + +/* Step 3 */ +_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; +_q1 set[1, (_q2 select 1)]; +_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; + [_p, _p1, _p2, _q1, _q2, _u, _d] \ No newline at end of file diff --git a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf index 45b60a69c1..05e4a50dcf 100644 --- a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf +++ b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf @@ -1,158 +1,158 @@ -/* - * Author: Nou - * Turn a laser designator on. - * - * Arguments: - * 0: Position of seeker (ASL) - * 1: Direction vector (will be normalized) - * 2: Seeker FOV in degrees - * 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. - * 4: Seeker laser code. - * - * Return value: - * Array, [Strongest compatible laser spot ASL pos, owner object] Nil array values if nothing found. - */ - -#include "script_component.hpp" - -private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"]; -private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"]; -private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"]; -private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"]; - -_pos = _this select 0; -_dir = vectorNormalized (_this select 1); -_seekerFov = _this select 2; -_seekerWavelengths = _this select 3; -_seekerCode = _this select 4; - - -_seekerCos = cos _seekerFov; - -_spots = []; -_buckets = []; -_excludes = []; -_bucketIndex = 0; -_finalPos = nil; -_finalOwner = nil; - -{ - _obj = _x select 0; - _owner = _x select 1; - _method = _x select 2; - _emitterWavelength = _x select 3; - _laserCode = _x select 4; - _divergence = _x select 5; - if(alive _obj && {_emitterWavelength >= (_seekerWavelengths select 0)} && {_emitterWavelength <= (_seekerWavelengths select 1)} && {_laserCode == _seekerCode}) then { - _laser = []; - if(IS_CODE(_method)) then { - _laser = _x call _method; - } else { - if(IS_STRING(_method)) then { - _laser = _x call (missionNamespace getVariable [_method, {}]); - } else { - if(IS_ARRAY(_method)) then { - if(count _method == 2) then { - _laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), _obj weaponDirection (_method select 1)]; - } else { - if(count _method == 3) then { - _laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), (ATLtoASL (_obj modelToWorldVisual (_method select 1))) vectorFromTo (ATLtoASL (_obj modelToWorldVisual (_method select 2)))]; - }; - }; - }; - }; - }; - - //Handle Weird Data Return - if (_laser params [["_laserPos", [], [[]], 3], ["_laserDir", [], [[]], 3]]) then { - _res = [_laserPos, _laserDir, _divergence] call FUNC(shootCone); - { - _testPoint = _x select 0; - _testPointVector = vectorNormalized (_testPoint vectorDiff _pos); - _testDotProduct = _dir vectorDotProduct _testPointVector; - if(_testDotProduct > _seekerCos) then { - _spots pushBack [_testPoint, _owner]; - }; - } forEach (_res select 2); - }; - }; -} forEach (GVAR(laserEmitters) select 1); - -if((count _spots) > 0) then { - _bucketPos = nil; - _bucketList = nil; - _c = 0; - while { count(_spots) != count(_excludes) && _c < (count _spots) } do { - scopeName "mainSearch"; - { - if(!(_forEachIndex in _excludes)) then { - _index = _buckets pushBack [_x, [_x]]; - _excludes pushBack _forEachIndex; - _bucketPos = _x select 0; - _bucketList = (_buckets select _index) select 1; - breakTo "mainSearch"; - }; - } forEach _spots; - { - if(!(_forEachIndex in _excludes)) then { - _testPos = (_x select 0); - if(_testPos vectorDistanceSqr _bucketPos <= 100) then { - _bucketList pushBack _x; - _excludes pushBack _forEachIndex; - }; - }; - } forEach _spots; - _c = _c + 1; - }; - _finalBuckets = []; - _largest = -1; - _largestIndex = 0; - { - _index = _finalBuckets pushBack []; - _bucketList = _finalBuckets select _index; - { - _testPos = (_x select 0); - if(!terrainIntersectASL [_pos, _testPos] && {!lineIntersects [_pos, _testPos]}) then { - _bucketList pushBack _x; - }; - } forEach (_x select 1); - if((count _bucketList) > _largest) then { - _largest = (count _bucketList); - _largestIndex = _index; - }; - } forEach _buckets; - - _finalBucket = _finalBuckets select _largestIndex; - _owners = HASH_CREATE; - - if(count _finalBucket > 0) then { - _avgX = 0; - _avgY = 0; - _avgZ = 0; - { - //player sideChat format["x: %1", _x]; - _avgX = _avgX + ((_x select 0) select 0); - _avgY = _avgY + ((_x select 0) select 1); - _avgZ = _avgZ + ((_x select 0) select 2); - _owner = _x select 1; - if(HASH_HASKEY(_owners, _owner)) then { - _count = HASH_GET(_owners, _owner); - HASH_SET(_owners, _owner, _count+1); - } else { - HASH_SET(_owners, _owner, 1); - }; - } forEach _finalBucket; - _count = count _finalBucket; - _finalPos = [_avgX/_count, _avgY/_count, _avgZ/_count]; - _maxOwner = -1; - _maxOwnerIndex = 0; - { - if((_owners select 1) select _forEachIndex > _maxOwner) then { - _maxOwner = (_owners select 1) select _forEachIndex; - _maxOwnerIndex = _forEachIndex; - }; - } forEach (_owners select 0); - _finalOwner = (_owners select 0) select _maxOwnerIndex; - }; -}; -[_finalPos, _owner]; +/* + * Author: Nou + * Turn a laser designator on. + * + * Arguments: + * 0: Position of seeker (ASL) + * 1: Direction vector (will be normalized) + * 2: Seeker FOV in degrees + * 3: Seeker wavelength sensitivity range, [1550,1550] is common eye safe. + * 4: Seeker laser code. + * + * Return Value: + * Array, [Strongest compatible laser spot ASL pos, owner object] Nil array values if nothing found. + */ + +#include "script_component.hpp" + +private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"]; +private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"]; +private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"]; +private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"]; + +_pos = _this select 0; +_dir = vectorNormalized (_this select 1); +_seekerFov = _this select 2; +_seekerWavelengths = _this select 3; +_seekerCode = _this select 4; + + +_seekerCos = cos _seekerFov; + +_spots = []; +_buckets = []; +_excludes = []; +_bucketIndex = 0; +_finalPos = nil; +_finalOwner = nil; + +{ + _obj = _x select 0; + _owner = _x select 1; + _method = _x select 2; + _emitterWavelength = _x select 3; + _laserCode = _x select 4; + _divergence = _x select 5; + if(alive _obj && {_emitterWavelength >= (_seekerWavelengths select 0)} && {_emitterWavelength <= (_seekerWavelengths select 1)} && {_laserCode == _seekerCode}) then { + _laser = []; + if(IS_CODE(_method)) then { + _laser = _x call _method; + } else { + if(IS_STRING(_method)) then { + _laser = _x call (missionNamespace getVariable [_method, {}]); + } else { + if(IS_ARRAY(_method)) then { + if(count _method == 2) then { + _laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), _obj weaponDirection (_method select 1)]; + } else { + if(count _method == 3) then { + _laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), (ATLtoASL (_obj modelToWorldVisual (_method select 1))) vectorFromTo (ATLtoASL (_obj modelToWorldVisual (_method select 2)))]; + }; + }; + }; + }; + }; + + //Handle Weird Data Return + if (_laser params [["_laserPos", [], [[]], 3], ["_laserDir", [], [[]], 3]]) then { + _res = [_laserPos, _laserDir, _divergence] call FUNC(shootCone); + { + _testPoint = _x select 0; + _testPointVector = vectorNormalized (_testPoint vectorDiff _pos); + _testDotProduct = _dir vectorDotProduct _testPointVector; + if(_testDotProduct > _seekerCos) then { + _spots pushBack [_testPoint, _owner]; + }; + } forEach (_res select 2); + }; + }; +} forEach (GVAR(laserEmitters) select 1); + +if((count _spots) > 0) then { + _bucketPos = nil; + _bucketList = nil; + _c = 0; + while { count(_spots) != count(_excludes) && _c < (count _spots) } do { + scopeName "mainSearch"; + { + if(!(_forEachIndex in _excludes)) then { + _index = _buckets pushBack [_x, [_x]]; + _excludes pushBack _forEachIndex; + _bucketPos = _x select 0; + _bucketList = (_buckets select _index) select 1; + breakTo "mainSearch"; + }; + } forEach _spots; + { + if(!(_forEachIndex in _excludes)) then { + _testPos = (_x select 0); + if(_testPos vectorDistanceSqr _bucketPos <= 100) then { + _bucketList pushBack _x; + _excludes pushBack _forEachIndex; + }; + }; + } forEach _spots; + _c = _c + 1; + }; + _finalBuckets = []; + _largest = -1; + _largestIndex = 0; + { + _index = _finalBuckets pushBack []; + _bucketList = _finalBuckets select _index; + { + _testPos = (_x select 0); + if(!terrainIntersectASL [_pos, _testPos] && {!lineIntersects [_pos, _testPos]}) then { + _bucketList pushBack _x; + }; + } forEach (_x select 1); + if((count _bucketList) > _largest) then { + _largest = (count _bucketList); + _largestIndex = _index; + }; + } forEach _buckets; + + _finalBucket = _finalBuckets select _largestIndex; + _owners = HASH_CREATE; + + if(count _finalBucket > 0) then { + _avgX = 0; + _avgY = 0; + _avgZ = 0; + { + //player sideChat format["x: %1", _x]; + _avgX = _avgX + ((_x select 0) select 0); + _avgY = _avgY + ((_x select 0) select 1); + _avgZ = _avgZ + ((_x select 0) select 2); + _owner = _x select 1; + if(HASH_HASKEY(_owners, _owner)) then { + _count = HASH_GET(_owners, _owner); + HASH_SET(_owners, _owner, _count+1); + } else { + HASH_SET(_owners, _owner, 1); + }; + } forEach _finalBucket; + _count = count _finalBucket; + _finalPos = [_avgX/_count, _avgY/_count, _avgZ/_count]; + _maxOwner = -1; + _maxOwnerIndex = 0; + { + if((_owners select 1) select _forEachIndex > _maxOwner) then { + _maxOwner = (_owners select 1) select _forEachIndex; + _maxOwnerIndex = _forEachIndex; + }; + } forEach (_owners select 0); + _finalOwner = (_owners select 0) select _maxOwnerIndex; + }; +}; +[_finalPos, _owner]; diff --git a/addons/laser/functions/fnc_shootCone.sqf b/addons/laser/functions/fnc_shootCone.sqf index a7187aa0e4..a9e1f3e50d 100644 --- a/addons/laser/functions/fnc_shootCone.sqf +++ b/addons/laser/functions/fnc_shootCone.sqf @@ -1,68 +1,68 @@ -#include "script_component.hpp" -//#define DEBUG_MODE_FULL -private ["_i", "_divergence","_pos","_vec","_longestReturn","_shortestReturn","_resultPositions","_p1","_p2","_p","_v","_cp","_vecRotateMap","_result", "_resultPos","_distance","_count","_pos2","_radOffset","_offset","_offsetPos","_offsetVector"]; -_divergence = 0.3; -_pos = _this select 0; -_vec = _this select 1; -if(count _this > 2) then { - _divergence = _this select 2; -}; -_count = 3; -if(count _this > 3) then { - _count = _this select 3; -}; -_longestReturn = -1000000000; -_shortestReturn = 1000000000; -_resultPositions = []; -_p1 = [0,0,0]; -_p2 = +_vec; -_p = (_vec call CBA_fnc_vect2polar); -_v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; -_cp = _vec vectorCrossProduct _v; - -_vecRotateMap = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); - -_result = [_pos, _vec] call FUNC(shootRay); -_resultPos = _result select 0; -if(!isNil "_resultPos") then { - _distance = _result select 1; - if(_distance < _shortestReturn) then { - _shortestReturn = _distance; - }; - if(_distance > _longestReturn) then { - _longestReturn = _distance; - }; - _resultPositions pushBack _result; -#ifdef DEBUG_MODE_FULL - // DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]]; - drawLine3D [ASLtoATL _pos, ASLtoATL _resultPos, [1,0,0,1]]; -#endif -}; - - -_pos2 = _pos vectorAdd (_vec vectorMultiply 1000); -{ - for "_i" from 0 to ceil(_count*_x) do { - _radOffset = random 360; - _offset = [_vecRotateMap, (((360/_count)*_i)+_radOffset) mod 360] call FUNC(rotateVectLine); - _offsetPos = _pos2 vectorAdd (_offset vectorMultiply (_divergence*_x)); - _offsetVector = _pos vectorFromTo _offsetPos; - _result = [_pos, _offsetVector] call FUNC(shootRay); - _resultPos = _result select 0; - if(!isNil "_resultPos") then { - _distance = _result select 1; - if(_distance < _shortestReturn) then { - _shortestReturn = _distance; - }; - if(_distance > _longestReturn) then { - _longestReturn = _distance; - }; - _resultPositions pushBack _result; -#ifdef DEBUG_MODE_FULL - // DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]]; - drawLine3D [ASLtoATL _pos, ASLtoATL _resultPos, [1,0,0,1]]; -#endif - }; - }; -} forEach [1,0.5,0.25]; +#include "script_component.hpp" +//#define DEBUG_MODE_FULL +private ["_i", "_divergence","_pos","_vec","_longestReturn","_shortestReturn","_resultPositions","_p1","_p2","_p","_v","_cp","_vecRotateMap","_result", "_resultPos","_distance","_count","_pos2","_radOffset","_offset","_offsetPos","_offsetVector"]; +_divergence = 0.3; +_pos = _this select 0; +_vec = _this select 1; +if(count _this > 2) then { + _divergence = _this select 2; +}; +_count = 3; +if(count _this > 3) then { + _count = _this select 3; +}; +_longestReturn = -1000000000; +_shortestReturn = 1000000000; +_resultPositions = []; +_p1 = [0,0,0]; +_p2 = +_vec; +_p = (_vec call CBA_fnc_vect2polar); +_v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; +_cp = _vec vectorCrossProduct _v; + +_vecRotateMap = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); + +_result = [_pos, _vec] call FUNC(shootRay); +_resultPos = _result select 0; +if(!isNil "_resultPos") then { + _distance = _result select 1; + if(_distance < _shortestReturn) then { + _shortestReturn = _distance; + }; + if(_distance > _longestReturn) then { + _longestReturn = _distance; + }; + _resultPositions pushBack _result; +#ifdef DEBUG_MODE_FULL + // DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]]; + drawLine3D [ASLtoATL _pos, ASLtoATL _resultPos, [1,0,0,1]]; +#endif +}; + + +_pos2 = _pos vectorAdd (_vec vectorMultiply 1000); +{ + for "_i" from 0 to ceil(_count*_x) do { + _radOffset = random 360; + _offset = [_vecRotateMap, (((360/_count)*_i)+_radOffset) mod 360] call FUNC(rotateVectLine); + _offsetPos = _pos2 vectorAdd (_offset vectorMultiply (_divergence*_x)); + _offsetVector = _pos vectorFromTo _offsetPos; + _result = [_pos, _offsetVector] call FUNC(shootRay); + _resultPos = _result select 0; + if(!isNil "_resultPos") then { + _distance = _result select 1; + if(_distance < _shortestReturn) then { + _shortestReturn = _distance; + }; + if(_distance > _longestReturn) then { + _longestReturn = _distance; + }; + _resultPositions pushBack _result; +#ifdef DEBUG_MODE_FULL + // DRAW_LINES set[(count DRAW_LINES), [_pos, _resultPos, [0, 1, 0, 1]]]; + drawLine3D [ASLtoATL _pos, ASLtoATL _resultPos, [1,0,0,1]]; +#endif + }; + }; +} forEach [1,0.5,0.25]; [_longestReturn, _shortestReturn, _resultPositions]; \ No newline at end of file diff --git a/addons/laser/functions/fnc_shootRay.sqf b/addons/laser/functions/fnc_shootRay.sqf index 83b257ed7b..51b5e55f17 100644 --- a/addons/laser/functions/fnc_shootRay.sqf +++ b/addons/laser/functions/fnc_shootRay.sqf @@ -1,24 +1,24 @@ -#include "script_component.hpp" - -private ["_pos", "_vec", "_distance", "_resultPos", "_fidelity", "_lastPos", "_i", "_nextPos"]; -scopeName "main"; -_pos = _this select 0; -_vec = _this select 1; -_distance = 0; -_resultPos = nil; -_fidelity = [1000,100,10,1,0.1]; -_lastPos = +_pos; -{ - scopeName "mainSearch"; - for "_i" from 1 to 10 do { - _nextPos = _lastPos vectorAdd (_vec vectorMultiply _x); - if(terrainIntersectASL [_lastPos, _nextPos] || {lineIntersects [_lastPos, _nextPos]}) then { - _resultPos = _lastPos; - breakTo "mainSearch"; - } else { - _distance = _distance + _x; - _lastPos = _nextPos; - }; - }; -} forEach _fidelity; +#include "script_component.hpp" + +private ["_pos", "_vec", "_distance", "_resultPos", "_fidelity", "_lastPos", "_i", "_nextPos"]; +scopeName "main"; +_pos = _this select 0; +_vec = _this select 1; +_distance = 0; +_resultPos = nil; +_fidelity = [1000,100,10,1,0.1]; +_lastPos = +_pos; +{ + scopeName "mainSearch"; + for "_i" from 1 to 10 do { + _nextPos = _lastPos vectorAdd (_vec vectorMultiply _x); + if(terrainIntersectASL [_lastPos, _nextPos] || {lineIntersects [_lastPos, _nextPos]}) then { + _resultPos = _lastPos; + breakTo "mainSearch"; + } else { + _distance = _distance + _x; + _lastPos = _nextPos; + }; + }; +} forEach _fidelity; [_resultPos, _distance]; \ No newline at end of file diff --git a/addons/laser/functions/fnc_unitTurretCanLockLaser.sqf b/addons/laser/functions/fnc_unitTurretCanLockLaser.sqf index a82e42400a..9fe478f623 100644 --- a/addons/laser/functions/fnc_unitTurretCanLockLaser.sqf +++ b/addons/laser/functions/fnc_unitTurretCanLockLaser.sqf @@ -2,10 +2,10 @@ * Author: jaynus * Checks if the turret occupied by the given unit can lock a laser designator and select laser code. * - * Argument: + * Arguments: * 0: Unit * - * Return value: + * Return Value: * Has designator? */ #include "script_component.hpp" diff --git a/addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf b/addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf index 091c4f7acf..5464e9711c 100644 --- a/addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf +++ b/addons/laser/functions/fnc_vanillaLaserSeekerHandler.sqf @@ -1,26 +1,26 @@ -/* - * Author: jaynus - * Handler function for laser network code. - * - * Argument: - * 0: Emitter - * 1: Owner - * - * Return value: - * [position, direction] - */ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"]; - -_emmiter = _this select 0; -_owner = _this select 1; - -// Not in a vehicle.... -// @TODO: handle lasering from turrets -if( (vehicle _emmiter) == _emmiter && alive _emmiter && (currentWeapon _emmiter) == "LaserDesignator") exitWith { - [(eyePos _emmiter), (eyeDirection _emmiter)] -}; - +/* + * Author: jaynus + * Handler function for laser network code. + * + * Arguments: + * 0: Emitter + * 1: Owner + * + * Return Value: + * [position, direction] + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"]; + +_emmiter = _this select 0; +_owner = _this select 1; + +// Not in a vehicle.... +// @TODO: handle lasering from turrets +if( (vehicle _emmiter) == _emmiter && alive _emmiter && (currentWeapon _emmiter) == "LaserDesignator") exitWith { + [(eyePos _emmiter), (eyeDirection _emmiter)] +}; + [-1,-1] \ No newline at end of file diff --git a/addons/laser/initKeybinds.sqf b/addons/laser/initKeybinds.sqf index 25fdd2ddcc..8ae9d05e9f 100644 --- a/addons/laser/initKeybinds.sqf +++ b/addons/laser/initKeybinds.sqf @@ -1,27 +1,27 @@ -["ACE3 Equipment", QGVAR(LaserCodeUp), localize LSTRING(laserCodeUp), -{ - if( EGVAR(laser_selfdesignate,active) - || - { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || - { [ACE_player] call FUNC(unitTurretCanLockLaser) } - ) then { - [] call FUNC(keyLaserCodeUp); - }; -}, -{false}, -[16, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+Q) - -["ACE3 Equipment", QGVAR(LaserCodeDown), localize LSTRING(laserCodeDown), -{ - if( EGVAR(laser_selfdesignate,active) - || - { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. - || - { [ACE_player] call FUNC(unitTurretCanLockLaser) } - ) then { - [] call FUNC(keyLaserCodeDown); - }; -}, -{false}, -[18, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) +["ACE3 Equipment", QGVAR(LaserCodeUp), localize LSTRING(laserCodeUp), +{ + if( EGVAR(laser_selfdesignate,active) + || + { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. + || + { [ACE_player] call FUNC(unitTurretCanLockLaser) } + ) then { + [] call FUNC(keyLaserCodeUp); + }; +}, +{false}, +[16, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+Q) + +["ACE3 Equipment", QGVAR(LaserCodeDown), localize LSTRING(laserCodeDown), +{ + if( EGVAR(laser_selfdesignate,active) + || + { (currentWeapon ACE_player) == "Laserdesignator" && (call CBA_fnc_getFoV) select 1 > 5 } // If laserdesignator & FOV, we are in scope. + || + { [ACE_player] call FUNC(unitTurretCanLockLaser) } + ) then { + [] call FUNC(keyLaserCodeDown); + }; +}, +{false}, +[18, [false, true, true]], false, 0] call CBA_fnc_addKeybind; // (ALT+CTRL+E) diff --git a/addons/laser/script_component.hpp b/addons/laser/script_component.hpp index f3542f686f..a1c69183df 100644 --- a/addons/laser/script_component.hpp +++ b/addons/laser/script_component.hpp @@ -1,27 +1,28 @@ -#define COMPONENT laser -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_LASER - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_LASER - #define DEBUG_SETTINGS DEBUG_SETTINGS_LASER -#endif - -#include "\z\ace\addons\main\script_macros.hpp" - - -#define FIREMODE_DIRECT_LOAL 1 - - -#define __LaserDesignatorIGUI (uiNamespace getVariable ["ACE_RscOptics_LaserDesignator", nil]) -#define __LaserDesignatorIGUI_LaserCode (__LaserDesignatorIGUI displayCtrl 123001) -#define __LaserDesignatorIGUI_ACE_Distance (__LaserDesignatorIGUI displayCtrl 123002) -#define __LaserDesignatorIGUI_CA_Distance (__LaserDesignatorIGUI displayCtrl 151) -#define __LaserDesignatorIGUI_LaserOn (__LaserDesignatorIGUI displayCtrl 158) \ No newline at end of file +#define COMPONENT laser +#define COMPONENT_BEAUTIFIED Laser +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_LASER + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_LASER + #define DEBUG_SETTINGS DEBUG_SETTINGS_LASER +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define FIREMODE_DIRECT_LOAL 1 + + +#define __LaserDesignatorIGUI (uiNamespace getVariable ["ACE_RscOptics_LaserDesignator", nil]) +#define __LaserDesignatorIGUI_LaserCode (__LaserDesignatorIGUI displayCtrl 123001) +#define __LaserDesignatorIGUI_ACE_Distance (__LaserDesignatorIGUI displayCtrl 123002) +#define __LaserDesignatorIGUI_CA_Distance (__LaserDesignatorIGUI displayCtrl 151) +#define __LaserDesignatorIGUI_LaserOn (__LaserDesignatorIGUI displayCtrl 158) diff --git a/addons/laser_selfdesignate/CfgEventhandlers.hpp b/addons/laser_selfdesignate/CfgEventhandlers.hpp index cfa8d65d7c..0458ace904 100644 --- a/addons/laser_selfdesignate/CfgEventhandlers.hpp +++ b/addons/laser_selfdesignate/CfgEventhandlers.hpp @@ -1,26 +1,26 @@ - -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - }; -}; - -class Extended_Init_EventHandlers { - class Helicopter { - class ADDON { - init = QUOTE(_this call DFUNC(initDesignatorActions)); - }; - }; -}; + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + }; +}; + +class Extended_Init_EventHandlers { + class Helicopter { + class ADDON { + init = QUOTE(_this call DFUNC(initDesignatorActions)); + }; + }; +}; diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index 3e47e13ffd..8eb84326c5 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -1,49 +1,49 @@ -class CfgVehicles { - class AllVehicles; - class Air: AllVehicles { - class Turrets; - }; - - class Helicopter: Air { - class Turrets { - class MainTurret; - }; - }; - - class Helicopter_Base_F: Helicopter {}; - - class Heli_Attack_01_base_F: Helicopter_Base_F {}; - - class B_Heli_Attack_01_F: Heli_Attack_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - GVAR(Enabled) = 0; // Enable laser self-designation - }; - }; - }; - - class Plane: Air {}; - class Plane_Base_F: Plane { - class Turrets { - class CopilotTurret; - }; - }; - - /* @TODO: LGB GBU - class Plane_CAS_01_base_F: Plane_Base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - GVAR(Enabled) = 1; // Enable laser self-designation - }; - }; - }; - - class Plane_CAS_02_base_F: Plane_Base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - GVAR(Enabled) = 1; // Enable laser self-designation - }; - }; - }; - */ -}; +class CfgVehicles { + class AllVehicles; + class Air: AllVehicles { + class Turrets; + }; + + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + }; + + class Helicopter_Base_F: Helicopter {}; + + class Heli_Attack_01_base_F: Helicopter_Base_F {}; + + class B_Heli_Attack_01_F: Heli_Attack_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; // Enable laser self-designation + }; + }; + }; + + class Plane: Air {}; + class Plane_Base_F: Plane { + class Turrets { + class CopilotTurret; + }; + }; + + /* @TODO: LGB GBU + class Plane_CAS_01_base_F: Plane_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; // Enable laser self-designation + }; + }; + }; + + class Plane_CAS_02_base_F: Plane_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; // Enable laser self-designation + }; + }; + }; + */ +}; diff --git a/addons/laser_selfdesignate/CfgWeapons.hpp b/addons/laser_selfdesignate/CfgWeapons.hpp index 70e1afde88..802e2ba6a5 100644 --- a/addons/laser_selfdesignate/CfgWeapons.hpp +++ b/addons/laser_selfdesignate/CfgWeapons.hpp @@ -1,11 +1,11 @@ -class CfgWeapons { - // Disable locking unless newb mode - class LauncherCore; - class RocketPods: LauncherCore { - // canLock = 1; - }; - - class missiles_DAGR: RocketPods { - canLock = 1; - }; -}; +class CfgWeapons { + // Disable locking unless newb mode + class LauncherCore; + class RocketPods: LauncherCore { + // canLock = 1; + }; + + class missiles_DAGR: RocketPods { + //canLock = 1; + }; +}; diff --git a/addons/laser_selfdesignate/XEH_post_init.sqf b/addons/laser_selfdesignate/XEH_post_init.sqf index dc30361926..6eccf9d1dd 100644 --- a/addons/laser_selfdesignate/XEH_post_init.sqf +++ b/addons/laser_selfdesignate/XEH_post_init.sqf @@ -1,2 +1,2 @@ -#include "script_component.hpp" - +#include "script_component.hpp" + diff --git a/addons/laser_selfdesignate/XEH_pre_init.sqf b/addons/laser_selfdesignate/XEH_pre_init.sqf index aa41d7e9bb..f957638ba2 100644 --- a/addons/laser_selfdesignate/XEH_pre_init.sqf +++ b/addons/laser_selfdesignate/XEH_pre_init.sqf @@ -1,11 +1,11 @@ -#include "script_component.hpp" - -ADDON = false; - -#include "XEH_PREP.hpp" - -GVAR(active) = false; - -FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; - -ADDON = true; +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +GVAR(active) = false; + +FUNC(getPosASL) = {visiblePositionASL (_this select 0)}; + +ADDON = true; diff --git a/addons/laser_selfdesignate/config.cpp b/addons/laser_selfdesignate/config.cpp index 597500caf6..e95d754809 100644 --- a/addons/laser_selfdesignate/config.cpp +++ b/addons/laser_selfdesignate/config.cpp @@ -1,15 +1,18 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_laser"}; - VERSION_CONFIG; - }; -}; - -#include "CfgEventhandlers.hpp" -#include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_laser"}; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventhandlers.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf b/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf index 955f1ea51d..f05a0e2323 100644 --- a/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf +++ b/addons/laser_selfdesignate/functions/fnc_findLaserSource.sqf @@ -1,23 +1,23 @@ -/* - * Author: jaynus - * Handler function for laser network code. - * - * Argument: - * 0: Emitter - * - * Return Value: - * 0: position - * 1: direction - * - * Public: No - */ -#include "script_component.hpp" - -private["_gunnerInfo", "_turretInfo"]; -params ["_emmiter"]; - -_gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer; -_turretInfo = [_emmiter, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); -_turretInfo params [["_povPos", -1], ["_povDir", -1]]; - -[_povPos, _povDir] +/* + * Author: jaynus + * Handler function for laser network code. + * + * Arguments: + * 0: Emitter + * + * Return Value: + * 0: position + * 1: direction + * + * Public: No + */ +#include "script_component.hpp" + +private["_gunnerInfo", "_turretInfo"]; +params ["_emmiter"]; + +_gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer; +_turretInfo = [_emmiter, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); +_turretInfo params [["_povPos", -1], ["_povDir", -1]]; + +[_povPos, _povDir] diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf index 300811cba2..be1793668d 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOff.sqf @@ -1,29 +1,29 @@ -/* - * Author: jaynus - * Turns off passed laser self designation. - * - * Argument: - * 0: Shooter, player shooting the laser - * 1: LaserUUID, the UUID of the laser returned by EFUNC(laser,laserOn) - * 2: Local laser target, unused. - * - * Return Value: - * True - */ -#include "script_component.hpp" - -if( (count _this) > 2) then { - params ["", "_laserUuid"]; - [_laserUuid] call EFUNC(laser,laserOff); - // @TODO: Nou gets to field all tickets about missing lasers. - //deleteVehicle _localLaserTarget; -}; - -GVAR(active) = false; - -if(!isNil QGVAR(selfDesignateHandle)) then { - [GVAR(selfDesignateHandle)] call CBA_fnc_removePerFrameHandler; - GVAR(selfDesignateHandle) = nil; -}; - -true +/* + * Author: jaynus + * Turns off passed laser self designation. + * + * Arguments: + * 0: Shooter, player shooting the laser + * 1: LaserUUID, the UUID of the laser returned by EFUNC(laser,laserOn) + * 2: Local laser target, unused. + * + * Return Value: + * True + */ +#include "script_component.hpp" + +if( (count _this) > 2) then { + params ["", "_laserUuid"]; + [_laserUuid] call EFUNC(laser,laserOff); + // @TODO: Nou gets to field all tickets about missing lasers. + //deleteVehicle _localLaserTarget; +}; + +GVAR(active) = false; + +if(!isNil QGVAR(selfDesignateHandle)) then { + [GVAR(selfDesignateHandle)] call CBA_fnc_removePerFrameHandler; + GVAR(selfDesignateHandle) = nil; +}; + +true diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index e585a409ff..545e975187 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -1,90 +1,90 @@ -/* - * Author: jaynus - * Turns on laser self designation from this vehicle based on the turret. - * There are no arguments, because it is all strictly based on the users vehicle. - * - * Arguments: - * None - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -TRACE_1("enter", _this); - -#define FCS_UPDATE_DELAY 1 - -FUNC(laserHudDesignatePFH) = { - private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; - params ["_args"]; - _args params ["_shooter", "_localLaserTarget"]; - _vehicle = vehicle _shooter; - TRACE_1("", _args); - - if((vehicle _shooter) == _shooter || {!alive _shooter} || {isNull _vehicle} || {!GVAR(active)} ) exitWith { - _args call FUNC(laserHudDesignateOff); - }; - if(!([_shooter] call FUNC(unitTurretHasDesignator)) ) exitWith { - _args call FUNC(laserHudDesignateOff); - }; - - if( (count _args) < 4) then { - _args set[3, ACE_diagTime + FCS_UPDATE_DELAY]; - }; - _forceUpdateTime = _args select 3; - - // @TODO: We don't have anything here we need to do the calculations for right now - /* - - _gunnerInfo = [_vehicle, (currentWeapon _vehicle)] call CBA_fnc_getFirer; - _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); - _povPos = _turretInfo select 0; - - _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; - _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; - - - _laserResult = [_povPos, [_waveLength,_waveLength], _laserCode] call EFUNC(laser,seekerFindLaserSpot); - _laserResultPosition = _laserResult select 0; - TRACE_1("Search", _laserResult); - - if((count _laserResult) > 0) then { - // @TODO: Nou gets to field all tickets about missing lasers. - //_localLaserTarget setPosASL _laserResultPosition; - }; - */ - - if(ACE_diagTime > _forceUpdateTime) then { - ["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent; - _args set[3, ACE_diagTime + FCS_UPDATE_DELAY]; - }; - - _this set[0, _args]; -}; - -private ["_laserTarget", "_handle", "_vehicle", "_laserUuid", "_waveLength", "_beamSpread", "_laserCode"]; - -if(!GVAR(active)) then { - GVAR(active) = true; - - TRACE_1("Activating laser", ""); - - // Get the self-designation variables, or use defaults - _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; - _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; - _beamSpread = (vehicle ACE_player) getVariable["ace_laser_beamSpread", ACE_DEFAULT_LASER_BEAMSPREAD]; - - _laserUuid = [(vehicle ACE_player), ACE_player, QFUNC(findLaserSource), _waveLength, _laserCode, _beamSpread] call EFUNC(laser,laserOn); - - // @TODO: Create the local target for the players side - // @TODO: Nou gets to field all tickets about missing lasers. - //_localLaserTarget = "LaserTargetW" createVehicleLocal (getpos ACE_player); - - GVAR(selfDesignateHandle) = [FUNC(laserHudDesignatePFH), 0.1, [ACE_player, _laserUuid, nil]] call CBA_fnc_addPerFrameHandler; -} else { - [] call FUNC(laserHudDesignateOff); - [] call FUNC(laserHudDesignateOn); -}; +/* + * Author: jaynus + * Turns on laser self designation from this vehicle based on the turret. + * There are no arguments, because it is all strictly based on the users vehicle. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +TRACE_1("enter", _this); + +#define FCS_UPDATE_DELAY 1 + +FUNC(laserHudDesignatePFH) = { + private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; + params ["_args"]; + _args params ["_shooter", "_localLaserTarget"]; + _vehicle = vehicle _shooter; + TRACE_1("", _args); + + if((vehicle _shooter) == _shooter || {!alive _shooter} || {isNull _vehicle} || {!GVAR(active)} ) exitWith { + _args call FUNC(laserHudDesignateOff); + }; + if(!([_shooter] call FUNC(unitTurretHasDesignator)) ) exitWith { + _args call FUNC(laserHudDesignateOff); + }; + + if( (count _args) < 4) then { + _args set[3, diag_tickTime + FCS_UPDATE_DELAY]; + }; + _forceUpdateTime = _args select 3; + + // @TODO: We don't have anything here we need to do the calculations for right now + /* + + _gunnerInfo = [_vehicle, (currentWeapon _vehicle)] call CBA_fnc_getFirer; + _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); + _povPos = _turretInfo select 0; + + _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; + _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; + + + _laserResult = [_povPos, [_waveLength,_waveLength], _laserCode] call EFUNC(laser,seekerFindLaserSpot); + _laserResultPosition = _laserResult select 0; + TRACE_1("Search", _laserResult); + + if((count _laserResult) > 0) then { + // @TODO: Nou gets to field all tickets about missing lasers. + //_localLaserTarget setPosASL _laserResultPosition; + }; + */ + + if(diag_tickTime > _forceUpdateTime) then { + ["ace_fcs_forceUpdate", []] call ace_common_fnc_localEvent; + _args set[3, diag_tickTime + FCS_UPDATE_DELAY]; + }; + + _this set[0, _args]; +}; + +private ["_laserTarget", "_handle", "_vehicle", "_laserUuid", "_waveLength", "_beamSpread", "_laserCode"]; + +if(!GVAR(active)) then { + GVAR(active) = true; + + TRACE_1("Activating laser", ""); + + // Get the self-designation variables, or use defaults + _laserCode = (vehicle ACE_player) getVariable["ace_laser_code", ACE_DEFAULT_LASER_CODE]; + _waveLength = (vehicle ACE_player) getVariable["ace_laser_waveLength", ACE_DEFAULT_LASER_WAVELENGTH]; + _beamSpread = (vehicle ACE_player) getVariable["ace_laser_beamSpread", ACE_DEFAULT_LASER_BEAMSPREAD]; + + _laserUuid = [(vehicle ACE_player), ACE_player, QFUNC(findLaserSource), _waveLength, _laserCode, _beamSpread] call EFUNC(laser,laserOn); + + // @TODO: Create the local target for the players side + // @TODO: Nou gets to field all tickets about missing lasers. + //_localLaserTarget = "LaserTargetW" createVehicleLocal (getpos ACE_player); + + GVAR(selfDesignateHandle) = [FUNC(laserHudDesignatePFH), 0.1, [ACE_player, _laserUuid, nil]] call CBA_fnc_addPerFrameHandler; +} else { + [] call FUNC(laserHudDesignateOff); + [] call FUNC(laserHudDesignateOn); +}; diff --git a/addons/laser_selfdesignate/functions/script_component.hpp b/addons/laser_selfdesignate/functions/script_component.hpp index 320dc825c7..845a51c186 100644 --- a/addons/laser_selfdesignate/functions/script_component.hpp +++ b/addons/laser_selfdesignate/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\laser_selfdesignate\script_component.hpp" +#include "\z\ace\addons\laser_selfdesignate\script_component.hpp" diff --git a/addons/laser_selfdesignate/script_component.hpp b/addons/laser_selfdesignate/script_component.hpp index fc0d608e32..583aca5e95 100644 --- a/addons/laser_selfdesignate/script_component.hpp +++ b/addons/laser_selfdesignate/script_component.hpp @@ -1,17 +1,18 @@ -#define COMPONENT laser_selfdesignate -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_LASER_SELFDESIGNATE - #define DEBUG_SETTINGS DEBUG_SETTINGS_LASER_SELFDESIGNATE -#endif - -#include "\z\ace\addons\main\script_macros.hpp" +#define COMPONENT laser_selfdesignate +#define COMPONENT_BEAUTIFIED Laser Selfdesignate +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_LASER_SELFDESIGNATE + #define DEBUG_SETTINGS DEBUG_SETTINGS_LASER_SELFDESIGNATE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/laserpointer/XEH_postInit.sqf b/addons/laserpointer/XEH_postInit.sqf index c478fe33fd..9506a91fb5 100644 --- a/addons/laserpointer/XEH_postInit.sqf +++ b/addons/laserpointer/XEH_postInit.sqf @@ -2,7 +2,7 @@ #include "script_component.hpp" // fixes laser when being captured. Needed, because the selectionPosition of the right hand is used -["SetHandcuffed", {if (_this select 1) then {(_this select 0) action ["GunLightOff", _this select 0]};}] call EFUNC(common,addEventHandler); +[QEGVAR(captives,setHandcuffed), {if (_this select 1) then {(_this select 0) action ["ace_gunLightOff", _this select 0]};}] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith {}; @@ -10,7 +10,7 @@ GVAR(nearUnits) = []; #include "initKeybinds.sqf" -["SettingsInitialized", { +["ace_settingsInitialized", { //If not enabled, dont't add draw eventhandler or PFEH (for performance) if (!GVAR(enabled)) exitWith {}; @@ -32,4 +32,4 @@ GVAR(nearUnits) = []; addMissionEventHandler ["Draw3D", { call FUNC(onDraw); }]; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/laserpointer/config.cpp b/addons/laserpointer/config.cpp index cbb3105696..add36aeff5 100644 --- a/addons/laserpointer/config.cpp +++ b/addons/laserpointer/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_acc_pointer_red","ACE_acc_pointer_green","ACE_acc_pointer_green_IR"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,8 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CfgJointRails.hpp" + +class ACE_newEvents { + GunLightOff = "ace_gunLightOff"; + SetHandcuffed = QEGVAR(captives,setHandcuffed); +}; diff --git a/addons/laserpointer/script_component.hpp b/addons/laserpointer/script_component.hpp index cee00afdca..0e450721fd 100644 --- a/addons/laserpointer/script_component.hpp +++ b/addons/laserpointer/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT laserpointer +#define COMPONENT_BEAUTIFIED Laser Pointer #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_LASERPOINTER #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/laserpointer/stringtable.xml b/addons/laserpointer/stringtable.xml index 1e4b150c3d..b161b0998c 100644 --- a/addons/laserpointer/stringtable.xml +++ b/addons/laserpointer/stringtable.xml @@ -27,7 +27,7 @@ Emits visible light. - Emettre de la lumière visible + Émet de la lumière visible. Strahlt sichtbares Licht aus. Испускает узкий пучок видимого света. Vyzařuje viditelné světlo. diff --git a/addons/logistics_uavbattery/CfgSounds.hpp b/addons/logistics_uavbattery/CfgSounds.hpp index 530c5b86a9..3cf83715ba 100644 --- a/addons/logistics_uavbattery/CfgSounds.hpp +++ b/addons/logistics_uavbattery/CfgSounds.hpp @@ -1,7 +1,7 @@ class CfgSounds { class ACE_replaceUAVBattery { name = "ACE_replaceUAVBattery"; - sound[]={QUOTE(PATHTOF(sounds\exchange_battery.ogg)),1,1}; + sound[]={QPATHTOF(sounds\exchange_battery.ogg),1,1}; titles[]={}; }; }; diff --git a/addons/logistics_uavbattery/CfgVehicles.hpp b/addons/logistics_uavbattery/CfgVehicles.hpp index a6f2db786f..2daa8c8011 100644 --- a/addons/logistics_uavbattery/CfgVehicles.hpp +++ b/addons/logistics_uavbattery/CfgVehicles.hpp @@ -20,7 +20,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player, _target)] call FUNC(refuelUAV)); showDisabled = 0; priority = 1.245; - icon = QUOTE(PATHTOF(ui\UAV_battery_ca.paa)); + icon = QPATHTOF(ui\UAV_battery_ca.paa); }; }; }; diff --git a/addons/logistics_uavbattery/CfgWeapons.hpp b/addons/logistics_uavbattery/CfgWeapons.hpp index 46120f7c3d..8beedff39b 100644 --- a/addons/logistics_uavbattery/CfgWeapons.hpp +++ b/addons/logistics_uavbattery/CfgWeapons.hpp @@ -6,8 +6,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(Battery_Name); descriptionShort = CSTRING(Battery_Description); - model = QUOTE(PATHTOF(data\ace_battery.p3d)); - picture = QUOTE(PATHTOF(ui\UAV_battery_ca.paa)); + model = QPATHTOF(data\ace_battery.p3d); + picture = QPATHTOF(ui\UAV_battery_ca.paa); class ItemInfo: InventoryItem_Base_F { mass = 20; }; diff --git a/addons/logistics_uavbattery/config.cpp b/addons/logistics_uavbattery/config.cpp index c6123e590f..dccdbde247 100644 --- a/addons/logistics_uavbattery/config.cpp +++ b/addons/logistics_uavbattery/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_UAVBattery"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"marc_book"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"marc_book"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index 25f452882c..65c0932bb7 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -24,7 +24,7 @@ _onFinish = { (_this select 0) params ["_caller", "_target"]; _caller removeItem "ACE_UAVBattery"; playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; - ["setFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local + [QEGVAR(common,setFuel), [_target, 1], [_target]] call CBA_fnc_targetEvent; //setFuel is local }; _onFailure = { diff --git a/addons/logistics_uavbattery/script_component.hpp b/addons/logistics_uavbattery/script_component.hpp index 836a39c415..464118c01f 100644 --- a/addons/logistics_uavbattery/script_component.hpp +++ b/addons/logistics_uavbattery/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT logistics_uavbattery +#define COMPONENT_BEAUTIFIED Logistics UAV Battery #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/logistics_uavbattery/stringtable.xml b/addons/logistics_uavbattery/stringtable.xml index 6ff6e4b52d..ea0cea97eb 100644 --- a/addons/logistics_uavbattery/stringtable.xml +++ b/addons/logistics_uavbattery/stringtable.xml @@ -5,7 +5,7 @@ Drone is full Drohne ist voll El VANT está lleno - L'UAV est chargé + Le drone est chargé Dron jest naładowany A drón fel van töltve Dron je nabitý @@ -17,7 +17,7 @@ You need a UAV Battery Du brauchst eine UAV-Batterie Necesitas una batería para VANT - L'UAV nécessite une batterie + Le drone nécessite une batterie Potrzebujesz baterii UAV Szükséged van egy UAV akkumulátorra Potřebuješ UAV baterii @@ -41,7 +41,7 @@ UAV Battery UAV-Batterie Batería para VANT - Batterie UAV + Batterie pour drone Bateria UAV UAV akkumulátor UAV baterie @@ -53,7 +53,7 @@ Used to refuel Carried UAV's Verwendet zum Aufladen von tragbaren UAVs Usada para reabastecer el VANT - Utilisée pour recharger l'UAV + Utilisée pour recharger un drone Używana do naładowania baterii przenośnego UAV Hordozható UAV-k feltöltéséhez való akkumulátor Používané k dobíjení UAV diff --git a/addons/logistics_wirecutter/CfgSounds.hpp b/addons/logistics_wirecutter/CfgSounds.hpp index 9958190ec1..598e72255b 100644 --- a/addons/logistics_wirecutter/CfgSounds.hpp +++ b/addons/logistics_wirecutter/CfgSounds.hpp @@ -1,12 +1,12 @@ class CfgSounds { class ACE_Wirecutter_sound { name = "ACE_wirecutter_sound"; - sound[] = {QUOTE(PATHTOF(sound\wire_cut.ogg)), "db-0", 1}; + sound[] = {QPATHTOF(sound\wire_cut.ogg), "db-0", 1}; titles[] = {}; }; class ACE_Wirecutter_sound_long { name = "ACE_wirecutter_sound_long"; - sound[] = {QUOTE(PATHTOF(sound\wire_cut_long.ogg)), "db-0", 1}; + sound[] = {QPATHTOF(sound\wire_cut_long.ogg), "db-0", 1}; titles[] = {}; }; }; diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index 2b365cc8e6..0674c44f1a 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -6,8 +6,8 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(wirecutterName); descriptionShort = CSTRING(wirecutterDescription); - model = QUOTE(PATHTOF(data\ace_wirecutter.p3d)); - picture = QUOTE(PATHTOF(ui\item_wirecutter_ca.paa)); + model = QPATHTOF(data\ace_wirecutter.p3d); + picture = QPATHTOF(ui\item_wirecutter_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 65; diff --git a/addons/logistics_wirecutter/XEH_clientInit.sqf b/addons/logistics_wirecutter/XEH_clientInit.sqf index c46cab29f1..45e93bc6bd 100644 --- a/addons/logistics_wirecutter/XEH_clientInit.sqf +++ b/addons/logistics_wirecutter/XEH_clientInit.sqf @@ -2,4 +2,4 @@ if (!hasInterface) exitWith {}; -["interactMenuOpened", {_this call FUNC(interactEH)}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {_this call FUNC(interactEH)}] call CBA_fnc_addEventHandler; diff --git a/addons/logistics_wirecutter/config.cpp b/addons/logistics_wirecutter/config.cpp index d83cff4035..25c58f1604 100644 --- a/addons/logistics_wirecutter/config.cpp +++ b/addons/logistics_wirecutter/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_wirecutter"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"gpgpgpgp", "PabstMirror"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"gpgpgpgp", "PabstMirror"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,3 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgWeapons.hpp" #include "CfgVehicles.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; \ No newline at end of file diff --git a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf index e28ff17db6..bf0f5d3bc9 100644 --- a/addons/logistics_wirecutter/functions/fnc_interactEH.sqf +++ b/addons/logistics_wirecutter/functions/fnc_interactEH.sqf @@ -46,9 +46,14 @@ TRACE_1("Starting wire-cut action PFEH",_interactionType); [_player, _attachedFence] call FUNC(cutDownFence); }; _fncCondition = { - params ["", "_player", "_attachedFence"]; + params ["_helper", "_player", "_attachedFence"]; if (!([_player, _attachedFence, []] call EFUNC(common,canInteractWith))) exitWith {false}; - ((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))}) + ((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))} && { + //Custom LOS check for fence + private _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); + ((!(lineIntersects [AGLtoASL _headPos, AGLtoASL (_helper modelToWorldVisual [0,0,1.25]), _attachedFence, ACE_player])) || + {!(lineIntersects [AGLtoASL _headPos, getPosASL _attachedFence, _attachedFence, ACE_player])}) + }) }; { @@ -56,7 +61,7 @@ TRACE_1("Starting wire-cut action PFEH",_interactionType); if ([_x] call FUNC(isFence)) then { _fencesHelped pushBack _x; _helper = "ACE_LogicDummy" createVehicleLocal (getpos _x); - _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QUOTE(PATHTOF(ui\wirecutter_ca.paa)), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5] call EFUNC(interact_menu,createAction); + _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction); [_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject); _helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]); _addedHelpers pushBack _helper; diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index a66a7bba08..9e52593ba7 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT logistics_wirecutter +#define COMPONENT_BEAUTIFIED Logistics Wire Cutter #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/logistics_wirecutter/stringtable.xml b/addons/logistics_wirecutter/stringtable.xml index 1f9955f4be..6790d67ec6 100644 --- a/addons/logistics_wirecutter/stringtable.xml +++ b/addons/logistics_wirecutter/stringtable.xml @@ -31,7 +31,7 @@ Cortar alambrado Przetnij płot Přestřihnout plot - Cisailler Clôture + Cisailler l'obstacle Cortar Cerca Taglia Drótkerítés átvágása @@ -43,7 +43,7 @@ Cortando alambrado / cables... Przecinanie płotu / drutów... Přestřihávám plot / dráty... - Cisaille l'obstacle... + Cisaillement de l'obstacle... Cortando Cerca / Arame... Sto tagliando... Drótok elvágása... @@ -55,11 +55,11 @@ Alambrado cortado Płot przecięty Plot přestřižen - Clôture cisaillée + Obstacle cisaillé Cerca cortada Fatto! Drótkerítés átvágva Забор разрезан - + \ No newline at end of file diff --git a/addons/magazinerepack/CfgSounds.hpp b/addons/magazinerepack/CfgSounds.hpp index 1390397e5e..a189c18b9c 100644 --- a/addons/magazinerepack/CfgSounds.hpp +++ b/addons/magazinerepack/CfgSounds.hpp @@ -1,12 +1,12 @@ class CfgSounds { class GVAR(soundMagazineFinished) { name = QGVAR(soundMagazineFinished); - sound[]={QUOTE(PATHTOF(sounds\magrepack_finished.wav)),1,1}; + sound[]={QPATHTOF(sounds\magrepack_finished.wav),1,1}; titles[]={}; }; class GVAR(soundRoundFinished) { name = QGVAR(soundRoundFinished); - sound[] = {QUOTE(PATHTOF(sounds\magrepack_single.wav)),1,1}; + sound[] = {QPATHTOF(sounds\magrepack_single.wav),1,1}; titles[] = {}; }; }; diff --git a/addons/magazinerepack/CfgVehicles.hpp b/addons/magazinerepack/CfgVehicles.hpp index 78af19bcfe..0bf4833bf0 100644 --- a/addons/magazinerepack/CfgVehicles.hpp +++ b/addons/magazinerepack/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { exceptions[] = {"isNotInside", "isNotSitting"}; insertChildren = QUOTE(_this call FUNC(getMagazineChildren)); priority = -2; - icon = QUOTE(PATHTOF(UI\repack_ca.paa)); + icon = QPATHTOF(UI\repack_ca.paa); }; }; }; diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 47c0ac889c..1434275e84 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2","esteldunedain"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf index fc875c8d2b..f8a18438e9 100644 --- a/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf +++ b/addons/magazinerepack/functions/fnc_getMagazineChildren.sqf @@ -1,12 +1,12 @@ /* - * Author: PabstMirror,commy2, esteldunedain, Ruthberg - * Gets magazine children for interaciton menu + * Author: PabstMirror, commy2, esteldunedain, Ruthberg + * Gets magazine children for interaciton menu. * - * Argument: + * Arguments: * 0: Target * 1: Player * - * Return value: + * Return Value: * ChildActions * * Example: @@ -16,13 +16,11 @@ */ #include "script_component.hpp" -private ["_unitMagazines", "_unitMagCounts", "_index", "_actions", "_displayName", "_picture", "_action"]; - params ["_target", "_player"]; // get all mags and ammo count -_unitMagazines = []; -_unitMagCounts = []; +private _unitMagazines = []; +private _unitMagCounts = []; { private "_xFullMagazineCount"; _x params ["_xClassname", "_xCount", "_xLoaded", "_xType"]; @@ -31,7 +29,7 @@ _unitMagCounts = []; //for every partial magazine, that is either in inventory or can be moved there if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {_player canAdd _xClassname}}) then { - _index = _unitMagazines find _xClassname; + private _index = _unitMagazines find _xClassname; if (_index == -1) then { _unitMagazines pushBack _xClassname; _unitMagCounts pushBack [_xCount]; @@ -42,13 +40,13 @@ _unitMagCounts = []; } forEach (magazinesAmmoFull _player); //Create the action children for all appropriate magazines -_actions = []; +private _actions = []; { if ((count (_unitMagCounts select _forEachIndex)) >= 2) then {// Ignore invalid magazines types (need 2+ partial mags to do anything) - _displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName"); - _picture = getText (configFile >> "CfgMagazines" >> _x >> "picture"); + private _displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName"); + private _picture = getText (configFile >> "CfgMagazines" >> _x >> "picture"); - _action = [_x, _displayName, _picture, {_this call FUNC(startRepackingMagazine)}, {true}, {}, _x] call EFUNC(interact_menu,createAction); + private _action = [_x, _displayName, _picture, {_this call FUNC(startRepackingMagazine)}, {true}, {}, _x] call EFUNC(interact_menu,createAction); _actions pushBack [_action, [], _player]; }; } forEach _unitMagazines; diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf index f0fbcf49c1..36544b0084 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -19,39 +19,36 @@ */ #include "script_component.hpp" -private ["_structuredOutputText", "_picture", "_fullMags", "_partialMags", "_fullMagazineCount"]; - params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; _args params ["_magazineClassname", "_lastAmmoCount"]; -_fullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count"); +private _fullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "count"); -//Don't show anything if player can't interact: +// Don't show anything if player can't interact if (!([ACE_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {}; -_structuredOutputText = if (_errorCode == 0) then { - format ["%1
", (localize LSTRING(RepackComplete))]; +// Count mags +private _fullMags = 0; +private _partialMags = 0; +{ + _x params ["_classname", "_count"]; + + if (_classname == _magazineClassname && {_count > 0}) then { + if (_count == _fullMagazineCount) then { + _fullMags = _fullMags + 1; + } else { + _partialMags = _partialMags + 1; + }; + }; +} forEach (magazinesAmmoFull ACE_player); + +private _repackedMagsText = format [localize LSTRING(RepackedMagazinesCount), _fullMags, _partialMags]; + +private _structuredOutputText = if (_errorCode == 0) then { + format ["%1
%2", localize LSTRING(RepackComplete), _repackedMagsText]; } else { - format ["%1
", (localize LSTRING(RepackInterrupted))]; + format ["%1
%2", localize LSTRING(RepackInterrupted), _repackedMagsText]; }; -_picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture"); -_structuredOutputText = _structuredOutputText + format ["
", _picture]; - -//EFUNC(common,displayTextStructured) doesn't have room for this, and I don't think it's nessacary, can fix in the future if wanted: - -// _fullMags = 0; -// _partialMags = 0; -// { - // EXPLODE_2_PVT(_x,_xClassname,_xCount); - // if ((_xClassname == _magazineClassname) && {_xCount > 0}) then { - // if (_xCount == _fullMagazineCount) then { - // _fullMags = _fullMags + 1; - // } else { - // _partialMags = _partialMags + 1; - // }; - // }; -// } forEach (magazinesAmmoFull ACE_player); -// _structuredOutputText = _structuredOutputText + format [("" + (localize LSTRING(RepackedMagazinesCount)) + ""), _fullMags, _partialMags]; - -[parseText _structuredOutputText, 2] call EFUNC(common,displayTextStructured); +private _picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture"); +[_structuredOutputText, _picture, nil, nil, 2.5] call EFUNC(common,displayTextPicture); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf index c1bf5ebdab..3808df4cdc 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -18,19 +18,16 @@ */ #include "script_component.hpp" -private ["_currentAmmoCount", "_addedMagazines", "_missingAmmo", "_index", "_updateMagazinesOnPlayerFnc"]; - params ["_ars", "_elapsedTime", "_totalTime"]; _args params ["_magazineClassname", "_lastAmmoCount", "_simEvents"]; if !((_simEvents select 0) params ["_nextEventTime", "_nextEventIsBullet", "_nextEventMags"]) exitWith { ERROR("No Event"); false }; - if (_nextEventTime > _elapsedTime) exitWith { true };//waiting on next event //Verify we aren't missing any ammo -_currentAmmoCount = []; +private _currentAmmoCount = []; { _x params ["_xClassname", "_xCount"]; if (_xClassname == _magazineClassname) then { @@ -39,11 +36,11 @@ _currentAmmoCount = []; } forEach (magazinesAmmo ACE_player); //only inventory mags //Go through mags we currently have and check off the ones we should have -_addedMagazines = +_currentAmmoCount; -_missingAmmo = false; +private _addedMagazines = +_currentAmmoCount; +private _missingAmmo = false; { if (_x > 0) then { - _index = _addedMagazines find _x; + private _index = _addedMagazines find _x; if (_index != -1) then { _addedMagazines deleteAt _index; } else { @@ -54,7 +51,7 @@ _missingAmmo = false; if (_missingAmmo) exitWith { false }; //something removed ammo that was being repacked (could be other players or scripts) -_updateMagazinesOnPlayerFnc = { +private _updateMagazinesOnPlayerFnc = { ACE_player removeMagazines _magazineClassname; //remove inventory magazines { if (_x > 0) then { diff --git a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf index 230bdefb4f..09c04de26e 100644 --- a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf +++ b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf @@ -19,47 +19,26 @@ */ #include "script_component.hpp" -private ["_fnc_newMag", "_time", "_events", "_fnc_swapAmmo", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded", "_swapProgress"]; - params ["_fullMagazineCount", "_arrayOfAmmoCounts", "_isBelt"]; // Sort Ascending - Don't modify original _arrayOfAmmoCounts = +_arrayOfAmmoCounts; _arrayOfAmmoCounts sort true; -_fnc_newMag = { +private _fnc_newMag = { _time = _time + GVAR(TimePerMagazine); _events pushBack [_time, false, +_arrayOfAmmoCounts]; }; -_fnc_swapAmmo = if (_isBelt) then { - { - _time = _time + GVAR(TimePerBeltLink); - _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - _ammoSwaped)]; - _arrayOfAmmoCounts set [_highIndex, ((_arrayOfAmmoCounts select _highIndex) + _ammoSwaped)]; - _events pushBack [_time, true, +_arrayOfAmmoCounts]; - } -} else { - { - for "_swapProgress" from 0 to (_ammoSwaped - 1) do { - _time = _time + GVAR(TimePerAmmo); - _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - 1)]; - _arrayOfAmmoCounts set [_highIndex, ((_arrayOfAmmoCounts select _highIndex) + 1)]; - _events pushBack [_time, true, +_arrayOfAmmoCounts]; - }; - } -}; - -_lowIndex = 0; -_highIndex = (count _arrayOfAmmoCounts) - 1; -_ammoToTransfer = 0; -_ammoAvailable = 0; - -_time = 0; -_events = []; +private _lowIndex = 0; +private _highIndex = (count _arrayOfAmmoCounts) - 1; +private _ammoToTransfer = 0; +private _ammoAvailable = 0; +private _time = 0; +private _events = []; while {_lowIndex < _highIndex} do { - _ammoNeeded = _fullMagazineCount - (_arrayOfAmmoCounts select _highIndex); + private _ammoNeeded = _fullMagazineCount - (_arrayOfAmmoCounts select _highIndex); _ammoAvailable = _arrayOfAmmoCounts select _lowIndex; if (_ammoAvailable == 0) then { @@ -70,8 +49,20 @@ while {_lowIndex < _highIndex} do { _highIndex = _highIndex - 1; call _fnc_newMag; } else { - _ammoSwaped = _ammoAvailable min _ammoNeeded; - call _fnc_swapAmmo; + private _ammoSwaped = _ammoAvailable min _ammoNeeded; + if (_isBelt) then { + _time = _time + GVAR(TimePerBeltLink); + _arrayOfAmmoCounts set [_lowIndex, (_arrayOfAmmoCounts select _lowIndex) - _ammoSwaped]; + _arrayOfAmmoCounts set [_highIndex, (_arrayOfAmmoCounts select _highIndex) + _ammoSwaped]; + _events pushBack [_time, true, +_arrayOfAmmoCounts]; + } else { + for "_swapProgress" from 0 to (_ammoSwaped - 1) do { + _time = _time + GVAR(TimePerAmmo); + _arrayOfAmmoCounts set [_lowIndex, (_arrayOfAmmoCounts select _lowIndex) - 1]; + _arrayOfAmmoCounts set [_highIndex, (_arrayOfAmmoCounts select _highIndex) + 1]; + _events pushBack [_time, true, +_arrayOfAmmoCounts]; + }; + }; }; }; }; diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index 859bbdfdfa..32ce65d188 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -13,39 +13,37 @@ * Nothing * * Example: - * ["30Rnd_65x39_caseless_mag"] call ace_magazinerepack_fnc_startRepackingMagazine + * [player, player, "30Rnd_65x39_caseless_mag"] call ace_magazinerepack_fnc_startRepackingMagazine * * Public: No */ #include "script_component.hpp" -private ["_magazineCfg", "_fullMagazineCount", "_isBelt", "_startingAmmoCounts", "_simEvents", "_totalTime"]; - params ["_target", "_player", "_magazineClassname"]; if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineClassname; +private _magazineCfg = configFile >> "CfgMagazines" >> _magazineClassname; // Calculate actual ammo to transfer during repack -_fullMagazineCount = getNumber (_magazineCfg >> "count"); +private _fullMagazineCount = getNumber (_magazineCfg >> "count"); //Is linked belt magazine: -_isBelt = (isNumber (_magazineCfg >> "ACE_isBelt")) && {(getNumber (_magazineCfg >> "ACE_isBelt")) == 1}; +private _isBelt = isNumber (_magazineCfg >> "ACE_isBelt") && {(getNumber (_magazineCfg >> "ACE_isBelt")) == 1}; //Check canInteractWith: -if (!([_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith {}; +if !([_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {}; [_player] call EFUNC(common,goKneeling); -_startingAmmoCounts = []; +private _startingAmmoCounts = []; { - EXPLODE_4_PVT(_x,_xClassname,_xCount,_xLoaded,_xType); - if ((_xClassname == _magazineClassname) && {(_xCount != _fullMagazineCount) && {_xCount > 0}}) then { + _x params ["_xClassname", "_xCount", "_xLoaded", "_xType"]; + if (_xClassname == _magazineClassname && {_xCount != _fullMagazineCount && {_xCount > 0}}) then { if (_xLoaded) then { //Try to Remove from weapon and add to inventory, otherwise ignore if (_player canAdd _magazineClassname) then { switch (_xType) do { - case (1): {_player removePrimaryWeaponItem _magazineClassname;}; - case (2): {_player removeHandgunItem _magazineClassname;}; - case (4): {_player removeSecondaryWeaponItem _magazineClassname;}; + case (1): {_player removePrimaryWeaponItem _magazineClassname}; + case (2): {_player removeHandgunItem _magazineClassname}; + case (4): {_player removeSecondaryWeaponItem _magazineClassname}; default {ERROR("Loaded Location Invalid");}; }; _player addMagazine [_magazineClassname, _xCount]; @@ -57,10 +55,10 @@ _startingAmmoCounts = []; }; } forEach (magazinesAmmoFull _player); -if ((count _startingAmmoCounts) < 2) exitWith {ERROR("Not Enough Mags to Repack");}; +if (count _startingAmmoCounts < 2) exitWith {ERROR("Not Enough Mags to Repack");}; -_simEvents = [_fullMagazineCount, _startingAmmoCounts, _isBelt] call FUNC(simulateRepackEvents); -_totalTime = (_simEvents select ((count _simEvents) - 1) select 0); +private _simEvents = [_fullMagazineCount, _startingAmmoCounts, _isBelt] call FUNC(simulateRepackEvents); +private _totalTime = _simEvents select (count _simEvents - 1) select 0; [ _totalTime, diff --git a/addons/magazinerepack/script_component.hpp b/addons/magazinerepack/script_component.hpp index 947c8c1ca1..79c1a20652 100644 --- a/addons/magazinerepack/script_component.hpp +++ b/addons/magazinerepack/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT magazinerepack +#define COMPONENT_BEAUTIFIED Magazine Repack #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_MAGAZINEREPACK #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index b89b4b587d..75cd177ed9 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -17,7 +17,7 @@ Select Magazine Menu Magazinauswahlmenü Menú de selección de cargador - Sélectionner menu des chargeurs + Sélectionner le menu des chargeurs Menu wyboru magazynków Zvolit menu zásobníků Seleziona menù di ricarica @@ -29,7 +29,7 @@ Select Mag Magazin auswählen Seleccionar cargador - Sélectionner chargeur + Sélectionner le chargeur Wybierz magazynek Vyber zásobník Seleziona caricatore @@ -110,4 +110,4 @@ %1 Total e %2 Parcial - + \ No newline at end of file diff --git a/addons/main/config.cpp b/addons/main/config.cpp index 7b15f0c8f0..9aebb11e36 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -1,591 +1,592 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { - // Vanilla - "3den", - "a3_air_f", - "a3_air_f_beta", - "a3_air_f_beta_heli_attack_01", - "a3_air_f_beta_heli_attack_02", - "a3_air_f_beta_heli_transport_01", - "a3_air_f_beta_heli_transport_02", - "a3_air_f_beta_parachute_01", - "a3_air_f_beta_parachute_02", - "a3_air_f_epb_heli_light_03", - "a3_air_f_epc_plane_cas_01", - "a3_air_f_epc_plane_cas_02", - "a3_air_f_epc_plane_fighter_03", - "a3_air_f_gamma_plane_fighter_03", - "a3_air_f_gamma_uav_01", - "a3_air_f_gamma_uav_02", - "a3_air_f_heli", - "a3_air_f_heli_heli_attack_01", - "a3_air_f_heli_heli_attack_02", - "a3_air_f_heli_heli_light_01", - "a3_air_f_heli_heli_light_02", - "a3_air_f_heli_heli_light_03", - "a3_air_f_heli_heli_transport_01", - "a3_air_f_heli_heli_transport_02", - "a3_air_f_heli_heli_transport_03", - "a3_air_f_heli_heli_transport_04", - "a3_air_f_heli_light_01", - "a3_air_f_heli_light_02", - "a3_animals_f", - "a3_animals_f_animconfig", - "a3_animals_f_chicken", - "a3_animals_f_dog", - "a3_animals_f_fishes", - "a3_animals_f_goat", - "a3_animals_f_kestrel", - "a3_animals_f_rabbit", - "a3_animals_f_seagull", - "a3_animals_f_sheep", - "a3_animals_f_snakes", - "a3_animals_f_turtle", - "a3_anims_f", - "a3_anims_f_config_sdr", - "a3_anims_f_epa", - "a3_anims_f_epc", - "a3_anims_f_exp_a", - "a3_anims_f_heli", - "a3_anims_f_kart", - "a3_anims_f_mark_deployment", - "a3_armor_f", - "a3_armor_f_amv", - "a3_armor_f_apc_wheeled_03", - "a3_armor_f_beta", - "a3_armor_f_beta_apc_tracked_02", - "a3_armor_f_epb_apc_tracked_03", - "a3_armor_f_epb_mbt_03", - "a3_armor_f_epc_mbt_01", - "a3_armor_f_marid", - "a3_armor_f_panther", - "a3_armor_f_slammer", - "a3_armor_f_t100k", - "a3_baseconfig_f", - "a3_boat_f", - "a3_boat_f_beta_boat_armed_01", - "a3_boat_f_beta_boat_transport_01", - "a3_boat_f_boat_armed_01", - "a3_boat_f_boat_transport_01", - "a3_boat_f_civilian_boat", - "a3_boat_f_epc_submarine_01_f", - "a3_boat_f_gamma_boat_transport_01", - "a3_boat_f_heli_boat_armed_01", - "a3_boat_f_heli_sdv_01", - "a3_boat_f_sdv_01", - "a3_boat_f_trawler", - "a3_cargoposes_f", - "a3_cargoposes_f_heli", - "a3_characters_f", - "a3_characters_f_beta", - "a3_characters_f_blufor", - "a3_characters_f_bootcamp", - "a3_characters_f_bootcamp_common", - "a3_characters_f_civil", - "a3_characters_f_common", - "a3_characters_f_epa", - "a3_characters_f_epb", - "a3_characters_f_epb_heads", - "a3_characters_f_epc", - "a3_characters_f_gamma", - "a3_characters_f_heads", - "a3_characters_f_indep", - "a3_characters_f_kart", - "a3_characters_f_mark", - "a3_characters_f_opfor", - "a3_characters_f_proxies", - "a3_data_f", - "a3_data_f_bootcamp", - "a3_data_f_curator", - "a3_data_f_curator_characters", - "a3_data_f_curator_eagle", - "a3_data_f_curator_intel", - "a3_data_f_curator_misc", - "a3_data_f_curator_respawn", - "a3_data_f_curator_virtual", - "a3_data_f_exp_a", - "a3_data_f_exp_a_virtual", - "a3_data_f_exp_b", - "a3_data_f_heli", - "a3_data_f_hook", - "a3_data_f_kart", - "a3_data_f_kart_particleeffects", - "a3_data_f_mark", - "a3_data_f_particleeffects", - "a3_dubbing_radio_f", - "a3_editor_f", - "a3_functions_f", - "a3_functions_f_bootcamp", - "a3_functions_f_curator", - "a3_functions_f_epa", - "a3_functions_f_epc", - "a3_functions_f_exp_a", - "a3_functions_f_heli", - "a3_functions_f_mark", - "a3_functions_f_mp_mark", - "a3_language_f", - "a3_language_f_beta", - "a3_language_f_bootcamp", - "a3_language_f_curator", - "a3_language_f_epa", - "a3_language_f_epb", - "a3_language_f_epc", - "a3_language_f_exp_a", - "a3_language_f_gamma", - "a3_language_f_heli", - "a3_language_f_kart", - "a3_language_f_mark", - "a3_language_f_mp_mark", - "a3_languagemissions_f", - "a3_languagemissions_f_beta", - "a3_languagemissions_f_gamma", - "a3_languagemissions_f_kart", - "a3_languagemissions_f_mp_mark", - "a3_map_altis", - "a3_map_altis_scenes", - "a3_map_data", - "a3_map_stratis", - "a3_map_stratis_scenes", - "a3_map_vr_scenes", - "a3_misc_f", - "a3_misc_f_helpers", - "a3_missions_f", - "a3_missions_f_beta", - "a3_missions_f_bootcamp", - "a3_missions_f_curator", - "a3_missions_f_epa", - "a3_missions_f_epb", - "a3_missions_f_epc", - "a3_missions_f_exp_a", - "a3_missions_f_gamma", - "a3_missions_f_heli", - "a3_missions_f_kart", - "a3_missions_f_mark", - "a3_missions_f_mp_mark", - "a3_modules_f", - "a3_modules_f_beta", - "a3_modules_f_beta_firingdrills", - "a3_modules_f_bootcamp", - "a3_modules_f_bootcamp_misc", - "a3_modules_f_curator", - "a3_modules_f_curator_animals", - "a3_modules_f_curator_cas", - "a3_modules_f_curator_chemlights", - "a3_modules_f_curator_curator", - "a3_modules_f_curator_effects", - "a3_modules_f_curator_environment", - "a3_modules_f_curator_flares", - "a3_modules_f_curator_intel", - "a3_modules_f_curator_lightning", - "a3_modules_f_curator_mines", - "a3_modules_f_curator_misc", - "a3_modules_f_curator_multiplayer", - "a3_modules_f_curator_objectives", - "a3_modules_f_curator_ordnance", - "a3_modules_f_curator_respawn", - "a3_modules_f_curator_smokeshells", - "a3_modules_f_dyno", - "a3_modules_f_effects", - "a3_modules_f_epb", - "a3_modules_f_epb_misc", - "a3_modules_f_events", - "a3_modules_f_exp_a", - "a3_modules_f_groupmodifiers", - "a3_modules_f_hc", - "a3_modules_f_heli", - "a3_modules_f_heli_spawnai", - "a3_modules_f_intel", - "a3_modules_f_kart", - "a3_modules_f_kart_timetrials", - "a3_modules_f_livefeed", - "a3_modules_f_mark", - "a3_modules_f_mark_firingdrills", - "a3_modules_f_mark_objectives", - "a3_modules_f_marta", - "a3_modules_f_misc", - "a3_modules_f_mp_mark", - "a3_modules_f_multiplayer", - "a3_modules_f_objectmodifiers", - "a3_modules_f_sites", - "a3_modules_f_skirmish", - "a3_modules_f_strategicmap", - "a3_modules_f_supports", - "a3_modules_f_uav", - "a3_music_f", - "a3_music_f_bootcamp", - "a3_music_f_epa", - "a3_music_f_epb", - "a3_music_f_epc", - "a3_music_f_heli", - "a3_music_f_mark", - "a3_plants_f_bush", - "a3_props_f_exp_a", - "a3_props_f_exp_a_military", - "a3_props_f_exp_a_military_equipment", - "a3_roads_f", - "a3_rocks_f", - "a3_signs_f", - "a3_signs_f_ad", - "a3_soft_f", - "a3_soft_f_beta_quadbike", - "a3_soft_f_bootcamp_offroad_01", - "a3_soft_f_bootcamp_quadbike", - "a3_soft_f_bootcamp_truck", - "a3_soft_f_car", - "a3_soft_f_crusher_ugv", - "a3_soft_f_epc_truck_03", - "a3_soft_f_gamma_hemtt", - "a3_soft_f_gamma_offroad", - "a3_soft_f_gamma_quadbike", - "a3_soft_f_gamma_truckheavy", - "a3_soft_f_heli_car", - "a3_soft_f_heli_crusher_ugv", - "a3_soft_f_heli_mrap_01", - "a3_soft_f_heli_mrap_02", - "a3_soft_f_heli_mrap_03", - "a3_soft_f_heli_quadbike", - "a3_soft_f_heli_suv", - "a3_soft_f_heli_truck", - "a3_soft_f_hemtt", - "a3_soft_f_kart_kart_01", - "a3_soft_f_mrap_01", - "a3_soft_f_mrap_02", - "a3_soft_f_mrap_03", - "a3_soft_f_offroad_01", - "a3_soft_f_quadbike", - "a3_soft_f_suv", - "a3_soft_f_truck", - "a3_soft_f_truckheavy", - "a3_sounds_f", - "a3_sounds_f_bootcamp", - "a3_sounds_f_epb", - "a3_sounds_f_epc", - "a3_sounds_f_exp_a", - "a3_sounds_f_mark", - "a3_static_f", - "a3_static_f_beta_mortar_01", - "a3_static_f_gamma", - "a3_static_f_gamma_aa", - "a3_static_f_gamma_at", - "a3_static_f_gamma_mortar_01", - "a3_static_f_mark_designator_01", - "a3_static_f_mark_designator_02", - "a3_static_f_mortar_01", - "a3_structures_f", - "a3_structures_f_bootcamp_civ_camping", - "a3_structures_f_bootcamp_civ_sportsgrounds", - "a3_structures_f_bootcamp_ind_cargo", - "a3_structures_f_bootcamp_items_electronics", - "a3_structures_f_bootcamp_items_food", - "a3_structures_f_bootcamp_items_sport", - "a3_structures_f_bootcamp_system", - "a3_structures_f_bootcamp_training", - "a3_structures_f_bootcamp_vr_blocks", - "a3_structures_f_bootcamp_vr_coverobjects", - "a3_structures_f_bootcamp_vr_helpers", - "a3_structures_f_bridges", - "a3_structures_f_civ", - "a3_structures_f_civ_accessories", - "a3_structures_f_civ_ancient", - "a3_structures_f_civ_belltowers", - "a3_structures_f_civ_calvaries", - "a3_structures_f_civ_camping", - "a3_structures_f_civ_chapels", - "a3_structures_f_civ_constructions", - "a3_structures_f_civ_dead", - "a3_structures_f_civ_garbage", - "a3_structures_f_civ_graffiti", - "a3_structures_f_civ_infoboards", - "a3_structures_f_civ_kiosks", - "a3_structures_f_civ_lamps", - "a3_structures_f_civ_market", - "a3_structures_f_civ_offices", - "a3_structures_f_civ_pavements", - "a3_structures_f_civ_playground", - "a3_structures_f_civ_sportsgrounds", - "a3_structures_f_civ_statues", - "a3_structures_f_civ_tourism", - "a3_structures_f_dominants", - "a3_structures_f_dominants_amphitheater", - "a3_structures_f_dominants_castle", - "a3_structures_f_dominants_church", - "a3_structures_f_dominants_hospital", - "a3_structures_f_dominants_lighthouse", - "a3_structures_f_dominants_wip", - "a3_structures_f_epa_civ_camping", - "a3_structures_f_epa_civ_constructions", - "a3_structures_f_epa_items_electronics", - "a3_structures_f_epa_items_food", - "a3_structures_f_epa_items_medical", - "a3_structures_f_epa_items_tools", - "a3_structures_f_epa_items_vessels", - "a3_structures_f_epa_mil_scrapyard", - "a3_structures_f_epa_walls", - "a3_structures_f_epb_civ_accessories", - "a3_structures_f_epb_civ_camping", - "a3_structures_f_epb_civ_dead", - "a3_structures_f_epb_civ_garbage", - "a3_structures_f_epb_civ_graffiti", - "a3_structures_f_epb_civ_playground", - "a3_structures_f_epb_furniture", - "a3_structures_f_epb_items_documents", - "a3_structures_f_epb_items_luggage", - "a3_structures_f_epb_items_military", - "a3_structures_f_epb_items_vessels", - "a3_structures_f_epb_naval_fishing", - "a3_structures_f_epc_civ_accessories", - "a3_structures_f_epc_civ_camping", - "a3_structures_f_epc_civ_garbage", - "a3_structures_f_epc_civ_infoboards", - "a3_structures_f_epc_civ_kiosks", - "a3_structures_f_epc_civ_playground", - "a3_structures_f_epc_civ_tourism", - "a3_structures_f_epc_dominants_ghosthotel", - "a3_structures_f_epc_dominants_stadium", - "a3_structures_f_epc_furniture", - "a3_structures_f_epc_items_documents", - "a3_structures_f_epc_items_electronics", - "a3_structures_f_epc_walls", - "a3_structures_f_exp_a", - "a3_structures_f_exp_a_vr_blocks", - "a3_structures_f_exp_a_vr_helpers", - "a3_structures_f_furniture", - "a3_structures_f_heli_civ_accessories", - "a3_structures_f_heli_civ_constructions", - "a3_structures_f_heli_civ_garbage", - "a3_structures_f_heli_civ_market", - "a3_structures_f_heli_furniture", - "a3_structures_f_heli_ind_airport", - "a3_structures_f_heli_ind_cargo", - "a3_structures_f_heli_ind_machines", - "a3_structures_f_heli_items_airport", - "a3_structures_f_heli_items_electronics", - "a3_structures_f_heli_items_food", - "a3_structures_f_heli_items_luggage", - "a3_structures_f_heli_items_sport", - "a3_structures_f_heli_items_tools", - "a3_structures_f_heli_vr_helpers", - "a3_structures_f_households", - "a3_structures_f_households_addons", - "a3_structures_f_households_house_big01", - "a3_structures_f_households_house_big02", - "a3_structures_f_households_house_shop01", - "a3_structures_f_households_house_shop02", - "a3_structures_f_households_house_small01", - "a3_structures_f_households_house_small02", - "a3_structures_f_households_house_small03", - "a3_structures_f_households_slum", - "a3_structures_f_households_stone_big", - "a3_structures_f_households_stone_shed", - "a3_structures_f_households_stone_small", - "a3_structures_f_households_wip", - "a3_structures_f_ind", - "a3_structures_f_ind_airport", - "a3_structures_f_ind_cargo", - "a3_structures_f_ind_carservice", - "a3_structures_f_ind_concretemixingplant", - "a3_structures_f_ind_crane", - "a3_structures_f_ind_dieselpowerplant", - "a3_structures_f_ind_factory", - "a3_structures_f_ind_fuelstation", - "a3_structures_f_ind_fuelstation_small", - "a3_structures_f_ind_pipes", - "a3_structures_f_ind_powerlines", - "a3_structures_f_ind_reservoirtank", - "a3_structures_f_ind_shed", - "a3_structures_f_ind_solarpowerplant", - "a3_structures_f_ind_tank", - "a3_structures_f_ind_transmitter_tower", - "a3_structures_f_ind_wavepowerplant", - "a3_structures_f_ind_windmill", - "a3_structures_f_ind_windpowerplant", - "a3_structures_f_items", - "a3_structures_f_items_cans", - "a3_structures_f_items_documents", - "a3_structures_f_items_electronics", - "a3_structures_f_items_gadgets", - "a3_structures_f_items_luggage", - "a3_structures_f_items_medical", - "a3_structures_f_items_military", - "a3_structures_f_items_stationery", - "a3_structures_f_items_tools", - "a3_structures_f_items_valuables", - "a3_structures_f_items_vessels", - "a3_structures_f_kart_civ_sportsgrounds", - "a3_structures_f_kart_mil_flags", - "a3_structures_f_kart_signs_companies", - "a3_structures_f_mark_items_military", - "a3_structures_f_mark_items_sport", - "a3_structures_f_mark_mil_flags", - "a3_structures_f_mark_training", - "a3_structures_f_mark_vr_helpers", - "a3_structures_f_mark_vr_shapes", - "a3_structures_f_mark_vr_targets", - "a3_structures_f_mil", - "a3_structures_f_mil_bagbunker", - "a3_structures_f_mil_bagfence", - "a3_structures_f_mil_barracks", - "a3_structures_f_mil_bunker", - "a3_structures_f_mil_cargo", - "a3_structures_f_mil_flags", - "a3_structures_f_mil_fortification", - "a3_structures_f_mil_helipads", - "a3_structures_f_mil_offices", - "a3_structures_f_mil_radar", - "a3_structures_f_mil_scrapyard", - "a3_structures_f_mil_shelters", - "a3_structures_f_mil_tenthangar", - "a3_structures_f_naval", - "a3_structures_f_naval_buoys", - "a3_structures_f_naval_fishing", - "a3_structures_f_naval_piers", - "a3_structures_f_naval_rowboats", - "a3_structures_f_research", - "a3_structures_f_signs_companies", - "a3_structures_f_system", - "a3_structures_f_training", - "a3_structures_f_training_invisibletarget", - "a3_structures_f_walls", - "a3_structures_f_wrecks", - "a3_supplies_f_heli", - "a3_supplies_f_heli_bladders", - "a3_supplies_f_heli_cargonets", - "a3_supplies_f_heli_fuel", - "a3_supplies_f_heli_slingload", - "a3_supplies_f_mark", - "a3_uav_f_characters_f_gamma", - "a3_uav_f_weapons_f_gamma_ammoboxes", - "a3_ui_f", - "a3_ui_f_bootcamp", - "a3_ui_f_curator", - "a3_ui_f_exp_a", - "a3_ui_f_heli", - "a3_ui_f_kart", - "a3_ui_f_mark", - "a3_ui_f_mp_mark", - "a3_uifonts_f", - "a3_weapons_f", - "a3_weapons_f_aaf", - "a3_weapons_f_acc", - "a3_weapons_f_ammoboxes", - "a3_weapons_f_beta", - "a3_weapons_f_beta_acc", - "a3_weapons_f_beta_ammoboxes", - "a3_weapons_f_beta_ebr", - "a3_weapons_f_beta_rifles_khaybar", - "a3_weapons_f_beta_rifles_mx", - "a3_weapons_f_beta_rifles_trg20", - "a3_weapons_f_bootcamp", - "a3_weapons_f_bootcamp_ammoboxes", - "a3_weapons_f_bootcamp_longrangerifles_gm6", - "a3_weapons_f_bootcamp_longrangerifles_m320", - "a3_weapons_f_csat", - "a3_weapons_f_dummyweapons", - "a3_weapons_f_ebr", - "a3_weapons_f_epa", - "a3_weapons_f_epa_acc", - "a3_weapons_f_epa_ammoboxes", - "a3_weapons_f_epa_ebr", - "a3_weapons_f_epa_longrangerifles_dmr_01", - "a3_weapons_f_epa_longrangerifles_gm6", - "a3_weapons_f_epa_rifles_mx", - "a3_weapons_f_epb", - "a3_weapons_f_epb_acc", - "a3_weapons_f_epb_ammoboxes", - "a3_weapons_f_epb_longrangerifles_gm3", - "a3_weapons_f_epb_longrangerifles_m320", - "a3_weapons_f_epb_rifles_mx_black", - "a3_weapons_f_epc", - "a3_weapons_f_explosives", - "a3_weapons_f_fia", - "a3_weapons_f_gamma", - "a3_weapons_f_gamma_acc", - "a3_weapons_f_gamma_ammoboxes", - "a3_weapons_f_gamma_items", - "a3_weapons_f_headgear", - "a3_weapons_f_itemholders", - "a3_weapons_f_items", - "a3_weapons_f_kart", - "a3_weapons_f_kart_pistols_pistol_signal_f", - "a3_weapons_f_launchers_law", - "a3_weapons_f_launchers_nlaw", - "a3_weapons_f_launchers_titan", - "a3_weapons_f_longrangerifles_gm6", - "a3_weapons_f_longrangerifles_m320", - "a3_weapons_f_machineguns_m200", - "a3_weapons_f_machineguns_zafir", - "a3_weapons_f_mark", - "a3_weapons_f_mark_acc", - "a3_weapons_f_mark_ebr", - "a3_weapons_f_mark_longrangerifles_dmr_01", - "a3_weapons_f_mark_longrangerifles_dmr_02", - "a3_weapons_f_mark_longrangerifles_dmr_03", - "a3_weapons_f_mark_longrangerifles_dmr_04", - "a3_weapons_f_mark_longrangerifles_dmr_05", - "a3_weapons_f_mark_longrangerifles_dmr_06", - "a3_weapons_f_mark_longrangerifles_gm6", - "a3_weapons_f_mark_longrangerifles_gm6_camo", - "a3_weapons_f_mark_longrangerifles_m320", - "a3_weapons_f_mark_longrangerifles_m320_camo", - "a3_weapons_f_mark_machineguns_m200", - "a3_weapons_f_mark_machineguns_mmg_01", - "a3_weapons_f_mark_machineguns_mmg_02", - "a3_weapons_f_mark_machineguns_zafir", - "a3_weapons_f_mark_rifles_khaybar", - "a3_weapons_f_mark_rifles_mk20", - "a3_weapons_f_mark_rifles_mx", - "a3_weapons_f_mark_rifles_sdar", - "a3_weapons_f_mark_rifles_trg20", - "a3_weapons_f_nato", - "a3_weapons_f_pistols_acpc2", - "a3_weapons_f_pistols_p07", - "a3_weapons_f_pistols_pdw2000", - "a3_weapons_f_pistols_pistol_heavy_01", - "a3_weapons_f_pistols_pistol_heavy_02", - "a3_weapons_f_pistols_rook40", - "a3_weapons_f_rifles_khaybar", - "a3_weapons_f_rifles_mk20", - "a3_weapons_f_rifles_mx", - "a3_weapons_f_rifles_sdar", - "a3_weapons_f_rifles_smg_02", - "a3_weapons_f_rifles_trg20", - "a3_weapons_f_rifles_vector", - "a3_weapons_f_uniforms", - "a3_weapons_f_vests", - "a3data", - "map_vr", - // CBA - "extended_eventhandlers", - "cba_ui", - "cba_xeh", - "cba_xeh_a3", - "cba_jr" - }; - author[] = {ECSTRING(common,ACETeam)}; - authorUrl = "http://ace3mod.com/"; - VERSION_CONFIG; - }; -}; - -class CfgMods { - class PREFIX { - dir = "@ace"; - name = "Advanced Combat Environment 3"; - picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; - hidePicture = "true"; - hideName = "true"; - actionName = "Website"; - action = "http://ace3mod.com/"; - description = "Issue Tracker: https://github.com/acemod/ACE3/issues"; - }; -}; - -#include "CfgSettings.hpp" -#include "CfgModuleCategories.hpp" -#include "CfgVehicleClasses.hpp" +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + // Vanilla + "3den", + "a3_air_f", + "a3_air_f_beta", + "a3_air_f_beta_heli_attack_01", + "a3_air_f_beta_heli_attack_02", + "a3_air_f_beta_heli_transport_01", + "a3_air_f_beta_heli_transport_02", + "a3_air_f_beta_parachute_01", + "a3_air_f_beta_parachute_02", + "a3_air_f_epb_heli_light_03", + "a3_air_f_epc_plane_cas_01", + "a3_air_f_epc_plane_cas_02", + "a3_air_f_epc_plane_fighter_03", + "a3_air_f_gamma_plane_fighter_03", + "a3_air_f_gamma_uav_01", + "a3_air_f_gamma_uav_02", + "a3_air_f_heli", + "a3_air_f_heli_heli_attack_01", + "a3_air_f_heli_heli_attack_02", + "a3_air_f_heli_heli_light_01", + "a3_air_f_heli_heli_light_02", + "a3_air_f_heli_heli_light_03", + "a3_air_f_heli_heli_transport_01", + "a3_air_f_heli_heli_transport_02", + "a3_air_f_heli_heli_transport_03", + "a3_air_f_heli_heli_transport_04", + "a3_air_f_heli_light_01", + "a3_air_f_heli_light_02", + "a3_animals_f", + "a3_animals_f_animconfig", + "a3_animals_f_chicken", + "a3_animals_f_dog", + "a3_animals_f_fishes", + "a3_animals_f_goat", + "a3_animals_f_kestrel", + "a3_animals_f_rabbit", + "a3_animals_f_seagull", + "a3_animals_f_sheep", + "a3_animals_f_snakes", + "a3_animals_f_turtle", + "a3_anims_f", + "a3_anims_f_config_sdr", + "a3_anims_f_epa", + "a3_anims_f_epc", + "a3_anims_f_exp_a", + "a3_anims_f_heli", + "a3_anims_f_kart", + "a3_anims_f_mark_deployment", + "a3_armor_f", + "a3_armor_f_amv", + "a3_armor_f_apc_wheeled_03", + "a3_armor_f_beta", + "a3_armor_f_beta_apc_tracked_02", + "a3_armor_f_epb_apc_tracked_03", + "a3_armor_f_epb_mbt_03", + "a3_armor_f_epc_mbt_01", + "a3_armor_f_marid", + "a3_armor_f_panther", + "a3_armor_f_slammer", + "a3_armor_f_t100k", + "a3_baseconfig_f", + "a3_boat_f", + "a3_boat_f_beta_boat_armed_01", + "a3_boat_f_beta_boat_transport_01", + "a3_boat_f_boat_armed_01", + "a3_boat_f_boat_transport_01", + "a3_boat_f_civilian_boat", + "a3_boat_f_epc_submarine_01_f", + "a3_boat_f_gamma_boat_transport_01", + "a3_boat_f_heli_boat_armed_01", + "a3_boat_f_heli_sdv_01", + "a3_boat_f_sdv_01", + "a3_boat_f_trawler", + "a3_cargoposes_f", + "a3_cargoposes_f_heli", + "a3_characters_f", + "a3_characters_f_beta", + "a3_characters_f_blufor", + "a3_characters_f_bootcamp", + "a3_characters_f_bootcamp_common", + "a3_characters_f_civil", + "a3_characters_f_common", + "a3_characters_f_epa", + "a3_characters_f_epb", + "a3_characters_f_epb_heads", + "a3_characters_f_epc", + "a3_characters_f_gamma", + "a3_characters_f_heads", + "a3_characters_f_indep", + "a3_characters_f_kart", + "a3_characters_f_mark", + "a3_characters_f_opfor", + "a3_characters_f_proxies", + "a3_data_f", + "a3_data_f_bootcamp", + "a3_data_f_curator", + "a3_data_f_curator_characters", + "a3_data_f_curator_eagle", + "a3_data_f_curator_intel", + "a3_data_f_curator_misc", + "a3_data_f_curator_respawn", + "a3_data_f_curator_virtual", + "a3_data_f_exp_a", + "a3_data_f_exp_a_virtual", + "a3_data_f_exp_b", + "a3_data_f_heli", + "a3_data_f_hook", + "a3_data_f_kart", + "a3_data_f_kart_particleeffects", + "a3_data_f_mark", + "a3_data_f_particleeffects", + "a3_dubbing_radio_f", + "a3_editor_f", + "a3_functions_f", + "a3_functions_f_bootcamp", + "a3_functions_f_curator", + "a3_functions_f_epa", + "a3_functions_f_epc", + "a3_functions_f_exp_a", + "a3_functions_f_heli", + "a3_functions_f_mark", + "a3_functions_f_mp_mark", + "a3_language_f", + "a3_language_f_beta", + "a3_language_f_bootcamp", + "a3_language_f_curator", + "a3_language_f_epa", + "a3_language_f_epb", + "a3_language_f_epc", + "a3_language_f_exp_a", + "a3_language_f_gamma", + "a3_language_f_heli", + "a3_language_f_kart", + "a3_language_f_mark", + "a3_language_f_mp_mark", + "a3_languagemissions_f", + "a3_languagemissions_f_beta", + "a3_languagemissions_f_gamma", + "a3_languagemissions_f_kart", + "a3_languagemissions_f_mp_mark", + "a3_map_altis", + "a3_map_altis_scenes", + "a3_map_data", + "a3_map_stratis", + "a3_map_stratis_scenes", + "a3_map_vr_scenes", + "a3_misc_f", + "a3_misc_f_helpers", + "a3_missions_f", + "a3_missions_f_beta", + "a3_missions_f_bootcamp", + "a3_missions_f_curator", + "a3_missions_f_epa", + "a3_missions_f_epb", + "a3_missions_f_epc", + "a3_missions_f_exp_a", + "a3_missions_f_gamma", + "a3_missions_f_heli", + "a3_missions_f_kart", + "a3_missions_f_mark", + "a3_missions_f_mp_mark", + "a3_modules_f", + "a3_modules_f_beta", + "a3_modules_f_beta_firingdrills", + "a3_modules_f_bootcamp", + "a3_modules_f_bootcamp_misc", + "a3_modules_f_curator", + "a3_modules_f_curator_animals", + "a3_modules_f_curator_cas", + "a3_modules_f_curator_chemlights", + "a3_modules_f_curator_curator", + "a3_modules_f_curator_effects", + "a3_modules_f_curator_environment", + "a3_modules_f_curator_flares", + "a3_modules_f_curator_intel", + "a3_modules_f_curator_lightning", + "a3_modules_f_curator_mines", + "a3_modules_f_curator_misc", + "a3_modules_f_curator_multiplayer", + "a3_modules_f_curator_objectives", + "a3_modules_f_curator_ordnance", + "a3_modules_f_curator_respawn", + "a3_modules_f_curator_smokeshells", + "a3_modules_f_dyno", + "a3_modules_f_effects", + "a3_modules_f_epb", + "a3_modules_f_epb_misc", + "a3_modules_f_events", + "a3_modules_f_exp_a", + "a3_modules_f_groupmodifiers", + "a3_modules_f_hc", + "a3_modules_f_heli", + "a3_modules_f_heli_spawnai", + "a3_modules_f_intel", + "a3_modules_f_kart", + "a3_modules_f_kart_timetrials", + "a3_modules_f_livefeed", + "a3_modules_f_mark", + "a3_modules_f_mark_firingdrills", + "a3_modules_f_mark_objectives", + "a3_modules_f_marta", + "a3_modules_f_misc", + "a3_modules_f_mp_mark", + "a3_modules_f_multiplayer", + "a3_modules_f_objectmodifiers", + "a3_modules_f_sites", + "a3_modules_f_skirmish", + "a3_modules_f_strategicmap", + "a3_modules_f_supports", + "a3_modules_f_uav", + "a3_music_f", + "a3_music_f_bootcamp", + "a3_music_f_epa", + "a3_music_f_epb", + "a3_music_f_epc", + "a3_music_f_heli", + "a3_music_f_mark", + "a3_plants_f_bush", + "a3_props_f_exp_a", + "a3_props_f_exp_a_military", + "a3_props_f_exp_a_military_equipment", + "a3_roads_f", + "a3_rocks_f", + "a3_signs_f", + "a3_signs_f_ad", + "a3_soft_f", + "a3_soft_f_beta_quadbike", + "a3_soft_f_bootcamp_offroad_01", + "a3_soft_f_bootcamp_quadbike", + "a3_soft_f_bootcamp_truck", + "a3_soft_f_car", + "a3_soft_f_crusher_ugv", + "a3_soft_f_epc_truck_03", + "a3_soft_f_gamma_hemtt", + "a3_soft_f_gamma_offroad", + "a3_soft_f_gamma_quadbike", + "a3_soft_f_gamma_truckheavy", + "a3_soft_f_heli_car", + "a3_soft_f_heli_crusher_ugv", + "a3_soft_f_heli_mrap_01", + "a3_soft_f_heli_mrap_02", + "a3_soft_f_heli_mrap_03", + "a3_soft_f_heli_quadbike", + "a3_soft_f_heli_suv", + "a3_soft_f_heli_truck", + "a3_soft_f_hemtt", + "a3_soft_f_kart_kart_01", + "a3_soft_f_mrap_01", + "a3_soft_f_mrap_02", + "a3_soft_f_mrap_03", + "a3_soft_f_offroad_01", + "a3_soft_f_quadbike", + "a3_soft_f_suv", + "a3_soft_f_truck", + "a3_soft_f_truckheavy", + "a3_sounds_f", + "a3_sounds_f_bootcamp", + "a3_sounds_f_epb", + "a3_sounds_f_epc", + "a3_sounds_f_exp_a", + "a3_sounds_f_mark", + "a3_static_f", + "a3_static_f_beta_mortar_01", + "a3_static_f_gamma", + "a3_static_f_gamma_aa", + "a3_static_f_gamma_at", + "a3_static_f_gamma_mortar_01", + "a3_static_f_mark_designator_01", + "a3_static_f_mark_designator_02", + "a3_static_f_mortar_01", + "a3_structures_f", + "a3_structures_f_bootcamp_civ_camping", + "a3_structures_f_bootcamp_civ_sportsgrounds", + "a3_structures_f_bootcamp_ind_cargo", + "a3_structures_f_bootcamp_items_electronics", + "a3_structures_f_bootcamp_items_food", + "a3_structures_f_bootcamp_items_sport", + "a3_structures_f_bootcamp_system", + "a3_structures_f_bootcamp_training", + "a3_structures_f_bootcamp_vr_blocks", + "a3_structures_f_bootcamp_vr_coverobjects", + "a3_structures_f_bootcamp_vr_helpers", + "a3_structures_f_bridges", + "a3_structures_f_civ", + "a3_structures_f_civ_accessories", + "a3_structures_f_civ_ancient", + "a3_structures_f_civ_belltowers", + "a3_structures_f_civ_calvaries", + "a3_structures_f_civ_camping", + "a3_structures_f_civ_chapels", + "a3_structures_f_civ_constructions", + "a3_structures_f_civ_dead", + "a3_structures_f_civ_garbage", + "a3_structures_f_civ_graffiti", + "a3_structures_f_civ_infoboards", + "a3_structures_f_civ_kiosks", + "a3_structures_f_civ_lamps", + "a3_structures_f_civ_market", + "a3_structures_f_civ_offices", + "a3_structures_f_civ_pavements", + "a3_structures_f_civ_playground", + "a3_structures_f_civ_sportsgrounds", + "a3_structures_f_civ_statues", + "a3_structures_f_civ_tourism", + "a3_structures_f_dominants", + "a3_structures_f_dominants_amphitheater", + "a3_structures_f_dominants_castle", + "a3_structures_f_dominants_church", + "a3_structures_f_dominants_hospital", + "a3_structures_f_dominants_lighthouse", + "a3_structures_f_dominants_wip", + "a3_structures_f_epa_civ_camping", + "a3_structures_f_epa_civ_constructions", + "a3_structures_f_epa_items_electronics", + "a3_structures_f_epa_items_food", + "a3_structures_f_epa_items_medical", + "a3_structures_f_epa_items_tools", + "a3_structures_f_epa_items_vessels", + "a3_structures_f_epa_mil_scrapyard", + "a3_structures_f_epa_walls", + "a3_structures_f_epb_civ_accessories", + "a3_structures_f_epb_civ_camping", + "a3_structures_f_epb_civ_dead", + "a3_structures_f_epb_civ_garbage", + "a3_structures_f_epb_civ_graffiti", + "a3_structures_f_epb_civ_playground", + "a3_structures_f_epb_furniture", + "a3_structures_f_epb_items_documents", + "a3_structures_f_epb_items_luggage", + "a3_structures_f_epb_items_military", + "a3_structures_f_epb_items_vessels", + "a3_structures_f_epb_naval_fishing", + "a3_structures_f_epc_civ_accessories", + "a3_structures_f_epc_civ_camping", + "a3_structures_f_epc_civ_garbage", + "a3_structures_f_epc_civ_infoboards", + "a3_structures_f_epc_civ_kiosks", + "a3_structures_f_epc_civ_playground", + "a3_structures_f_epc_civ_tourism", + "a3_structures_f_epc_dominants_ghosthotel", + "a3_structures_f_epc_dominants_stadium", + "a3_structures_f_epc_furniture", + "a3_structures_f_epc_items_documents", + "a3_structures_f_epc_items_electronics", + "a3_structures_f_epc_walls", + "a3_structures_f_exp_a", + "a3_structures_f_exp_a_vr_blocks", + "a3_structures_f_exp_a_vr_helpers", + "a3_structures_f_furniture", + "a3_structures_f_heli_civ_accessories", + "a3_structures_f_heli_civ_constructions", + "a3_structures_f_heli_civ_garbage", + "a3_structures_f_heli_civ_market", + "a3_structures_f_heli_furniture", + "a3_structures_f_heli_ind_airport", + "a3_structures_f_heli_ind_cargo", + "a3_structures_f_heli_ind_machines", + "a3_structures_f_heli_items_airport", + "a3_structures_f_heli_items_electronics", + "a3_structures_f_heli_items_food", + "a3_structures_f_heli_items_luggage", + "a3_structures_f_heli_items_sport", + "a3_structures_f_heli_items_tools", + "a3_structures_f_heli_vr_helpers", + "a3_structures_f_households", + "a3_structures_f_households_addons", + "a3_structures_f_households_house_big01", + "a3_structures_f_households_house_big02", + "a3_structures_f_households_house_shop01", + "a3_structures_f_households_house_shop02", + "a3_structures_f_households_house_small01", + "a3_structures_f_households_house_small02", + "a3_structures_f_households_house_small03", + "a3_structures_f_households_slum", + "a3_structures_f_households_stone_big", + "a3_structures_f_households_stone_shed", + "a3_structures_f_households_stone_small", + "a3_structures_f_households_wip", + "a3_structures_f_ind", + "a3_structures_f_ind_airport", + "a3_structures_f_ind_cargo", + "a3_structures_f_ind_carservice", + "a3_structures_f_ind_concretemixingplant", + "a3_structures_f_ind_crane", + "a3_structures_f_ind_dieselpowerplant", + "a3_structures_f_ind_factory", + "a3_structures_f_ind_fuelstation", + "a3_structures_f_ind_fuelstation_small", + "a3_structures_f_ind_pipes", + "a3_structures_f_ind_powerlines", + "a3_structures_f_ind_reservoirtank", + "a3_structures_f_ind_shed", + "a3_structures_f_ind_solarpowerplant", + "a3_structures_f_ind_tank", + "a3_structures_f_ind_transmitter_tower", + "a3_structures_f_ind_wavepowerplant", + "a3_structures_f_ind_windmill", + "a3_structures_f_ind_windpowerplant", + "a3_structures_f_items", + "a3_structures_f_items_cans", + "a3_structures_f_items_documents", + "a3_structures_f_items_electronics", + "a3_structures_f_items_gadgets", + "a3_structures_f_items_luggage", + "a3_structures_f_items_medical", + "a3_structures_f_items_military", + "a3_structures_f_items_stationery", + "a3_structures_f_items_tools", + "a3_structures_f_items_valuables", + "a3_structures_f_items_vessels", + "a3_structures_f_kart_civ_sportsgrounds", + "a3_structures_f_kart_mil_flags", + "a3_structures_f_kart_signs_companies", + "a3_structures_f_mark_items_military", + "a3_structures_f_mark_items_sport", + "a3_structures_f_mark_mil_flags", + "a3_structures_f_mark_training", + "a3_structures_f_mark_vr_helpers", + "a3_structures_f_mark_vr_shapes", + "a3_structures_f_mark_vr_targets", + "a3_structures_f_mil", + "a3_structures_f_mil_bagbunker", + "a3_structures_f_mil_bagfence", + "a3_structures_f_mil_barracks", + "a3_structures_f_mil_bunker", + "a3_structures_f_mil_cargo", + "a3_structures_f_mil_flags", + "a3_structures_f_mil_fortification", + "a3_structures_f_mil_helipads", + "a3_structures_f_mil_offices", + "a3_structures_f_mil_radar", + "a3_structures_f_mil_scrapyard", + "a3_structures_f_mil_shelters", + "a3_structures_f_mil_tenthangar", + "a3_structures_f_naval", + "a3_structures_f_naval_buoys", + "a3_structures_f_naval_fishing", + "a3_structures_f_naval_piers", + "a3_structures_f_naval_rowboats", + "a3_structures_f_research", + "a3_structures_f_signs_companies", + "a3_structures_f_system", + "a3_structures_f_training", + "a3_structures_f_training_invisibletarget", + "a3_structures_f_walls", + "a3_structures_f_wrecks", + "a3_supplies_f_heli", + "a3_supplies_f_heli_bladders", + "a3_supplies_f_heli_cargonets", + "a3_supplies_f_heli_fuel", + "a3_supplies_f_heli_slingload", + "a3_supplies_f_mark", + "a3_uav_f_characters_f_gamma", + "a3_uav_f_weapons_f_gamma_ammoboxes", + "a3_ui_f", + "a3_ui_f_bootcamp", + "a3_ui_f_curator", + "a3_ui_f_exp_a", + "a3_ui_f_heli", + "a3_ui_f_kart", + "a3_ui_f_mark", + "a3_ui_f_mp_mark", + "a3_uifonts_f", + "a3_weapons_f", + "a3_weapons_f_aaf", + "a3_weapons_f_acc", + "a3_weapons_f_ammoboxes", + "a3_weapons_f_beta", + "a3_weapons_f_beta_acc", + "a3_weapons_f_beta_ammoboxes", + "a3_weapons_f_beta_ebr", + "a3_weapons_f_beta_rifles_khaybar", + "a3_weapons_f_beta_rifles_mx", + "a3_weapons_f_beta_rifles_trg20", + "a3_weapons_f_bootcamp", + "a3_weapons_f_bootcamp_ammoboxes", + "a3_weapons_f_bootcamp_longrangerifles_gm6", + "a3_weapons_f_bootcamp_longrangerifles_m320", + "a3_weapons_f_csat", + "a3_weapons_f_dummyweapons", + "a3_weapons_f_ebr", + "a3_weapons_f_epa", + "a3_weapons_f_epa_acc", + "a3_weapons_f_epa_ammoboxes", + "a3_weapons_f_epa_ebr", + "a3_weapons_f_epa_longrangerifles_dmr_01", + "a3_weapons_f_epa_longrangerifles_gm6", + "a3_weapons_f_epa_rifles_mx", + "a3_weapons_f_epb", + "a3_weapons_f_epb_acc", + "a3_weapons_f_epb_ammoboxes", + "a3_weapons_f_epb_longrangerifles_gm3", + "a3_weapons_f_epb_longrangerifles_m320", + "a3_weapons_f_epb_rifles_mx_black", + "a3_weapons_f_epc", + "a3_weapons_f_explosives", + "a3_weapons_f_fia", + "a3_weapons_f_gamma", + "a3_weapons_f_gamma_acc", + "a3_weapons_f_gamma_ammoboxes", + "a3_weapons_f_gamma_items", + "a3_weapons_f_headgear", + "a3_weapons_f_itemholders", + "a3_weapons_f_items", + "a3_weapons_f_kart", + "a3_weapons_f_kart_pistols_pistol_signal_f", + "a3_weapons_f_launchers_law", + "a3_weapons_f_launchers_nlaw", + "a3_weapons_f_launchers_titan", + "a3_weapons_f_longrangerifles_gm6", + "a3_weapons_f_longrangerifles_m320", + "a3_weapons_f_machineguns_m200", + "a3_weapons_f_machineguns_zafir", + "a3_weapons_f_mark", + "a3_weapons_f_mark_acc", + "a3_weapons_f_mark_ebr", + "a3_weapons_f_mark_longrangerifles_dmr_01", + "a3_weapons_f_mark_longrangerifles_dmr_02", + "a3_weapons_f_mark_longrangerifles_dmr_03", + "a3_weapons_f_mark_longrangerifles_dmr_04", + "a3_weapons_f_mark_longrangerifles_dmr_05", + "a3_weapons_f_mark_longrangerifles_dmr_06", + "a3_weapons_f_mark_longrangerifles_gm6", + "a3_weapons_f_mark_longrangerifles_gm6_camo", + "a3_weapons_f_mark_longrangerifles_m320", + "a3_weapons_f_mark_longrangerifles_m320_camo", + "a3_weapons_f_mark_machineguns_m200", + "a3_weapons_f_mark_machineguns_mmg_01", + "a3_weapons_f_mark_machineguns_mmg_02", + "a3_weapons_f_mark_machineguns_zafir", + "a3_weapons_f_mark_rifles_khaybar", + "a3_weapons_f_mark_rifles_mk20", + "a3_weapons_f_mark_rifles_mx", + "a3_weapons_f_mark_rifles_sdar", + "a3_weapons_f_mark_rifles_trg20", + "a3_weapons_f_nato", + "a3_weapons_f_pistols_acpc2", + "a3_weapons_f_pistols_p07", + "a3_weapons_f_pistols_pdw2000", + "a3_weapons_f_pistols_pistol_heavy_01", + "a3_weapons_f_pistols_pistol_heavy_02", + "a3_weapons_f_pistols_rook40", + "a3_weapons_f_rifles_khaybar", + "a3_weapons_f_rifles_mk20", + "a3_weapons_f_rifles_mx", + "a3_weapons_f_rifles_sdar", + "a3_weapons_f_rifles_smg_02", + "a3_weapons_f_rifles_trg20", + "a3_weapons_f_rifles_vector", + "a3_weapons_f_uniforms", + "a3_weapons_f_vests", + "a3data", + "map_vr", + // CBA + "extended_eventhandlers", + "cba_ui", + "cba_xeh", + "cba_xeh_a3", + "cba_jr" + }; + author = ECSTRING(common,ACETeam); + url = CSTRING(URL); + VERSION_CONFIG; + }; +}; + +class CfgMods { + class PREFIX { + dir = "@ace"; + name = "Advanced Combat Environment 3"; + picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; + hidePicture = "true"; + hideName = "true"; + actionName = "Website"; + action = CSTRING(URL); + description = "Issue Tracker: https://github.com/acemod/ACE3/issues"; + }; +}; + +#include "CfgSettings.hpp" +#include "CfgModuleCategories.hpp" +#include "CfgVehicleClasses.hpp" diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp index dd7f17429e..2f40ce8e8d 100644 --- a/addons/main/script_component.hpp +++ b/addons/main/script_component.hpp @@ -1,17 +1,18 @@ -#define COMPONENT main -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_MAIN - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_MAIN - #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN -#endif - -#include "\z\ace\addons\main\script_macros.hpp" +#define COMPONENT main +#define COMPONENT_BEAUTIFIED Main +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_MAIN + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MAIN + #define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/main/script_debug.hpp b/addons/main/script_debug.hpp index 315a26a65f..92f58e1f96 100644 --- a/addons/main/script_debug.hpp +++ b/addons/main/script_debug.hpp @@ -1,40 +1,40 @@ -/** -STACK TRACING -**/ -//#define ENABLE_CALLSTACK -//#define ENABLE_PERFORMANCE_COUNTERS -//#define DEBUG_EVENTS - -#ifdef ENABLE_CALLSTACK - #define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} - #define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} - #define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC) - - #define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} - #define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} -#else - #define CALLSTACK(function) function - #define CALLSTACK_NAMED(function, functionName) function - #define DUMPSTACK -#endif - - -/** -PERFORMANCE COUNTERS SECTION -**/ -//#define ENABLE_PERFORMANCE_COUNTERS - -#ifdef ENABLE_PERFORMANCE_COUNTERS - #define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret } - - #define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter)); - #define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime]; - #define END_COUNTER(x) GVAR(DOUBLES(x,counter)) pushBack [(GVAR(DOUBLES(x,counter)) select 2), diag_tickTime]; - - #define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC) -#else - #define CREATE_COUNTER(x) /* disabled */ - #define BEGIN_COUNTER(x) /* disabled */ - #define END_COUNTER(x) /* disabled */ - #define DUMP_COUNTERS /* disabled */ -#endif +/** +STACK TRACING +**/ +//#define ENABLE_CALLSTACK +//#define ENABLE_PERFORMANCE_COUNTERS +//#define DEBUG_EVENTS + +#ifdef ENABLE_CALLSTACK + #define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} + #define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} + #define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC) + + #define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} + #define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} +#else + #define CALLSTACK(function) function + #define CALLSTACK_NAMED(function, functionName) function + #define DUMPSTACK +#endif + + +/** +PERFORMANCE COUNTERS SECTION +**/ +//#define ENABLE_PERFORMANCE_COUNTERS + +#ifdef ENABLE_PERFORMANCE_COUNTERS + #define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret } + + #define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter)); + #define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime]; + #define END_COUNTER(x) GVAR(DOUBLES(x,counter)) pushBack [(GVAR(DOUBLES(x,counter)) select 2), diag_tickTime]; + + #define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC) +#else + #define CREATE_COUNTER(x) /* disabled */ + #define BEGIN_COUNTER(x) /* disabled */ + #define END_COUNTER(x) /* disabled */ + #define DUMP_COUNTERS /* disabled */ +#endif diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index a64c8e014d..c7997dee28 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -1,210 +1,210 @@ -#include "\x\cba\addons\main\script_macros_common.hpp" -#include "\x\cba\addons\xeh\script_xeh.hpp" - -// Default versioning level -#define DEFAULT_VERSIONING_LEVEL 2 - -#define DGVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(GVAR(varName)) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(GVAR(varName))); }; GVAR(varName) -#define DVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(varName) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(varName)); }; varName -#define DFUNC(var1) TRIPLES(ADDON,fnc,var1) -#define DEFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2) - -#define QFUNC(var1) QUOTE(DFUNC(var1)) -#define QEFUNC(var1,var2) QUOTE(DEFUNC(var1,var2)) - -#define PATHTOEF(var1,var2) PATHTOF_SYS(PREFIX,var1,var2) - -#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)] -#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)] -#define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)] - -#define GETVAR(var1,var2,var3) var1 GETVAR_SYS(var2,var3) -#define GETMVAR(var1,var2) missionNamespace GETVAR_SYS(var1,var2) -#define GETUVAR(var1,var2) uiNamespace GETVAR_SYS(var1,var2) -#define GETPRVAR(var1,var2) profileNamespace GETVAR_SYS(var1,var2) -#define GETPAVAR(var1,var2) parsingNamespace GETVAR_SYS(var1,var2) - -#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3) -#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3) -#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2) -#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2) -#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2) -#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2) - -#define GETGVAR(var1,var2) GETMVAR(GVAR(var1),var2) -#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3) - -#define ARR_SELECT(ARRAY,INDEX,DEFAULT) if (count ARRAY > INDEX) then {ARRAY select INDEX} else {DEFAULT} - - -#define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ - weapon = #WEAPON; \ - count = COUNT; \ -} - -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -} - -#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ - magazine = #MAGAZINE; \ - count = COUNT; \ -} - -#define MACRO_ADDBACKPACK(BACKPACK,COUNT) class _xx_##BACKPACK { \ - backpack = #BACKPACK; \ - count = COUNT; \ -} - -// item types -#define TYPE_DEFAULT 0 -#define TYPE_MUZZLE 101 -#define TYPE_OPTICS 201 -#define TYPE_FLASHLIGHT 301 -#define TYPE_BIPOD 302 -#define TYPE_FIRST_AID_KIT 401 -#define TYPE_FINS 501 // not implemented -#define TYPE_BREATHING_BOMB 601 // not implemented -#define TYPE_NVG 602 -#define TYPE_GOGGLE 603 -#define TYPE_SCUBA 604 // not implemented -#define TYPE_HEADGEAR 605 -#define TYPE_FACTOR 607 -#define TYPE_RADIO 611 -#define TYPE_HMD 616 -#define TYPE_BINOCULAR 617 -#define TYPE_MEDIKIT 619 -#define TYPE_TOOLKIT 620 -#define TYPE_UAV_TERMINAL 621 -#define TYPE_VEST 701 -#define TYPE_UNIFORM 801 -#define TYPE_BACKPACK 901 - -#ifdef DISABLE_COMPILE_CACHE - #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) -#else - #define PREP(fncName) [QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)), QFUNC(fncName)] call CBA_fnc_compileFunction -#endif - -#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf)) - -#define HASH_CREATE ([] call EFUNC(common,hashCreate)) -#define HASH_SET(hash, key, val) ([hash, key, val, __FILE__, __LINE__] call EFUNC(common,hashSet)) -#define HASH_GET(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashGet)) -#define HASH_REM(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashRem)) -#define HASH_HASKEY(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashHasKey)) - -#define HASHLIST_CREATELIST(keys) ([keys] call EFUNC(common,hashListCreateList)) -#define HASHLIST_CREATEHASH(hashList) ([hashList] call EFUNC(common,hashListCreateHash)) -#define HASHLIST_SELECT(hashList, index) ([hashList, index, __FILE__, __LINE__] call EFUNC(common,hashListSelect)) -#define HASHLIST_SET(hashList, index, value) ([hashList, index, value, __FILE__, __LINE__] call EFUNC(common,hashListSet)) -#define HASHLIST_PUSH(hashList, value) ([hashList, value, __FILE__, __LINE__] call EFUNC(common,hashListPush)) - -// Time functions for accuracy per frame -#define ACE_tickTime (ACE_time + (diag_tickTime - ACE_diagTime)) - -#define ACE_isHC (!hasInterface && !isDedicated) - -#define IDC_STAMINA_BAR 193 - -//By default CBA's TRACE/LOG/WARNING spawn a buffer, which can cause messages to be logged out of order: -#ifdef CBA_DEBUG_SYNCHRONOUS - #define CBA_fnc_log { params ["_file","_lineNum","_message"]; diag_log [diag_frameNo, diag_tickTime, time, _file + ":"+str(_lineNum + 1), _message]; } -#endif - -#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message) -#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message) - -#define ACE_LOGERROR(message) ACE_LOG(COMPONENT,"ERROR",message) -#define ACE_LOGERROR_1(message,arg1) ACE_LOGERROR(FORMAT_1(message,arg1)) -#define ACE_LOGERROR_2(message,arg1,arg2) ACE_LOGERROR(FORMAT_2(message,arg1,arg2)) -#define ACE_LOGERROR_3(message,arg1,arg2,arg3) ACE_LOGERROR(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_LOGERROR_4(message,arg1,arg2,arg3,arg4) ACE_LOGERROR(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_LOGERROR_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGERROR(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_LOGERROR_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGERROR(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_LOGERROR_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGERROR(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_LOGERROR_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGERROR(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_ERRORFORMAT(message) ACE_LOGFORMAT(COMPONENT,"ERROR",message) -#define ACE_ERRORFORMAT_1(message,arg1) ACE_ERRORFORMAT(FORMAT_1(message,arg1)) -#define ACE_ERRORFORMAT_2(message,arg1,arg2) ACE_ERRORFORMAT(FORMAT_2(message,arg1,arg2)) -#define ACE_ERRORFORMAT_3(message,arg1,arg2,arg3) ACE_ERRORFORMAT(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_ERRORFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_ERRORFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_ERRORFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_ERRORFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_ERRORFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_ERRORFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_ERRORFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_ERRORFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_ERRORFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_ERRORFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_LOGWARNING(message) ACE_LOG(COMPONENT,"WARNING",message) -#define ACE_LOGWARNING_1(message,arg1) ACE_LOGWARNING(FORMAT_1(message,arg1)) -#define ACE_LOGWARNING_2(message,arg1,arg2) ACE_LOGWARNING(FORMAT_2(message,arg1,arg2)) -#define ACE_LOGWARNING_3(message,arg1,arg2,arg3) ACE_LOGWARNING(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_LOGWARNING_4(message,arg1,arg2,arg3,arg4) ACE_LOGWARNING(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_LOGWARNING_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGWARNING(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_LOGWARNING_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGWARNING(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_LOGWARNING_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGWARNING(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_LOGWARNING_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGWARNING(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_WARNINGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"WARNING",message) -#define ACE_WARNINGFORMAT_1(message,arg1) ACE_WARNINGFORMAT(FORMAT_1(message,arg1)) -#define ACE_WARNINGFORMAT_2(message,arg1,arg2) ACE_WARNINGFORMAT(FORMAT_2(message,arg1,arg2)) -#define ACE_WARNINGFORMAT_3(message,arg1,arg2,arg3) ACE_WARNINGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_WARNINGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_WARNINGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_WARNINGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_WARNINGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_WARNINGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_WARNINGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_WARNINGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_WARNINGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_WARNINGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_WARNINGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_LOGINFO(message) ACE_LOG(COMPONENT,"INFO",message) -#define ACE_LOGINFO_1(message,arg1) ACE_LOGINFO(FORMAT_1(message,arg1)) -#define ACE_LOGINFO_2(message,arg1,arg2) ACE_LOGINFO(FORMAT_2(message,arg1,arg2)) -#define ACE_LOGINFO_3(message,arg1,arg2,arg3) ACE_LOGINFO(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_LOGINFO_4(message,arg1,arg2,arg3,arg4) ACE_LOGINFO(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_LOGINFO_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGINFO(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_LOGINFO_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGINFO(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_LOGINFO_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGINFO(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_LOGINFO_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGINFO(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_INFOFORMAT(message) ACE_LOGFORMAT(COMPONENT,"INFO",message) -#define ACE_INFOFORMAT_1(message,arg1) ACE_INFOFORMAT(FORMAT_1(message,arg1)) -#define ACE_INFOFORMAT_2(message,arg1,arg2) ACE_INFOFORMAT(FORMAT_2(message,arg1,arg2)) -#define ACE_INFOFORMAT_3(message,arg1,arg2,arg3) ACE_INFOFORMAT(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_INFOFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_INFOFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_INFOFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_INFOFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_INFOFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_INFOFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_INFOFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_INFOFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_INFOFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_INFOFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_LOGDEBUG(message) ACE_LOG(COMPONENT,"DEBUG",message) -#define ACE_LOGDEBUG_1(message,arg1) ACE_LOGDEBUG(FORMAT_1(message,arg1)) -#define ACE_LOGDEBUG_2(message,arg1,arg2) ACE_LOGDEBUG(FORMAT_2(message,arg1,arg2)) -#define ACE_LOGDEBUG_3(message,arg1,arg2,arg3) ACE_LOGDEBUG(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_LOGDEBUG_4(message,arg1,arg2,arg3,arg4) ACE_LOGDEBUG(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_LOGDEBUG_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGDEBUG(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_LOGDEBUG_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGDEBUG(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_LOGDEBUG_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGDEBUG(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_LOGDEBUG_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGDEBUG(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_DEBUGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"DEBUG",message) -#define ACE_DEBUGFORMAT_1(message,arg1) ACE_DEBUGFORMAT(FORMAT_1(message,arg1)) -#define ACE_DEBUGFORMAT_2(message,arg1,arg2) ACE_DEBUGFORMAT(FORMAT_2(message,arg1,arg2)) -#define ACE_DEBUGFORMAT_3(message,arg1,arg2,arg3) ACE_DEBUGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) -#define ACE_DEBUGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_DEBUGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) -#define ACE_DEBUGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_DEBUGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) -#define ACE_DEBUGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_DEBUGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) -#define ACE_DEBUGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_DEBUGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) -#define ACE_DEBUGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_DEBUGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) - -#define ACE_DEPRECATED(arg1,arg2,arg3) ACE_LOGWARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3) - -#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ - format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)] -#ifdef DEBUG_MODE_FULL -#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ - [THIS_FILE_, __LINE__, PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J)] call CBA_fnc_log -#else - #define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */ -#endif - -#include "script_debug.hpp" +#include "\x\cba\addons\main\script_macros_common.hpp" +#include "\x\cba\addons\xeh\script_xeh.hpp" + +// Default versioning level +#define DEFAULT_VERSIONING_LEVEL 2 + +#define DGVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(GVAR(varName)) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(GVAR(varName))); }; GVAR(varName) +#define DVAR(varName) if(isNil "ACE_DEBUG_NAMESPACE") then { ACE_DEBUG_NAMESPACE = []; }; if(!(QUOTE(varName) in ACE_DEBUG_NAMESPACE)) then { PUSH(ACE_DEBUG_NAMESPACE, QUOTE(varName)); }; varName +#define DFUNC(var1) TRIPLES(ADDON,fnc,var1) +#define DEFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2) + +#undef QFUNC +#undef QEFUNC +#define QFUNC(var1) QUOTE(DFUNC(var1)) +#define QEFUNC(var1,var2) QUOTE(DEFUNC(var1,var2)) + +#define GETVAR_SYS(var1,var2) getVariable [ARR_2(QUOTE(var1),var2)] +#define SETVAR_SYS(var1,var2) setVariable [ARR_2(QUOTE(var1),var2)] +#define SETPVAR_SYS(var1,var2) setVariable [ARR_3(QUOTE(var1),var2,true)] + +#undef GETVAR +#define GETVAR(var1,var2,var3) var1 GETVAR_SYS(var2,var3) +#define GETMVAR(var1,var2) missionNamespace GETVAR_SYS(var1,var2) +#define GETUVAR(var1,var2) uiNamespace GETVAR_SYS(var1,var2) +#define GETPRVAR(var1,var2) profileNamespace GETVAR_SYS(var1,var2) +#define GETPAVAR(var1,var2) parsingNamespace GETVAR_SYS(var1,var2) + +#undef SETVAR +#define SETVAR(var1,var2,var3) var1 SETVAR_SYS(var2,var3) +#define SETPVAR(var1,var2,var3) var1 SETPVAR_SYS(var2,var3) +#define SETMVAR(var1,var2) missionNamespace SETVAR_SYS(var1,var2) +#define SETUVAR(var1,var2) uiNamespace SETVAR_SYS(var1,var2) +#define SETPRVAR(var1,var2) profileNamespace SETVAR_SYS(var1,var2) +#define SETPAVAR(var1,var2) parsingNamespace SETVAR_SYS(var1,var2) + +#define GETGVAR(var1,var2) GETMVAR(GVAR(var1),var2) +#define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3) + +#define ARR_SELECT(ARRAY,INDEX,DEFAULT) if (count ARRAY > INDEX) then {ARRAY select INDEX} else {DEFAULT} + + +#define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ + weapon = #WEAPON; \ + count = COUNT; \ +} + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +} + +#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ + magazine = #MAGAZINE; \ + count = COUNT; \ +} + +#define MACRO_ADDBACKPACK(BACKPACK,COUNT) class _xx_##BACKPACK { \ + backpack = #BACKPACK; \ + count = COUNT; \ +} + +// item types +#define TYPE_DEFAULT 0 +#define TYPE_MUZZLE 101 +#define TYPE_OPTICS 201 +#define TYPE_FLASHLIGHT 301 +#define TYPE_BIPOD 302 +#define TYPE_FIRST_AID_KIT 401 +#define TYPE_FINS 501 // not implemented +#define TYPE_BREATHING_BOMB 601 // not implemented +#define TYPE_NVG 602 +#define TYPE_GOGGLE 603 +#define TYPE_SCUBA 604 // not implemented +#define TYPE_HEADGEAR 605 +#define TYPE_FACTOR 607 +#define TYPE_RADIO 611 +#define TYPE_HMD 616 +#define TYPE_BINOCULAR 617 +#define TYPE_MEDIKIT 619 +#define TYPE_TOOLKIT 620 +#define TYPE_UAV_TERMINAL 621 +#define TYPE_VEST 701 +#define TYPE_UNIFORM 801 +#define TYPE_BACKPACK 901 + +#ifdef DISABLE_COMPILE_CACHE + #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf) +#else + #undef PREP + #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction +#endif + +#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QPATHTOF(folder\__PREP__.sqf) + +#define HASH_CREATE ([] call EFUNC(common,hashCreate)) +#define HASH_SET(hash, key, val) ([hash, key, val, __FILE__, __LINE__] call EFUNC(common,hashSet)) +#define HASH_GET(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashGet)) +#define HASH_REM(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashRem)) +#define HASH_HASKEY(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashHasKey)) + +#define HASHLIST_CREATELIST(keys) ([keys] call EFUNC(common,hashListCreateList)) +#define HASHLIST_CREATEHASH(hashList) ([hashList] call EFUNC(common,hashListCreateHash)) +#define HASHLIST_SELECT(hashList, index) ([hashList, index, __FILE__, __LINE__] call EFUNC(common,hashListSelect)) +#define HASHLIST_SET(hashList, index, value) ([hashList, index, value, __FILE__, __LINE__] call EFUNC(common,hashListSet)) +#define HASHLIST_PUSH(hashList, value) ([hashList, value, __FILE__, __LINE__] call EFUNC(common,hashListPush)) + +#define ACE_isHC (!hasInterface && !isDedicated) + +#define IDC_STAMINA_BAR 193 + +//By default CBA's TRACE/LOG/WARNING spawn a buffer, which can cause messages to be logged out of order: +#ifdef CBA_DEBUG_SYNCHRONOUS + #define CBA_fnc_log { params ["_file","_lineNum","_message"]; diag_log [diag_frameNo, diag_tickTime, time, _file + ":"+str(_lineNum + 1), _message]; } +#endif + +#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message) +#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message) + +#define ACE_LOGERROR(message) ACE_LOG(COMPONENT,"ERROR",message) +#define ACE_LOGERROR_1(message,arg1) ACE_LOGERROR(FORMAT_1(message,arg1)) +#define ACE_LOGERROR_2(message,arg1,arg2) ACE_LOGERROR(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGERROR_3(message,arg1,arg2,arg3) ACE_LOGERROR(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGERROR_4(message,arg1,arg2,arg3,arg4) ACE_LOGERROR(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGERROR_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGERROR(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGERROR_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGERROR(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGERROR_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGERROR(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGERROR_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGERROR(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_ERRORFORMAT(message) ACE_LOGFORMAT(COMPONENT,"ERROR",message) +#define ACE_ERRORFORMAT_1(message,arg1) ACE_ERRORFORMAT(FORMAT_1(message,arg1)) +#define ACE_ERRORFORMAT_2(message,arg1,arg2) ACE_ERRORFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_ERRORFORMAT_3(message,arg1,arg2,arg3) ACE_ERRORFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_ERRORFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_ERRORFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_ERRORFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_ERRORFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_ERRORFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_ERRORFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_ERRORFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_ERRORFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_ERRORFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_ERRORFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGWARNING(message) ACE_LOG(COMPONENT,"WARNING",message) +#define ACE_LOGWARNING_1(message,arg1) ACE_LOGWARNING(FORMAT_1(message,arg1)) +#define ACE_LOGWARNING_2(message,arg1,arg2) ACE_LOGWARNING(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGWARNING_3(message,arg1,arg2,arg3) ACE_LOGWARNING(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGWARNING_4(message,arg1,arg2,arg3,arg4) ACE_LOGWARNING(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGWARNING_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGWARNING(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGWARNING_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGWARNING(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGWARNING_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGWARNING(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGWARNING_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGWARNING(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_WARNINGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"WARNING",message) +#define ACE_WARNINGFORMAT_1(message,arg1) ACE_WARNINGFORMAT(FORMAT_1(message,arg1)) +#define ACE_WARNINGFORMAT_2(message,arg1,arg2) ACE_WARNINGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_WARNINGFORMAT_3(message,arg1,arg2,arg3) ACE_WARNINGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_WARNINGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_WARNINGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_WARNINGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_WARNINGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_WARNINGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_WARNINGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_WARNINGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_WARNINGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_WARNINGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_WARNINGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGINFO(message) ACE_LOG(COMPONENT,"INFO",message) +#define ACE_LOGINFO_1(message,arg1) ACE_LOGINFO(FORMAT_1(message,arg1)) +#define ACE_LOGINFO_2(message,arg1,arg2) ACE_LOGINFO(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGINFO_3(message,arg1,arg2,arg3) ACE_LOGINFO(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGINFO_4(message,arg1,arg2,arg3,arg4) ACE_LOGINFO(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGINFO_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGINFO(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGINFO_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGINFO(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGINFO_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGINFO(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGINFO_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGINFO(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_INFOFORMAT(message) ACE_LOGFORMAT(COMPONENT,"INFO",message) +#define ACE_INFOFORMAT_1(message,arg1) ACE_INFOFORMAT(FORMAT_1(message,arg1)) +#define ACE_INFOFORMAT_2(message,arg1,arg2) ACE_INFOFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_INFOFORMAT_3(message,arg1,arg2,arg3) ACE_INFOFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_INFOFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_INFOFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_INFOFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_INFOFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_INFOFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_INFOFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_INFOFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_INFOFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_INFOFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_INFOFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_LOGDEBUG(message) ACE_LOG(COMPONENT,"DEBUG",message) +#define ACE_LOGDEBUG_1(message,arg1) ACE_LOGDEBUG(FORMAT_1(message,arg1)) +#define ACE_LOGDEBUG_2(message,arg1,arg2) ACE_LOGDEBUG(FORMAT_2(message,arg1,arg2)) +#define ACE_LOGDEBUG_3(message,arg1,arg2,arg3) ACE_LOGDEBUG(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_LOGDEBUG_4(message,arg1,arg2,arg3,arg4) ACE_LOGDEBUG(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_LOGDEBUG_5(message,arg1,arg2,arg3,arg4,arg5) ACE_LOGDEBUG(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_LOGDEBUG_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_LOGDEBUG(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_LOGDEBUG_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_LOGDEBUG(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_LOGDEBUG_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_LOGDEBUG(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_DEBUGFORMAT(message) ACE_LOGFORMAT(COMPONENT,"DEBUG",message) +#define ACE_DEBUGFORMAT_1(message,arg1) ACE_DEBUGFORMAT(FORMAT_1(message,arg1)) +#define ACE_DEBUGFORMAT_2(message,arg1,arg2) ACE_DEBUGFORMAT(FORMAT_2(message,arg1,arg2)) +#define ACE_DEBUGFORMAT_3(message,arg1,arg2,arg3) ACE_DEBUGFORMAT(FORMAT_3(message,arg1,arg2,arg3)) +#define ACE_DEBUGFORMAT_4(message,arg1,arg2,arg3,arg4) ACE_DEBUGFORMAT(FORMAT_4(message,arg1,arg2,arg3,arg4)) +#define ACE_DEBUGFORMAT_5(message,arg1,arg2,arg3,arg4,arg5) ACE_DEBUGFORMAT(FORMAT_5(message,arg1,arg2,arg3,arg4,arg5)) +#define ACE_DEBUGFORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6) ACE_DEBUGFORMAT(FORMAT_6(message,arg1,arg2,arg3,arg4,arg5,arg6)) +#define ACE_DEBUGFORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7) ACE_DEBUGFORMAT(FORMAT_7(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7)) +#define ACE_DEBUGFORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ACE_DEBUGFORMAT(FORMAT_8(message,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)) + +#define ACE_DEPRECATED(arg1,arg2,arg3) ACE_LOGWARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3) + +#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)] +#ifdef DEBUG_MODE_FULL +#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + [THIS_FILE_, __LINE__, PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J)] call CBA_fnc_log +#else + #define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */ +#endif + +#include "script_debug.hpp" diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 1f86448c94..dcf84348a5 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -1,16 +1,22 @@ -// COMPONENT should be defined in the script_component.hpp and included BEFORE this hpp - -#define MAINPREFIX z -#define PREFIX ace - -#define MAJOR 3 -#define MINOR 5 -#define PATCHLVL 1 -#define BUILD 0 - -#define VERSION MAJOR.MINOR.PATCHLVL.BUILD -#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD - -// MINIMAL required version for the Mod. Components can specify others.. -#define REQUIRED_VERSION 1.56 -#define REQUIRED_CBA_VERSION {2,3,1} +// COMPONENT should be defined in the script_component.hpp and included BEFORE this hpp + +#define MAINPREFIX z +#define PREFIX ace + +#define MAJOR 3 +#define MINOR 6 +#define PATCHLVL 0 +#define BUILD 0 + +#define VERSION MAJOR.MINOR.PATCHLVL.BUILD +#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD + +// MINIMAL required version for the Mod. Components can specify others.. +#define REQUIRED_VERSION 1.60 +#define REQUIRED_CBA_VERSION {2,4,1} + +#ifdef COMPONENT_BEAUTIFIED + #define COMPONENT_NAME QUOTE(ACE3 - COMPONENT_BEAUTIFIED) +#else + #define COMPONENT_NAME QUOTE(ACE3 - COMPONENT) +#endif diff --git a/addons/main/stringtable.xml b/addons/main/stringtable.xml index 985bfb4836..4648225f9f 100644 --- a/addons/main/stringtable.xml +++ b/addons/main/stringtable.xml @@ -12,5 +12,16 @@ Logistica ACE ACE Logistique + + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + http://ace3mod.com/ + - \ No newline at end of file + diff --git a/addons/map/CfgAmmo.hpp b/addons/map/CfgAmmo.hpp index 01cd9427e8..82ff6841cb 100644 --- a/addons/map/CfgAmmo.hpp +++ b/addons/map/CfgAmmo.hpp @@ -1,48 +1,54 @@ class CfgAmmo { - - class FlareCore; - - class FlareBase: FlareCore {}; - class F_20mm_White: FlareBase {}; - - class ACE_FlashlightProxy_White: F_20mm_White { + + class Chemlight_base; + + class ACE_FlashlightProxy_White: Chemlight_base { model = "\A3\Weapons_f\empty"; - effectFlare = "FlareShell"; - - triggerTime = 0; - intensity = 0.5; - flareSize = 1; - timeToLive = 10e10; - - lightColor[] = {1,1,1,1}; - - grenadeBurningSound[] = {}; - grenadeFireSound[] = {}; - soundTrigger[] = {}; - SmokeShellSoundHit1[] = {}; - SmokeShellSoundHit2[] = {}; - SmokeShellSoundHit3[] = {}; - SmokeShellSoundLoop1[] = {}; - SmokeShellSoundLoop2[] = {}; + effectsSmoke = "ACE_FlashlightEffect_White"; + explosionTime = 0.01; + timeToLive = 1e10; + + soundImpactHard1[] = {"",1,1}; + soundImpactHard2[] = {"",1,1}; + soundImpactHard3[] = {"",1,1}; + soundImpactHard4[] = {"",1,1}; + soundImpactHard5[] = {"",1,1}; + soundImpactHard6[] = {"",1,1}; + soundImpactHard7[] = {"",1,1}; + soundImpactIron1[] = {"",1,1}; + soundImpactIron2[] = {"",1,1}; + soundImpactIron3[] = {"",1,1}; + soundImpactIron4[] = {"",1,1}; + soundImpactIron5[] = {"",1,1}; + soundImpactSoft1[] = {"",1,1}; + soundImpactSoft2[] = {"",1,1}; + soundImpactSoft3[] = {"",1,1}; + soundImpactSoft4[] = {"",1,1}; + soundImpactSoft5[] = {"",1,1}; + soundImpactSoft6[] = {"",1,1}; + soundImpactSoft7[] = {"",1,1}; + soundImpactWater1[] = {"",1,1}; + soundImpactWater2[] = {"",1,1}; + soundImpactWater3[] = {"",1,1}; + soundImpactWoodExt1[] = {"",1,1}; + soundImpactWoodExt2[] = {"",1,1}; + soundImpactWoodExt3[] = {"",1,1}; + soundImpactWoodExt4[] = {"",1,1}; }; - + class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White { - intensity = 1; - lightColor[] = {1,0,0,1}; + effectsSmoke = "ACE_FlashlightEffect_Red"; }; - - 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}; + effectsSmoke = "ACE_FlashlightEffect_Blue"; }; - + + class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White { + effectsSmoke = "ACE_FlashlightEffect_Green"; + }; + class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White { - intensity = 1; - lightColor[] = {1,1,0.5,1}; + effectsSmoke = "ACE_FlashlightEffect_Yellow"; }; -}; +}; \ No newline at end of file diff --git a/addons/map/CfgLights.hpp b/addons/map/CfgLights.hpp new file mode 100644 index 0000000000..bd69f9acbf --- /dev/null +++ b/addons/map/CfgLights.hpp @@ -0,0 +1,35 @@ +class CfgLights { + + class Chemlight_Blue; + + class ACE_FlashlightLight_White: Chemlight_Blue { + brightness = 100; + color[] = {1,1,1,1}; + diffuse[] = {1,1,1}; + intensity = 100; + position[] = {0,0,0}; + + class Attenuation { + constant = 0; + linear = 0; + quadratic = 10000; + start = 0.075; + }; + }; + + class ACE_FlashlightLight_Red: ACE_FlashlightLight_White { + diffuse[] = {1,0,0}; + }; + + class ACE_FlashlightLight_Blue: ACE_FlashlightLight_White { + diffuse[] = {0.25,0.25,1}; + }; + + class ACE_FlashlightLight_Green: ACE_FlashlightLight_White { + diffuse[] = {0,1,0}; + }; + + class ACE_FlashlightLight_Yellow: ACE_FlashlightLight_White { + diffuse[] = {1,1,0.4}; + }; +}; \ No newline at end of file diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index df52756eee..16eba79cb2 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -24,7 +24,7 @@ class CfgVehicles { scope = 2; isGlobal = 1; isSingular = 1; - icon = PATHTOF(UI\Icon_Module_Map_ca.paa); + icon = QPATHTOF(UI\Icon_Module_Map_ca.paa); class Arguments { class MapIllumination { displayName = CSTRING(MapIllumination_DisplayName); @@ -84,7 +84,7 @@ class CfgVehicles { scope = 2; isGlobal = 0; isSingular = 1; - icon = PATHTOF(UI\Icon_Module_BFTracking_ca.paa); + icon = QPATHTOF(UI\Icon_Module_BFTracking_ca.paa); class Arguments { class Enabled { displayName = CSTRING(BFT_Enabled_DisplayName); diff --git a/addons/map/Effects.hpp b/addons/map/Effects.hpp new file mode 100644 index 0000000000..1dc9b4c993 --- /dev/null +++ b/addons/map/Effects.hpp @@ -0,0 +1,36 @@ +// "Smoke" effect classes for global flashlight glow + +class ACE_FlashlightEffect_White { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_White"; + }; +}; + +class ACE_FlashlightEffect_Red { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Red"; + }; +}; + +class ACE_FlashlightEffect_Blue { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Blue"; + }; +}; + +class ACE_FlashlightEffect_Green { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Green"; + }; +}; + +class ACE_FlashlightEffect_Yellow { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Yellow"; + }; +}; \ No newline at end of file diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index f3b3ba6106..00d6fea0fb 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -9,6 +9,7 @@ if (isServer) then { { if (_x isKindOf "ACE_FlashlightProxy_White") then { // ACE_LOGINFO_2("Deleting leftover light [%1:%2] from DC player [%3]", _x, typeOf _x, _disconnectedPlayer); + detach _x; deleteVehicle _x; }; } forEach attachedObjects _disconnectedPlayer; @@ -29,7 +30,7 @@ call FUNC(determineZoom); if (isNull findDisplay 12) exitWith {}; GVAR(lastStillPosition) = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; - GVAR(lastStillTime) = ACE_time; + GVAR(lastStillTime) = CBA_missionTime; GVAR(isShaking) = false; //map sizes are multiples of 1280 @@ -72,7 +73,7 @@ call FUNC(determineZoom); [_this select 1] call CBA_fnc_removePerFrameHandler; }, 0] call CBA_fnc_addPerFrameHandler; -["SettingsInitialized", { +["ace_settingsInitialized", { if (isMultiplayer && {GVAR(DefaultChannel) != -1}) then { //Set the chat channel once the map has finished loading [{ @@ -99,15 +100,15 @@ call FUNC(determineZoom); GVAR(flashlightInUse) = ""; GVAR(glow) = objNull; - ["playerInventoryChanged", { + ["loadout", { private _flashlights = [ACE_player] call FUNC(getUnitFlashlights); if ((GVAR(flashlightInUse) != "") && !(GVAR(flashlightInUse) in _flashlights)) then { GVAR(flashlightInUse) = ""; }; - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addPlayerEventHandler; if (GVAR(mapGlow)) then { - ["visibleMapChanged", { + ["visibleMap", { params ["_player", "_mapOn"]; if (_mapOn) then { if (!alive _player && !isNull GVAR(glow)) then { @@ -127,15 +128,15 @@ call FUNC(determineZoom); [""] call FUNC(flashlightGlow); }; }; - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addPlayerEventHandler; }; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // hide clock on map if player has no watch GVAR(hasWatch) = true; -["playerInventoryChanged", { +["loadout", { if (isNull (_this select 0)) exitWith { GVAR(hasWatch) = true; }; @@ -144,4 +145,4 @@ GVAR(hasWatch) = true; if (_x isKindOf ["ItemWatch", configFile >> "CfgWeapons"]) exitWith {GVAR(hasWatch) = true;}; false } count (assignedItems ACE_player); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index 6d6b4030ec..1d830a8bd6 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"KoffeinFlummi","Rocko","esteldunedain"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","Rocko","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -29,6 +31,8 @@ class RscEdit; #include "CfgVehicles.hpp" #include "CfgAmmo.hpp" #include "CfgSounds.hpp" +#include "CfgLights.hpp" +#include "Effects.hpp" class RscMapControl { maxSatelliteAlpha = 0.5; diff --git a/addons/map/functions/fnc_compileFlashlightMenu.sqf b/addons/map/functions/fnc_compileFlashlightMenu.sqf index 836b483a20..5b91f15ca4 100644 --- a/addons/map/functions/fnc_compileFlashlightMenu.sqf +++ b/addons/map/functions/fnc_compileFlashlightMenu.sqf @@ -7,7 +7,7 @@ * 1: Player * 3: Parameters * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf index 011489f321..07567b9079 100644 --- a/addons/map/functions/fnc_flashlightGlow.sqf +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Flashlight classname ("" for off) * - * Return value: + * Return Value: * None * * Example: @@ -20,7 +20,10 @@ private ["_light", "_color", "_class"]; params ["_flashlight"]; _light = GVAR(glow); -if (!isNull _light) then {deleteVehicle _light}; +if (!isNull _light) then { + detach _light; + deleteVehicle _light; +}; if (_flashlight != "") then { _color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); @@ -28,9 +31,9 @@ if (_flashlight != "") then { _class = format["ACE_FlashlightProxy_%1", _color]; _light = _class createVehicle [0,0,0]; - _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; + _light attachTo [ACE_player, [0,0.1,-0.05], "neck"]; } else { _light = objNull; }; -GVAR(glow) = _light; +GVAR(glow) = _light; \ No newline at end of file diff --git a/addons/map/functions/fnc_getUnitFlashlights.sqf b/addons/map/functions/fnc_getUnitFlashlights.sqf index 41874cc0ca..eeaf504156 100644 --- a/addons/map/functions/fnc_getUnitFlashlights.sqf +++ b/addons/map/functions/fnc_getUnitFlashlights.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Unit to check * - * Return value: + * Return Value: * Flashlight classnames (empty for none) * * Example: diff --git a/addons/map/functions/fnc_switchFlashlight.sqf b/addons/map/functions/fnc_switchFlashlight.sqf index e177f886fa..e270ee0c11 100644 --- a/addons/map/functions/fnc_switchFlashlight.sqf +++ b/addons/map/functions/fnc_switchFlashlight.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Flashlight classname ("" for off) * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/map/functions/fnc_updateMapEffects.sqf b/addons/map/functions/fnc_updateMapEffects.sqf index 0e36a6fdd6..b89a75aa32 100644 --- a/addons/map/functions/fnc_updateMapEffects.sqf +++ b/addons/map/functions/fnc_updateMapEffects.sqf @@ -44,8 +44,8 @@ if (GVAR(mapShake)) then { _amplitude = (_speed - 0.1) / 5 * (1000 * _mapScale); _time = 0.1; - _shakePos = [(GVAR(lastStillPosition) select 0) + sin((ACE_time + _time - GVAR(lastStillTime))*100) * _amplitude * 0.25, - (GVAR(lastStillPosition) select 1) + sin((ACE_time + _time - GVAR(lastStillTime))*260) * _amplitude]; + _shakePos = [(GVAR(lastStillPosition) select 0) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*100) * _amplitude * 0.25, + (GVAR(lastStillPosition) select 1) + sin((CBA_missionTime + _time - GVAR(lastStillTime))*260) * _amplitude]; _mapCtrl ctrlMapAnimAdd [_time, _mapScale, _shakePos]; ctrlMapAnimCommit _mapCtrl; @@ -62,7 +62,7 @@ if (GVAR(mapShake)) then { } else { // The map is still, store state GVAR(lastStillPosition) = _mapCentre; - GVAR(lastStillTime) = ACE_time; + GVAR(lastStillTime) = CBA_missionTime; }; }; }; diff --git a/addons/map/script_component.hpp b/addons/map/script_component.hpp index c8767d76a0..414d4d17c9 100644 --- a/addons/map/script_component.hpp +++ b/addons/map/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT map +#define COMPONENT_BEAUTIFIED Map #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index 73bf0cc774..364f595637 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -20,7 +20,7 @@ ¿Iluminación de mapa? Osvětlení mapy Iluminação do mapa? - Luminosité + Illumination de la carte ? Térkép megvilágítása? Освещение карты? Illuminazione Mappa? @@ -29,7 +29,7 @@ Simulate map lighting based on ambient lighting and player's items? Simuliere Kartenbeleuchtung auf Basis des Umgebungslichts sowie der mitgeführten Gegenstände? Symuluj oświetlenie mapy bazujące na oświetleniu otoczenia oraz przedmiotach gracza? - Calcul la luminosité de la carte en fonction des conditions de lumière ? + Calculer la luminosité de la carte en fonction des conditions de lumière ? Симулировать освещение карты на основе окружающего света и приборов игрока? Simular a luz do mapa baseado em luz ambiente e itens do jogador? Simular iluminación de mapa basada en la iluminación ambiente y los elementos de los jugadores? @@ -45,7 +45,7 @@ Resplandor de linterna en el mapa? Nasvícení mapy pomocí baterky? Luce della torcia in mappa? - Lumière de la lampe de carte + Lumière de la lampe de carte ? Add external glow to players who use flashlight on map? @@ -65,7 +65,7 @@ Kamerawackeln Třesení mapy? Tremor de mapa? - Tremblement de la carte? + Tremblement de la carte ? Térkép-rázkódás? Тряска карты? Scuoti la mappa? @@ -77,7 +77,7 @@ Kamerawackeln beim Gehen? Umožnit třesení mapy za pochodu? Tremer o mapa enquanto caminha? - La carte tremble lors d'un déplacement ? + Faire trembler la carte lors d'un déplacement? Rázkódjon-e a térkép mozgáskor? Заставлять карту трястись при ходьбе? Far scuotere la mappa mentre cammini? @@ -89,7 +89,7 @@ Kartenvergrößerung einschränken Omezit přiblížení mapy? Limitar zoom do mapa? - Limiter le zoom de la carte? + Limiter le zoom de la carte ? Térkép-nagyítás korlátozása? Ограничить приближение карты? Limita lo zoom in mappa? @@ -101,7 +101,7 @@ Schränkt die maximale Kartenvergrößerung ein. Omezit stupeň přiblížení pro mapu? Limitar a quantidade de zoom disponível para o mapa? - Limite le zoom maximum pour la carte? + Limiter le zoom maximum de la carte ? Korlátozva legyen-e a nagyítás mennyisége a térképnél? Ограничить максимальное приближение, доступное на карте? Limita l'ammontare di zoom disponibile per la mappa? @@ -125,7 +125,7 @@ Gitter-Koordinaten auf dem Mauszeiger anzeigen? Zobrazit souřadnice u kurzoru v mapě? Mostrar as coordenadas de grade no ponteiro do mouse? - Affiche les coordonnées à coté du curseur ? + Afficher les coordonnées de la grille à coté du curseur ? Mutatva legyen-e a kurzornál található rész rácskoordinátája? Показывать координаты около курсора мыши? Mostra la griglia coordinate sul cursore mouse? @@ -136,7 +136,7 @@ Dieses Modul erweitert die Kartenfunktionen. Tento modul umožňuje přizpůsobit mapu s obrazem. Este módulo permite que você personalize a tela de mapa. - Ce module permet de personnaliser l'écran de la carte + Ce module permet de personnaliser l'écran de la carte. Ez a modul lehetővé teszi a térképnézet testreszabását. Этот модуль позволяет настроить отображение карты. Este módulo permite personalizar la pantalla del mapa. @@ -149,7 +149,7 @@ Blue Force Tracking Blue Force Tracking Rastreio de forças azuis - Blue Force Tracking + Blue Force Tracking (SFA) Blue Force követés Система слежения Blue Force Tracking Blue Force Tracking @@ -173,7 +173,7 @@ Aktywuj Blue Force Tracking. Domyślnie: Nie Povolit Blue Force Tracking. Výchozí: Ne Activar Blue Force Tracking. Por defecto: No - Activer le SFA. Défaut: non + Active le SFA. Défaut : non Blue Force követés engedélyezése. Alapértelmezett: Nem Включает систему служения BFT. По-умолчанию: Нет Abilita Blue Force Tracking. Default: No @@ -209,7 +209,7 @@ KI-Gruppen verstecken? Skrýt AI skupiny? Esconder grupos de IA? - Cacher les groupes IA ? + Cacher les groupes d'IA ? AI csoportok elrejtése? Скрыть группы ботов? Nascondere gruppi IA? @@ -233,7 +233,7 @@ Zeigen Sie die Namen der Spieler? Zobrazit jména hráčů? Mostrar os nomes dos jogadores? - Afficher les noms des joueurs? + Afficher les noms des joueurs ? Itt található az a játékos nevét? Показать имена игроков? Mostra i nomi dei giocatori? @@ -245,7 +245,7 @@ Zeigen einzelnen Spielernamen? Zobrazit názvy jednotlivých hráčů? Mostrar nomes individuais dos jogadores? - Afficher les noms des joueurs individuels? + Affiche les noms des joueurs individuels ? Itt található az adott játékos neveket? Показать отдельные имена игроков? Mostra i nomi dei giocatori singoli? @@ -278,7 +278,7 @@ NSG Noktowizja Óculos de Visão Noturna - Lunettes de vision nocturne + JVN ПНВ NVG NVG @@ -289,7 +289,7 @@ Ein Włącz Ligado - Allumer + Allumé Вкл. Zapnout Encendido @@ -300,7 +300,7 @@ Aus Wyłącz Desligado - Éteindre + Éteins Выкл. Vypnout Apagado @@ -361,7 +361,7 @@ Zvolit kanál po startu Imposta Canale all'Avvio Setear canal al comenzar - Définir le canal de départ + Mettre un canal par défaut Change the starting marker channel at mission start @@ -372,7 +372,7 @@ Nastavit kanál po startu mise Cambia il canale marker iniziale all'avvio di missione Cambiar el canal de marcadores inicial al comenzar la misión - Changer le marqueur du canal de départ au départ de la mission + Change le canal de communication par défaut au début de la mission. \ No newline at end of file diff --git a/addons/map_gestures/CfgVehicles.hpp b/addons/map_gestures/CfgVehicles.hpp index d4c88883e6..5593d66181 100644 --- a/addons/map_gestures/CfgVehicles.hpp +++ b/addons/map_gestures/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { isGlobal = 0; isSingular = 1; author = ECSTRING(common,ACETeam); - icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); + icon = QPATHTOF(ui\icon_module_map_gestures_ca.paa); class Arguments { class enabled { displayName = CSTRING(enabled_DisplayName); @@ -49,7 +49,7 @@ class CfgVehicles { function = QFUNC(moduleGroupSettings); isGlobal = 0; author = ECSTRING(common,ACETeam); - icon = PATHTOF(ui\icon_module_map_gestures_ca.paa); + icon = QPATHTOF(ui\icon_module_map_gestures_ca.paa); class Arguments { class leadColor { displayName = CSTRING(leadColor_displayName); diff --git a/addons/map_gestures/XEH_postInit.sqf b/addons/map_gestures/XEH_postInit.sqf index 233ee23c04..185eaf97f0 100644 --- a/addons/map_gestures/XEH_postInit.sqf +++ b/addons/map_gestures/XEH_postInit.sqf @@ -6,7 +6,7 @@ if (["STMapGestures"] call EFUNC(common,isModLoaded)) exitWith { if (!hasInterface) exitWith {}; -["SettingsInitialized", { +["ace_settingsInitialized", { if (!GVAR(enabled)) exitWith {}; [{ if (isNull (findDisplay 12)) exitWith {}; @@ -18,4 +18,4 @@ if (!hasInterface) exitWith {}; [_pfhId] call CBA_fnc_removePerFrameHandler; }, 1, []] call CBA_fnc_addPerFrameHandler; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/map_gestures/XEH_serverPostInit.sqf b/addons/map_gestures/XEH_serverPostInit.sqf index bde1cdc55b..1b70e24149 100644 --- a/addons/map_gestures/XEH_serverPostInit.sqf +++ b/addons/map_gestures/XEH_serverPostInit.sqf @@ -1,3 +1,3 @@ #include "script_component.hpp" -[EVENT_PLAYER_HAS_NO_OWNER_ID, FUNC(assignClientIDOnServer)] call EFUNC(common,addEventHandler); +[QGVAR(noOwnerID), FUNC(assignClientIDOnServer)] call CBA_fnc_addEventHandler; diff --git a/addons/map_gestures/config.cpp b/addons/map_gestures/config.cpp index 72e7f82078..b7bbf791e7 100644 --- a/addons/map_gestures/config.cpp +++ b/addons/map_gestures/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Dslyecxi", "MikeMatrix"}; - authorUrl = "https://github.com/MikeMatrix"; + author = ECSTRING(common,ACETeam); + authors[] = {"Dslyecxi", "MikeMatrix"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/map_gestures/functions/fnc_transmit.sqf b/addons/map_gestures/functions/fnc_transmit.sqf index c9dc487db2..aacff9e679 100644 --- a/addons/map_gestures/functions/fnc_transmit.sqf +++ b/addons/map_gestures/functions/fnc_transmit.sqf @@ -31,7 +31,7 @@ if (!GVAR(EnableTransmit) || !visibleMap) exitWith { { _ownerID = _x getVariable QGVAR(owner_id); if (isNil "_ownerID") then { - [EVENT_PLAYER_HAS_NO_OWNER_ID, [name _x]] call EFUNC(common,serverEvent); + [QGVAR(noOwnerID), [name _x]] call CBA_fnc_serverEvent; } else { _playerOwnerID = ACE_player getVariable QGVAR(owner_id); if (!isNil "_playerOwnerID" && _ownerID != _playerOwnerID) then { diff --git a/addons/map_gestures/functions/fnc_transmitterInit.sqf b/addons/map_gestures/functions/fnc_transmitterInit.sqf index 897855dc00..d115fb22c5 100644 --- a/addons/map_gestures/functions/fnc_transmitterInit.sqf +++ b/addons/map_gestures/functions/fnc_transmitterInit.sqf @@ -28,7 +28,7 @@ if (!isNil QGVAR(MouseMoveHandlerID)) then { }; GVAR(MouseMoveHandlerID) = _mapCtrl ctrlAddEventHandler ["MouseMoving", { // Don't transmit any data if we're using the map tools - if (!GVAR(EnableTransmit) || EGVAR(maptools,drawing_isDrawing) || EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)) exitWith {}; + if (!GVAR(EnableTransmit) || EGVAR(maptools,mapTool_isDragging) || EGVAR(maptools,mapTool_isRotating)) exitWith {}; params ["_control", "_posX", "_posY"]; diff --git a/addons/map_gestures/script_component.hpp b/addons/map_gestures/script_component.hpp index 2bc9b212d0..96189555f9 100644 --- a/addons/map_gestures/script_component.hpp +++ b/addons/map_gestures/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT map_gestures +#define COMPONENT_BEAUTIFIED Map Gestures #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -15,5 +16,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define EVENT_PLAYER_HAS_NO_OWNER_ID "PlayerNameHasNoOwnerID" diff --git a/addons/maptools/ACE_Settings.hpp b/addons/maptools/ACE_Settings.hpp index 0a88948a7f..0da43b64ca 100644 --- a/addons/maptools/ACE_Settings.hpp +++ b/addons/maptools/ACE_Settings.hpp @@ -1,6 +1,10 @@ class ACE_Settings { - class GVAR(everyoneCanDrawOnBriefing) { + class GVAR(rotateModifierKey) { value = 1; - typeName = "BOOL"; + typeName = "SCALAR"; + isClientSettable = 1; + displayName = CSTRING(rotateModifierKey_displayName); + description = CSTRING(rotateModifierKey_description); + values[] = {"$STR_A3_OPTIONS_DISABLED", "ALT", "CTRL", "SHIFT"}; }; }; diff --git a/addons/maptools/CfgVehicles.hpp b/addons/maptools/CfgVehicles.hpp index 063f88f38b..6c9bdc74d9 100644 --- a/addons/maptools/CfgVehicles.hpp +++ b/addons/maptools/CfgVehicles.hpp @@ -3,9 +3,26 @@ class CfgVehicles { class CAManBase: Man { class ACE_SelfActions { + class ACE_MapGpsShow { + displayName = CSTRING(MapGpsShow); + condition = QUOTE((!GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)}); + statement = QUOTE(GVAR(mapGpsShow) = true; [GVAR(mapGpsShow)] call FUNC(openMapGps)); + exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; + showDisabled = 0; + priority = 0; + }; + class ACE_MapGpsHide { + displayName = CSTRING(MapGpsHide); + condition = QUOTE((GVAR(mapGpsShow)) && {call FUNC(canUseMapGPS)}); + statement = QUOTE(GVAR(mapGpsShow) = false; [GVAR(mapGpsShow)] call FUNC(openMapGps)); + exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; + showDisabled = 0; + priority = 0; + }; + class ACE_MapTools { displayName = CSTRING(MapTools_Menu); - condition = QUOTE((call FUNC(canUseMapTools) || {call FUNC(canUseMapGPS)})); + condition = QUOTE(call FUNC(canUseMapTools)); statement = ""; exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 0; @@ -13,7 +30,7 @@ class CfgVehicles { class ACE_MapToolsHide { displayName = CSTRING(MapToolsHide); - condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); + condition = QUOTE(GVAR(mapTool_Shown) != 0); statement = QUOTE(GVAR(mapTool_Shown) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; @@ -21,7 +38,7 @@ class CfgVehicles { }; class ACE_MapToolsShowNormal { displayName = CSTRING(MapToolsShowNormal); - condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 1})); + condition = QUOTE(GVAR(mapTool_Shown) != 1); statement = QUOTE(GVAR(mapTool_Shown) = 1;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; @@ -29,7 +46,7 @@ class CfgVehicles { }; class ACE_MapToolsShowSmall { displayName = CSTRING(MapToolsShowSmall); - condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 2})); + condition = QUOTE(GVAR(mapTool_Shown) != 2); statement = QUOTE(GVAR(mapTool_Shown) = 2;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; @@ -37,7 +54,7 @@ class CfgVehicles { }; class ACE_MapToolsAlignNorth { displayName = CSTRING(MapToolsAlignNorth); - condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0})); + condition = QUOTE(GVAR(mapTool_Shown) != 0); statement = QUOTE(GVAR(mapTool_angle) = 0;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; @@ -45,40 +62,12 @@ class CfgVehicles { }; class ACE_MapToolsAlignCompass { displayName = CSTRING(MapToolsAlignCompass); - condition = QUOTE((call FUNC(canUseMapTools) && {GVAR(mapTool_Shown) != 0} && {('ItemCompass' in assigneditems ACE_player) || {'ItemCompass' in assigneditems ACE_player}})); + condition = QUOTE((GVAR(mapTool_Shown) != 0) && {'ItemCompass' in assigneditems ACE_player}); statement = QUOTE(GVAR(mapTool_angle) = getDir ACE_player;); exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; showDisabled = 1; priority = 1; }; - class ACE_MapGpsShow { - displayName = CSTRING(MapGpsShow); - condition = QUOTE((call FUNC(canUseMapGPS) && {!GVAR(mapGpsShow)})); - statement = QUOTE(GVAR(mapGpsShow) = true; [GVAR(mapGpsShow)] call FUNC(openMapGps)); - exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; - showDisabled = 0; - priority = 0; - }; - class ACE_MapGpsHide { - displayName = CSTRING(MapGpsHide); - condition = QUOTE((call FUNC(canUseMapGPS) && {GVAR(mapGpsShow)})); - statement = QUOTE(GVAR(mapGpsShow) = false; [GVAR(mapGpsShow)] call FUNC(openMapGps)); - exceptions[] = {"isNotDragging", "notOnMap", "isNotInside", "isNotSitting"}; - showDisabled = 0; - priority = 0; - }; - }; - }; - - class ACE_Actions { - class ACE_MainActions { - class ACE_CopyMap { - displayName = CSTRING(CopyMap); - condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target})); - statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart)); - showDisabled = 0; - priority = -1; - }; }; }; }; diff --git a/addons/maptools/CfgWeapons.hpp b/addons/maptools/CfgWeapons.hpp index 5cec99bfb0..dc7a7046dd 100644 --- a/addons/maptools/CfgWeapons.hpp +++ b/addons/maptools/CfgWeapons.hpp @@ -5,8 +5,8 @@ class CfgWeapons { class ACE_MapTools: ACE_ItemCore { displayName = CSTRING(Name); descriptionShort = CSTRING(Description); - model = QUOTE(PATHTOF(data\ace_MapTools.p3d)); - picture = PATHTOF(UI\maptool_item.paa); + model = QPATHTOF(data\ace_MapTools.p3d); + picture = QPATHTOF(UI\maptool_item.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 1; diff --git a/addons/maptools/MapControls.hpp b/addons/maptools/MapControls.hpp deleted file mode 100644 index 409796a6b1..0000000000 --- a/addons/maptools/MapControls.hpp +++ /dev/null @@ -1,80 +0,0 @@ -class controls { - class CA_PlayerName: RscText { - x = "2 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ProfilePicture: RscPicture { - x = "13.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ProfileBackground: RscText { - x = "13.3 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class Separator1: RscPicture { - x = "14.5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - }; - class ColorBlack: RscButton { - idc = 36732; - x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.2,0.2,1}; - colorBackgroundActive[] = {0,0,0,1}; - colorFocused[] = {0,0,0,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorBlack')]); - }; - class ColorRed: RscButton { - idc = 36733; - x = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.2,0.2,1}; - colorBackgroundActive[] = {1,0,0,1}; - colorFocused[] = {1,0,0,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorRed')]); - }; - class ColorGreen: RscButton { - idc = 36734; - x = "0.6 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.8,0.2,1}; - colorBackgroundActive[] = {0,1,0,1}; - colorFocused[] = {0,1,0,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorGreen')]); - }; - class ColorBlue: RscButton { - idc = 36735; - x = "0.9 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.2,0.2,0.8,1}; - colorBackgroundActive[] = {0,0,1,1}; - colorFocused[] = {0,0,1,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorBlue')]); - }; - class ColorYellow: RscButton { - idc = 36736; - x = "1.2 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.8,0.2,1}; - colorBackgroundActive[] = {1,1,0,1}; - colorFocused[] = {1,1,0,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorYellow')]); - }; - class ColorWhite: RscButton { - idc = 36737; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - y = "0.25 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "0.3 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.00 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorBackground[] = {0.8,0.8,0.8,1}; - colorBackgroundActive[] = {1,1,1,1}; - colorFocused[] = {1,1,1,1}; - onButtonClick = QUOTE(missionNamespace setVariable [ARR_2(QUOTE(QGVAR(drawing_drawColor)),'ColorWhite')]); - }; -}; diff --git a/addons/maptools/MapGpsUI.hpp b/addons/maptools/MapGpsUI.hpp index 170f0d1620..c5b230f163 100644 --- a/addons/maptools/MapGpsUI.hpp +++ b/addons/maptools/MapGpsUI.hpp @@ -26,7 +26,7 @@ class RscTitles { y = Y_gps; w = W_gps; h = H_gps; - text = PATHTOF(UI\mapGps.paa); + text = QPATHTOF(UI\mapGps.paa); colorBackground[] = {1, 1, 1, 1}; }; class heading: RscText{ diff --git a/addons/maptools/XEH_PREP.hpp b/addons/maptools/XEH_PREP.hpp index cff37aa65d..1670c59593 100644 --- a/addons/maptools/XEH_PREP.hpp +++ b/addons/maptools/XEH_PREP.hpp @@ -1,20 +1,9 @@ - -PREP(addLineMarker); PREP(calculateMapScale); -PREP(cancelDrawing); -PREP(canDraw); -PREP(canUseMapTools); PREP(canUseMapGPS); -PREP(copyMapReceiveMarkers); -PREP(copyMapRemoteSend); -PREP(copyMapStart); -PREP(handleKeyDown); +PREP(canUseMapTools); PREP(handleMouseButton); PREP(handleMouseMove); -PREP(handleMouseZChanged); PREP(isInsideMapTool); PREP(openMapGps); PREP(openMapGpsUpdate); -PREP(removeLineMarker); PREP(updateMapToolMarkers); -PREP(updateLineMarker); diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index 06cb8eda3d..8569f0eb9f 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -5,7 +5,6 @@ if (!hasInterface) exitWith {}; // Init variables -GVAR(mapVisableLastFrame) = false; GVAR(mapGpsShow) = true; GVAR(mapTool_Shown) = 0; @@ -14,59 +13,16 @@ GVAR(mapTool_angle) = 0; GVAR(mapTool_isDragging) = false; GVAR(mapTool_isRotating) = false; -GVAR(drawing_isDrawing) = false; -GVAR(drawing_tempLineMarker) = []; -GVAR(drawing_lineMarkers) = []; -GVAR(drawing_drawColor) = "ColorBlack"; -GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737]; +//Install the event handers for the map tools on the main in-game map +[{!isNull findDisplay 12}, +{ + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; + ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}]; +}, []] call CBA_fnc_waitUntilAndExecute; -// 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 { - _fnc_installMapEvents = { - private "_d"; - _d = _this; - ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; - ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; - ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; - ((findDisplay _d) displayCtrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(updateMapToolMarkers);}]; - (findDisplay _d) displayAddEventHandler ["KeyDown", {_this call FUNC(handleKeyDown);}]; - }; - - // Wait until the briefing map is detected - // display = 37 for SP - // display = 52 for host server on MP; - // display = 53 for MP clients) - waitUntil {(!isNull findDisplay 37) || (!isNull findDisplay 52) || (!isNull findDisplay 53) || (!isNull findDisplay 12)}; - - if (isNull findDisplay 12) then { - // Install event handlers on the map control of the briefing screen (control = 51) - GVAR(drawing_syncMarkers) = true; - if (!isNull findDisplay 52) then { - 52 call _fnc_installMapEvents; - } else { - if (!isNull findDisplay 53) then { - 53 call _fnc_installMapEvents; - } else { - 37 call _fnc_installMapEvents; - }; - }; - } else { - // Briefing screen was skipped; the player is JIP, create the markers defined during the briefing - GVAR(drawing_syncMarkers) = false; - { - _x call FUNC(addLineMarker); - } forEach GVAR(drawing_serverLineMarkers); - }; - - // Wait until the main map display is detected (display = 12) - waitUntil { !isNull findDisplay 12 }; - // Install event handlers on the map control and display (control = 51) - GVAR(drawing_syncMarkers) = false; - 12 call _fnc_installMapEvents; -}; - -["visibleMapChanged", { +["visibleMap", { params ["", "_mapOn"]; if (_mapOn) then { // Show GPS if required @@ -74,7 +30,5 @@ GVAR(drawing_controls) = [36732, 36733, 36734, 36735, 36736, 36737]; } else { // Hide GPS [false] call FUNC(openMapGps); - // Cancel drawing - call FUNC(cancelDrawing); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/maptools/XEH_preInit.sqf b/addons/maptools/XEH_preInit.sqf index 3022d53753..a7feade1c3 100644 --- a/addons/maptools/XEH_preInit.sqf +++ b/addons/maptools/XEH_preInit.sqf @@ -4,16 +4,4 @@ ADDON = false; #include "XEH_PREP.hpp" -if (isServer) then { - GVAR(drawing_serverLineMarkers) = []; - publicVariable QGVAR(drawing_serverLineMarkers); -}; - -//Add Event Handlers: -["drawing_removeLineMarker", FUNC(removeLineMarker) ] call EFUNC(common,addEventHandler); -["drawing_addLineMarker", FUNC(addLineMarker) ] call EFUNC(common,addEventHandler); - -["drawing_requestMarkers", FUNC(copyMapRemoteSend) ] call EFUNC(common,addEventHandler); -["drawing_sendbackMarkers", FUNC(copyMapReceiveMarkers) ] call EFUNC(common,addEventHandler); - ADDON = true; diff --git a/addons/maptools/config.cpp b/addons/maptools/config.cpp index 1e82cd2269..e94ec2edcd 100644 --- a/addons/maptools/config.cpp +++ b/addons/maptools/config.cpp @@ -2,18 +2,18 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_MapTools"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"esteldunedain"}; - authorUrl = "https://github.com/esteldunedain/"; + author = ECSTRING(common,ACETeam); + authors[] = {"esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; -#include "ACE_Settings.hpp" - class RscControlsGroup; class RscActiveText; class RscPicture; @@ -25,44 +25,8 @@ class RscButtonMenuCancel; class RscButtonMenu; class RscEdit; +#include "ACE_Settings.hpp" #include "MapGpsUI.hpp" #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" - - -// REGULAR MAP -class RscDisplayMainMap { - // Create the drawing color selector - class controls { - class TopRight: RscControlsGroup { - #include "MapControls.hpp" - }; - }; -}; - -// BRIEFING SCREEN -class RscDisplayGetReady: RscDisplayMainMap { - // Create the drawing color selector - class controls { - class TopRight: RscControlsGroup { - #include "MapControls.hpp" - }; - }; -}; -class RscDisplayClientGetReady: RscDisplayGetReady { - // Create the drawing color selector - class controls { - class TopRight: RscControlsGroup { - #include "MapControls.hpp" - }; - }; -}; -class RscDisplayServerGetReady: RscDisplayGetReady { - // Create the drawing color selector - class controls { - class TopRight: RscControlsGroup { - #include "MapControls.hpp" - }; - }; -}; diff --git a/addons/maptools/functions/fnc_addLineMarker.sqf b/addons/maptools/functions/fnc_addLineMarker.sqf deleted file mode 100644 index 017dc5b494..0000000000 --- a/addons/maptools/functions/fnc_addLineMarker.sqf +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Author: esteldunedain - * Add the line marker - * - * Arguments: - * 0: Marker Name - * 1: Marker start pos - * 2: Marker end pos - * 3: Color index - * - * Return value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_name", "_startPos", "_endPos", "_color"]; - -private ["_marker", "_difPos", "_mag"]; - -_difPos = _endPos vectorDiff _startPos; - -_marker = createMarkerLocal [_name, _startPos]; -_name setMarkerShapeLocal "RECTANGLE"; -_name setMarkerAlphaLocal 1; -_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); -} else { - _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); -}; diff --git a/addons/maptools/functions/fnc_calculateMapScale.sqf b/addons/maptools/functions/fnc_calculateMapScale.sqf index 018edf68d9..926ed558fe 100644 --- a/addons/maptools/functions/fnc_calculateMapScale.sqf +++ b/addons/maptools/functions/fnc_calculateMapScale.sqf @@ -5,16 +5,14 @@ * Arguments: * None * - * Return value: + * Return Value: * No * * Public: No */ #include "script_component.hpp" -private ["_screenOffset", "_pos"]; - -_pos = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; -_screenOffset = ((findDisplay 12) displayCtrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)]; +private _pos = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; +private _screenOffset = ((findDisplay 12) displayCtrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)]; (_screenOffset select 0) - 0.5 diff --git a/addons/maptools/functions/fnc_canDraw.sqf b/addons/maptools/functions/fnc_canDraw.sqf deleted file mode 100644 index da55043d85..0000000000 --- a/addons/maptools/functions/fnc_canDraw.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Author: esteldunedain - * canDraw - * - * Arguments: - * None - * - * Return value: - * - * - * Public: No - */ -#include "script_component.hpp" - -(missionNameSpace getVariable [QGVAR(drawing_syncMarkers), true] && {GVAR(EveryoneCanDrawOnBriefing)}) || -{(!isNull ACE_player) && {"ACE_MapTools" in items ACE_player}} diff --git a/addons/maptools/functions/fnc_canUseMapGPS.sqf b/addons/maptools/functions/fnc_canUseMapGPS.sqf index 381136a1cc..a327c2bc8d 100644 --- a/addons/maptools/functions/fnc_canUseMapGPS.sqf +++ b/addons/maptools/functions/fnc_canUseMapGPS.sqf @@ -5,7 +5,7 @@ * Arguments: * None * - * Return value: + * Return Value: * * * Public: No diff --git a/addons/maptools/functions/fnc_canUseMapTools.sqf b/addons/maptools/functions/fnc_canUseMapTools.sqf index 7658c2c1d2..8c16425082 100644 --- a/addons/maptools/functions/fnc_canUseMapTools.sqf +++ b/addons/maptools/functions/fnc_canUseMapTools.sqf @@ -5,7 +5,7 @@ * Arguments: * None * - * Return value: + * Return Value: * * * Public: No diff --git a/addons/maptools/functions/fnc_cancelDrawing.sqf b/addons/maptools/functions/fnc_cancelDrawing.sqf deleted file mode 100644 index bc80602cfc..0000000000 --- a/addons/maptools/functions/fnc_cancelDrawing.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Author: esteldunedain - * Cancel the drawing of the current line marker - * - * Arguments: - * None - * - * Return value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -GVAR(drawing_isDrawing) = false; -if (count GVAR(drawing_tempLineMarker) > 0) then { - 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 deleted file mode 100644 index 6c3c706208..0000000000 --- a/addons/maptools/functions/fnc_copyMapReceiveMarkers.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: esteldunedain - * Copy recieved markers to map - * - * Arguments: - * 0: Array of markers to copy - * - * Return value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -params ["_lineMarkers"]; - -{ - private "_marker"; - _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_copyMapRemoteSend.sqf b/addons/maptools/functions/fnc_copyMapRemoteSend.sqf deleted file mode 100644 index 551019f900..0000000000 --- a/addons/maptools/functions/fnc_copyMapRemoteSend.sqf +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Author: esteldunedain - * - * Send Map markers to other player - * - * Argument: - * 0: Target player (Unit) - * - * Return value: - * Return - */ - -#include "script_component.hpp" - -params ["_requester"]; - -["drawing_sendbackMarkers", _requester, [GVAR(drawing_lineMarkers)]] call EFUNC(common,targetEvent); diff --git a/addons/maptools/functions/fnc_copyMapStart.sqf b/addons/maptools/functions/fnc_copyMapStart.sqf deleted file mode 100644 index 7295f6f499..0000000000 --- a/addons/maptools/functions/fnc_copyMapStart.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: esteldunedain - * Send request to remote player - * - * Arguments: - * 0: Player - * 0: Target player - * - * Code Chain: - * START: copyMapStart: triggers event drawing_requestMarkers on remote - * handeled by: copyMapRemoteSend: triggers event "drawing_sendbackMarkers" on origin - * handeled by: copyMapReceiveMarkers - * - * Return value: - * Return - */ - -#include "script_component.hpp" - -params ["_player", "_target"]; - -["drawing_requestMarkers", _target, [_player]] call EFUNC(common,targetEvent); diff --git a/addons/maptools/functions/fnc_handleKeyDown.sqf b/addons/maptools/functions/fnc_handleKeyDown.sqf deleted file mode 100644 index a83522ac91..0000000000 --- a/addons/maptools/functions/fnc_handleKeyDown.sqf +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Author: esteldunedain - * Handle key down on map. - * - * Arguments: - * 0: Display (display) - * 1: Key code (number) - * 2: Shift Key (boolean) - * 3: Ctrl Key (boolean) - * 4: Alt Key (boolean) - * - * Return value: - * Boolean, true if event was handled - */ - -#include "script_component.hpp" - -params ["", "_code"]; -TRACE_1("params",_code); - -private ["_handled", "_relPos", "_diffVector", "_magDiffVector", "_lambdaLong", "_lambdaTrasAbs"]; - -_handled = false; - -#define DIK_ESCAPE 0x01 -#define DIK_DELETE 0xD3 - -// If pressed Esc while drawing -if (_code == DIK_ESCAPE) exitWith { - if (GVAR(drawing_isDrawing)) then { - call FUNC(cancelDrawing); - _handled = true; - }; - _handled -}; - -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]; - }; - _handled = true; - }; - } forEach GVAR(drawing_lineMarkers); - }; - _handled -}; - -_handled diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index cb1a4598ad..bf30a32ce1 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -2,23 +2,20 @@ * Author: esteldunedain * Handle mouse buttons. * - * Argument: + * Arguments: * 0: 1 if mouse down down, 0 if mouse button up (Number) * 1: Parameters of the mouse button event * - * Return value: + * Return Value: * Boolean, true if event was handled */ - #include "script_component.hpp" params ["_dir", "_params"]; _params params ["_control", "_button", "_screenPosX", "_screenPosY", "_shiftKey", "_ctrlKey", "_altKey"]; TRACE_2("params",_dir,_params); -private["_gui", "_handled", "_marker", "_pos"]; - -_handled = false; +private _handled = false; // If it's not a left button event, exit if (_button != 0) exitWith {_handled}; @@ -32,51 +29,32 @@ if (_dir != 1) then { }; } else { // If clicking - if !(call FUNC(canDraw)) exitWith {_handled = false;}; + if !(call FUNC(canUseMapTools)) exitWith {}; // Transform mouse screen position to coordinates - _pos = _control ctrlMapScreenToWorld [_screenPosX, _screenPosY]; + private _pos = _control ctrlMapScreenToWorld [_screenPosX, _screenPosY]; _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); - ["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent); - // Log who drew on the briefing screen - [ACE_INFOFORMAT_1("Player %1 drew on the briefing screen", profileName)] call EFUNC(common,serverLog); - } else { - GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); - GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker)); - }; - 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 (GVAR(mapTool_Shown) == 0) exitWith {_handled = false;}; + if (GVAR(mapTool_Shown) == 0) exitWith {}; // 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 { + + private _rotateKeyPressed = switch (GVAR(rotateModifierKey)) do { + case (1): {_altKey}; + case (2): {_ctrlKey}; + case (3): {_shiftKey}; + default {false}; + }; + + if (_rotateKeyPressed) 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); @@ -88,7 +66,6 @@ if (_dir != 1) then { }; _handled = true; }; - _handled }; _handled diff --git a/addons/maptools/functions/fnc_handleMouseMove.sqf b/addons/maptools/functions/fnc_handleMouseMove.sqf index b27087290b..a52163ba32 100644 --- a/addons/maptools/functions/fnc_handleMouseMove.sqf +++ b/addons/maptools/functions/fnc_handleMouseMove.sqf @@ -2,11 +2,11 @@ * Author: esteldunedain * Handle mouse movement over the map tool. * - * Argument: + * Arguments: * 0: Map Control * 1: Mouse position on screen coordinates * - * Return value: + * Return Value: * Boolean, true if event was handled */ @@ -15,44 +15,28 @@ params ["_control", "_mousePosX", "_mousePosY"]; TRACE_3("params",_control,_mousePosX,_mousePosY); -private ["_control", "_pos"]; - -GVAR(mousePosition) = _control ctrlMapScreenToWorld [_mousePosX, _mousePosY]; -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); - }; +// If have no map tools, then exit +if (((isNull ACE_player) || {!("ACE_MapTools" in items ACE_player)})) exitWith { false }; -// Handle drawing -if (GVAR(drawing_isDrawing)) exitWith { - GVAR(drawing_tempLineMarker) set [2, GVAR(mousePosition)]; - TRACE_1("updating line pos",GVAR(mousePosition)); - GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); - false -}; - -// Handle Map tools +// If map tools not shown, then exit if (GVAR(mapTool_Shown) == 0) exitWith {false}; +private _mousePosition = _control ctrlMapScreenToWorld [_mousePosX, _mousePosY]; + // 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) + (_mousePosition select 0) - (GVAR(mapTool_startDragPos) select 0)]; + GVAR(mapTool_pos) set [1, (GVAR(mapTool_startPos) select 1) + (_mousePosition select 1) - (GVAR(mapTool_startDragPos) select 1)]; true }; // Rotation if (GVAR(mapTool_isRotating)) exitWith { - private "_angle"; // 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); + private _angle = (180 + ((_mousePosition select 0) - (GVAR(mapTool_startPos) select 0)) atan2 ((_mousePosition select 1) - (GVAR(mapTool_startPos) select 1)) mod 360); GVAR(mapTool_angle) = GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle); true diff --git a/addons/maptools/functions/fnc_handleMouseZChanged.sqf b/addons/maptools/functions/fnc_handleMouseZChanged.sqf deleted file mode 100644 index 0af86a81c5..0000000000 --- a/addons/maptools/functions/fnc_handleMouseZChanged.sqf +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: esteldunedain - * - * Handle mouse wheel. - * - * Argument: - * 0: Control - * 1: Scroll Amount - * - * Return value: - * Boolean, true if event was handled - */ - -#include "script_component.hpp" - -private ["_dir", "_params", "_control", "_button", "_screenPos", "_shiftKey", "_ctrlKey", "_handled", "_pos"]; - -_control = _this select 0; -_dir = _this select 1; -_handled = false; - -_handled = true; -// If drawing, change line color - - -//@todo AGM bug: -// 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 = ACE_Map_drawColor - count ACE_Map_drawColors; -}; -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; - -_handled = true; -}; */ -_handled diff --git a/addons/maptools/functions/fnc_isInsideMapTool.sqf b/addons/maptools/functions/fnc_isInsideMapTool.sqf index eeaf8f346a..1bcb35f86a 100644 --- a/addons/maptools/functions/fnc_isInsideMapTool.sqf +++ b/addons/maptools/functions/fnc_isInsideMapTool.sqf @@ -6,7 +6,7 @@ * 0: x Position (in meters) * 1: y Position (in meters) * - * Return value: + * Return Value: * Boolean */ #include "script_component.hpp" @@ -16,21 +16,19 @@ #define DIST_TOP_TO_CENTER_PERC 0.65 #define DIST_LEFT_TO_CENTER_PERC 0.30 -private ["_textureWidth", "_relPos", "_dirVector", "_lambdaLong", "_lambdaTrasAbs", "_pos"]; - if (GVAR(mapTool_Shown) == 0) exitWith {false}; -_textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapTool_Shown) - 1); +private _textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapTool_Shown) - 1); -_pos = [_this select 0, _this select 1, 0]; -_relPos = _pos vectorDiff [GVAR(mapTool_pos) select 0, GVAR(mapTool_pos) select 1, 0]; -_dirVector = [sin(GVAR(mapTool_angle)), cos(GVAR(mapTool_angle)), 0]; +private _pos = [_this select 0, _this select 1, 0]; +private _relPos = _pos vectorDiff [GVAR(mapTool_pos) select 0, GVAR(mapTool_pos) select 1, 0]; +private _dirVector = [sin(GVAR(mapTool_angle)), cos(GVAR(mapTool_angle)), 0]; // Projection of the relative position over the longitudinal axis of the map tool -_lambdaLong = _dirVector vectorDotProduct _relPos; +private _lambdaLong = _dirVector vectorDotProduct _relPos; if (_lambdaLong < DIST_BOTTOM_TO_CENTER_PERC * _textureWidth) exitWith {false}; // Projection of the relative position over the trasversal axis of the map tool -_lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_dirVector vectorMultiply _lambdaLong)); +private _lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_dirVector vectorMultiply _lambdaLong)); if (_lambdaLong > DIST_TOP_TO_CENTER_PERC * _textureWidth) exitWith {false}; if (_lambdaTrasAbs > DIST_LEFT_TO_CENTER_PERC * _textureWidth) exitWith {false}; diff --git a/addons/maptools/functions/fnc_openMapGps.sqf b/addons/maptools/functions/fnc_openMapGps.sqf index dc2df07b57..c3e2a8bfee 100644 --- a/addons/maptools/functions/fnc_openMapGps.sqf +++ b/addons/maptools/functions/fnc_openMapGps.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: Open GPS? * - * Return value: + * Return Value: * Nothing * * Public: No @@ -14,9 +14,7 @@ params ["_shouldOpenGps"]; -private ["_isOpen"]; - -_isOpen = !(isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])); +private _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"]; diff --git a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf index 4a77f4a6c3..719bf37763 100644 --- a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf +++ b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf @@ -3,16 +3,14 @@ #include "script_component.hpp" -private ["_mapGpsDisplay", "_ctrl"]; - if ((!("ItemGPS" in assigneditems ACE_player)) || {isNull (uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull])}) exitWith { ("RscACE_MapGps" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; // Close GPS RSC [(_this select 1)] call CBA_fnc_removePerFrameHandler; // Remove frameHandler }; disableSerialization; -_mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]; -_ctrl = _mapGpsDisplay displayCtrl 913590; +private _mapGpsDisplay = uiNamespace getVariable [QGVAR(ui_mapGpsDisplay), displayNull]; +private _ctrl = _mapGpsDisplay displayCtrl 913590; _ctrl ctrlSetText str (round (getDir ACE_player)); // Set Heading _ctrl = _mapGpsDisplay displayCtrl 913591; _ctrl ctrlSetText str (round ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude)); // Set Altitude diff --git a/addons/maptools/functions/fnc_removeLineMarker.sqf b/addons/maptools/functions/fnc_removeLineMarker.sqf deleted file mode 100644 index bd0a16adb1..0000000000 --- a/addons/maptools/functions/fnc_removeLineMarker.sqf +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Author: esteldunedain - * Remove the line marker - * - * Arguments: - * 0: Marker Name - * - * Return value: - * Return - */ - -#include "script_component.hpp" - -params ["_name"]; - -deleteMarkerLocal _name; -{ - 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); -}; diff --git a/addons/maptools/functions/fnc_updateLineMarker.sqf b/addons/maptools/functions/fnc_updateLineMarker.sqf deleted file mode 100644 index 12aee5b1df..0000000000 --- a/addons/maptools/functions/fnc_updateLineMarker.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: esteldunedain - * Updates the line marker position and scale - * - * Arguments: - * 0: Marker Name - * 1: Marker start pos - * 2: Marker end pos - * 3: Color index - * - * Return value: - * None - */ -#include "script_component.hpp" - -params ["_name", "_startPos", "_endPos", "_color"]; -TRACE_4("params",_name,_startPos,_endPos,_color); - -private ["_difPos", "_mag"]; - -_difPos = _endPos vectorDiff _startPos; - -_name setMarkerShapeLocal "RECTANGLE"; -_name setMarkerAlphaLocal 1; -_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); -} else { - _name setMarkerSizeLocal [5, 5]; - _name setMarkerDirLocal 0; -}; diff --git a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf index 5d11c6a6e9..47688cdb91 100644 --- a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf +++ b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: The Map * - * Return value: + * Return Value: * Nothing * * Public: No @@ -18,40 +18,28 @@ params ["_theMap"]; -private ["_rotatingTexture", "_textureWidth", "_scaleX", "_scaleY", "_xPos", "_yPos"]; +if ((GVAR(mapTool_Shown) == 0) || {!("ACE_MapTools" in items ACE_player)}) exitWith {}; -// Show/Hide draw buttons -if ([] call FUNC(canDraw)) 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); - }; -}; - -if (!("ACE_MapTools" in items ACE_player)|| {GVAR(mapTool_Shown) == 0}) exitWith {}; - -_rotatingTexture = ""; -_textureWidth = 0; +private _rotatingTexture = ""; +private _textureWidth = 0; if (GVAR(mapTool_Shown) == 1) then { - _rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingNormal.paa)); + _rotatingTexture = QPATHTOF(data\mapToolRotatingNormal.paa); _textureWidth = TEXTURE_WIDTH_IN_M; } else { - _rotatingTexture = QUOTE(PATHTOF(data\mapToolRotatingSmall.paa)); + _rotatingTexture = QPATHTOF(data\mapToolRotatingSmall.paa); _textureWidth = TEXTURE_WIDTH_IN_M / 2; }; // Update scale of both parts getResolution params ["_resWidth", "_resHeight", "", "", "_aspectRatio"]; -_scaleX = 32 * _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale)); -_scaleY = _scaleX * ((_resWidth / _resHeight) / _aspectRatio); //handle bad aspect ratios +private _scaleX = 32 * _textureWidth * CONSTANT_SCALE * (call FUNC(calculateMapScale)); +private _scaleY = _scaleX * ((_resWidth / _resHeight) / _aspectRatio); //handle bad aspect ratios // Position of the fixed part -_xPos = GVAR(mapTool_pos) select 0; -_yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC; +private _xPos = GVAR(mapTool_pos) select 0; +private _yPos = (GVAR(mapTool_pos) select 1) + _textureWidth * CENTER_OFFSET_Y_PERC; -_theMap drawIcon [QUOTE(PATHTOF(data\mapToolFixed.paa)), [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, 0, "", 0]; +_theMap drawIcon [QPATHTOF(data\mapToolFixed.paa), [1,1,1,1], [_xPos,_yPos], _scaleX, _scaleY, 0, "", 0]; // Position and rotation of the rotating part _xPos = (GVAR(mapTool_pos) select 0) + sin(GVAR(mapTool_angle)) * _textureWidth * CENTER_OFFSET_Y_PERC; diff --git a/addons/maptools/script_component.hpp b/addons/maptools/script_component.hpp index 497ee14dc1..d5f5b0f2d7 100644 --- a/addons/maptools/script_component.hpp +++ b/addons/maptools/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT maptools +#define COMPONENT_BEAUTIFIED Map Tools #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/maptools/stringtable.xml b/addons/maptools/stringtable.xml index 3db0d4d972..778357751c 100644 --- a/addons/maptools/stringtable.xml +++ b/addons/maptools/stringtable.xml @@ -53,7 +53,7 @@ Show Normal Map Tool Zeige Kartenwerkzeug (normal) Mostrar herr. de mapa normal - Montrer outils normaux + Montrer les outils de cartographie (normaux) Visualizza Strumenti Cartografici standard Mostrar Ferramenta de Mapa Padrão Térképészeti eszköz megjelenítése (normál méret) @@ -65,7 +65,7 @@ Show Small Map Tool Zeige Kartenwerkzeug (klein) Mostrar herr. de mapa pequeñas - Montrer petits outils + Montrer les outils de cartographie (petits) Visualizza Strumenti Cartografici piccoli Mostrar Ferramenta de Mapa Pequena Térképészeti eszköz megjelenítése (kicsinyített) @@ -77,7 +77,7 @@ Align Map Tool to North Kartenwerkzeug nach Norden ausrichten Alinear herr. de mapa al norte - Aligner au nord + Aligner les outils sur le nord Allinea gli Strumenti Cartografici con il Nord Alinhar Ferramenta de Mapa com o Norte Térképészeti eszköz Északhoz állítása @@ -89,7 +89,7 @@ Align Map Tool to Compass Kartenwerkzeug am Kompass ausrichten Alinear herr. de mapa a la brújula - Aligner sur la boussole + Aligner les outils sur la boussole Allinea gli Strumenti Cartografici con la bussola Alinhar Ferramenta de Mapa com a Bússola Térképészeti eszköz iránytűhöz állítása @@ -121,22 +121,10 @@ Schovat GPS na mapě Скрыть GPS на карте - - Copy Map - Karte kopieren - Copiar mapa - Скопировать карту - Kopiuj oznaczenia mapy - Copier la carte - Zkopírovat mapu - Copiare Carta - Térkép másolása - Copiar Mapa - Direction: %1° Drehung: %1° - Direction: %1° + Direction : %1° Směr: %1° Kierunek: %1° Dirección: %1° @@ -145,5 +133,13 @@ Direzione: %1° Direção: %1 + + Rotate Map Tools Key + Touche de rotation des outils de naviguation + + + Modifier key to allow rotating map tools + Touche modificatrice permettant la rotation des outils de naviguation + \ No newline at end of file diff --git a/addons/markers/CfgEventHandlers.hpp b/addons/markers/CfgEventHandlers.hpp index becf395052..e1f9294767 100644 --- a/addons/markers/CfgEventHandlers.hpp +++ b/addons/markers/CfgEventHandlers.hpp @@ -16,3 +16,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class RscDiary { + ADDON = QUOTE(_this call FUNC(mapDisplayInitEH)); + }; +}; diff --git a/addons/markers/XEH_PREP.hpp b/addons/markers/XEH_PREP.hpp index 67344454ec..c6ad5c6ba2 100644 --- a/addons/markers/XEH_PREP.hpp +++ b/addons/markers/XEH_PREP.hpp @@ -1,6 +1,7 @@ PREP(getEnabledChannels); PREP(initInsertMarker); +PREP(mapDisplayInitEH); PREP(mapDrawEH); PREP(onLBSelChangedChannel); PREP(onLBSelChangedColor); diff --git a/addons/markers/XEH_postInit.sqf b/addons/markers/XEH_postInit.sqf index 7b5924d680..6e1af95a50 100644 --- a/addons/markers/XEH_postInit.sqf +++ b/addons/markers/XEH_postInit.sqf @@ -2,15 +2,15 @@ #include "script_component.hpp" // recieve remote marker data -[QGVAR(setMarkerNetwork), {_this call DFUNC(setMarkerNetwork)}] call EFUNC(common,addEventHandler); +[QGVAR(setMarkerNetwork), {_this call DFUNC(setMarkerNetwork)}] call CBA_fnc_addEventHandler; // recieve marker data for JIP -[QGVAR(setMarkerJIP), {_this call DFUNC(setMarkerJIP)}] call EFUNC(common,addEventHandler); +[QGVAR(setMarkerJIP), {_this call DFUNC(setMarkerJIP)}] call CBA_fnc_addEventHandler; // request marker data for JIP if (isMultiplayer && {!isServer} && {hasInterface}) then { GVAR(localLogic) = (createGroup sideLogic) createUnit ["Logic", [0,0,0], [], 0, "NONE"]; - [QGVAR(sendMarkersJIP), [GVAR(localLogic)]] call EFUNC(common,serverEvent); + [QGVAR(sendMarkersJIP), [GVAR(localLogic)]] call CBA_fnc_serverEvent; }; GVAR(mapDisplaysWithDrawEHs) = []; diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index 5308117754..da62205b51 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -50,6 +50,6 @@ if (isNil QGVAR(MarkerColorsCache)) then { }; //Server Sync JIP markers: -[QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call EFUNC(common,addEventHandler); +[QGVAR(sendMarkersJIP), FUNC(sendMarkersJIP)] call CBA_fnc_addEventHandler; ADDON = true; diff --git a/addons/markers/config.cpp b/addons/markers/config.cpp index 24d3c778d8..1a8c310735 100644 --- a/addons/markers/config.cpp +++ b/addons/markers/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index 2de05575f7..549a89730d 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -238,4 +238,4 @@ //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); _aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}]; -}, _this] call EFUNC(common,execNextFrame); +}, _this] call CBA_fnc_execNextFrame; diff --git a/addons/markers/functions/fnc_mapDisplayInitEH.sqf b/addons/markers/functions/fnc_mapDisplayInitEH.sqf new file mode 100644 index 0000000000..662f6f80c0 --- /dev/null +++ b/addons/markers/functions/fnc_mapDisplayInitEH.sqf @@ -0,0 +1,34 @@ +/* + * Author: PabstMirror + * Handles XEH DisplayLoad for the various map displays (RscDiary) + * + * Arguments: + * 0: Map Display (idd 12,37,52,53) + * + * Return Value: + * None + * + * Example: + * [display] call ace_markers_fnc_mapDisplayInitEH + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; +TRACE_1("params",_display); + +private _bisShapeLB = _display displayctrl 1091; +private _curSelShape = missionNamespace getVariable [QGVAR(curSelMarkerShape), 0]; +TRACE_2("shape",_bisShapeLB,_curSelShape); +_bisShapeLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedShape)}]; +_bisShapeLB lbSetCurSel _curSelShape; + + +private _bisColorLB = _display displayctrl 1090; +private _curSelColor = missionNamespace getVariable [QGVAR(curSelMarkerColor), 0]; +TRACE_2("color",_bisColorLB,_curSelColor); +_bisColorLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedColor)}]; +_bisColorLB lbSetCurSel _curSelColor; diff --git a/addons/markers/functions/fnc_onLBSelChangedColor.sqf b/addons/markers/functions/fnc_onLBSelChangedColor.sqf index 215cd72580..dc186a6c61 100644 --- a/addons/markers/functions/fnc_onLBSelChangedColor.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedColor.sqf @@ -26,3 +26,15 @@ GVAR(curSelMarkerColor) = _index; private _config = (configFile >> "CfgMarkerColors") select _data; GVAR(currentMarkerColorConfigName) = configName _config; + +//Set map display to same color: +private _bisColorLB = switch (false) do { + case (isNull findDisplay 12): {(findDisplay 12) displayCtrl 1090}; + case (isNull findDisplay 52): {(findDisplay 52) displayCtrl 1090}; + case (isNull findDisplay 53): {(findDisplay 53) displayCtrl 1090}; + case (isNull findDisplay 37): {(findDisplay 37) displayCtrl 1090}; + default {controlNull}; +}; +if (_ctrl != _bisColorLB) then { //Don't set what we got a EH from + _bisColorLB lbSetCurSel GVAR(curSelMarkerColor); +}; diff --git a/addons/markers/functions/fnc_onLBSelChangedShape.sqf b/addons/markers/functions/fnc_onLBSelChangedShape.sqf index 41f0f30a0d..6fd9aabd89 100644 --- a/addons/markers/functions/fnc_onLBSelChangedShape.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedShape.sqf @@ -26,3 +26,15 @@ GVAR(curSelMarkerShape) = _index; private _config = (configFile >> "CfgMarkers") select _data; GVAR(currentMarkerConfigName) = configName _config; + +//Set map display to same shape: +private _bisShapeLB = switch (false) do { + case (isNull findDisplay 12): {(findDisplay 12) displayCtrl 1091}; + case (isNull findDisplay 52): {(findDisplay 52) displayCtrl 1091}; + case (isNull findDisplay 53): {(findDisplay 53) displayCtrl 1091}; + case (isNull findDisplay 37): {(findDisplay 37) displayCtrl 1091}; + default {controlNull}; +}; +if (_ctrl != _bisShapeLB) then { //Don't set what we got a EH from + _bisShapeLB lbSetCurSel GVAR(curSelMarkerShape); +}; diff --git a/addons/markers/functions/fnc_placeMarker.sqf b/addons/markers/functions/fnc_placeMarker.sqf index 5b0783b454..281953e104 100644 --- a/addons/markers/functions/fnc_placeMarker.sqf +++ b/addons/markers/functions/fnc_placeMarker.sqf @@ -30,7 +30,7 @@ if (_closeNum == 1) then { GETGVAR(currentMarkerPosition,[]), GETGVAR(currentMarkerAngle,0) ] - ]] call EFUNC(common,globalEvent); + ]] call CBA_fnc_globalEvent; - }, []] call EFUNC(common,execNextFrame); + }, []] call CBA_fnc_execNextFrame; }; diff --git a/addons/markers/functions/fnc_sendMarkersJIP.sqf b/addons/markers/functions/fnc_sendMarkersJIP.sqf index 5b1a779b27..e63a32b843 100644 --- a/addons/markers/functions/fnc_sendMarkersJIP.sqf +++ b/addons/markers/functions/fnc_sendMarkersJIP.sqf @@ -20,6 +20,6 @@ TRACE_1("params",_logic); [ QGVAR(setMarkerJIP), - [_logic], - [GETGVAR(allMapMarkers,[]), GETGVAR(allMapMarkersProperties,[])] -] call EFUNC(common,targetEvent); + [GETGVAR(allMapMarkers,[]), GETGVAR(allMapMarkersProperties,[])], + [_logic] +] call CBA_fnc_targetEvent; diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp index 1da213875a..458f5cfabf 100644 --- a/addons/markers/script_component.hpp +++ b/addons/markers/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT markers +#define COMPONENT_BEAUTIFIED Markers #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index 5934203333..900e6cb26c 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -6,7 +6,7 @@ class ACE_Head { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,0,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { displayName = CSTRING(Bandage); @@ -16,7 +16,7 @@ class ACE_Head { EXCEPTIONS showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical class FieldDressing { @@ -27,28 +27,28 @@ class ACE_Head { EXCEPTIONS showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'head', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'head', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'head', 'ElasticBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'head', 'ElasticBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'head', 'QuikClot')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'head', 'QuikClot')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class CheckPulse: fieldDressing { displayName = CSTRING(Actions_CheckPulse); @@ -83,7 +83,7 @@ class ACE_Torso { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,1,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { displayName = CSTRING(Bandage); @@ -94,7 +94,7 @@ class ACE_Torso { showDisabled = 1; priority = 2; enableInside = 1; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PlaceInBodyBag { displayName = CSTRING(PlaceInBodyBag); @@ -115,7 +115,7 @@ class ACE_Torso { showDisabled = 1; priority = 2; enableInside = 1; - icon = PATHTOF(UI\icons\triageCard.paa); + icon = QPATHTOF(UI\icons\triageCard.paa); }; class Diagnose { displayName = CSTRING(Actions_Diagnose); @@ -138,35 +138,35 @@ class ACE_Torso { showDisabled = 0; priority = 2; enableInside = 1; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'body', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'body', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'body', 'ElasticBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'body', 'ElasticBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'body', 'QuikClot')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'body', 'QuikClot')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class SurgicalKit: fieldDressing { displayName = CSTRING(Use_SurgicalKit); condition = QUOTE([ARR_4(_player, _target, 'body', 'SurgicalKit')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'body', 'SurgicalKit')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\surgicalKit.paa); + icon = QPATHTOF(UI\icons\surgicalKit.paa); }; class PersonalAidKit: fieldDressing { displayName = CSTRING(Use_Aid_Kit); @@ -190,7 +190,7 @@ class ACE_ArmLeft { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,2,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { @@ -201,7 +201,7 @@ class ACE_ArmLeft { EXCEPTIONS showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -213,70 +213,70 @@ class ACE_ArmLeft { EXCEPTIONS showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'ElasticBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'ElasticBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'QuikClot')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'QuikClot')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class Tourniquet: fieldDressing { displayName = CSTRING(Actions_Tourniquet); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Tourniquet')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Tourniquet')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Morphine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Morphine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Adenosine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Epinephrine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Epinephrine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class BloodIV: fieldDressing { displayName = CSTRING(Actions_Blood4_1000); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'BloodIV')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'BloodIV')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\iv.paa); + icon = QPATHTOF(UI\icons\iv.paa); }; class BloodIV_500: BloodIV { displayName = CSTRING(Actions_Blood4_500); @@ -353,7 +353,7 @@ class ACE_ArmRight { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,3,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { @@ -364,7 +364,7 @@ class ACE_ArmRight { EXCEPTIONS showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -376,14 +376,14 @@ class ACE_ArmRight { EXCEPTIONS showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -402,14 +402,14 @@ class ACE_ArmRight { condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Tourniquet')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Tourniquet')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Morphine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Morphine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { @@ -417,7 +417,7 @@ class ACE_ArmRight { condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); @@ -436,7 +436,7 @@ class ACE_ArmRight { condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\iv.paa); + icon = QPATHTOF(UI\icons\iv.paa); }; class BloodIV_500: BloodIV { displayName = CSTRING(Actions_Blood4_500); @@ -514,7 +514,7 @@ class ACE_LegLeft { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,4,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { @@ -525,7 +525,7 @@ class ACE_LegLeft { EXCEPTIONS showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; @@ -538,14 +538,14 @@ class ACE_LegLeft { EXCEPTIONS showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -564,28 +564,28 @@ class ACE_LegLeft { condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Tourniquet')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Tourniquet')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Morphine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Morphine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); @@ -598,7 +598,7 @@ class ACE_LegLeft { condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\iv.paa); + icon = QPATHTOF(UI\icons\iv.paa); }; class BloodIV_500: BloodIV { displayName = CSTRING(Actions_Blood4_500); @@ -662,7 +662,7 @@ class ACE_LegRight { ACTION_CONDITION modifierFunction = QUOTE([ARR_4(_target,_player,5,_this select 3)] call FUNC(modifyMedicalAction)); EXCEPTIONS - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); distance = MEDICAL_ACTION_DISTANCE; class Bandage { @@ -673,7 +673,7 @@ class ACE_LegRight { EXCEPTIONS showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; @@ -686,14 +686,14 @@ class ACE_LegRight { EXCEPTIONS showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'PackingBandage')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'PackingBandage')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -712,21 +712,21 @@ class ACE_LegRight { condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Tourniquet')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Tourniquet')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Morphine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Morphine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); @@ -745,7 +745,7 @@ class ACE_LegRight { condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(canTreatCached)); statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(treatment)); EXCEPTIONS - icon = PATHTOF(UI\icons\iv.paa); + icon = QPATHTOF(UI\icons\iv.paa); }; class BloodIV_500: BloodIV { displayName = CSTRING(Actions_Blood4_500); diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index 54a8ba60f5..fca025adcb 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -4,11 +4,11 @@ class Medical { exceptions[] = {"isNotInside", "isNotSitting"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); condition = "true"; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class ACE_Head { displayName = CSTRING(Head); - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); exceptions[] = {"isNotInside", "isNotSitting"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); modifierFunction = QUOTE([ARR_4(_target,_player,0,_this select 3)] call FUNC(modifyMedicalAction)); @@ -23,7 +23,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical class FieldDressing { @@ -34,28 +34,28 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'head', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'head', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'head', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'head', 'ElasticBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'head', 'ElasticBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'head', 'QuikClot')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'head', 'QuikClot')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class CheckPulse: fieldDressing { displayName = CSTRING(Actions_CheckPulse); @@ -81,7 +81,7 @@ class Medical { modifierFunction = QUOTE([ARR_4(_target,_player,1,_this select 3)] call FUNC(modifyMedicalAction)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class Bandage { displayName = CSTRING(Bandage); @@ -91,7 +91,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class TriageCard { @@ -102,7 +102,7 @@ class Medical { statement = QUOTE([ARR_2(_target, true)] call DFUNC(displayTriageCard)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\triageCard.paa); + icon = QPATHTOF(UI\icons\triageCard.paa); }; // Advanced medical @@ -114,28 +114,28 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'body', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'body', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'body', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'body', 'ElasticBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'body', 'ElasticBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'body', 'QuikClot')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'body', 'QuikClot')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; }; class ACE_ArmLeft { @@ -145,7 +145,7 @@ class Medical { statement = QUOTE([ARR_3(_target, true, 2)] call DFUNC(displayPatientInformation)); modifierFunction = QUOTE([ARR_4(_target,_player,2,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class Bandage { displayName = CSTRING(Bandage); @@ -155,7 +155,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -167,63 +167,63 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'ElasticBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'ElasticBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'QuikClot')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'QuikClot')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class Tourniquet: fieldDressing { displayName = CSTRING(Actions_Tourniquet); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Tourniquet')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Tourniquet')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Morphine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Morphine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Adenosine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Atropine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Epinephrine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Epinephrine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class CheckPulse: fieldDressing { displayName = CSTRING(Actions_CheckPulse); @@ -252,7 +252,7 @@ class Medical { statement = QUOTE([ARR_3(_target, true, 3)] call DFUNC(displayPatientInformation)); modifierFunction = QUOTE([ARR_4(_target,_player,3,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class Bandage { displayName = CSTRING(Bandage); @@ -262,7 +262,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -274,14 +274,14 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -300,21 +300,21 @@ class Medical { condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Tourniquet')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Tourniquet')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Morphine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Morphine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Adenosine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); @@ -355,7 +355,7 @@ class Medical { statement = QUOTE([ARR_3(_target, true, 4)] call DFUNC(displayPatientInformation)); modifierFunction = QUOTE([ARR_4(_target,_player,4,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class Bandage { displayName = CSTRING(Bandage); @@ -365,7 +365,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; @@ -378,14 +378,14 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -404,28 +404,28 @@ class Medical { condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Tourniquet')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Tourniquet')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Morphine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Morphine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Adenosine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Atropine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Epinephrine: Morphine { displayName = CSTRING(Inject_Epinephrine); @@ -447,7 +447,7 @@ class Medical { statement = QUOTE([ARR_3(_target, true, 5)] call DFUNC(displayPatientInformation)); modifierFunction = QUOTE([ARR_4(_target,_player,5,_this select 3)] call FUNC(modifyMedicalAction)); condition = "true"; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); class Bandage { displayName = CSTRING(Bandage); @@ -457,7 +457,7 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; @@ -470,14 +470,14 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\bandage.paa); + icon = QPATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'PackingBandage')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'PackingBandage')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\packingBandage.paa); + icon = QPATHTOF(UI\icons\packingBandage.paa); }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -496,21 +496,21 @@ class Medical { condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Tourniquet')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Tourniquet')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\tourniquet.paa); + icon = QPATHTOF(UI\icons\tourniquet.paa); }; class Morphine: fieldDressing { displayName = CSTRING(Inject_Morphine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Morphine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Morphine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Adenosine: Morphine { displayName = CSTRING(Inject_Atropine); condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(canTreatCached)); exceptions[] = {"isNotInside"}; statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Adenosine')] call DFUNC(treatment)); - icon = PATHTOF(UI\icons\autoInjector.paa); + icon = QPATHTOF(UI\icons\autoInjector.paa); }; class Atropine: Morphine { displayName = CSTRING(Inject_Atropine); diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 14205fbd30..bab34f475b 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -312,10 +312,11 @@ class ACE_Medical_Actions { itemConsumed = QGVAR(consumeItem_PAK); animationPatient = ""; animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback"; - animationCaller = "AinvPknlMstpSlayWnonDnon_medicOther"; + animationPatientUnconsciousExcludeOn[] = {"ainjppnemstpsnonwrfldnon"}; + animationCaller = "AinvPknlMstpSlayWrflDnon_medicOther"; animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; - animationCallerSelf = ""; - animationCallerSelfProne = ""; + animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; + animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, @@ -438,7 +439,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.0002; }; }; - // Occur when an entire structure or part of it is forcibly pulled away, such as the loss of a permanent tooth or an ear lobe. Explosions, gunshots, and animal bites may cause avulsions. class Avulsions { name = CSTRING(Wounds_Avulsion); @@ -465,7 +465,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.05; }; }; - // Also called bruises, these are the result of a forceful trauma that injures an internal structure without breaking the skin. Blows to the chest, abdomen, or head with a blunt instrument (e.g. a football or a fist) can cause contusions. class Contusion { name = CSTRING(Wounds_Contusion); @@ -491,7 +490,6 @@ class ACE_Medical_Advanced { maxDamage = 0.2; }; }; - // Occur when a heavy object falls onto a person, splitting the skin and shattering or tearing underlying structures. class CrushWound { name = CSTRING(Wounds_Crush); @@ -518,7 +516,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.0095; }; }; - // Slicing wounds made with a sharp instrument, leaving even edges. They may be as minimal as a paper cut or as significant as a surgical incision. class Cut { name = CSTRING(Wounds_Cut); @@ -545,7 +542,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.05; }; }; - // Also called tears, these are separating wounds that produce ragged edges. They are produced by a tremendous force against the body, either from an internal source as in childbirth, or from an external source like a punch. class Laceration { name = CSTRING(Wounds_Laceration); @@ -572,7 +568,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.03; }; }; - // Also called velocity wounds, they are caused by an object entering the body at a high speed, typically a bullet or small peices of shrapnel. class velocityWound { name = CSTRING(Wounds_VelocityWound); @@ -590,6 +585,7 @@ class ACE_Medical_Advanced { class Medium { name = CSTRING(Wounds_VelocityWound_Medium); minDamage = 0.3; + maxDamage = 0.75; bleedingRate = 0.05; }; class Large { @@ -598,7 +594,6 @@ class ACE_Medical_Advanced { bleedingRate = 0.1; }; }; - // Deep, narrow wounds produced by sharp objects such as nails, knives, and broken glass. class punctureWound { name = CSTRING(Wounds_PunctureWound); @@ -691,6 +686,11 @@ class ACE_Medical_Advanced { }; class Treatment { class Bandaging { + // Field dressing is normal average treatment + // packing bandage is average treatment, higher reopen change, longer reopening delay + // elastic bandage is higher treatment, higher reopen change, shorter reopen delay + // quickclot is lower treatment, lower reopen change, longer reopening delay + class FieldDressing { // How effect is the bandage for treating one wounds type injury effectiveness = 1; @@ -698,55 +698,39 @@ class ACE_Medical_Advanced { reopeningChance = 0.1; reopeningMinDelay = 120; reopeningMaxDelay = 200; + class Abrasion { effectiveness = 3; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + reopeningChance = 0.3; + reopeningMinDelay = 200; + reopeningMaxDelay = 1000; }; class AbrasionMinor: Abrasion { - effectiveness = 5; - reopeningChance = 0; - reopeningMinDelay = 1000; - reopeningMaxDelay = 5000; + effectiveness = 3; }; class AbrasionMedium: Abrasion { - effectiveness = 3; + effectiveness = 2.5; reopeningChance = 0.7; - reopeningMinDelay = 750; - reopeningMaxDelay = 3000; }; class AbrasionLarge: Abrasion { effectiveness = 2; reopeningChance = 0.9; - reopeningMinDelay = 300; - reopeningMaxDelay = 1000; }; - class Avulsions: Abrasion { - effectiveness = 0.2; - reopeningChance = 0.8; - reopeningMinDelay = 5; - reopeningMaxDelay = 20; + effectiveness = 1; + reopeningChance = 0.5; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; }; class AvulsionsMinor: Avulsions { - effectiveness = 0.4; - reopeningChance = 0.75; - reopeningMinDelay = 5; - reopeningMaxDelay = 20; - }; + effectiveness = 1; + }; class AvulsionsMedium: Avulsions { - effectiveness = 0.3; - reopeningChance = 0.85; - reopeningMinDelay = 5; - reopeningMaxDelay = 10; + effectiveness = 0.9; }; class AvulsionsLarge: Avulsions { - effectiveness = 0.1; - reopeningChance = 0.9; - reopeningMinDelay = 2; - reopeningMaxDelay = 10; + effectiveness = 0.75; }; class Contusion: Abrasion { @@ -761,178 +745,127 @@ class ACE_Medical_Advanced { class CrushWound: Abrasion { effectiveness = 1; - reopeningChance = 0.4; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + reopeningChance = 0.2; + reopeningMinDelay = 20; + reopeningMaxDelay = 1000; }; class CrushWoundMinor: CrushWound { effectiveness = 1; - reopeningChance = 0.4; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + reopeningChance = 0.2; }; class CrushWoundMedium: CrushWound { - effectiveness = 0.4; + effectiveness = 0.7; reopeningChance = 0.3; - reopeningMinDelay = 100; - reopeningMaxDelay = 150; }; class CrushWoundLarge: CrushWound { - effectiveness = 0.2; - reopeningChance = 0.2; - reopeningMinDelay = 50; - reopeningMaxDelay = 70; + effectiveness = 0.6; + reopeningChance = 0.4; }; class Cut: Abrasion { - effectiveness = 3; - reopeningChance = 0.3; - reopeningMinDelay = 2000; - reopeningMaxDelay = 5000; + effectiveness = 4; + reopeningChance = 0.1; + reopeningMinDelay = 300; + reopeningMaxDelay = 1000; }; class CutMinor: Cut { - effectiveness = 6; + effectiveness = 4; reopeningChance = 0.1; - reopeningMinDelay = 5000; - reopeningMaxDelay = 8000; }; class CutMedium: Cut { effectiveness = 3; reopeningChance = 0.3; - reopeningMinDelay = 1200; - reopeningMaxDelay = 2000; }; class CutLarge: Cut { effectiveness = 1; - reopeningChance = 0.6; - reopeningMinDelay = 220; - reopeningMaxDelay = 260; + reopeningChance = 0.5; }; class Laceration: Abrasion { - effectiveness = 0.8; + effectiveness = 0.95; reopeningChance = 0.3; - reopeningMinDelay = 220; - reopeningMaxDelay = 500; - }; - class LacerationMinor: Laceration { - effectiveness = 0.8; - reopeningChance = 0.3; - reopeningMinDelay = 400; + reopeningMinDelay = 100; reopeningMaxDelay = 800; }; + class LacerationMinor: Laceration { + effectiveness = 0.95; + reopeningChance = 0.3; + }; class LacerationMedium: Laceration { - effectiveness = 0.5; + effectiveness = 0.7; reopeningChance = 0.5; - reopeningMinDelay = 220; - reopeningMaxDelay = 500; }; class LacerationLarge: Laceration { - effectiveness = 0.3; - reopeningChance = 0.7; - reopeningMinDelay = 120; - reopeningMaxDelay = 260; + effectiveness = 0.5; + reopeningChance = 0.6; }; class velocityWound: Abrasion { - effectiveness = 0.5; + effectiveness = 2; reopeningChance = 0.7; reopeningMinDelay = 100; - reopeningMaxDelay = 300; + reopeningMaxDelay = 500; }; class velocityWoundMinor: velocityWound { - effectiveness = 0.8; - reopeningChance = 0.4; - reopeningMinDelay = 300; - reopeningMaxDelay = 550; + effectiveness = 2; }; class velocityWoundMedium: velocityWound { - effectiveness = 0.6; - reopeningChance = 0.8; - reopeningMinDelay = 100; - reopeningMaxDelay = 300; + effectiveness = 1.5; }; class velocityWoundLarge: velocityWound { - effectiveness = 0.3; - reopeningChance = 0.9; - reopeningMinDelay = 50; - reopeningMaxDelay = 170; + effectiveness = 1; }; class punctureWound: Abrasion { - effectiveness = 0.6; - reopeningChance = 0.3; + effectiveness = 2; + reopeningChance = 0.5; reopeningMinDelay = 200; - reopeningMaxDelay = 300; + reopeningMaxDelay = 850; }; class punctureWoundMinor: punctureWound { - effectiveness = 0.8; - reopeningChance = 0.5; - reopeningMinDelay = 500; - reopeningMaxDelay = 800; + effectiveness = 2; }; class punctureWoundMedium: punctureWound { - effectiveness = 0.6; - reopeningChance = 0.3; - reopeningMinDelay = 400; - reopeningMaxDelay = 600; + effectiveness = 1.3; }; class punctureWoundLarge: punctureWound { - effectiveness = 0.3; - reopeningChance = 0.8; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; + effectiveness = 0.9; }; }; + class PackingBandage: fieldDressing { class Abrasion { - effectiveness = 0.1; - reopeningChance = 0.9; - reopeningMinDelay = 5; - reopeningMaxDelay = 10; + effectiveness = 3; + reopeningChance = 0.6; + reopeningMinDelay = 800; + reopeningMaxDelay = 1500; }; class AbrasionMinor: Abrasion { - effectiveness = 0.1; - reopeningChance = 0.9; - reopeningMinDelay = 5; - reopeningMaxDelay = 10; + effectiveness = 3; }; class AbrasionMedium: Abrasion { - effectiveness = 0.1; + effectiveness = 2.5; reopeningChance = 0.9; - reopeningMinDelay = 5; - reopeningMaxDelay = 10; }; class AbrasionLarge: Abrasion { - effectiveness = 1; - reopeningChance = 0.9; - reopeningMinDelay = 5; - reopeningMaxDelay = 10; + effectiveness = 2; + reopeningChance = 1; }; class Avulsions: Abrasion { effectiveness = 1; - reopeningChance = 0.3; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + reopeningChance = 0.7; + reopeningMinDelay = 1000; + reopeningMaxDelay = 1600; }; class AvulsionsMinor: Avulsions { effectiveness = 1; - reopeningChance = 0.2; - reopeningMinDelay = 500; - reopeningMaxDelay = 1000; }; class AvulsionsMedium: Avulsions { - effectiveness = 0.7; - reopeningChance = 0.4; - reopeningMinDelay = 250; - reopeningMaxDelay = 750; + effectiveness = 0.9; }; class AvulsionsLarge: Avulsions { - effectiveness = 0.5; - reopeningChance = 0.5; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + effectiveness = 0.75; }; class Contusion: Abrasion { @@ -943,166 +876,266 @@ class ACE_Medical_Advanced { }; class ContusionMinor: Contusion {}; class ContusionMedium: Contusion {}; - class ContusionLarge: Contusion { - effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; + class ContusionLarge: Contusion {}; class CrushWound: Abrasion { - effectiveness = 0.6; - reopeningChance = 0.2; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; - }; - class CrushWoundMinor: CrushWound { - effectiveness = 0.8; - reopeningChance = 0.4; - reopeningMinDelay = 500; + effectiveness = 1; + reopeningChance = 0.5; + reopeningMinDelay = 600; reopeningMaxDelay = 1000; }; - class CrushWoundMedium: CrushWound { - effectiveness = 0.6; + class CrushWoundMinor: CrushWound { + effectiveness = 1; reopeningChance = 0.6; - reopeningMinDelay = 280; - reopeningMaxDelay = 320; + }; + class CrushWoundMedium: CrushWound { + effectiveness = 0.7; + reopeningChance = 0.7; }; class CrushWoundLarge: CrushWound { - effectiveness = 0.4; + effectiveness = 0.6; reopeningChance = 0.8; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; }; class Cut: Abrasion { - effectiveness = 0.2; + effectiveness = 4; reopeningChance = 0.4; - reopeningMinDelay = 10000; - reopeningMaxDelay = 20000; + reopeningMinDelay = 700; + reopeningMaxDelay = 1000; }; class CutMinor: Cut { - effectiveness = 1; - reopeningChance = 0.1; - reopeningMinDelay = 20000; - reopeningMaxDelay = 30000; + effectiveness = 4; + reopeningChance = 0.6; }; class CutMedium: Cut { - effectiveness = 0.5; - reopeningChance = 0.4; - reopeningMinDelay = 2000; - reopeningMaxDelay = 3000; + effectiveness = 3; + reopeningChance = 0.7; }; class CutLarge: Cut { - effectiveness = 0.7; - reopeningChance = 0.6; - reopeningMinDelay = 300; - reopeningMaxDelay = 2060; + effectiveness = 1; + reopeningChance = 0.8; }; class Laceration: Abrasion { - effectiveness = 0.5; - reopeningChance = 0.5; - reopeningMinDelay = 120; - reopeningMaxDelay = 260; + effectiveness = 0.95; + reopeningChance = 0.65; + reopeningMinDelay = 500; + reopeningMaxDelay = 2000; }; class LacerationMinor: Laceration { - effectiveness = 1; - reopeningChance = 0.1; - reopeningMinDelay = 500; - reopeningMaxDelay = 700; + effectiveness = 0.95; + reopeningChance = 0.65; }; class LacerationMedium: Laceration { effectiveness = 0.7; - reopeningChance = 0.3; - reopeningMinDelay = 300; - reopeningMaxDelay = 600; + reopeningChance = 0.8; }; class LacerationLarge: Laceration { - effectiveness = 0.3; - reopeningChance = 0.5; - reopeningMinDelay = 220; - reopeningMaxDelay = 360; + effectiveness = 0.5; + reopeningChance = 0.9; }; + class velocityWound: Abrasion { - effectiveness = 1; - reopeningChance = 0.5; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; + effectiveness = 2; + reopeningChance = 1; + reopeningMinDelay = 800; + reopeningMaxDelay = 2000; }; class velocityWoundMinor: velocityWound { - effectiveness = 1; - reopeningChance = 0.7; - reopeningMinDelay = 800; - reopeningMaxDelay = 1000; + effectiveness = 2; }; class velocityWoundMedium: velocityWound { - effectiveness = 0.6; - reopeningChance = 0.6; - reopeningMinDelay = 500; - reopeningMaxDelay = 800; + effectiveness = 1.5; }; class velocityWoundLarge: velocityWound { - effectiveness = 0.3; - reopeningChance = 0.5; - reopeningMinDelay = 300; - reopeningMaxDelay = 500; + effectiveness = 1; }; + class punctureWound: Abrasion { - effectiveness = 0.1; - reopeningChance = 0.5; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; + effectiveness = 2; + reopeningChance = 1; + reopeningMinDelay = 1000; + reopeningMaxDelay = 3000; + }; + class punctureWoundMinor: punctureWound { + effectiveness = 2; }; - class punctureWoundMinor: punctureWound {}; class punctureWoundMedium: punctureWound { - effectiveness = 0.2; - reopeningChance = 0.5; + effectiveness = 1.3; }; class punctureWoundLarge: punctureWound { - effectiveness = 0.3; - reopeningChance = 0.5; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; + effectiveness = 0.9; }; }; class ElasticBandage: fieldDressing { class Abrasion { + effectiveness = 4; + reopeningChance = 0.6; + reopeningMinDelay = 80; + reopeningMaxDelay = 150; + }; + class AbrasionMinor: Abrasion { + effectiveness = 4; + }; + class AbrasionMedium: Abrasion { + effectiveness = 3; + reopeningChance = 0.9; + }; + class AbrasionLarge: Abrasion { + effectiveness = 2.5; + reopeningChance = 1; + }; + + class Avulsions: Abrasion { + effectiveness = 2; + reopeningChance = 0.7; + reopeningMinDelay = 100; + reopeningMaxDelay = 160; + }; + class AvulsionsMinor: Avulsions { + effectiveness = 2; + }; + class AvulsionsMedium: Avulsions { + effectiveness = 1.4; + }; + class AvulsionsLarge: Avulsions { + effectiveness = 1; + }; + + class Contusion: Abrasion { effectiveness = 2; reopeningChance = 0; reopeningMinDelay = 0; reopeningMaxDelay = 0; }; - class AbrasionMinor: Abrasion {}; - class AbrasionMedium: Abrasion { + class ContusionMinor: Contusion {}; + class ContusionMedium: Contusion {}; + class ContusionLarge: Contusion {}; + + class CrushWound: Abrasion { + effectiveness = 2; + reopeningChance = 0.5; + reopeningMinDelay = 60; + reopeningMaxDelay = 100; + }; + class CrushWoundMinor: CrushWound { + effectiveness = 2; + reopeningChance = 0.6; + }; + class CrushWoundMedium: CrushWound { + effectiveness = 1.7; + reopeningChance = 0.7; + }; + class CrushWoundLarge: CrushWound { + effectiveness = 1.6; + reopeningChance = 0.8; + }; + + class Cut: Abrasion { + effectiveness = 5; + reopeningChance = 0.4; + reopeningMinDelay = 70; + reopeningMaxDelay = 100; + }; + class CutMinor: Cut { + effectiveness = 5; + reopeningChance = 0.6; + }; + class CutMedium: Cut { + effectiveness = 3.5; + reopeningChance = 0.7; + }; + class CutLarge: Cut { + effectiveness = 2; + reopeningChance = 0.8; + }; + + class Laceration: Abrasion { + effectiveness = 2; + reopeningChance = 0.65; + reopeningMinDelay = 50; + reopeningMaxDelay = 200; + }; + class LacerationMinor: Laceration { + effectiveness = 2; + reopeningChance = 0.65; + }; + class LacerationMedium: Laceration { + effectiveness = 1.5; + reopeningChance = 0.8; + }; + class LacerationLarge: Laceration { + effectiveness = 1; + reopeningChance = 0.9; + }; + + class velocityWound: Abrasion { + effectiveness = 2.2; + reopeningChance = 1; + reopeningMinDelay = 80; + reopeningMaxDelay = 200; + }; + class velocityWoundMinor: velocityWound { + effectiveness = 2.2; + }; + class velocityWoundMedium: velocityWound { + effectiveness = 1.75; + }; + class velocityWoundLarge: velocityWound { effectiveness = 1.5; }; - class AbrasionLarge: Abrasion { + + class punctureWound: Abrasion { + effectiveness = 2.5; + reopeningChance = 1; + reopeningMinDelay = 100; + reopeningMaxDelay = 300; + }; + class punctureWoundMinor: punctureWound { + effectiveness = 2.5; + }; + class punctureWoundMedium: punctureWound { + effectiveness = 2; + }; + class punctureWoundLarge: punctureWound { + effectiveness = 1.5; + }; + }; + + class QuikClot: fieldDressing { + class Abrasion { + effectiveness = 2; + reopeningChance = 0.3; + reopeningMinDelay = 800; + reopeningMaxDelay = 1500; + }; + class AbrasionMinor: Abrasion { + effectiveness = 2; + }; + class AbrasionMedium: Abrasion { effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; + reopeningChance = 0.4; + }; + class AbrasionLarge: Abrasion { + effectiveness = 0.7; + reopeningChance = 0.5; }; class Avulsions: Abrasion { - effectiveness = 0.3; - reopeningChance = 0.4; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + effectiveness = 0.7; + reopeningChance = 0.2; + reopeningMinDelay = 1000; + reopeningMaxDelay = 1600; }; class AvulsionsMinor: Avulsions { - effectiveness = 0.9; - reopeningChance = 0.2; + effectiveness = 0.7; }; class AvulsionsMedium: Avulsions { - effectiveness = 0.7; - reopeningChance = 0.4; + effectiveness = 0.65; }; class AvulsionsLarge: Avulsions { - effectiveness = 0.3; - reopeningChance = 0.4; - reopeningMinDelay = 120; - reopeningMaxDelay = 200; + effectiveness = 0.5; }; class Contusion: Abrasion { @@ -1116,228 +1149,90 @@ class ACE_Medical_Advanced { class ContusionLarge: Contusion {}; class CrushWound: Abrasion { - effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + effectiveness = 0.6; + reopeningChance = 0.5; + reopeningMinDelay = 600; + reopeningMaxDelay = 1000; + }; + class CrushWoundMinor: CrushWound { + effectiveness = 0.6; + reopeningChance = 0.3; + }; + class CrushWoundMedium: CrushWound { + effectiveness = 0.5; }; - class CrushWoundMinor: CrushWound {}; - class CrushWoundMedium: CrushWound {}; class CrushWoundLarge: CrushWound { - effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + effectiveness = 0.4; }; class Cut: Abrasion { - effectiveness = 1.5; + effectiveness = 2; reopeningChance = 0.2; - reopeningMinDelay = 10; - reopeningMaxDelay = 400; + reopeningMinDelay = 700; + reopeningMaxDelay = 1000; }; - class CutMinor: Cut {}; - class CutMedium: Cut { - effectiveness = 1.2; + class CutMinor: Cut { + effectiveness = 2; reopeningChance = 0.3; }; - class CutLarge: Cut { + class CutMedium: Cut { effectiveness = 1; - reopeningChance = 0.5; - reopeningMinDelay = 10; - reopeningMaxDelay = 400; + }; + class CutLarge: Cut { + effectiveness = 0.6; }; class Laceration: Abrasion { - effectiveness = 1; - reopeningChance = 0.3; - reopeningMinDelay = 120; - reopeningMaxDelay = 260; + effectiveness = 0.7; + reopeningChance = 0.4; + reopeningMinDelay = 500; + reopeningMaxDelay = 2000; + }; + class LacerationMinor: Laceration { + effectiveness = 0.7; + reopeningChance = 0.4; }; - class LacerationMinor: Laceration {}; class LacerationMedium: Laceration { + effectiveness = 0.7; + }; + class LacerationLarge: Laceration { + effectiveness = 0.5; + }; + + class velocityWound: Abrasion { + effectiveness = 1; + reopeningChance = 0.5; + reopeningMinDelay = 800; + reopeningMaxDelay = 2000; + }; + class velocityWoundMinor: velocityWound { + effectiveness = 1; + }; + class velocityWoundMedium: velocityWound { effectiveness = 0.75; }; - class LacerationLarge: Laceration { - effectiveness = 0.5; - reopeningChance = 0.3; - reopeningMinDelay = 120; - reopeningMaxDelay = 260; - }; - - class velocityWound: Abrasion { - effectiveness = 0.7; - reopeningChance = 0.5; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; - }; - class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound { - effectiveness = 0.5; - }; class velocityWoundLarge: velocityWound { - effectiveness = 0.25; - reopeningChance = 0.7; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; + effectiveness = 0.5; }; class punctureWound: Abrasion { - effectiveness = 0.9; - reopeningChance = 0.3; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; - }; - class punctureWoundMinor: punctureWound {}; - class punctureWoundMedium: punctureWound { - effectiveness = 0.9; - reopeningChance = 0.5; - }; - class punctureWoundLarge: punctureWound { - effectiveness = 0.85; - reopeningChance = 0.7; - reopeningMinDelay = 20; - reopeningMaxDelay = 300; - }; - }; - class QuikClot: fieldDressing { - class Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - class AbrasionMinor: Abrasion {}; - class AbrasionMedium: Abrasion {}; - class AbrasionLarge: Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - - class Avulsions: Abrasion { - effectiveness = 0.6; - reopeningChance = 0.1; - reopeningMinDelay = 300; - reopeningMaxDelay = 350; - }; - class AvulsionsMinor: Avulsions {}; - class AvulsionsMedium: Avulsions { - effectiveness = 0.4; - }; - class AvulsionsLarge: Avulsions { - effectiveness = 0.2; - reopeningChance = 0.1; - reopeningMinDelay = 300; - reopeningMaxDelay = 350; - }; - - class Contusion: Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - class ContusionMinor: Contusion {}; - class ContusionMedium: Contusion {}; - class ContusionLarge: Contusion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - - class CrushWound: Abrasion { effectiveness = 1; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; + reopeningChance = 0.5; + reopeningMinDelay = 1000; + reopeningMaxDelay = 3000; }; - class CrushWoundMinor: CrushWound {}; - class CrushWoundMedium: CrushWound { - effectiveness = 0.9; - reopeningChance = 0.05; + class punctureWoundMinor: punctureWound { + effectiveness = 1; }; - class CrushWoundLarge: CrushWound { - effectiveness = 0.7; - reopeningChance = 0.1; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - - class Cut: Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 100; - reopeningMaxDelay = 400; - }; - class CutMinor: Cut {}; - class CutMedium: Cut { - effectiveness = 0.6; - reopeningChance = 0; - }; - class CutLarge: Cut { - effectiveness = 0.5; - reopeningChance = 0.2; - reopeningMinDelay = 100; - reopeningMaxDelay = 400; - }; - - class Laceration: Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - class LacerationMinor: Laceration {}; - class LacerationMedium: Laceration { - effectiveness = 0.6; - }; - class LacerationLarge: Laceration { - effectiveness = 0.5; - reopeningChance = 0; - reopeningMinDelay = 0; - reopeningMaxDelay = 0; - }; - - class velocityWound: Abrasion { - effectiveness = 0.7; - reopeningChance = 0; - reopeningMinDelay = 200; - reopeningMaxDelay = 300; - }; - class velocityWoundMinor: velocityWound {}; - class velocityWoundMedium: velocityWound { - effectiveness = 0.6; - }; - class velocityWoundLarge: velocityWound { - effectiveness = 0.5; - reopeningChance = 0.1; - reopeningMinDelay = 200; - reopeningMaxDelay = 300; - }; - - class punctureWound: Abrasion { - effectiveness = 0.5; - reopeningChance = 0.05; - reopeningMinDelay = 200; - reopeningMaxDelay = 300; - }; - class punctureWoundMinor: punctureWound {}; class punctureWoundMedium: punctureWound { - effectiveness = 0.4; - reopeningChance = 0.1; + effectiveness = 0.7; }; class punctureWoundLarge: punctureWound { - effectiveness = 0.3; - reopeningChance = 0.15; - reopeningMinDelay = 200; - reopeningMaxDelay = 300; + effectiveness = 0.4; }; }; - }; + class Medication { // How much does the pain get reduced? painReduce = 0; diff --git a/addons/medical/CfgEden.hpp b/addons/medical/CfgEden.hpp index 508d53d54c..a9b4594b66 100644 --- a/addons/medical/CfgEden.hpp +++ b/addons/medical/CfgEden.hpp @@ -16,9 +16,9 @@ class Cfg3DEN { class Value: ctrlToolbox { idc = 100; style = "0x02"; - x = "48 * (pixelW * 1.25 * 4)"; - w = "82 * (pixelW * 1.25 * 4)"; - h = "5 * (pixelH * 1.25 * 4)"; + x = "48 * (pixelW * pixelGrid * 0.25)"; + w = "82 * (pixelW * pixelGrid * 0.25)"; + h = "5 * (pixelH * pixelGrid * 0.25)"; rows = 1; columns = 4; strings[] = {"$STR_3DEN_Attributes_Lock_Default_text", CSTRING(AssignMedicRoles_role_none), CSTRING(AssignMedicRoles_role_medic), CSTRING(AssignMedicRoles_role_doctorShort)}; diff --git a/addons/medical/CfgSounds.hpp b/addons/medical/CfgSounds.hpp index 6b5fa48344..9cc5faedf9 100644 --- a/addons/medical/CfgSounds.hpp +++ b/addons/medical/CfgSounds.hpp @@ -1,37 +1,37 @@ class CfgSounds { class ACE_heartbeat_fast_1 { name = "ACE_heartbeat_fast_1"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_1.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\fast_1.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_fast_2 { name = "ACE_heartbeat_fast_2"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_2.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\fast_2.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_fast_3 { name = "ACE_heartbeat_fast_3"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_3.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\fast_3.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_norm_1 { name = "ACE_heartbeat_norm_1"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_1.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\norm_1.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_norm_2 { name = "ACE_heartbeat_norm_2"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_2.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\norm_2.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_slow_1 { name = "ACE_heartbeat_slow_1"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_1.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\slow_1.wav), "db+1", 1}; titles[] = {}; }; class ACE_heartbeat_slow_2 { name = "ACE_heartbeat_slow_2"; - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_2.wav)), "db+1", 1}; + sound[] = {QPATHTOF(sounds\heart_beats\slow_2.wav), "db+1", 1}; titles[] = {}; }; }; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index 86ad45296b..3425fa9ad3 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -14,7 +14,7 @@ class CfgVehicles { class ACE_moduleMedicalSettings: ACE_Module { scope = 2; displayName = CSTRING(MedicalSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; function = QUOTE(DFUNC(moduleMedicalSettings)); functionPriority = 1; @@ -156,9 +156,9 @@ class CfgVehicles { class ACE_moduleBasicMedicalSettings: ACE_Module { scope = 2; displayName = CSTRING(BasicMedicalSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; - function = QUOTE(FUNC(moduleBasicMedicalSettings)); + function = QFUNC(moduleBasicMedicalSettings); functionPriority = 10; isGlobal = 2; isSingular = 1; @@ -198,9 +198,9 @@ class CfgVehicles { class ACE_moduleAdvancedMedicalSettings: ACE_Module { scope = 2; displayName = CSTRING(AdvancedMedicalSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; - function = QUOTE(FUNC(moduleAdvancedMedicalSettings)); + function = QFUNC(moduleAdvancedMedicalSettings); functionPriority = 10; isGlobal = 2; isSingular = 1; @@ -320,7 +320,7 @@ class CfgVehicles { class ACE_moduleReviveSettings: ACE_Module { scope = 2; displayName = CSTRING(ReviveSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; function = QUOTE(DFUNC(moduleReviveSettings)); functionPriority = 1; @@ -364,9 +364,9 @@ class CfgVehicles { class ACE_moduleAssignMedicRoles: Module_F { scope = 2; displayName = CSTRING(AssignMedicRoles_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicRoles)); + function = QFUNC(moduleAssignMedicRoles); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; @@ -411,9 +411,9 @@ class CfgVehicles { class ACE_moduleAssignMedicVehicle: Module_F { scope = 2; displayName = CSTRING(AssignMedicVehicle_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicalVehicle)); + function = QFUNC(moduleAssignMedicalVehicle); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; @@ -455,9 +455,9 @@ class CfgVehicles { class ACE_moduleAssignMedicalFacility: Module_F { scope = 2; displayName = CSTRING(AssignMedicalFacility_Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicalFacility)); + function = QFUNC(moduleAssignMedicalFacility); functionPriority = 10; isGlobal = 2; isTriggerActivated = 0; @@ -534,7 +534,7 @@ class CfgVehicles { exceptions[] = {"isNotInside"}; condition = QUOTE((vehicle _target != _target && vehicle _target == vehicle _player) || GVAR(menuTypeStyle) == 1); statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); #undef EXCEPTIONS #undef ACTION_CONDITION @@ -549,7 +549,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionLoadUnit)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); exceptions[] = {"isNotDragging", "isNotCarrying"}; }; class GVAR(UnLoadPatient) { @@ -559,7 +559,7 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionUnloadUnit)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\icons\medical_cross.paa); + icon = QPATHTOF(UI\icons\medical_cross.paa); exceptions[] = {"isNotDragging", "isNotCarrying", "isNotInside"}; }; }; @@ -659,7 +659,7 @@ class CfgVehicles { scope = 1; scopeCurator = 2; side = -1; - model = QUOTE(PATHTOEF(apl,bodybag.p3d)); + model = QPATHTOEF(apl,bodybag.p3d); icon = ""; displayName = CSTRING(Bodybag_Display); EGVAR(dragging,canDrag) = 1; @@ -686,40 +686,40 @@ class CfgVehicles { scopeCurator = 0; displayName = " "; destrType = "DestructNo"; - model = QUOTE(PATHTOF(data\littergeneric.p3d)); + model = QPATHTOF(data\littergeneric.p3d); }; class ACE_MedicalLitter_clean: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_clean.p3d)); + model = QPATHTOF(data\littergeneric_clean.p3d); }; class ACE_MedicalLitter_bandage1: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_bandages1.p3d)); + model = QPATHTOF(data\littergeneric_bandages1.p3d); }; class ACE_MedicalLitter_bandage2: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_bandages2.p3d)); + model = QPATHTOF(data\littergeneric_bandages2.p3d); }; class ACE_MedicalLitter_bandage3: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_bandages3.p3d)); + model = QPATHTOF(data\littergeneric_bandages3.p3d); }; class ACE_MedicalLitter_packingBandage: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_packingBandage.p3d)); + model = QPATHTOF(data\littergeneric_packingBandage.p3d); }; class ACE_MedicalLitter_gloves: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_gloves.p3d)); + model = QPATHTOF(data\littergeneric_gloves.p3d); }; class ACE_MedicalLitter_adenosine: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_adenosine.p3d)); + model = QPATHTOF(data\littergeneric_adenosine.p3d); }; class ACE_MedicalLitter_atropine: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_atropine.p3d)); + model = QPATHTOF(data\littergeneric_atropine.p3d); }; class ACE_MedicalLitter_epinephrine: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_epinephrine.p3d)); + model = QPATHTOF(data\littergeneric_epinephrine.p3d); }; class ACE_MedicalLitter_morphine: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_morphine.p3d)); + model = QPATHTOF(data\littergeneric_morphine.p3d); }; class ACE_MedicalLitter_QuickClot: ACE_MedicalLitterBase { - model = QUOTE(PATHTOF(data\littergeneric_Quikclot.p3d)); + model = QPATHTOF(data\littergeneric_Quikclot.p3d); }; class Item_Base_F; class ACE_fieldDressingItem: Item_Base_F { @@ -880,7 +880,7 @@ class CfgVehicles { scopeCurator = 2; accuracy = 1000; displayName = CSTRING(medicalSupplyCrate); - model = PATHTOF(data\ace_medcrate.p3d); + model = QPATHTOF(data\ace_medcrate.p3d); author = ECSTRING(common,ACETeam); class TransportItems { MACRO_ADDITEM(ACE_fieldDressing,50); diff --git a/addons/medical/CfgWeapons.hpp b/addons/medical/CfgWeapons.hpp index 1c752c2aea..df9a756a34 100644 --- a/addons/medical/CfgWeapons.hpp +++ b/addons/medical/CfgWeapons.hpp @@ -22,8 +22,8 @@ class CfgWeapons { class ACE_ItemCore; class ACE_fieldDressing: ACE_ItemCore { scope = 2; - model = QUOTE(PATHTOF(data\bandage.p3d)); - picture = QUOTE(PATHTOF(ui\items\fieldDressing_x_ca.paa)); + model = QPATHTOF(data\bandage.p3d); + picture = QPATHTOF(ui\items\fieldDressing_x_ca.paa); displayName = CSTRING(Bandage_Basic_Display); descriptionShort = CSTRING(Bandage_Basic_Desc_Short); descriptionUse = CSTRING(Bandage_Basic_Desc_Use); @@ -34,8 +34,8 @@ class CfgWeapons { class ACE_packingBandage: ACE_ItemCore { scope = 2; displayName = CSTRING(Packing_Bandage_Display); - picture = QUOTE(PATHTOF(ui\items\packingBandage_x_ca.paa)); - model = QUOTE(PATHTOF(data\packingbandage.p3d)); + picture = QPATHTOF(ui\items\packingBandage_x_ca.paa); + model = QPATHTOF(data\packingbandage.p3d); descriptionShort = CSTRING(Packing_Bandage_Desc_Short); descriptionUse = CSTRING(Packing_Bandage_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -45,7 +45,7 @@ class CfgWeapons { class ACE_elasticBandage: ACE_ItemCore { scope = 2; displayName = CSTRING(Bandage_Elastic_Display); - picture = QUOTE(PATHTOF(ui\items\elasticBandage_x_ca.paa)); + picture = QPATHTOF(ui\items\elasticBandage_x_ca.paa); model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d"; descriptionShort = CSTRING(Bandage_Elastic_Desc_Short); descriptionUse = CSTRING(Bandage_Elastic_Desc_Use); @@ -56,8 +56,8 @@ class CfgWeapons { class ACE_tourniquet: ACE_ItemCore { scope = 2; displayName = CSTRING(Tourniquet_Display); - picture = QUOTE(PATHTOF(ui\items\tourniquet_x_ca.paa)); - model = QUOTE(PATHTOF(data\tourniquet.p3d)); + picture = QPATHTOF(ui\items\tourniquet_x_ca.paa); + model = QPATHTOF(data\tourniquet.p3d); descriptionShort = CSTRING(Tourniquet_Desc_Short); descriptionUse = CSTRING(Tourniquet_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -67,8 +67,8 @@ class CfgWeapons { class ACE_morphine: ACE_ItemCore { scope = 2; displayName = CSTRING(Morphine_Display); - picture = QUOTE(PATHTOF(ui\items\morphine_x_ca.paa)); - model = QUOTE(PATHTOF(data\morphine.p3d)); + picture = QPATHTOF(ui\items\morphine_x_ca.paa); + model = QPATHTOF(data\morphine.p3d); descriptionShort = CSTRING(Morphine_Desc_Short); descriptionUse = CSTRING(Morphine_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -78,8 +78,8 @@ class CfgWeapons { class ACE_adenosine: ACE_ItemCore { scope = 2; displayName = CSTRING(Adenosine_Display); - picture = QUOTE(PATHTOF(ui\items\adenosine_x_ca.paa)); - model = QUOTE(PATHTOF(data\adenosine.p3d)); + picture = QPATHTOF(ui\items\adenosine_x_ca.paa); + model = QPATHTOF(data\adenosine.p3d); descriptionShort = CSTRING(adenosine_Desc_Short); descriptionUse = CSTRING(adenosine_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -89,8 +89,8 @@ class CfgWeapons { class ACE_atropine: ACE_ItemCore { scope = 2; displayName = CSTRING(Atropine_Display); - picture = QUOTE(PATHTOF(ui\items\atropine_x_ca.paa)); - model = QUOTE(PATHTOF(data\atropine.p3d)); + picture = QPATHTOF(ui\items\atropine_x_ca.paa); + model = QPATHTOF(data\atropine.p3d); descriptionShort = CSTRING(Atropine_Desc_Short); descriptionUse = CSTRING(Atropine_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -100,8 +100,8 @@ class CfgWeapons { class ACE_epinephrine: ACE_ItemCore { scope = 2; displayName = CSTRING(Epinephrine_Display); - picture = QUOTE(PATHTOF(ui\items\epinephrine_x_ca.paa)); - model = QUOTE(PATHTOF(data\epinephrine.p3d)); + picture = QPATHTOF(ui\items\epinephrine_x_ca.paa); + model = QPATHTOF(data\epinephrine.p3d); descriptionShort = CSTRING(Epinephrine_Desc_Short); descriptionUse = CSTRING(Epinephrine_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -112,10 +112,10 @@ class CfgWeapons { class ACE_plasmaIV: ACE_ItemCore { scope = 2; displayName = CSTRING(Plasma_IV); - model = QUOTE(PATHTOF(data\IVBag_1000ml.p3d)); + model = QPATHTOF(data\IVBag_1000ml.p3d); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_plasma_1000ml_ca.paa)) }; - picture = QUOTE(PATHTOF(ui\items\plasmaIV_x_ca.paa)); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_1000ml_ca.paa) }; + picture = QPATHTOF(ui\items\plasmaIV_x_ca.paa); descriptionShort = CSTRING(Plasma_IV_Desc_Short); descriptionUse = CSTRING(Plasma_IV_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -124,27 +124,27 @@ class CfgWeapons { }; class ACE_plasmaIV_500: ACE_plasmaIV { displayName = CSTRING(Plasma_IV_500); - model = QUOTE(PATHTOF(data\IVBag_500ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_plasma_500ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_500ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_500ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 5; }; }; class ACE_plasmaIV_250: ACE_plasmaIV { displayName = CSTRING(Plasma_IV_250); - model = QUOTE(PATHTOF(data\IVBag_250ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_plasma_250ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_250ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_plasma_250ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 2.5; }; }; class ACE_bloodIV: ACE_ItemCore { scope = 2; - model = QUOTE(PATHTOF(data\IVBag_1000ml.p3d)); + model = QPATHTOF(data\IVBag_1000ml.p3d); displayName = CSTRING(Blood_IV); - picture = QUOTE(PATHTOF(ui\items\bloodIV_x_ca.paa)); + picture = QPATHTOF(ui\items\bloodIV_x_ca.paa); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_blood_1000ml_ca.paa)) }; + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_1000ml_ca.paa) }; descriptionShort = CSTRING(Blood_IV_Desc_Short); descriptionUse = CSTRING(Blood_IV_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -153,16 +153,16 @@ class CfgWeapons { }; class ACE_bloodIV_500: ACE_bloodIV { displayName = CSTRING(Blood_IV_500); - model = QUOTE(PATHTOF(data\IVBag_500ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_blood_500ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_500ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_500ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 5; }; }; class ACE_bloodIV_250: ACE_bloodIV { displayName = CSTRING(Blood_IV_250); - model = QUOTE(PATHTOF(data\IVBag_250ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_blood_250ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_250ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_blood_250ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 2.5; }; @@ -170,10 +170,10 @@ class CfgWeapons { class ACE_salineIV: ACE_ItemCore { scope = 2; displayName = CSTRING(Saline_IV); - model = QUOTE(PATHTOF(data\IVBag_1000ml.p3d)); + model = QPATHTOF(data\IVBag_1000ml.p3d); hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_saline_1000ml_ca.paa)) }; - picture = QUOTE(PATHTOF(ui\items\salineIV_x_ca.paa)); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_1000ml_ca.paa) }; + picture = QPATHTOF(ui\items\salineIV_x_ca.paa); descriptionShort = CSTRING(Saline_IV_Desc_Short); descriptionUse = CSTRING(Saline_IV_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -182,16 +182,16 @@ class CfgWeapons { }; class ACE_salineIV_500: ACE_salineIV { displayName = CSTRING(Saline_IV_500); - model = QUOTE(PATHTOF(data\IVBag_500ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_saline_500ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_500ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_500ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 5; }; }; class ACE_salineIV_250: ACE_salineIV { displayName = CSTRING(Saline_IV_250); - model = QUOTE(PATHTOF(data\IVBag_250ml.p3d)); - hiddenSelectionsTextures[] = { QUOTE(PATHTOF(data\IVBag_saline_250ml_ca.paa)) }; + model = QPATHTOF(data\IVBag_250ml.p3d); + hiddenSelectionsTextures[] = { QPATHTOF(data\IVBag_saline_250ml_ca.paa) }; class ItemInfo: InventoryItem_Base_F { mass = 2.5; }; @@ -199,8 +199,8 @@ class CfgWeapons { class ACE_quikclot: ACE_ItemCore { scope = 2; displayName = CSTRING(QuikClot_Display); - model = QUOTE(PATHTOF(data\QuikClot.p3d)); - picture = QUOTE(PATHTOF(ui\items\quickclot_x_ca.paa)); + model = QPATHTOF(data\QuikClot.p3d); + picture = QPATHTOF(ui\items\quickclot_x_ca.paa); descriptionShort = CSTRING(QuikClot_Desc_Short); descriptionUse = CSTRING(QuikClot_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -210,7 +210,7 @@ class CfgWeapons { class ACE_personalAidKit: ACE_ItemCore { scope = 2; displayName = CSTRING(Aid_Kit_Display); - picture = QUOTE(PATHTOF(ui\items\personal_aid_kit_x_ca.paa)); + picture = QPATHTOF(ui\items\personal_aid_kit_x_ca.paa); descriptionShort = CSTRING(Aid_Kit_Desc_Short); descriptionUse = CSTRING(Aid_Kit_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -220,8 +220,8 @@ class CfgWeapons { class ACE_surgicalKit: ACE_ItemCore { scope=2; displayName= CSTRING(SurgicalKit_Display); - model = QUOTE(PATHTOF(data\surgical_kit.p3d)); - picture = QUOTE(PATHTOF(ui\items\surgicalKit_x_ca.paa)); + model = QPATHTOF(data\surgical_kit.p3d); + picture = QPATHTOF(ui\items\surgicalKit_x_ca.paa); descriptionShort = CSTRING(SurgicalKit_Desc_Short); descriptionUse = CSTRING(SurgicalKit_Desc_Use); class ItemInfo: InventoryItem_Base_F { @@ -231,8 +231,8 @@ class CfgWeapons { class ACE_bodyBag: ACE_ItemCore { scope=2; displayName= CSTRING(Bodybag_Display); - model = QUOTE(PATHTOF(data\bodybagItem.p3d)); - picture = QUOTE(PATHTOF(ui\items\bodybag_x_ca.paa)); + model = QPATHTOF(data\bodybagItem.p3d); + picture = QPATHTOF(ui\items\bodybag_x_ca.paa); descriptionShort = CSTRING(Bodybag_Desc_Short); descriptionUse = CSTRING(Bodybag_Desc_Use); class ItemInfo: InventoryItem_Base_F { diff --git a/addons/medical/XEH_PREP.hpp b/addons/medical/XEH_PREP.hpp index d7322082c6..1b5c752653 100644 --- a/addons/medical/XEH_PREP.hpp +++ b/addons/medical/XEH_PREP.hpp @@ -73,6 +73,7 @@ PREP(setDead); PREP(setHitPointDamage); PREP(setStructuralDamage); PREP(setUnconscious); +PREP(showBloodEffect); PREP(translateSelections); PREP(treatment); PREP(treatment_failure); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index f0d3b907f6..1c0c93d93c 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -6,34 +6,32 @@ 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_propagateWound", FUNC(onPropagateWound)] call EFUNC(common,addEventHandler); -["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call EFUNC(common,addEventHandler); -["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); +["ace_interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call CBA_fnc_addEventHandler; //Treatment EventHandlers: -["actionCheckBloodPressureLocal", DFUNC(actionCheckBloodPressureLocal)] call EFUNC(common,addEventHandler); -["actionCheckPulseLocal", DFUNC(actionCheckPulseLocal)] call EFUNC(common,addEventHandler); -["addToInjuredCollection", DFUNC(addToInjuredCollection)] call EFUNC(common,addEventHandler); -["addToMedicalLog", DFUNC(addToLog)] call EFUNC(common,addEventHandler); -["addToTriageCard", DFUNC(addToTriageCard)] call EFUNC(common,addEventHandler); -["setDead", DFUNC(setDead)] call EFUNC(common,addEventHandler); -["setHitPointDamage", DFUNC(setHitPointDamage)] call EFUNC(common,addEventHandler); -["setUnconscious", DFUNC(setUnconscious)] call EFUNC(common,addEventHandler); -["treatmentAdvanced_bandageLocal", DFUNC(treatmentAdvanced_bandageLocal)] call EFUNC(common,addEventHandler); -["treatmentAdvanced_CPRLocal", DFUNC(treatmentAdvanced_CPRLocal)] call EFUNC(common,addEventHandler); -["treatmentAdvanced_fullHealLocal", DFUNC(treatmentAdvanced_fullHealLocal)] call EFUNC(common,addEventHandler); -["treatmentAdvanced_medicationLocal", DFUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler); -["treatmentBasic_bandageLocal", DFUNC(treatmentBasic_bandageLocal)] call EFUNC(common,addEventHandler); -["treatmentBasic_bloodbagLocal", DFUNC(treatmentBasic_bloodbagLocal)] call EFUNC(common,addEventHandler); -["treatmentBasic_morphineLocal", DFUNC(treatmentBasic_morphineLocal)] call EFUNC(common,addEventHandler); -["treatmentIVLocal", DFUNC(treatmentIVLocal)] call EFUNC(common,addEventHandler); -["treatmentTourniquetLocal", DFUNC(treatmentTourniquetLocal)] call EFUNC(common,addEventHandler); -["actionPlaceInBodyBag", FUNC(actionPlaceInBodyBag)] call EFUNC(common,addEventHandler); +[QGVAR(actionCheckBloodPressureLocal), DFUNC(actionCheckBloodPressureLocal)] call CBA_fnc_addEventHandler; +[QGVAR(actionCheckPulseLocal), DFUNC(actionCheckPulseLocal)] call CBA_fnc_addEventHandler; +[QGVAR(addVitalLoop), DFUNC(addVitalLoop)] call CBA_fnc_addEventHandler; +[QGVAR(addToMedicalLog), DFUNC(addToLog)] call CBA_fnc_addEventHandler; +[QGVAR(addToTriageCard), DFUNC(addToTriageCard)] call CBA_fnc_addEventHandler; +[QGVAR(setDead), DFUNC(setDead)] call CBA_fnc_addEventHandler; +[QGVAR(setHitPointDamage), DFUNC(setHitPointDamage)] call CBA_fnc_addEventHandler; +[QGVAR(setUnconscious), DFUNC(setUnconscious)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentAdvanced_bandageLocal), DFUNC(treatmentAdvanced_bandageLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentAdvanced_CPRLocal), DFUNC(treatmentAdvanced_CPRLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentAdvanced_fullHealLocal), DFUNC(treatmentAdvanced_fullHealLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentAdvanced_medicationLocal), DFUNC(treatmentAdvanced_medicationLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentBasic_bandageLocal), DFUNC(treatmentBasic_bandageLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentBasic_bloodbagLocal), DFUNC(treatmentBasic_bloodbagLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentBasic_morphineLocal), DFUNC(treatmentBasic_morphineLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentIVLocal), DFUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler; +[QGVAR(treatmentTourniquetLocal), DFUNC(treatmentTourniquetLocal)] call CBA_fnc_addEventHandler; +[QGVAR(actionPlaceInBodyBag), FUNC(actionPlaceInBodyBag)] call CBA_fnc_addEventHandler; //Handle Deleting Bodies on Server: -if (isServer) then {["placedInBodyBag", FUNC(serverRemoveBody)] call EFUNC(common,addEventHandler);}; +if (isServer) then {["ace_placedInBodyBag", FUNC(serverRemoveBody)] call CBA_fnc_addEventHandler;}; -["medical_onUnconscious", { +["ace_unconscious", { params ["_unit", "_status"]; if (local _unit) then { if (_status) then { @@ -48,7 +46,7 @@ if (isServer) then {["placedInBodyBag", FUNC(serverRemoveBody)] call EFUNC(commo _unit setVariable ["acre_sys_core_isDisabled", false, true]; }; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Initialize all effects @@ -104,7 +102,7 @@ GVAR(effectPainCC) = [ // Initialize Other Variables GVAR(effectBlind) = false; -GVAR(effectTimeBlood) = ACE_time; +GVAR(effectTimeBlood) = CBA_missionTime; // MAIN EFFECTS LOOP [{ @@ -139,11 +137,11 @@ GVAR(effectTimeBlood) = ACE_time; [{ GVAR(effectBlindingCC) ppEffectAdjust [1,1,0, [1,1,1,0], [0,0,0,1], [0,0,0,0]]; GVAR(effectBlindingCC) ppEffectCommit ((_this select 0) * 2); - }, [_strength], 0.01, 0] call EFUNC(common,waitAndExecute); + }, [_strength], 0.01, 0] call CBA_fnc_waitAndExecute; [{ GVAR(effectBlindingCC) ppEffectEnable false; - }, [], (_strength * 2) + 0.5, 0] call EFUNC(common,waitAndExecute); + }, [], (_strength * 2) + 0.5, 0] call CBA_fnc_waitAndExecute; GVAR(effectBlind) = false; }; @@ -151,13 +149,18 @@ GVAR(effectTimeBlood) = ACE_time; _bleeding = [ACE_player] call FUNC(getBloodLoss); // Bleeding Indicator - if (_bleeding > 0 and GVAR(effectTimeBlood) + 3.5 < ACE_time) then { - GVAR(effectTimeBlood) = ACE_time; - [600 * _bleeding] call BIS_fnc_bloodEffect; + if (_bleeding > 0 and GVAR(effectTimeBlood) + 3.5 < CBA_missionTime) then { + GVAR(effectTimeBlood) = CBA_missionTime; + [600 * _bleeding] call FUNC(showBloodEffect); }; // Blood Volume Effect - _blood = (ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100; + _blood = if (GVAR(level) < 2) then { + (ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100; + } else { + (((ACE_player getVariable [QGVAR(bloodVolume), 100]) - 60) max 0) / 40; + }; + if (_blood > 0.99) then { GVAR(effectBloodVolumeCC) ppEffectEnable false; } else { @@ -168,8 +171,8 @@ GVAR(effectTimeBlood) = ACE_time; }, 0.5, []] call CBA_fnc_addPerFrameHandler; -GVAR(lastHeartBeat) = ACE_time; -GVAR(lastHeartBeatSound) = ACE_time; +GVAR(lastHeartBeat) = CBA_missionTime; +GVAR(lastHeartBeatSound) = CBA_missionTime; // HEARTRATE BASED EFFECTS [{ @@ -189,8 +192,8 @@ GVAR(lastHeartBeatSound) = ACE_time; GVAR(effectPainCC) ppEffectEnable false; }; } else { - if ((ACE_time > GVAR(lastHeartBeat) + _interval)) then { - GVAR(lastHeartBeat) = ACE_time; + if ((CBA_missionTime > GVAR(lastHeartBeat) + _interval)) then { + GVAR(lastHeartBeat) = CBA_missionTime; // Pain effect, no pain effect in zeus camera if (isNull curatorCamera) then { @@ -206,15 +209,15 @@ GVAR(lastHeartBeatSound) = ACE_time; [{ GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; GVAR(effectPainCA) ppEffectCommit (_this select 1); - }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call CBA_fnc_waitAndExecute; [{ GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; GVAR(effectPainCA) ppEffectCommit 0.01; - }, [_strength * 0.7], _interval * 0.3, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.7], _interval * 0.3, 0] call CBA_fnc_waitAndExecute; [{ GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; GVAR(effectPainCA) ppEffectCommit (_this select 1); - }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call CBA_fnc_waitAndExecute; } else { GVAR(effectPainCA) ppEffectEnable false; }; @@ -228,15 +231,15 @@ GVAR(lastHeartBeatSound) = ACE_time; [{ GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; GVAR(effectPainCC) ppEffectCommit (_this select 1); - }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call CBA_fnc_waitAndExecute; [{ GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; GVAR(effectPainCC) ppEffectCommit 0.01; - }, [_strength * 0.7], _interval * 0.3, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.7], _interval * 0.3, 0] call CBA_fnc_waitAndExecute; [{ GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; GVAR(effectPainCC) ppEffectCommit (_this select 1); - }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call EFUNC(common,waitAndExecute); + }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call CBA_fnc_waitAndExecute; } else { GVAR(effectPainCC) ppEffectEnable false; }; @@ -247,8 +250,8 @@ GVAR(lastHeartBeatSound) = ACE_time; if (GVAR(level) >= 2 && {_heartRate > 0}) then { _minTime = 60 / _heartRate; - if (ACE_time - GVAR(lastHeartBeatSound) > _minTime) then { - GVAR(lastHeartBeatSound) = ACE_time; + if (CBA_missionTime - GVAR(lastHeartBeatSound) > _minTime) then { + GVAR(lastHeartBeatSound) = CBA_missionTime; // Heart rate sound effect if (_heartRate < 60) then { _sound = GVAR(heartBeatSounds_Normal) select (random((count GVAR(heartBeatSounds_Normal)) -1)); @@ -264,7 +267,7 @@ GVAR(lastHeartBeatSound) = ACE_time; }, 0, []] call CBA_fnc_addPerFrameHandler; }; -["SettingsInitialized", { +["ace_settingsInitialized", { // Networked litter (need to wait for GVAR(litterCleanUpDelay) to be set) [QGVAR(createLitter), FUNC(handleCreateLitter), GVAR(litterCleanUpDelay)] call EFUNC(common,addSyncedEventHandler); @@ -287,18 +290,18 @@ GVAR(lastHeartBeatSound) = ACE_time; {((_this select 0) getVariable [QGVAR(inReviveState), false])}, {((_this select 0) getVariable ["ACE_isDead", false])} ] call FUNC(addUnconsciousCondition); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Prevent all types of interaction while unconscious // @todo: probably remove this when CBA keybind hold key works properly ["isNotUnconscious", {!((_this select 0) getVariable ["ACE_isUnconscious", false])}] call EFUNC(common,addCanInteractWithCondition); // Item Event Handler -["playerInventoryChanged", FUNC(itemCheck)] call EFUNC(common,addEventHandler); +["loadout", FUNC(itemCheck)] call CBA_fnc_addPlayerEventHandler; if (hasInterface) then { - ["PlayerJip", { + ["ace_playerJIP", { ACE_LOGINFO("JIP Medical init for player."); [player] call FUNC(init); - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addEventHandler; }; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 85232498bd..a5dc596ba2 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -35,7 +35,7 @@ private _fixStatic = { 1 preloadObject (_this select 0); }, { TRACE_1("preload done",_this); - }, [_vehType]] call EFUNC(common,waitUntilAndExecute); + }, [_vehType]] call CBA_fnc_waitUntilAndExecute; }; }; ["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler; @@ -47,7 +47,7 @@ addMissionEventHandler ["Loaded",{ 1 preloadObject (_this select 0); }, { TRACE_1("preload done",_this); - }, [_x]] call EFUNC(common,waitUntilAndExecute); + }, [_x]] call CBA_fnc_waitUntilAndExecute; } forEach GVAR(fixedStatics); }]; diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 7d48672972..1d1c34d6c7 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -7,7 +7,7 @@ params ["_unit"]; // Reset captive status for respawning unit if (!(_unit getVariable ["ACE_isUnconscious", false])) then { - [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); + [_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set); }; // Remove maximum unconsciousness time handler diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index f558391e4a..0cff136624 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_medicalSupplyCrate", "ACE_medicalSupplyCrate_advanced", "ACE_fieldDressingItem", "ACE_packingBandageItem", "ACE_elasticBandageItem", "ACE_tourniquetItem", "ACE_morphineItem", "ACE_atropineItem", "ACE_epinephrineItem", "ACE_plasmaIVItem", "ACE_bloodIVItem", "ACE_salineIVItem", "ACE_quikclotItem", "ACE_personalAidKitItem", "ACE_surgicalKitItem", "ACE_bodyBagItem", "ACE_bodyBagObject"}; weapons[] = {"ACE_fieldDressing", "ACE_packingBandage", "ACE_elasticBandage", "ACE_tourniquet", "ACE_morphine", "ACE_atropine", "ACE_epinephrine", "ACE_plasmaIV", "ACE_plasmaIV_500", "ACE_plasmaIV_250", "ACE_bloodIV", "ACE_bloodIV_500", "ACE_bloodIV_250", "ACE_salineIV", "ACE_salineIV_500", "ACE_salineIV_250", "ACE_quikclot", "ACE_personalAidKit", "ACE_surgicalKit", "ACE_bodyBag"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction", "ace_apl"}; - author[] = {"Glowbal", "KoffeinFlummi"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"Glowbal", "KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -21,5 +23,35 @@ class CfgPatches { #include "CfgEden.hpp" #include "ACE_Medical_Treatments.hpp" #include "ACE_Settings.hpp" +#include "ui\CfgInGameUI.hpp" #include "ui\RscTitles.hpp" #include "ui\triagecard.hpp" + +class ACE_newEvents { + medical_onUnconscious = "ace_unconscious"; + medical_treatmentSuccess = "ace_treatmentSucceded"; + medical_onSetDead = "ace_killed"; + Medical_onEnteredCardiacArrest = "ace_cardiacArrestEntered"; + Medical_onItemAddedToTriageCard = "ace_triageCardItemAdded"; + medical_onLogEntryAdded = "ace_medicalLogEntryAdded"; + Medical_onHeartRateAdjustmentAdded = "ace_heartRateAdjustmentAdded"; + placedInBodyBag = "ace_placedInBodyBag"; + actionPlaceInBodyBag = QGVAR(actionPlaceInBodyBag); + treatmentTourniquetLocal = QGVAR(treatmentTourniquetLocal); + treatmentIVLocal = QGVAR(treatmentIVLocal); + treatmentBasic_morphineLocal = QGVAR(treatmentBasic_morphineLocal); + treatmentBasic_bloodbagLocal = QGVAR(treatmentBasic_bloodbagLocal); + treatmentBasic_bandageLocal = QGVAR(treatmentBasic_bandageLocal); + treatmentAdvanced_medicationLocal = QGVAR(treatmentAdvanced_medicationLocal); + treatmentAdvanced_fullHealLocal = QGVAR(treatmentAdvanced_fullHealLocal); + treatmentAdvanced_CPRLocal = QGVAR(treatmentAdvanced_CPRLocal); + treatmentAdvanced_bandageLocal = QGVAR(treatmentAdvanced_bandageLocal); + setUnconscious = QGVAR(setUnconscious); + setHitPointDamage = QGVAR(setHitPointDamage); + setDead = QGVAR(setDead); + addToTriageCard = QGVAR(addToTriageCard); + addToMedicalLog = QGVAR(addToMedicalLog); + actionCheckPulseLocal = QGVAR(actionCheckPulseLocal); + actionCheckBloodPressureLocal = QGVAR(actionCheckBloodPressureLocal); + addVitalLoop = QGVAR(addVitalLoop); +}; diff --git a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf index 4d821ea6b0..9e66eda263 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressure.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressure.sqf @@ -16,7 +16,7 @@ params ["_caller", "_target", "_selectionName"]; if (local _target) then { - ["actionCheckBloodPressureLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent); + [QGVAR(actionCheckBloodPressureLocal), [_caller, _target, _selectionName]] call CBA_fnc_localEvent; } else { - ["actionCheckBloodPressureLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent); + [QGVAR(actionCheckBloodPressureLocal), [_caller, _target, _selectionName], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 0fd9394f92..184110265a 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -14,17 +14,16 @@ #include "script_component.hpp" -private ["_bloodPressure", "_logOutPut", "_output"]; params ["_caller", "_target", "_selectionName"]; -_bloodPressure = if (!alive _target) then { +private _bloodPressure = if (!alive _target) then { [0,0] } else { [_target] call FUNC(getBloodPressure) }; _bloodPressure params [ "_bloodPressureLow", "_bloodPressureHigh"]; -_output = ""; -_logOutPut = ""; +private _output = ""; +private _logOutPut = ""; if ([_caller] call FUNC(isMedic)) then { _output = LSTRING(Check_Bloodpressure_Output_1); _logOutPut = format["%1/%2",round(_bloodPressureHigh),round(_bloodPressureLow)]; @@ -57,7 +56,7 @@ if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC( _logOutPut = ""; }; -["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); +[QEGVAR(common,displayTextStructured), [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller], [_caller]] call CBA_fnc_targetEvent; if (_logOutPut != "") then { [_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller, false, true] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionCheckPulse.sqf b/addons/medical/functions/fnc_actionCheckPulse.sqf index 2c0a46c826..39f196a0a5 100644 --- a/addons/medical/functions/fnc_actionCheckPulse.sqf +++ b/addons/medical/functions/fnc_actionCheckPulse.sqf @@ -16,7 +16,7 @@ params ["_caller","_target", "_selectionName"]; if (local _target) then { - ["actionCheckPulseLocal", [_caller, _target, _selectionName]] call EFUNC(common,localEvent); + [QGVAR(actionCheckPulseLocal), [_caller, _target, _selectionName]] call CBA_fnc_localEvent; } else { - ["actionCheckPulseLocal", _target, [_caller, _target, _selectionName]] call EFUNC(common,targetEvent); + [QGVAR(actionCheckPulseLocal), [_caller, _target, _selectionName], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index 83852f8042..cf84df075e 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -14,15 +14,14 @@ #include "script_component.hpp" -private ["_heartRateOutput", "_heartRate", "_logOutPut"]; params ["_caller", "_unit", "_selectionName"]; -_heartRate = _unit getVariable [QGVAR(heartRate), 80]; +private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; if (!alive _unit) then { _heartRate = 0; }; -_heartRateOutput = LSTRING(Check_Pulse_Output_5); -_logOutPut = LSTRING(Check_Pulse_None); +private _heartRateOutput = LSTRING(Check_Pulse_Output_5); +private _logOutPut = LSTRING(Check_Pulse_None); if (_heartRate > 1.0) then { if ([_caller] call FUNC(isMedic)) then { @@ -49,7 +48,7 @@ if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC( _logOutPut = LSTRING(Check_Pulse_None); }; -["displayTextStructured", [_caller], [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent); +[QEGVAR(common,displayTextStructured), [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; if (_logOutPut != "") then { [_unit,"activity", LSTRING(Check_Pulse_Log),[[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf index d69fa90c86..c47dc5dd64 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -14,12 +14,11 @@ #include "script_component.hpp" -private ["_output"]; params ["_caller", "_target"]; -_output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake)); +private _output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsive)] select ([_target] call EFUNC(common,isAwake)); -["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent); +[QEGVAR(common,displayTextStructured), [[_output, [_target] call EFUNC(common,getName)], 2, _caller], [_caller]] call CBA_fnc_targetEvent; -[_target,"activity",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target,"quick_view",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target ,"activity", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "quick_view", _output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionDiagnose.sqf b/addons/medical/functions/fnc_actionDiagnose.sqf index ffb2583a15..3a611a116d 100644 --- a/addons/medical/functions/fnc_actionDiagnose.sqf +++ b/addons/medical/functions/fnc_actionDiagnose.sqf @@ -17,14 +17,14 @@ private "_genericMessages"; params ["_caller", "_target"]; -_genericMessages = [LSTRING(diagnoseMessage)]; +private _genericMessages = [LSTRING(diagnoseMessage), [_target] call EFUNC(common,getName)]; -_genericMessages pushBack ([_target] call EFUNC(common,getName)); if (alive _target) then { _genericMessages pushBack LSTRING(diagnoseAlive); } else { _genericMessages pushBack LSTRING(diagnoseDead); }; + if (_target getVariable[QGVAR(hasLostBlood), 0] > 0) then { if (_target getVariable[QGVAR(hasLostBlood), 0] > 1) then { _genericMessages pushBack LSTRING(lostBloodALot); @@ -43,4 +43,4 @@ if (alive _target) then { }; }; -["displayTextStructured", [_caller], [_genericMessages, 3.0, _caller]] call EFUNC(common,targetEvent); +[QEGVAR(common,displayTextStructured), [_genericMessages, 3.0, _caller], [_caller]] call CBA_fnc_targetEvent; diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index 41970e23d2..35ebfefebc 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -18,7 +18,7 @@ private "_vehicle"; params ["_caller", "_target"]; if ([_target] call EFUNC(common,isAwake)) exitWith { - ["displayTextStructured", [_caller], [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [[LSTRING(CanNotLoaded), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; }; if ([_target] call FUNC(isBeingCarried)) then { [_caller, _target] call EFUNC(dragging,dropObject_carry); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index d7a316cab0..1ae1dfdc6d 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -22,7 +22,7 @@ TRACE_2("params",_caller,_target); if (!local _target) exitWith { TRACE_1("running where local",local _target); - ["actionPlaceInBodyBag", [_target], [_caller, _target]] call EFUNC(common,targetEvent); + [QGVAR(actionPlaceInBodyBag), [_caller, _target], [_target]] call CBA_fnc_targetEvent; objNull }; @@ -47,6 +47,6 @@ private _bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, ""]; _bodyBag setPosASL _position; _bodyBag setDir _direction; -["placedInBodyBag", [_target, _bodyBag]] call EFUNC(common,globalEvent); //hide and delete body on server +["ace_placedInBodyBag", [_target, _bodyBag]] call CBA_fnc_globalEvent; //hide and delete body on server _bodyBag diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index 660c3f9ff7..bf0a3e5ae4 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -15,22 +15,20 @@ #include "script_component.hpp" -private ["_part", "_tourniquets", "_output"]; params ["_caller", "_target", "_selectionName"]; TRACE_3("params",_caller,_target,_selectionName); // grab the required data -_part = [_selectionName] call FUNC(selectionNameToNumber); -_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +private _part = [_selectionName] call FUNC(selectionNameToNumber); +private _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 { - _output = LSTRING(noTourniquetOnBodyPart); - ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [LSTRING(noTourniquetOnBodyPart), 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; }; // Removing the tourniquet -_tourniquets set[_part, 0]; +_tourniquets set [_part, 0]; _target setVariable [QGVAR(tourniquets), _tourniquets, true]; // Adding the tourniquet item to the caller @@ -44,11 +42,12 @@ TRACE_2("meds",_part,_delayedMedications); _x params ["", "", "_medPartNum"]; if (_part == _medPartNum) then { TRACE_1("delayed medication call after tourniquet removeal",_x); - ["treatmentAdvanced_medicationLocal", [_target], _x] call EFUNC(common,targetEvent); + [QGVAR(treatmentAdvanced_medicationLocal), _x, [_target]] call CBA_fnc_targetEvent; _delayedMedications set [_forEachIndex, -1]; _updatedArray = true; }; } forEach _delayedMedications; + if (_updatedArray) then { _delayedMedications = _delayedMedications - [-1]; _target setVariable [QGVAR(occludedMedications), _delayedMedications, true]; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 705eeb88f5..75fe76bce9 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -21,4 +21,4 @@ params ["_caller", "_target", ["_drag", false]]; if (vehicle _target == _target) exitWith {}; if (([_target] call EFUNC(common,isAwake))) exitWith {}; -["unloadPersonEvent", _target, [_target, vehicle _target, _caller]] call EFUNC(common,targetEvent); +["ace_unloadPersonEvent", [_target, vehicle _target, _caller], _target] call CBA_fnc_targetEvent; diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf index a11cc4689f..1969e3ff74 100644 --- a/addons/medical/functions/fnc_addDamageToUnit.sqf +++ b/addons/medical/functions/fnc_addDamageToUnit.sqf @@ -54,7 +54,7 @@ private _debugCode = { ACE_LOGERROR_6("addDamageToUnit - FAILED - [unit:%1, partNo:%2, addDmg:%3] results:[alive:%4 old:%5 new:%6]", _unit, _partNumber, _damageToAdd, alive _unit, _startDmg, _endDmg); }; }; -[{diag_frameno > (_this select 0)}, _debugCode, [_checkAtFrame, _unit, _startDmg, _damageToAdd, _partNumber]] call EFUNC(common,waitUntilAndExecute); +[{diag_frameno > (_this select 0)}, _debugCode, [_checkAtFrame, _unit, _startDmg, _damageToAdd, _partNumber]] call CBA_fnc_waitUntilAndExecute; #endif private _return = [_unit, _selection, (_currentDamage + _damageToAdd), _unit, _typeOfDamage, _hitpointIndex] call FUNC(handleDamage); diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index cc8c093071..a23ea45023 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -16,10 +16,10 @@ #include "script_component.hpp" - params [["_unit", objNull, [objNull]], ["_value", 0, [0]], ["_time", 1, [0]], ["_callBack", {}, [{}]]]; -_adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; +private _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; _adjustment pushBack [_value, _time, _callBack]; -_unit setVariable [QGVAR(heartRateAdjustments), _adjustment ]; -["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call EFUNC(common,localEvent); +_unit setVariable [QGVAR(heartRateAdjustments), _adjustment]; + +["ace_heartRateAdjustmentAdded", [_unit, _value, _time]] call CBA_fnc_localEvent; diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf index 88c463d1eb..f0c6b9c622 100644 --- a/addons/medical/functions/fnc_addToLog.sqf +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -16,22 +16,20 @@ #include "script_component.hpp" -private ["_moment", "_logVarName", "_log","_newLog", "_logs"]; params ["_unit", "_type", "_message", "_arguments"]; if (!local _unit) exitWith { - ["addToMedicalLog", _unit, _this] call EFUNC(common,targetEvent); + [QGVAR(addToMedicalLog), _this, _unit] call CBA_fnc_targetEvent; }; date params ["", "", "", "_hour", "_minute"]; -_moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]; +private _moment = format [ (["%1:%2", "%1:0%2"] select (_minute < 10)), _hour, _minute]; +private _logVarName = format[QGVAR(logFile_%1), _type]; -_logVarName = format[QGVAR(logFile_%1), _type]; - -_log = _unit getVariable [_logVarName, []]; +private _log = _unit getVariable [_logVarName, []]; if (count _log >= 8) then { - _newLog = []; + private _newLog = []; { // ensure the first element will not be added if (_forEachIndex > 0) then { @@ -43,9 +41,9 @@ if (count _log >= 8) then { _log pushBack [_message, _moment, _type, _arguments]; _unit setVariable [_logVarName, _log, true]; -["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call EFUNC(common,localEvent); +["ace_medicalLogEntryAdded", [_unit, _type, _message, _arguments]] call CBA_fnc_localEvent; -_logs = _unit getVariable [QGVAR(allLogs), []]; +private _logs = _unit getVariable [QGVAR(allLogs), []]; if !(_logVarName in _logs) then { _logs pushBack _logVarName; _unit setVariable [QGVAR(allLogs), _logs, true]; diff --git a/addons/medical/functions/fnc_addToTriageCard.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf index ca54d8cd27..0e11f38f77 100644 --- a/addons/medical/functions/fnc_addToTriageCard.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -14,22 +14,20 @@ #include "script_component.hpp" -private ["_log", "_inList", "_amount"]; params ["_unit", "_newItem"]; if (!local _unit) exitWith { - ["addToTriageCard", _unit, _this] call EFUNC(common,targetEvent); + [QGVAR(addToTriageCard), _this, _unit] call CBA_fnc_targetEvent; }; -_log = _unit getVariable [QGVAR(triageCard), []]; -_inList = false; -_amount = 1; +private _log = _unit getVariable [QGVAR(triageCard), []]; +private _inList = false; +private _amount = 1; { if ((_x select 0) == _newItem) exitWith { - private "_info"; - _info = _log select _forEachIndex; + private _info = _log select _forEachIndex; _info set [1,(_info select 1) + 1]; - _info set [2, ACE_gameTime]; + _info set [2, CBA_missionTime]; _log set [_forEachIndex, _info]; _amount = (_info select 1); @@ -38,7 +36,7 @@ _amount = 1; } forEach _log; if (!_inList) then { - _log pushBack [_newItem, 1, ACE_gameTime]; + _log pushBack [_newItem, 1, CBA_missionTime]; }; _unit setVariable [QGVAR(triageCard), _log, true]; -["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call EFUNC(common,localEvent); +["ace_triageCardItemAdded", [_unit, _newItem, _amount]] call CBA_fnc_localEvent; diff --git a/addons/medical/functions/fnc_addUnloadPatientActions.sqf b/addons/medical/functions/fnc_addUnloadPatientActions.sqf index f29b3923f1..596a536de6 100644 --- a/addons/medical/functions/fnc_addUnloadPatientActions.sqf +++ b/addons/medical/functions/fnc_addUnloadPatientActions.sqf @@ -2,12 +2,12 @@ * Author: esteldunedain * Create one unload action per unconscious passenger * - * Argument: + * Arguments: * 0: Vehicle * 1: Player * 3: Parameters * - * Return value: + * Return Value: * Children actions * * Public: No @@ -15,11 +15,10 @@ #include "script_component.hpp" params ["_vehicle", "_player", "_parameters"]; -private ["_actions", "_unit"]; -_actions = []; +private _actions = []; { - _unit = _x; + private _unit = _x; if (_unit != _player && {(alive _unit) && {_unit getVariable ["ACE_isUnconscious", false]}}) then { _actions pushBack [ diff --git a/addons/medical/functions/fnc_addVitalLoop.sqf b/addons/medical/functions/fnc_addVitalLoop.sqf index 52b2cc11f9..aa3d6608d0 100644 --- a/addons/medical/functions/fnc_addVitalLoop.sqf +++ b/addons/medical/functions/fnc_addVitalLoop.sqf @@ -18,7 +18,7 @@ params ["_unit", ["_force", false]]; if !([_unit] call FUNC(hasMedicalEnabled) || _force) exitWith {}; if !(local _unit) exitWith { - ["addVitalLoop", _unit, [_unit, _force]] call EFUNC(common,targetEvent); + [QGVAR(addVitalLoop), [_unit, _force], _unit] call CBA_fnc_targetEvent; }; // Quit if the unit already has a vital loop, or is dead, unless it's forced @@ -27,4 +27,4 @@ if ((_unit getVariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force // Schedule the loop to be executed again 1 sec later // @todo: should the loop be started righ away instead? _unit setVariable [QGVAR(addedToUnitLoop), true, true]; -[DFUNC(vitalLoop), [_unit, ACE_time], 1] call EFUNC(common,waitAndExecute); +[DFUNC(vitalLoop), [_unit, CBA_missionTime], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_adjustPainLevel.sqf b/addons/medical/functions/fnc_adjustPainLevel.sqf index 7b97cdc48f..b78ee3d4f7 100644 --- a/addons/medical/functions/fnc_adjustPainLevel.sqf +++ b/addons/medical/functions/fnc_adjustPainLevel.sqf @@ -26,15 +26,13 @@ TRACE_3("ACE_DEBUG: adjustPainLevel Called",_unit, _pain, _addedPain); //Ignore if medical system disabled: if (GVAR(level) == 0) exitWith {}; -_pain = _unit getVariable [QGVAR(pain), 0]; +private _pain = ((_unit getVariable [QGVAR(pain), 0]) + _addedPain) max 0; -_pain = _pain + _addedPain; if (GVAR(level) == 1) then {_pain = _pain min 1;}; //for basic, cap at 1 -_pain = _pain max 0; _unit setVariable [QGVAR(pain), _pain]; //Start up the vital watching (if not already running) [_unit] call FUNC(addVitalLoop); -_pain +_pain; diff --git a/addons/medical/functions/fnc_bodyCleanupLoop.sqf b/addons/medical/functions/fnc_bodyCleanupLoop.sqf index 03c1234713..af17ffcd34 100644 --- a/addons/medical/functions/fnc_bodyCleanupLoop.sqf +++ b/addons/medical/functions/fnc_bodyCleanupLoop.sqf @@ -27,4 +27,4 @@ if (GVAR(bodiesToDelete) isEqualTo []) exitWith { }; // Schedule the loop to be executed again 20 sec later -[DFUNC(bodyCleanupLoop), [], 20] call EFUNC(common,waitAndExecute); +[DFUNC(bodyCleanupLoop), [], 20] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf index e6856335cc..53707ae65c 100644 --- a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf +++ b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf @@ -14,12 +14,11 @@ #include "script_component.hpp" -private ["_accessLevel", "_return"]; params ["_caller", "_target"]; -_accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1]; +private _accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1]; -_return = false; +private _return = false; if (_accessLevel >= 0) then { if (_accessLevel == 0) exitWith { _return = true; }; diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf index 1d9fadf455..1c78eb1e43 100644 --- a/addons/medical/functions/fnc_canTreat.sqf +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -19,20 +19,18 @@ #include "script_component.hpp" -private ["_config", "_medicRequired", "_items", "_locations", "_return", "_condition", "_patientStateCondition", "_allowedSelections"]; params ["_caller", "_target", "_selectionName", "_className"]; if !(_target isKindOf "CAManBase") exitWith { false }; - -_config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className); +private _config = (ConfigFile >> "ACE_Medical_Actions" >> (["Basic", "Advanced"] select (GVAR(level)>=2)) >> _className); if !(isClass _config) exitwith {false}; // Allow self treatment check if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; -_medicRequired = if (isNumber (_config >> "requiredMedic")) then { +private _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { // Check for required class @@ -43,15 +41,15 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then { }; if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith { false }; -_items = getArray (_config >> "items"); +private _items = getArray (_config >> "items"); if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith { false }; -_allowedSelections = getArray (_config >> "allowedSelections"); +private _allowedSelections = getArray (_config >> "allowedSelections"); if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith { false }; -_return = true; +private _return = true; if (getText (_config >> "condition") != "") then { - _condition = getText (_config >> "condition"); + private _condition = getText (_config >> "condition"); if (isnil _condition) then { _condition = compile _condition; } else { @@ -65,27 +63,25 @@ if (getText (_config >> "condition") != "") then { }; if (!_return) exitwith { false }; -_patientStateCondition = if (isText(_config >> "patientStateCondition")) then { +private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] } else { getNumber(_config >> "patientStateCondition") }; if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; -_locations = getArray (_config >> "treatmentLocations"); +private _locations = getArray (_config >> "treatmentLocations"); if ("All" in _locations) exitwith { true }; -private [ "_medFacility", "_medVeh"]; -_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; -_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; +private _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; +private _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; { if (_x == "field") exitwith {_return = true;}; if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { - private "_val"; - _val = missionNamespace getVariable _x; + private _val = missionNamespace getVariable _x; if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index bb90e0e3e2..fd3bc9a403 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -21,7 +21,6 @@ #define MIN_ENTRIES_LITTER_CONFIG 3 -private ["_config", "_litter", "_createLitter", "_position", "_createdLitter"]; params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_bloodLossOnSelection"]; //Ensures comptibilty with other possible medical treatment configs @@ -30,28 +29,27 @@ private _previousDamage = _bloodLossOnSelection; if !(GVAR(allowLitterCreation)) exitwith {}; if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; -_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); -if (GVAR(level) >= 2) then { - _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); +private _config = if (GVAR(level) >= 2) then { + (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); +} else { + (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className) }; if !(isClass _config) exitwith {false}; - if !(isArray (_config >> "litter")) exitwith {}; -_litter = getArray (_config >> "litter"); +private _litter = getArray (_config >> "litter"); -_createLitter = { - private["_position", "_direction"]; +private _createLitter = { params ["_unit", "_litterClass"]; // @TODO: handle carriers over water // For now, don't spawn litter if we are over water to avoid floating litter - if(surfaceIsWater (getPos _unit)) exitWith { false }; + if (surfaceIsWater (getPos _unit)) exitWith { false }; - _position = getPosATL _unit; + private _position = getPosATL _unit; _position params ["_posX", "_posY", "_posZ"]; _position = [_posX + (random 2) - 1, _posY + (random 2) - 1, _posZ]; - _direction = (random 360); + private _direction = (random 360); // Create the litter, and timeout the event based on the cleanup delay // The cleanup delay for events in MP is handled by the server side @@ -60,7 +58,7 @@ _createLitter = { true }; -_createdLitter = []; +private _createdLitter = []; { if (_x isEqualType []) then { if (count _x < MIN_ENTRIES_LITTER_CONFIG) exitwith {}; diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index 8a70d336c2..9dbbcce9a6 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -22,7 +22,6 @@ #define CHANGE_FATAL_TORSO 0.6 #define CHANGE_FATAL_LIMB 0.1 -private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"]; params ["_unit", "_part", ["_withDamage", 0]]; if (!alive _unit) exitWith {true}; @@ -30,7 +29,7 @@ if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitWith { true }; if (_part < 0 || _part > 5) exitWith {false}; // Find the correct Damage threshold for unit. -_damageThreshold = [1,1,1]; +private _damageThreshold = [1,1,1]; if ([_unit] call EFUNC(common,IsPlayer)) then { _damageThreshold =_unit getVariable[QGVAR(unitDamageThreshold), [GVAR(playerDamageThreshold), GVAR(playerDamageThreshold), GVAR(playerDamageThreshold) * 1.7]]; } else { @@ -38,20 +37,20 @@ if ([_unit] call EFUNC(common,IsPlayer)) then { }; _damageThreshold params ["_thresholdHead", "_thresholdTorso", "_thresholdLimbs"]; -_damageBodyPart = ((_unit getVariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; +private _damageBodyPart = ((_unit getVariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; // Check if damage to body part is higher as damage head if (_part == 0) exitWith { - _chanceFatal = CHANGE_FATAL_HEAD + ((INCREASE_CHANCE_HEAD * (_damageBodyPart - _thresholdHead)) * 10); + private _chanceFatal = CHANGE_FATAL_HEAD + ((INCREASE_CHANCE_HEAD * (_damageBodyPart - _thresholdHead)) * 10); (_damageBodyPart >= _thresholdHead && {(_chanceFatal >= random(1))}); }; // Check if damage to body part is higher as damage torso if (_part == 1) exitWith { - _chanceFatal = CHANGE_FATAL_TORSO + ((INCREASE_CHANCE_TORSO * (_damageBodyPart - _thresholdTorso)) * 10); + private _chanceFatal = CHANGE_FATAL_TORSO + ((INCREASE_CHANCE_TORSO * (_damageBodyPart - _thresholdTorso)) * 10); (_damageBodyPart >= _thresholdTorso && {(_chanceFatal >= random(1))}); }; // Check if damage to body part is higher as damage limbs // We use a slightly lower decrease for limbs, as we want any injuries done to those to be less likely to be fatal compared to head shots or torso. -_chanceFatal = CHANGE_FATAL_LIMB + ((INCREASE_CHANGE_LIMB * (_damageBodyPart - _thresholdLimbs)) * 10); +private _chanceFatal = CHANGE_FATAL_LIMB + ((INCREASE_CHANGE_LIMB * (_damageBodyPart - _thresholdLimbs)) * 10); (_damageBodyPart >= _thresholdLimbs && {(_chanceFatal >= random(1))}); diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf index 1e1816d5f5..0f44ea5699 100644 --- a/addons/medical/functions/fnc_displayPatientInformation.sqf +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -18,7 +18,7 @@ // Exit for basic medical if (GVAR(level) < 2) exitWith {}; -private ["_amountOfGeneric", "_bandagedwounds", "_logCtrl", "_part", "_partText", "_pointDamage", "_severity", "_total", "_totalIvVolume", "_triageStatus", "_type"]; + params ["_target", ["_show", true], ["_selectionN", 0]]; GVAR(currentSelectedSelectionN) = [0, _selectionN] select (IS_SCALAR(_selectionN)); @@ -42,20 +42,20 @@ if (_show) then { if (ACE_player distance _target > MAX_DISTANCE) exitwith { ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; [_idPFH] call CBA_fnc_removePerFrameHandler; - ["displayTextStructured", [ACE_player], [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [[LSTRING(DistanceToFar), [_target] call EFUNC(common,getName)], 1.75, ACE_player], [ACE_player]] call CBA_fnc_targetEvent; }; disableSerialization; - _display = uiNamespace getVariable QGVAR(DisplayInformation); + private _display = uiNamespace getVariable QGVAR(DisplayInformation); if (isnil "_display") exitwith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; - _allInjuryTexts = []; - _genericMessages = []; + private _allInjuryTexts = []; + private _genericMessages = []; if (GVAR(level) >= 2 && {([_unit] call FUNC(hasMedicalEnabled))}) then { - _partText = [LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm) ,LSTRING(RightArm) ,LSTRING(LeftLeg), LSTRING(RightLeg)] select _selectionN; + private _partText = [LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm) ,LSTRING(RightArm) ,LSTRING(LeftLeg), LSTRING(RightLeg)] select _selectionN; _genericMessages pushback [localize _partText, [1, 1, 1, 1]]; }; @@ -73,10 +73,9 @@ if (_show) then { _genericMessages pushback [localize LSTRING(Status_Pain), [1, 1, 1, 1]]; }; - _totalIvVolume = 0; + private _totalIvVolume = 0; { - private "_value"; - _value = _target getVariable _x; + private _value = _target getVariable _x; if !(isnil "_value") then { _totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]); }; @@ -85,16 +84,15 @@ if (_show) then { _genericMessages pushback [format[localize LSTRING(receivingIvVolume), floor _totalIvVolume], [1, 1, 1, 1]]; }; - _damaged = [false, false, false, false, false, false]; - _selectionBloodLoss = [0,0,0,0,0,0]; + private _damaged = [false, false, false, false, false, false]; + private _selectionBloodLoss = [0,0,0,0,0,0]; if (GVAR(level) >= 2 && {([_target] call FUNC(hasMedicalEnabled))}) then { - _openWounds = _target getVariable [QGVAR(openWounds), []]; - private "_amountOf"; + private _openWounds = _target getVariable [QGVAR(openWounds), []]; { _x params ["", "_x1", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding if (_amountOf > 0) then { - _damaged set[_selectionX, true]; + _damaged set [_selectionX, true]; _selectionBloodLoss set [_selectionX, (_selectionBloodLoss select _selectionX) + (20 * (_x4 * _amountOf))]; if (_selectionN == _selectionX) then { @@ -110,7 +108,7 @@ if (_show) then { }; } foreach _openWounds; - _bandagedwounds = _target getVariable [QGVAR(bandagedWounds), []]; + private _bandagedwounds = _target getVariable [QGVAR(bandagedWounds), []]; { _x params ["", "", "_selectionX", "_amountOf", "_x4"]; // Find how much this bodypart is bleeding @@ -131,18 +129,18 @@ if (_show) then { }; } foreach _bandagedwounds; } else { - _damaged = [true, true, true, true, true, true]; + private _damaged = [true, true, true, true, true, true]; { private _hitPoint = [_target, _x, true] call FUNC(translateSelections); _selectionBloodLoss set [_forEachIndex, _target getHitPointDamage _hitPoint]; if (_target getHitPointDamage _hitPoint > 0 && {_forEachIndex == _selectionN}) then { - _pointDamage = _target getHitPointDamage _hitPoint; - _severity = switch (true) do { + private _pointDamage = _target getHitPointDamage _hitPoint; + private _severity = switch (true) do { case (_pointDamage > 0.5): {localize LSTRING(HeavilyWounded)}; case (_pointDamage > 0.1): {localize LSTRING(LightlyWounded)}; default {localize LSTRING(VeryLightlyWounded)}; }; - _part = localize ([ + private _part = localize ([ LSTRING(Head), LSTRING(Torso), LSTRING(LeftArm), @@ -157,14 +155,13 @@ if (_show) then { // Handle the body image coloring - _availableSelections = [50,51,52,53,54,55]; + private _availableSelections = [50,51,52,53,54,55]; { - private ["_red", "_green", "_blue", "_total"]; - _total = _x; + private _total = _x; + private _red = 1; + private _green = 1; + private _blue = 1; - _red = 1; - _green = 1; - _blue = 1; if (_total > 0) then { if (_damaged select _forEachIndex) then { _green = (0.9 - _total) max 0; @@ -178,7 +175,7 @@ if (_show) then { (_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0]; } foreach _selectionBloodLoss; - _lbCtrl = (_display displayCtrl 200); + private _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; { _x params ["_add", "_color"]; @@ -186,7 +183,7 @@ if (_show) then { _lbCtrl lbSetColor [_foreachIndex, _color]; } foreach _genericMessages; - _amountOfGeneric = count _genericMessages; + private _amountOfGeneric = count _genericMessages; { _x params ["_add", "_color"]; _lbCtrl lbAdd _add; @@ -196,13 +193,11 @@ if (_show) then { _lbCtrl lbAdd (localize LSTRING(NoInjuriesBodypart)); }; - _logCtrl = (_display displayCtrl 302); + private _logCtrl = (_display displayCtrl 302); lbClear _logCtrl; - private ["_logs", "_message", "_moment", "_arguments", "_lbCtrl"]; - _logs = _target getVariable [QGVAR(logFile_Activity), []]; + private _logs = _target getVariable [QGVAR(logFile_Activity), []]; { - // [_message,_moment,_type, _arguments] _x params ["_message", "_moment", "_type", "_arguments"]; if (isLocalized _message) then { _message = localize _message; @@ -217,7 +212,7 @@ if (_show) then { _logCtrl lbAdd format["%1 %2", _moment, _message]; } foreach _logs; - _triageStatus = [_target] call FUNC(getTriageStatus); + private _triageStatus = [_target] call FUNC(getTriageStatus); (_display displayCtrl 303) ctrlSetText (_triageStatus select 0); (_display displayCtrl 303) ctrlSetBackgroundColor (_triageStatus select 2); diff --git a/addons/medical/functions/fnc_displayTriageCard.sqf b/addons/medical/functions/fnc_displayTriageCard.sqf index 47af145055..1633853214 100644 --- a/addons/medical/functions/fnc_displayTriageCard.sqf +++ b/addons/medical/functions/fnc_displayTriageCard.sqf @@ -14,7 +14,6 @@ #include "script_component.hpp" -private ["_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"]; params ["_target", ["_show", true]]; GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull}; @@ -24,7 +23,6 @@ if (_show) then { createDialog QGVAR(triageCard); [{ - private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"]; params ["_args", "_idPFH"]; _args params ["_target"]; if (GVAR(TriageCardTarget) != _target) exitWith { @@ -32,21 +30,21 @@ if (_show) then { }; disableSerialization; - _display = uiNamespace getVariable QGVAR(triageCard); + private _display = uiNamespace getVariable QGVAR(triageCard); if (isNil "_display") exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; - _triageCardTexts = []; + private _triageCardTexts = []; // TODO fill the lb with the appropiate information for the patient - _lbCtrl = (_display displayCtrl 200); + private _lbCtrl = (_display displayCtrl 200); lbClear _lbCtrl; - _log = _target getVariable [QGVAR(triageCard), []]; + private _log = _target getVariable [QGVAR(triageCard), []]; { _x params ["_item", "_amount"]; - _message = _item; + private _message = _item; if (isClass(configFile >> "CfgWeapons" >> _item)) then { _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); } else { @@ -64,8 +62,7 @@ if (_show) then { _lbCtrl lbAdd _x; } forEach _triageCardTexts; - _triageStatus = [_target] call FUNC(getTriageStatus); - + private _triageStatus = [_target] call FUNC(getTriageStatus); _triageStatus params ["_text", "", "_color"]; (_display displayCtrl 2000) ctrlSetText _text; diff --git a/addons/medical/functions/fnc_dropDownTriageCard.sqf b/addons/medical/functions/fnc_dropDownTriageCard.sqf index e7a4d3c0a9..c499283446 100644 --- a/addons/medical/functions/fnc_dropDownTriageCard.sqf +++ b/addons/medical/functions/fnc_dropDownTriageCard.sqf @@ -13,20 +13,19 @@ #include "script_component.hpp" -private ["_ctrl", "_display", "_idc", "_pos"]; params ["_show"]; -disableSerialization; -_display = uiNamespace getVariable QGVAR(triageCard); +disableSerialization; +private _display = uiNamespace getVariable QGVAR(triageCard); if (isNil "_display") exitWith {}; -_pos = [0,0,0,0]; +private _pos = [0,0,0,0]; if (_show) then { _pos = ctrlPosition (_display displayCtrl 2001); }; for "_idc" from 2002 to 2006 step 1 do { _pos set [1, (_pos select 1) + (_pos select 3)]; - _ctrl = (_display displayCtrl _idc); + private _ctrl = (_display displayCtrl _idc); _ctrl ctrlSetPosition _pos; _ctrl ctrlCommit 0; }; diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index 3fdc4f9d52..63908eecc7 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -20,14 +20,12 @@ // Value is taken because with cardic output and resistance at default values, it will put blood pressure Low at 80. #define MODIFIER_BP_LOW 0.1524 -private ["_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; - params ["_unit"]; -_cardiacOutput = [_unit] call FUNC(getCardiacOutput); -_resistance = _unit getVariable [QGVAR(peripheralResistance), 100]; +private _cardiacOutput = [_unit] call FUNC(getCardiacOutput); +private _resistance = _unit getVariable [QGVAR(peripheralResistance), 100]; -_bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; -_bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; +private _bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; +private _bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; [_bloodPressureLow max 0, _bloodPressureHigh max 0] diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 1737bb3b98..04051e54b2 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -28,24 +28,26 @@ */ #define BLOOD_CHANGE_PER_SECOND 0.0595 +#define EMPTY_IV_BAG_VALUE 0 +#define IV_VOLUME (_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) + IV_CHANGE_PER_SECOND + private ["_bloodVolume", "_bloodVolumeChange", "_ivVolume"]; params ["_unit"]; -_bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; -_bloodVolumeChange = -([_unit] call FUNC(getBloodLoss)); +private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; +private _bloodVolumeChange = -([_unit] call FUNC(getBloodLoss)); -if (_bloodVolume < 100.0) then { +if (_bloodVolume < 100) then { { - if ((_unit getVariable [_x, 0]) > 0) then { + if ((_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) > EMPTY_IV_BAG_VALUE) then { _bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND; - _ivVolume = (_unit getVariable [_x, 0]) + IV_CHANGE_PER_SECOND; - _unit setVariable [_x,_ivVolume]; + _unit setVariable [_x, IV_VOLUME]; }; } forEach GVAR(IVBags); } else { { - if ((_unit getVariable [_x, 0]) > 0) then { - _unit setVariable [_x, 0]; // lets get rid of exessive IV volume + if ((_unit getVariable [_x, EMPTY_IV_BAG_VALUE]) > EMPTY_IV_BAG_VALUE) then { + _unit setVariable [_x, EMPTY_IV_BAG_VALUE]; // lets get rid of exessive IV volume }; } forEach GVAR(IVBags); }; diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index d07319e8b5..74da98012b 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -14,7 +14,7 @@ #include "script_component.hpp" /* - Cardiac output (Q or or CO ) is the volume of blood being pumped by the heart, in particular by a left or right ventricle in the ACE_time interval of one minute. CO may be measured in many ways, for example dm3/min (1 dm3 equals 1 litre). + Cardiac output (Q or or CO ) is the volume of blood being pumped by the heart, in particular by a left or right ventricle in the CBA_missionTime interval of one minute. CO may be measured in many ways, for example dm3/min (1 dm3 equals 1 litre). Source: http://en.wikipedia.org/wiki/Cardiac_output */ diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index 3ba4b7875f..4f0b19f80c 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -15,22 +15,21 @@ #define HEART_RATE_MODIFIER 0.02 -private ["_heartRate", "_hrIncrease", "_bloodLoss", "_time", "_values", "_adjustment", "_change", "_callBack", "_bloodVolume"]; params ["_unit"]; -_hrIncrease = 0; +private _hrIncrease = 0; if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then { - _heartRate = _unit getVariable [QGVAR(heartRate), 80]; - _bloodLoss = [_unit] call FUNC(getBloodLoss); + private _heartRate = _unit getVariable [QGVAR(heartRate), 80]; + private _bloodLoss = [_unit] call FUNC(getBloodLoss); - _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; + private _adjustment = _unit getVariable [QGVAR(heartRateAdjustments), []]; { _x params ["_values", "_time", "_callBack"]; if (abs _values > 0) then { if (_time <= 0) then { _time = 1; }; - _change = (_values / _time); + private _change = (_values / _time); _hrIncrease = _hrIncrease + _change; if ( (_time - 1) <= 0) then { @@ -45,15 +44,15 @@ if (!(_unit getVariable [QGVAR(inCardiacArrest),false])) then { _adjustment set [_forEachIndex, ObjNull]; [_unit] call _callBack; }; - } forEach _adjustment; + _adjustment = _adjustment - [ObjNull]; _unit setVariable [QGVAR(heartRateAdjustments), _adjustment]; - _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; + private _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; if (_bloodVolume > 75) then { - if (_bloodLoss >0.0) then { - if (_bloodLoss <0.5) then { + if (_bloodLoss > 0.0) then { + if (_bloodLoss < 0.5) then { if (_heartRate < 126) then { _hrIncrease = _hrIncrease + 0.05; }; diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index cf8cc86c22..ad366b5ab2 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -13,14 +13,13 @@ #include "script_component.hpp" -private ["_unit","_return"]; params ["_unit"]; if (isnil QGVAR(unconsciousConditions)) then { GVAR(unconsciousConditions) = []; }; -_return = false; +private _return = false; { if ((_x isEqualType {}) && {([_unit] call _x)}) exitwith { _return = true; diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf index 84ffa01258..f2a5a45af2 100644 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical/functions/fnc_handleBandageOpening.sqf @@ -21,16 +21,16 @@ private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"]; -_classID = _injury select 1; -_className = GVAR(woundClassNames) select _classID; +private _classID = _injury select 1; +private _className = GVAR(woundClassNames) select _classID; // default, just in case.. -_reopeningChance = 0.1; -_reopeningMinDelay = 120; -_reopeningMaxDelay = 200; +private _reopeningChance = 0.1; +private _reopeningMinDelay = 120; +private _reopeningMaxDelay = 200; // Get the default values for the used bandage -_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); +private _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); if (isClass (_config >> _bandage)) then { _config = (_config >> _bandage); _reopeningChance = getNumber (_config >> "reopeningChance"); @@ -41,7 +41,7 @@ if (isClass (_config >> _bandage)) then { }; if (isClass (_config >> _className)) then { - _woundTreatmentConfig = (_config >> _className); + private _woundTreatmentConfig = (_config >> _className); if (isNumber (_woundTreatmentConfig >> "reopeningChance")) then { _reopeningChance = getNumber (_woundTreatmentConfig >> "reopeningChance"); }; @@ -56,10 +56,10 @@ if (isClass (_config >> _className)) then { }; TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reopeningMaxDelay); -_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; -_injuryType = _injury select 1; -_exist = false; -_bandagedInjury = []; +private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; +private _injuryType = _injury select 1; +private _exist = false; +private _bandagedInjury = []; { if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith { _exist = true; @@ -85,19 +85,18 @@ if (random(1) <= _reopeningChance) then { _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); TRACE_1("Will open",_delay); [{ - private ["_bandage", "_openWounds", "_selectedInjury","_bandagedWounds","_exist"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; TRACE_5("params",_target,_impact,_part,_injuryIndex,_injury); //if (alive _target) then { - _openWounds = _target getVariable [QGVAR(openWounds), []]; - if ((count _openWounds)-1 < _injuryIndex) exitwith {}; - _selectedInjury = _openWounds select _injuryIndex; + private _openWounds = _target getVariable [QGVAR(openWounds), []]; + if ((count _openWounds) - 1 < _injuryIndex) exitwith {}; + private _selectedInjury = _openWounds select _injuryIndex; if (_selectedInjury select 1 == _injury select 1 && (_selectedInjury select 2) == (_injury select 2)) then { // matching the IDs - _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; - _exist = false; - _injuryId = _injury select 1; + private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []]; + private _exist = false; + private _injuryId = _injury select 1; { if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith { _exist = true; @@ -117,5 +116,5 @@ if (random(1) <= _reopeningChance) then { }; // Otherwise something went wrong, we we don't reopen them.. //}; - }, [_target, _impact, _part, _injuryIndex, +_injury], _delay] call EFUNC(common,waitAndExecute); + }, [_target, _impact, _part, _injuryIndex, +_injury], _delay] call CBA_fnc_waitAndExecute; }; diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index 971342affb..b67d2107b0 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -1,50 +1,50 @@ -/* - * Author: Glowbal - * handle Litter Create - * - * Arguments: - * 0: Litter Class - * 1: Position - * 2: Unit - * - * Return Value: - * None - * - * Public: No - */ -#include "script_component.hpp" - -if(!hasInterface) exitWith { false }; - -params ["_litterClass", "_position", "_direction"]; -private["_litterObject", "_maxLitterCount"]; -//IGNORE_PRIVATE_WARNING(_values); - -if (isNil QGVAR(allCreatedLitter)) then { - GVAR(allCreatedLitter) = []; - GVAR(litterPFHRunning) = false; -}; - -_litterObject = _litterClass createVehicleLocal _position; -_litterObject setDir _direction; -_litterObject setPosATL _position; -// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112 -[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call EFUNC(common,execNextFrame); - -_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); -if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { - // gank the first litter object, and spawn ours. - private["_oldLitter"]; - _oldLitter = GVAR(allCreatedLitter) deleteAt 0; - { - deleteVehicle _x; - } forEach (_oldLitter select 1); -}; - -GVAR(allCreatedLitter) pushBack [ACE_time, [_litterObject]]; - -if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { - // Start the litter cleanup loop - GVAR(litterPFHRunning) = true; - call FUNC(litterCleanupLoop); -}; +/* + * Author: Glowbal + * handle Litter Create + * + * Arguments: + * 0: Litter Class + * 1: Position + * 2: Unit + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if(!hasInterface) exitWith { false }; + +params ["_litterClass", "_position", "_direction"]; +private["_litterObject", "_maxLitterCount"]; +//IGNORE_PRIVATE_WARNING(_values); + +if (isNil QGVAR(allCreatedLitter)) then { + GVAR(allCreatedLitter) = []; + GVAR(litterPFHRunning) = false; +}; + +_litterObject = _litterClass createVehicleLocal _position; +_litterObject setDir _direction; +_litterObject setPosATL _position; +// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112 +[{ params ["_object", "_pos"]; _object setPosATL _pos; }, [_litterObject, _position]] call CBA_fnc_execNextFrame; + +_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail); +if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then { + // gank the first litter object, and spawn ours. + private["_oldLitter"]; + _oldLitter = GVAR(allCreatedLitter) deleteAt 0; + { + deleteVehicle _x; + } forEach (_oldLitter select 1); +}; + +GVAR(allCreatedLitter) pushBack [CBA_missionTime, [_litterObject]]; + +if(!GVAR(litterPFHRunning) && {GVAR(litterCleanUpDelay) > 0}) then { + // Start the litter cleanup loop + GVAR(litterPFHRunning) = true; + call FUNC(litterCleanupLoop); +}; diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index b46ffcf1ad..4cf237e949 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -120,11 +120,11 @@ if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitW if (_delayedUnconsicous) then { [{ [_this select 0, true] call FUNC(setUnconscious); - }, [_unit], 0.7] call EFUNC(common,waitAndExecute); + }, [_unit], 0.7] call CBA_fnc_waitAndExecute; } else { [{ [_this select 0, true] call FUNC(setUnconscious); - }, [_unit]] call EFUNC(common,execNextFrame); + }, [_unit]] call CBA_fnc_execNextFrame; }; 0.89; }; diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 33b1d3f7ee..068162a55b 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -8,8 +8,12 @@ * 2: Amount Of Damage * 3: Shooter * 4: Projectile - * 5: Current damage to be returned - * 6: Type of Damage + * 5: Hit part index of the hit point + * 6: Current damage to be returned + * + * //On 1.63 dev: + * 6: Shooter? + * 7: Current damage to be returned * * Return Value: * None @@ -19,20 +23,24 @@ #include "script_component.hpp" -private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"]; params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"]; -_part = [_selectionName] call FUNC(selectionNameToNumber); +//Temp fix for 1.63 handleDamage changes +if (_newDamage isEqualType objNull) then { + _newDamage = _this select 7; +}; + +private _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitWith {}; -_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; +private _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; // Sorting out the damage -_damageBodyParts = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +private _damageBodyParts = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; _damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; _unit setVariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; -_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); +private _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); [_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_assignWounds); diff --git a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index e42e6be725..b18604f133 100644 --- a/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -17,10 +17,8 @@ params ["_unit"]; if (!local _unit) exitWith {}; -private "_bodyStatus"; - // ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"] -_bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +private _bodyStatus = _unit getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; _bodyStatus params ["_headDamage", "_torsoDamage", "_handsDamageR", "_handsDamageL", "_legsDamageR", "_legsDamageL"]; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 04dceff84d..0d4e9292a8 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -12,13 +12,12 @@ #include "script_component.hpp" -private ["_damageBodyParts", "_cache_params", "_cache_damages"]; params ["_target"]; TRACE_1("ACE_DEBUG: HandleDamage_BASIC Called",_target); -_damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; -_cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []]; -_cache_damages = _target getVariable QGVAR(cachedDamages); +private _damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +private _cache_params = _target getVariable [QGVAR(cachedHandleDamageParams), []]; +private _cache_damages = _target getVariable QGVAR(cachedDamages); TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_cache_damages); diff --git a/addons/medical/functions/fnc_handleLocal.sqf b/addons/medical/functions/fnc_handleLocal.sqf index 270a993b43..42e8a9b7b2 100644 --- a/addons/medical/functions/fnc_handleLocal.sqf +++ b/addons/medical/functions/fnc_handleLocal.sqf @@ -25,7 +25,7 @@ if (_local) then { if ((_unit getVariable ["ACE_isUnconscious",false]) && {count (_unit getVariable [QGVAR(unconsciousArguments), []]) >= 6}) then { private "_arguments"; _arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]); - _arguments set [2, ACE_time]; + _arguments set [2, CBA_missionTime]; [DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 23272f0890..8cbc38e63a 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -13,18 +13,17 @@ #include "script_component.hpp" -private ["_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues", "_airwayStatus", "_blood"]; params ["_unit", "_interval"]; TRACE_3("ACE_DEBUG",_unit,_interval,_unit); if (_interval == 0) exitWith {}; -_lastTimeValuesSynced = _unit getVariable [QGVAR(lastMomentValuesSynced), 0]; -_syncValues = (ACE_time - _lastTimeValuesSynced >= (10 + floor(random(10))) && GVAR(keepLocalSettingsSynced)); +private _lastTimeValuesSynced = _unit getVariable [QGVAR(lastMomentValuesSynced), 0]; +private _syncValues = (CBA_missionTime - _lastTimeValuesSynced >= (10 + floor(random(10))) && GVAR(keepLocalSettingsSynced)); if (_syncValues) then { - _unit setVariable [QGVAR(lastMomentValuesSynced), ACE_time]; + _unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime]; }; -_bloodVolume = (_unit getVariable [QGVAR(bloodVolume), 100]) + ([_unit] call FUNC(getBloodVolumeChange)); +private _bloodVolume = (_unit getVariable [QGVAR(bloodVolume), 100]) + ([_unit] call FUNC(getBloodVolumeChange)); _bloodVolume = _bloodVolume max 0; _unit setVariable [QGVAR(bloodVolume), _bloodVolume, _syncValues]; @@ -61,7 +60,7 @@ if (([_unit] call FUNC(getBloodLoss)) > 0) then { }; }; -_painStatus = _unit getVariable [QGVAR(pain), 0]; +private _painStatus = _unit getVariable [QGVAR(pain), 0]; TRACE_4("ACE_DEBUG",_painStatus,_unit getVariable QGVAR(hasPain),_unit getVariable QGVAR(painSuppress),_unit); if (_painStatus > (_unit getVariable [QGVAR(painSuppress), 0])) then { if !(_unit getVariable [QGVAR(hasPain), false]) then { @@ -86,11 +85,10 @@ if (GVAR(level) == 1) then { }; // bleeding - _blood = _unit getVariable [QGVAR(bloodVolume), 100]; - if (_blood <= 35 and !(_unit getVariable ["ACE_isUnconscious", false])) then { + if (_bloodVolume <= 35 and !(_unit getVariable ["ACE_isUnconscious", false])) then { [_unit, true] call FUNC(setUnconscious); }; - if (_blood == 0) then { + if (_bloodVolume == 0) then { [_unit] call FUNC(setDead); }; }; @@ -116,13 +114,13 @@ if (GVAR(level) >= 2) then { _painStatus = _painStatus + (count _oldTourniquets) * 0.001 * _interval; // Set the vitals - _heartRate = (_unit getVariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); + private _heartRate = (_unit getVariable [QGVAR(heartRate), 80]) + (([_unit] call FUNC(getHeartRateChange)) * _interval); _unit setVariable [QGVAR(heartRate), _heartRate max 0, _syncValues]; - _bloodPressure = [_unit] call FUNC(getBloodPressure); + private _bloodPressure = [_unit] call FUNC(getBloodPressure); _unit setVariable [QGVAR(bloodPressure), _bloodPressure, _syncValues]; - _painReduce = if (_painStatus > 5) then {0.002} else {0.001}; + _painReduce = [0.001, 0.002] select (_painStatus > 5); // @todo: replace this and the rest of the setVariable with EFUNC(common,setApproximateVariablePublic) _unit setVariable [QGVAR(pain), (_painStatus - _painReduce * _interval) max 0, _syncValues]; @@ -131,7 +129,7 @@ if (GVAR(level) >= 2) then { // TODO Disabled until implemented fully // Handle airway /*if (GVAR(setting_allowAirwayInjuries)) then { - _airwayStatus = _unit getVariable [QGVAR(airwayStatus), 100]; + private _airwayStatus = _unit getVariable [QGVAR(airwayStatus), 100]; if (((_unit getVariable [QGVAR(airwayOccluded), false]) || (_unit getVariable [QGVAR(airwayCollapsed), false])) && !((_unit getVariable [QGVAR(airwaySecured), false]))) then { if (_airwayStatus >= 0.5) then { _unit setVariable [QGVAR(airwayStatus), _airwayStatus - 0.5 * _interval, _syncValues]; @@ -160,26 +158,15 @@ if (GVAR(level) >= 2) then { [_unit, true, 10+ random(20)] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already. }; - if (_bloodPressureH > 260) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_bloodPressureL < 40 && _heartRate > 190) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_bloodPressureH > 145 && _heartRate > 150) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_heartRate > 200) then { - [_unit] call FUNC(setCardiacArrest); - }; + if ((_bloodPressureH > 260) + || {_bloodPressureL < 40 && ({_heartRate > 190})} + || {(_bloodPressureH > 145 && {_heartRate > 150})}) then { - if (_heartRate < 20) then { + if (random(1) > 0.7) then { + [_unit] call FUNC(setCardiacArrest); + }; + }; + if (_heartRate > 200 || (_heartRate < 20)) then { [_unit] call FUNC(setCardiacArrest); }; }; diff --git a/addons/medical/functions/fnc_hasItem.sqf b/addons/medical/functions/fnc_hasItem.sqf index 3eb2f1e5f0..cebe02e6c6 100644 --- a/addons/medical/functions/fnc_hasItem.sqf +++ b/addons/medical/functions/fnc_hasItem.sqf @@ -15,7 +15,6 @@ #include "script_component.hpp" -private ["_medic", "_patient", "_item", "_return", "_crew"]; params ["_medic", "_patient", "_item"]; if (isNil QGVAR(setting_allowSharedEquipment)) then { @@ -29,9 +28,9 @@ if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { true }; -_return = false; +private _return = false; if ((vehicle _medic != _medic) && {[vehicle _medic] call FUNC(isMedicalVehicle)}) then { - _crew = crew vehicle _medic; + private _crew = crew vehicle _medic; { if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { _return = true; diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf index 7937b6a157..d3e79c0a54 100644 --- a/addons/medical/functions/fnc_hasItems.sqf +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -15,10 +15,9 @@ #include "script_component.hpp" -private ["_medic", "_patient", "_items", "_return"]; params ["_medic", "_patient", "_items"]; -_return = true; +private _return = true; { // if (_x isEqualType [] && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { diff --git a/addons/medical/functions/fnc_hasMedicalEnabled.sqf b/addons/medical/functions/fnc_hasMedicalEnabled.sqf index 5e2d73f925..5cc5b60aa3 100644 --- a/addons/medical/functions/fnc_hasMedicalEnabled.sqf +++ b/addons/medical/functions/fnc_hasMedicalEnabled.sqf @@ -16,10 +16,9 @@ */ #include "script_component.hpp" -private "_medicalEnabled"; params ["_unit"]; -_medicalEnabled = _unit getVariable QGVAR(enableMedical); +private _medicalEnabled = _unit getVariable QGVAR(enableMedical); if (isNil "_medicalEnabled") exitWith { (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getVariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1) || GVAR(level) == 1) }; diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index 868b07fbf4..504135c204 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -86,4 +86,4 @@ _unit setVariable [QGVAR(allLogs), [], true]; // items [{ _this call FUNC(itemCheck); -}, [_unit], 0.5, 0.1] call EFUNC(common,waitAndExecute); +}, [_unit], 0.5, 0.1] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_isInMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf index f934978d2b..313ee8eca4 100644 --- a/addons/medical/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -19,7 +19,7 @@ params ["_unit"]; //Cache the results as this function could be called rapidly (_unit getVariable [QGVAR(cacheInFacility), [-9, false]]) params ["_expireTime", "_lastResult"]; -if (ACE_time < _expireTime) exitWith {_lastResult}; +if (CBA_missionTime < _expireTime) exitWith {_lastResult}; private _eyePos = eyePos _unit; private _isInBuilding = false; @@ -58,6 +58,6 @@ if (!_isInBuilding) then { }; //Save the results (with a 1 second expiry) -_unit setVariable [QGVAR(cacheInFacility), [ACE_time + 1, _isInBuilding]]; +_unit setVariable [QGVAR(cacheInFacility), [CBA_missionTime + 1, _isInBuilding]]; _isInBuilding; diff --git a/addons/medical/functions/fnc_litterCleanupLoop.sqf b/addons/medical/functions/fnc_litterCleanupLoop.sqf index ac102d5d59..00e301be6e 100644 --- a/addons/medical/functions/fnc_litterCleanupLoop.sqf +++ b/addons/medical/functions/fnc_litterCleanupLoop.sqf @@ -15,7 +15,7 @@ { _x params ["_time", "_objects"]; - if (ACE_time - _time >= GVAR(litterCleanUpDelay)) then { + if (CBA_missionTime - _time >= GVAR(litterCleanUpDelay)) then { { deleteVehicle _x; } forEach _objects; @@ -30,4 +30,4 @@ if ( (count GVAR(allCreatedLitter)) == 0) exitWith { }; // Schedule the loop to be executed again 30 sec later -[DFUNC(litterCleanupLoop), [], 30] call EFUNC(common,waitAndExecute); +[DFUNC(litterCleanupLoop), [], 30] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_medicationEffectLoop.sqf b/addons/medical/functions/fnc_medicationEffectLoop.sqf index 6d89675d8a..00ef00a82c 100644 --- a/addons/medical/functions/fnc_medicationEffectLoop.sqf +++ b/addons/medical/functions/fnc_medicationEffectLoop.sqf @@ -39,4 +39,4 @@ _amountDecreased = _amountDecreased + _decreaseRate; if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _unit) exitWith {}; // Schedule the loop to be executed again 1 sec later -[DFUNC(medicationEffectLoop), [_unit, _variableName, _amountDecreased, _decreaseRate, _viscosityAdjustmentRate, _painReduceRate], 1] call EFUNC(common,waitAndExecute); +[DFUNC(medicationEffectLoop), [_unit, _variableName, _amountDecreased, _decreaseRate, _viscosityAdjustmentRate, _painReduceRate], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_modifyMedicalAction.sqf b/addons/medical/functions/fnc_modifyMedicalAction.sqf index 02e5985297..8c8e64d465 100644 --- a/addons/medical/functions/fnc_modifyMedicalAction.sqf +++ b/addons/medical/functions/fnc_modifyMedicalAction.sqf @@ -20,22 +20,20 @@ params ["_target", "_player", "_selectionN", "_actionData"]; if (GVAR(level) < 2 || {!([_target] call FUNC(hasMedicalEnabled))}) exitWith { - private ["_pointDamage"]; - _pointDamage = (_target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; + private _pointDamage = (_target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]) select _selectionN; if (_pointDamage >= 0.8) exitWith { - _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; + _actionData set [2, QPATHTOF(UI\icons\medical_crossRed.paa)]; }; if (_pointDamage > 0) exitWith { - _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossYellow.paa))]; + _actionData set [2, QPATHTOF(UI\icons\medical_crossYellow.paa)]; }; }; -private ["_openWounds", "_amountOf"]; -_openWounds = _target getVariable [QGVAR(openWounds), []]; +private _openWounds = _target getVariable [QGVAR(openWounds), []]; { _x params ["", "", "_selectionX", "_amountOf", "_x4"]; if (_amountOf > 0 && {(_selectionN == _selectionX)} && {_x4 > 0}) exitWith { - _actionData set [2, QUOTE(PATHTOF(UI\icons\medical_crossRed.paa))]; + _actionData set [2, QPATHTOF(UI\icons\medical_crossRed.paa)]; }; } forEach _openWounds; diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 28b1d4dd0b..019abd094c 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -18,12 +18,11 @@ #include "script_component.hpp" -private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce); -_foundEntry = false; -_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; +private _foundEntry = false; +private _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { _x params ["_variableX", "_allMedsFromClassname"]; if (_variableX== _variable) exitWith { @@ -43,12 +42,12 @@ if (!_foundEntry) then { }; -_usedMeds = _target getVariable [_variable, 0]; +private _usedMeds = _target getVariable [_variable, 0]; if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVAR(enableOverdosing)) then { [_target] call FUNC(setDead); }; -_hasOverDosed = 0; +private _hasOverDosed = 0; { _x params ["_med", "_limit"]; { @@ -60,8 +59,8 @@ _hasOverDosed = 0; } forEach _incompatabileMeds; if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { - _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); - _onOverDose = getText (_medicationConfig >> "onOverDose"); + private _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); + private _onOverDose = getText (_medicationConfig >> "onOverDose"); if (isClass (_medicationConfig >> _className)) then { _medicationConfig = (_medicationConfig >> _className); if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; @@ -74,8 +73,8 @@ if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { [_target, _className] call _onOverDose; }; -_decreaseAmount = 1 / _timeInSystem; -_viscosityAdjustment = _viscosityChange / _timeInSystem; +private _decreaseAmount = 1 / _timeInSystem; +private _viscosityAdjustment = _viscosityChange / _timeInSystem; // Run the loop that computes the effect of the medication over time [_target, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] call FUNC(medicationEffectLoop); diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf index dff59fb2cf..e0a28dfd18 100644 --- a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -19,6 +19,6 @@ params ["_unit", "_originOfrequest"]; if (local _unit && !(local _originOfrequest)) then { _openWounds = _unit getVariable [QGVAR(openWounds), []]; { - ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); + ["ace_medical_propagateWound", [_unit, _x], [_originOfrequest]] call CBA_fnc_targetEvent; } forEach _openWounds; }; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index 6dae7ab276..2e5ec2ab5f 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -16,7 +16,6 @@ #include "script_component.hpp" -private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"]; params ["_unit", "_pain"]; if (!local _unit || !GVAR(enableScreams)) exitWith{}; @@ -27,7 +26,7 @@ _unit setVariable [QGVAR(playingInjuredSound),true]; // Play the sound if there is any damage present. if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { // Classnames of the available sounds. - _availableSounds_A = [ + private _availableSounds_A = [ "WoundedGuyA_01", "WoundedGuyA_02", "WoundedGuyA_03", @@ -37,7 +36,7 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { "WoundedGuyA_07", "WoundedGuyA_08" ]; - _availableSounds_B = [ + private _availableSounds_B = [ "WoundedGuyB_01", "WoundedGuyB_02", "WoundedGuyB_03", @@ -47,14 +46,14 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { "WoundedGuyB_07", "WoundedGuyB_08" ]; - _availableSounds_C = [ + private _availableSounds_C = [ "WoundedGuyC_01", "WoundedGuyC_02", "WoundedGuyC_03", "WoundedGuyC_04", "WoundedGuyC_05" ]; - _sound = ""; + private _sound = ""; // Select the to be played sound based upon damage amount. if (_pain > 0.5) then { @@ -70,14 +69,13 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters. // Figure out what the delay will be before it is possible to play a sound again. - private "_delay"; - _delay = (30 - (random(25) * _pain)) max (3.5 + random(2)); + private _delay = (30 - (random(25) * _pain)) max (3.5 + random(2)); // Clean up the lock [{ - (_this select 0) setVariable [QGVAR(playingInjuredSound),nil]; - }, [_unit], _delay, _delay] call EFUNC(common,waitAndExecute); + (_this select 0) setVariable [QGVAR(playingInjuredSound), nil]; + }, [_unit], _delay, _delay] call CBA_fnc_waitAndExecute; }; // Clean up in case there has not been played any sounds. -_unit setVariable [QGVAR(playingInjuredSound),nil]; +_unit setVariable [QGVAR(playingInjuredSound), nil]; diff --git a/addons/medical/functions/fnc_requestWoundSync.sqf b/addons/medical/functions/fnc_requestWoundSync.sqf index 1d7d6de53f..9f72c0b322 100644 --- a/addons/medical/functions/fnc_requestWoundSync.sqf +++ b/addons/medical/functions/fnc_requestWoundSync.sqf @@ -19,4 +19,4 @@ params [ "_target", "_caller"]; if (local _target || GVAR(level) < 2) exitWith {}; // if the target is local, we already got the most update to date information if (_target getVariable [QGVAR(isWoundSynced), false]) exitWith {}; _target setVariable [QGVAR(isWoundSynced), true]; -["medical_woundUpdateRequest", [_target], [_target, _caller]] call EFUNC(common,targetEvent); +["ace_medical_woundUpdateRequest", [_target, _caller], [_target]] call CBA_fnc_targetEvent; diff --git a/addons/medical/functions/fnc_reviveStateLoop.sqf b/addons/medical/functions/fnc_reviveStateLoop.sqf index 77a48c9340..bfc55ae6d8 100644 --- a/addons/medical/functions/fnc_reviveStateLoop.sqf +++ b/addons/medical/functions/fnc_reviveStateLoop.sqf @@ -35,7 +35,7 @@ if ((alive _unit) && {(vehicle _unit) != _unit} && {!alive (vehicle _unit)}) the }; // If the timer run out, let the unit die and exit the loop -if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith { +if (GVAR(maxReviveTime) > 0 && {CBA_missionTime - _startTime > GVAR(maxReviveTime)}) exitwith { _unit setVariable [QGVAR(inReviveState), nil, true]; _unit setVariable [QGVAR(reviveStartTime), nil]; [_unit, true] call FUNC(setDead); @@ -53,4 +53,4 @@ if !(_unit getVariable [QGVAR(inReviveState), false]) exitwith { }; // Schedule the loop to be executed again 1 sec later -[DFUNC(reviveStateLoop), [_unit], 1] call EFUNC(common,waitAndExecute); +[DFUNC(reviveStateLoop), [_unit], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_serverRemoveBody.sqf b/addons/medical/functions/fnc_serverRemoveBody.sqf index 311199b1b8..42e755f003 100644 --- a/addons/medical/functions/fnc_serverRemoveBody.sqf +++ b/addons/medical/functions/fnc_serverRemoveBody.sqf @@ -21,7 +21,7 @@ params ["_target"]; TRACE_2("",_target,isPlayer _target); //Hide the body globaly -["hideObjectGlobal", [_target, true]] call EFUNC(common,serverEvent); +[QEGVAR(common,hideObjectGlobal), [_target, true]] call CBA_fnc_serverEvent; if (isNil QGVAR(bodiesToDelete)) then {GVAR(bodiesToDelete) = [];}; GVAR(bodiesToDelete) pushBack _target; diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index bf4a679bdc..f41dda8591 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -21,7 +21,7 @@ if (_unit getVariable [QGVAR(inCardiacArrest),false]) exitWith {}; _unit setVariable [QGVAR(inCardiacArrest), true,true]; _unit setVariable [QGVAR(heartRate), 0]; -["Medical_onEnteredCardiacArrest", [_unit]] call EFUNC(common,localEvent); +["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent; [_unit, true] call FUNC(setUnconscious); _timeInCardiacArrest = 120 + round(random(600)); @@ -35,9 +35,9 @@ _timeInCardiacArrest = 120 + round(random(600)); [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setVariable [QGVAR(inCardiacArrest), nil,true]; }; - if (ACE_time - _startTime >= _timeInCardiacArrest) exitWith { + if (CBA_missionTime - _startTime >= _timeInCardiacArrest) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; _unit setVariable [QGVAR(inCardiacArrest), nil,true]; [_unit] call FUNC(setDead); }; -}, 1, [_unit, ACE_time, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler; +}, 1, [_unit, CBA_missionTime, _timeInCardiacArrest] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index 061a28c081..0e5fd884f4 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -20,7 +20,7 @@ params ["_unit", ["_force", false], ["_delaySetDamage", false]]; if ((!alive _unit) || {_unit getVariable ["ACE_isDead", false]}) exitWith {true}; if (!local _unit) exitwith { - ["setDead", _unit, [_unit, _force]] call EFUNC(common,targetEvent); + [QGVAR(setDead), [_unit, _force], _unit] call CBA_fnc_targetEvent; false; }; @@ -38,7 +38,7 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal == }; _unit setVariable [QGVAR(inReviveState), true, true]; - _unit setVariable [QGVAR(reviveStartTime), ACE_time]; + _unit setVariable [QGVAR(reviveStartTime), CBA_missionTime]; [_unit, true] call FUNC(setUnconscious); // Run the loop that tracks the revive state @@ -51,7 +51,7 @@ if (isPLayer _unit) then { _unit setVariable ["isDeadPlayer", true, true]; }; -["medical_onSetDead", [_unit]] call EFUNC(common,localEvent); +["ace_killed", [_unit]] call CBA_fnc_localEvent; //Delay a frame before killing the unit via scripted damage //to avoid triggering the "Killed" Event twice (and having the wrong killer) @@ -59,7 +59,7 @@ if (isPLayer _unit) then { if (!_delaySetDamage) then { [_unit, 1] call FUNC(setStructuralDamage); } else { - [FUNC(setStructuralDamage), [_unit, 1]] call EFUNC(common,execNextFrame); + [FUNC(setStructuralDamage), [_unit, 1]] call CBA_fnc_execNextFrame; }; true; diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf index 9abce575cd..b1dfe59d29 100644 --- a/addons/medical/functions/fnc_setHitPointDamage.sqf +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -26,7 +26,7 @@ params ["_unit", "_selection", "_damage", ["_disabled", false]]; // Unit isn't local, give function to machine where it is. if !(local _unit) exitWith { - ["setHitPointDamage", _unit, _this] call EFUNC(common,targetEvent); + [QGVAR(setHitPointDamage), _this, _unit] call CBA_fnc_targetEvent; }; // Check if overall damage adjustment is disabled diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 25bc8aacb5..41c02dd553 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -39,7 +39,7 @@ if !(_set) exitWith { if !(!(isNull _unit) && {(_unit isKindOf "CAManBase") && ([_unit] call EFUNC(common,isAwake))}) exitWith{}; if (!local _unit) exitWith { - ["setUnconscious", _unit, [_unit, _set, _minWaitingTime, _force]] call EFUNC(common,targetEvent); + [QGVAR(setUnconscious), [_unit, _set, _minWaitingTime, _force], _unit] call CBA_fnc_targetEvent; }; _unit setVariable ["ACE_isUnconscious", true, true]; @@ -96,14 +96,14 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then { }; // Delay Unconscious so the AI dont instant stop shooting on the unit #3121 if (GVAR(delayUnconCaptive) == 0) then { - [_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set); + [_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set); } else { [{ params ["_unit"]; if (_unit getVariable ["ACE_isUnconscious", false]) then { - [_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set); + [_unit, "setCaptive", "ace_unconscious", true] call EFUNC(common,statusEffect_set); }; - },[_unit], GVAR(delayUnconCaptive)] call EFUNC(common,waitAndExecute); + },[_unit], GVAR(delayUnconCaptive)] call CBA_fnc_waitAndExecute; }; _anim = [_unit] call EFUNC(common,getDeathAnim); @@ -113,13 +113,13 @@ _anim = [_unit] call EFUNC(common,getDeathAnim); if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call EFUNC(common,doAnimation); }; -}, [_unit, _anim], 0.5, 0] call EFUNC(common,waitAndExecute); +}, [_unit, _anim], 0.5, 0] call CBA_fnc_waitAndExecute; -_startingTime = ACE_time; +_startingTime = CBA_missionTime; [DFUNC(unconsciousPFH), 0.1, [_unit, _originalPos, _startingTime, _minWaitingTime, false, vehicle _unit isKindOf "ParachuteBase"] ] call CBA_fnc_addPerFrameHandler; // unconscious can't talk [_unit, "isUnconscious"] call EFUNC(common,muteUnit); -["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent); +["ace_unconscious", [_unit, true]] call CBA_fnc_globalEvent; diff --git a/addons/medical/functions/fnc_showBloodEffect.sqf b/addons/medical/functions/fnc_showBloodEffect.sqf new file mode 100644 index 0000000000..7659064aaa --- /dev/null +++ b/addons/medical/functions/fnc_showBloodEffect.sqf @@ -0,0 +1,158 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Does the blood screen effect, just like BIS_fnc_bloodeffect, but in non-sheduled environment. + * + * Arguments: + * 0: Effect multiplier + * + * Return Value: + * None + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_bloodRemaining"]; + +disableSerialization; + +// get already existing controls, or create them +private ["_fxBloodControls", "_bloodCtrl1", "_bloodCtrl2", "_bloodCtrl3"]; + +_fxBloodControls = GETUVAR(GVAR(FXBloodControls),[]); + +if (count _fxBloodControls != 3) then { + _bloodCtrl1 = findDisplay 46 ctrlCreate ["RscPicture", -1]; + _bloodCtrl2 = findDisplay 46 ctrlCreate ["RscPicture", -1]; + _bloodCtrl3 = findDisplay 46 ctrlCreate ["RscPicture", -1]; + + // set their textures, screen position etc. + _bloodCtrl1 ctrlSetText "A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_lower_ca.paa"; + _bloodCtrl2 ctrlSetText "A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_middle_ca.paa"; + _bloodCtrl3 ctrlSetText "A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_upper_ca.paa"; + + // positions are from config + private "_ctrlPosition"; + _ctrlPosition = [ + ((0 * safezoneW) + safezoneX) + ((safezoneW - (2.125 * safezoneW * 3/4)) / 2), + (-0.0625 * safezoneH) + safezoneY, + 2.125 * safezoneW * 3/4, + 1.125 * safezoneH + ]; + + _bloodCtrl1 ctrlSetPosition _ctrlPosition; + _bloodCtrl2 ctrlSetPosition _ctrlPosition; + _bloodCtrl3 ctrlSetPosition _ctrlPosition; + + _fxBloodControls = [_bloodCtrl1, _bloodCtrl2, _bloodCtrl3]; + SETUVAR(GVAR(FXBloodControls),_fxBloodControls); +} else { + _bloodCtrl1 = _fxBloodControls select 0; + _bloodCtrl2 = _fxBloodControls select 1; + _bloodCtrl3 = _fxBloodControls select 2; +}; + +// reset everything +_bloodCtrl1 ctrlSetFade 1; +_bloodCtrl2 ctrlSetFade 1; +_bloodCtrl3 ctrlSetFade 1; + +_bloodCtrl1 ctrlCommit 0; +_bloodCtrl2 ctrlCommit 0; +_bloodCtrl3 ctrlCommit 0; + +if (_bloodRemaining < 5) exitWith { + // nothing +}; + +if (_bloodRemaining < 25) exitWith { + _bloodCtrl1 ctrlSetFade 0.2; + _bloodCtrl1 ctrlCommit 0.2; + + [{ + (_this select 0) ctrlSetFade 1; + (_this select 0) ctrlCommit 0.8; + }, _fxBloodControls, 0.7] call CBA_fnc_waitAndExecute; +}; + +if (_bloodRemaining < 40) exitWith { + _bloodCtrl1 ctrlSetFade 0.2; + _bloodCtrl2 ctrlSetFade 0.85; + _bloodCtrl1 ctrlCommit 0.2; + _bloodCtrl2 ctrlCommit 0.2; + + [{ + (_this select 0) ctrlSetFade 1; + (_this select 1) ctrlSetFade 1; + (_this select 1) ctrlCommit 1; + }, _fxBloodControls, 0.7] call CBA_fnc_waitAndExecute; + + [{ + (_this select 0) ctrlCommit 0.8; + }, _fxBloodControls, 1.2] call CBA_fnc_waitAndExecute; +}; + +if (_bloodRemaining < 55) exitWith { + _bloodCtrl1 ctrlSetFade 0.2; + _bloodCtrl2 ctrlSetFade 0.7; + _bloodCtrl1 ctrlCommit 0.2; + _bloodCtrl2 ctrlCommit 0.2; + + [{ + (_this select 0) ctrlSetFade 1; + (_this select 1) ctrlSetFade 1; + (_this select 2) ctrlSetFade 1; + (_this select 1) ctrlCommit 1; + }, _fxBloodControls, 0.7] call CBA_fnc_waitAndExecute; + + [{ + (_this select 0) ctrlCommit 0.8; + }, _fxBloodControls, 1.2] call CBA_fnc_waitAndExecute; +}; + +if (_bloodRemaining < 70) exitWith { + _bloodCtrl1 ctrlSetFade 0.2; + _bloodCtrl2 ctrlSetFade 0.7; + _bloodCtrl3 ctrlSetFade 0.85; + _bloodCtrl1 ctrlCommit 0.2; + _bloodCtrl2 ctrlCommit 0.2; + _bloodCtrl3 ctrlCommit 0.2; + + [{ + (_this select 0) ctrlSetFade 1; + (_this select 1) ctrlSetFade 1; + (_this select 2) ctrlSetFade 1; + (_this select 2) ctrlCommit 1.5; + }, _fxBloodControls, 0.7] call CBA_fnc_waitAndExecute; + + [{ + (_this select 1) ctrlCommit 1; + }, _fxBloodControls, 1.7] call CBA_fnc_waitAndExecute; + + [{ + (_this select 0) ctrlCommit 0.8; + }, _fxBloodControls, 2.2] call CBA_fnc_waitAndExecute; +}; + +//default +_bloodCtrl1 ctrlSetFade 0.2; +_bloodCtrl2 ctrlSetFade 0.7; +_bloodCtrl3 ctrlSetFade 0.7; +_bloodCtrl1 ctrlCommit 0.2; +_bloodCtrl2 ctrlCommit 0.2; +_bloodCtrl3 ctrlCommit 0.2; + +[{ + (_this select 0) ctrlSetFade 1; + (_this select 1) ctrlSetFade 1; + (_this select 2) ctrlSetFade 1; + (_this select 2) ctrlCommit 1.5; +}, _fxBloodControls, 0.7] call CBA_fnc_waitAndExecute; + +[{ + (_this select 1) ctrlCommit 1; +}, _fxBloodControls, 1.7] call CBA_fnc_waitAndExecute; + +[{ + (_this select 0) ctrlCommit 0.8; +}, _fxBloodControls, 2.2] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf index d7f80edc35..453d074f98 100644 --- a/addons/medical/functions/fnc_treatment.sqf +++ b/addons/medical/functions/fnc_treatment.sqf @@ -16,28 +16,26 @@ #include "script_component.hpp" -private ["_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"]; params ["_caller", "_target", "_selectionName", "_className"]; // If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { - [{ - _this call FUNC(treatment); - }, _this] call EFUNC(common,execNextFrame); + [DFUNC(treatment), _this] call CBA_fnc_execNextFrame; }; if !(_target isKindOf "CAManBase") exitWith {false}; -_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); }; + if !(isClass _config) exitwith {false}; // Allow self treatment check if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; -_medicRequired = if (isNumber (_config >> "requiredMedic")) then { +private _medicRequired = if (isNumber (_config >> "requiredMedic")) then { getNumber (_config >> "requiredMedic"); } else { // Check for required class @@ -49,16 +47,16 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then { if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; -_allowedSelections = getArray (_config >> "allowedSelections"); +private _allowedSelections = getArray (_config >> "allowedSelections"); if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; // Check item -_items = getArray (_config >> "items"); +private _items = getArray (_config >> "items"); if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; -_return = true; +private _return = true; if (isText (_config >> "Condition")) then { - _condition = getText(_config >> "condition"); + private _condition = getText(_config >> "condition"); if (_condition != "") then { if (isnil _condition) then { _condition = compile _condition; @@ -74,7 +72,7 @@ if (isText (_config >> "Condition")) then { }; if (!_return) exitwith {false}; -_patientStateCondition = if (isText(_config >> "patientStateCondition")) then { +private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] } else { getNumber(_config >> "patientStateCondition") @@ -82,22 +80,20 @@ _patientStateCondition = if (isText(_config >> "patientStateCondition")) then { if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; // Check allowed locations -_locations = getArray (_config >> "treatmentLocations"); +private _locations = getArray (_config >> "treatmentLocations"); if ("All" in _locations) then { _return = true; } else { - private [ "_medFacility", "_medVeh"]; - _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; - _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; + private _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; + private _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))}; { if (_x == "field") exitwith {_return = true;}; if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; if !(isnil _x) exitwith { - private "_val"; - _val = missionNamespace getVariable _x; + private _val = missionNamespace getVariable _x; if (_val isEqualType 0) then { _return = switch (_val) do { case 0: {true}; //AdvancedMedicalSettings_anywhere @@ -113,8 +109,8 @@ if ("All" in _locations) then { if !(_return) exitwith {false}; -_usersOfItems = []; -_consumeItems = if (isNumber (_config >> "itemConsumed")) then { +private _usersOfItems = []; +private _consumeItems = if (isNumber (_config >> "itemConsumed")) then { getNumber (_config >> "itemConsumed"); } else { // Check for required class @@ -128,7 +124,7 @@ if (_consumeItems > 0) then { }; // Parse the config for the progress callback -_callbackProgress = getText (_config >> "callbackProgress"); +private _callbackProgress = getText (_config >> "callbackProgress"); if (_callbackProgress == "") then { _callbackProgress = "true"; }; @@ -139,7 +135,7 @@ if (isNil _callbackProgress) then { }; // Patient Animation -_patientAnim = getText (_config >> "animationPatient"); +private _patientAnim = getText (_config >> "animationPatient"); if (_target getVariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then { if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then { _patientAnim = getText (_config >> "animationPatientUnconscious"); @@ -155,7 +151,7 @@ if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) }; // Player Animation -_callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); +private _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); if (_caller == _target) then { _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); }; @@ -167,8 +163,8 @@ if (currentWeapon _caller == secondaryWeapon _caller) then { _caller selectWeapon (primaryWeapon _caller); }; -_wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller))); -_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; +private _wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller))); +private _callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; if (vehicle _caller == _caller && {_callerAnim != ""}) then { if (primaryWeapon _caller == "") then { _caller addWeapon "ACE_FakePrimaryWeapon"; @@ -195,11 +191,11 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then { }; //Get treatment time -_treatmentTime = if (isNumber (_config >> "treatmentTime")) then { +private _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { getNumber (_config >> "treatmentTime"); } else { if (isText (_config >> "treatmentTime")) exitwith { - _treatmentTimeConfig = getText(_config >> "treatmentTime"); + private _treatmentTimeConfig = getText(_config >> "treatmentTime"); if (isnil _treatmentTimeConfig) then { _treatmentTimeConfig = compile _treatmentTimeConfig; } else { @@ -225,13 +221,13 @@ _treatmentTime = if (isNumber (_config >> "treatmentTime")) then { ] call EFUNC(common,progressBar); // Display Icon -_iconDisplayed = getText (_config >> "actionIconPath"); +private _iconDisplayed = getText (_config >> "actionIconPath"); if (_iconDisplayed != "") then { [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); }; // handle display of text/hints -_displayText = ""; +private _displayText = ""; if (_target != _caller) then { _displayText = getText(_config >> "displayTextOther"); } else { @@ -239,7 +235,7 @@ if (_target != _caller) then { }; if (_displayText != "") then { - ["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf index 7d34a278f1..0ce1f7d4d9 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -22,9 +22,9 @@ if (alive _target && {(_target getVariable [QGVAR(inCardiacArrest), false] || _t [_target, "activity_view", LSTRING(Activity_cpr), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); if (local _target) then { - ["treatmentAdvanced_CPRLocal", [_caller, _target]] call EFUNC(common,localEvent); + [QGVAR(treatmentAdvanced_CPRLocal), [_caller, _target]] call CBA_fnc_localEvent; } else { - ["treatmentAdvanced_CPRLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent); + [QGVAR(treatmentAdvanced_CPRLocal), [_caller, _target], _target] call CBA_fnc_targetEvent; }; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index 07431ac66d..fbc7aac601 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -14,13 +14,12 @@ #include "script_component.hpp" -private "_reviveStartTime"; params ["_caller","_target"]; if (_target getVariable [QGVAR(inReviveState), false]) then { - _reviveStartTime = _target getVariable [QGVAR(reviveStartTime),0]; + private _reviveStartTime = _target getVariable [QGVAR(reviveStartTime),0]; if (_reviveStartTime > 0) then { - _target setVariable [QGVAR(reviveStartTime), (_reviveStartTime + random(20)) min ACE_time]; + _target setVariable [QGVAR(reviveStartTime), (_reviveStartTime + random(20)) min CBA_missionTime]; }; }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index 98881e1a28..e3b94700d2 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -17,6 +17,7 @@ */ #include "script_component.hpp" + params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]]; [_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); @@ -27,9 +28,9 @@ if !([_target] call FUNC(hasMedicalEnabled)) exitWith { }; if (local _target) then { - ["treatmentAdvanced_bandageLocal", [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,localEvent); + [QGVAR(treatmentAdvanced_bandageLocal), [_target, _className, _selectionName, _specificSpot]] call CBA_fnc_localEvent; } else { - ["treatmentAdvanced_bandageLocal", _target, [_target, _className, _selectionName, _specificSpot]] call EFUNC(common,targetEvent); + [QGVAR(treatmentAdvanced_bandageLocal), [_target, _className, _selectionName, _specificSpot], _target] call CBA_fnc_targetEvent; }; /* { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf index 5cfe73ab8d..39ebc6878c 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -15,44 +15,43 @@ #include "script_component.hpp" -private ["_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectiveness", "_mostEffectiveInjury", "_impact", "_exit", "_classID", "_effectivenessFound", "_className", "_hitPoints", "_hitSelections", "_point", "_woundTreatmentConfig"]; params ["_target", "_bandage", "_selectionName", ["_specificClass", -1]]; // Ensure it is a valid bodypart -_part = [_selectionName] call FUNC(selectionNameToNumber); +private _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitWith {false}; // Get the open wounds for this unit -_openWounds = _target getVariable [QGVAR(openWounds), []]; +private _openWounds = _target getVariable [QGVAR(openWounds), []]; if (count _openWounds == 0) exitWith {false}; // nothing to do here! // Get the default effectiveness for the used bandage -_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); -_effectiveness = getNumber (_config >> "effectiveness"); +private _config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); +private _effectiveness = getNumber (_config >> "effectiveness"); if (isClass (_config >> _bandage)) then { _config = (_config >> _bandage); if (isNumber (_config >> "effectiveness")) then { _effectiveness = getNumber (_config >> "effectiveness");}; }; // Figure out which injury for this bodypart is the best choice to bandage -_mostEffectiveSpot = 0; -_effectivenessFound = -1; -_mostEffectiveInjury = _openWounds select 0; -_exit = false; +private _mostEffectiveSpot = 0; +private _effectivenessFound = -1; +private _mostEffectiveInjury = _openWounds select 0; +private _exit = false; { _x params ["", "_classID", "_partX"]; TRACE_2("OPENWOUND: ", _target, _x); // Only parse injuries that are for the selected bodypart. if (_partX == _part) then { - _woundEffectiveness = _effectiveness; + private _woundEffectiveness = _effectiveness; // Select the classname from the wound classname storage - _className = GVAR(woundClassNames) select _classID; + private _className = GVAR(woundClassNames) select _classID; // Check if this wound type has attributes specified for the used bandage if (isClass (_config >> _className)) then { // Collect the effectiveness from the used bandage for this wound type - _woundTreatmentConfig = (_config >> _className); + private _woundTreatmentConfig = (_config >> _className); if (isNumber (_woundTreatmentConfig >> "effectiveness")) then { _woundEffectiveness = getNumber (_woundTreatmentConfig >> "effectiveness"); }; @@ -83,14 +82,14 @@ if (_effectivenessFound == -1) exitWith {}; // Seems everything is patched up on // TODO refactor this part // Find the impact this bandage has and reduce the amount this injury is present -_impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) }; +private _impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) }; _mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _impact) max 0]; _openWounds set [_mostEffectiveSpot, _mostEffectiveInjury]; _target setVariable [QGVAR(openWounds), _openWounds, !USE_WOUND_EVENT_SYNC]; if (USE_WOUND_EVENT_SYNC) then { - ["medical_propagateWound", [_target, _mostEffectiveInjury]] call EFUNC(common,globalEvent); + ["ace_medical_propagateWound", [_target, _mostEffectiveInjury]] call CBA_fnc_globalEvent; }; // Handle the reopening of bandaged wounds if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { @@ -102,16 +101,14 @@ if (_impact > 0 && {GVAR(enableAdvancedWounds)}) then { // Arma combines left and right arms into a single body part (HitHands), same with left and right legs (HitLegs). // Arms are actually hands. if (GVAR(healHitPointAfterAdvBandage)) then { - private["_currentWounds", "_headWounds", "_bodyWounds", "_legsWounds", "_armWounds"]; - // Get the list of the wounds the target is currently suffering from. - _currentWounds = _target getVariable [QGVAR(openWounds), []]; + private _currentWounds = _target getVariable [QGVAR(openWounds), []]; // Tally of unbandaged wounds to each body part. - _headWounds = 0; - _bodyWounds = 0; - _legsWounds = 0; - _armWounds = 0; + private _headWounds = 0; + private _bodyWounds = 0; + private _legsWounds = 0; + private _armWounds = 0; // Loop through all current wounds and add up the number of unbandaged wounds on each body part. { @@ -120,7 +117,7 @@ if (GVAR(healHitPointAfterAdvBandage)) then { // Use switch/case for early termination if wounded limb is found before all six are checked. // Number of wounds multiplied by blood loss will return zero for a fully // bandaged body part, not incrementing the wound counter; or it will return - // some other number which will increment the wound counter. + // some other number which will increment the wound counter. switch (_bodyPart) do { // Head case 0: { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf index a5332df107..18bd0468d2 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf @@ -13,9 +13,9 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; if (local _target) then { - ["treatmentAdvanced_fullHealLocal", [_caller, _target]] call EFUNC(common,localEvent); + [QGVAR(treatmentAdvanced_fullHealLocal), [_caller, _target]] call CBA_fnc_localEvent; } else { - ["treatmentAdvanced_fullHealLocal", _target, [_caller, _target]] call EFUNC(common,targetEvent); + [QGVAR(treatmentAdvanced_fullHealLocal), [_caller, _target], _target] call CBA_fnc_targetEvent; }; true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index 1bb3f23b15..df6eefe3cd 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -10,7 +10,6 @@ #include "script_component.hpp" -private "_allUsedMedication"; params ["_caller", "_target"]; if (alive _target) exitWith { @@ -60,7 +59,7 @@ if (alive _target) exitWith { _target setVariable [QGVAR(painSuppress), 0, true]; // medication - _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; + private _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; { _target setVariable [_x select 0, nil]; } forEach _allUsedMedication; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf index a0539948ea..b2b222e601 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealTreatmentTime.sqf @@ -15,9 +15,7 @@ */ #include "script_component.hpp" -private "_totalDamage"; - -_totalDamage = 0; +private _totalDamage = 0; { _totalDamage = _totalDamage + _x; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 185853b677..ceb788f571 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -22,7 +22,7 @@ TRACE_5("params",_caller,_target,_selectionName,_className,_items); private _part = [_selectionName] call FUNC(selectionNameToNumber); -["treatmentAdvanced_medicationLocal", [_target], [_target, _className, _part]] call EFUNC(common,targetEvent); +[QGVAR(treatmentAdvanced_medicationLocal), [_target, _className, _part], [_target]] call CBA_fnc_targetEvent; { if (_x != "") then { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index 85f8485f6b..46a8b9c2a8 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -15,8 +15,6 @@ #include "script_component.hpp" -private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; - params ["_target", "_className", "_partNumber"]; TRACE_3("params",_target,_className,_partNumber); @@ -30,23 +28,22 @@ if ((_tourniquets select _partNumber) > 0) exitWith { }; // We have added a new dose of this medication to our system, so let's increase it -_varName = format[QGVAR(%1_inSystem), _className]; -_currentInSystem = _target getVariable [_varName, 0]; -_currentInSystem = _currentInSystem + 1; -_target setVariable [_varName, _currentInSystem]; +private _varName = format[QGVAR(%1_inSystem), _className]; +private _currentInSystem = _target getVariable [_varName, 0]; +_target setVariable [_varName, _currentInSystem + 1]; // Find the proper attributes for the used medication -_medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); -_painReduce = getNumber (_medicationConfig >> "painReduce"); -_hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); -_hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); -_hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); -_timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); -_maxDose = getNumber (_medicationConfig >> "maxDose"); -_viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); -_hrCallback = getText (_medicationConfig >> "hrCallback"); +private _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); +private _painReduce = getNumber (_medicationConfig >> "painReduce"); +private _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); +private _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); +private _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); +private _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); +private _maxDose = getNumber (_medicationConfig >> "maxDose"); +private _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); +private _hrCallback = getText (_medicationConfig >> "hrCallback"); -_inCompatableMedication = []; +private _inCompatableMedication = []; if (isClass (_medicationConfig >> _className)) then { _medicationConfig = (_medicationConfig >> _className); if (isNumber (_medicationConfig >> "painReduce")) then { _painReduce = getNumber (_medicationConfig >> "painReduce");}; @@ -67,7 +64,7 @@ if (isNil _hrCallback) then { if (!(_hrCallback isEqualType {})) then {_hrCallback = {TRACE_1("callback was NOT code",_hrCallback)};}; // Adjust the heart rate based upon config entry -_heartRate = _target getVariable [QGVAR(heartRate), 70]; +private _heartRate = _target getVariable [QGVAR(heartRate), 70]; if (alive _target) then { if (_heartRate > 0) then { if (_heartRate <= 45) then { @@ -84,7 +81,7 @@ if (alive _target) then { if (_painReduce > 0) then { // Reduce pain - _painSuppress = _target getVariable [QGVAR(painSuppress), 0]; + private _painSuppress = _target getVariable [QGVAR(painSuppress), 0]; _target setVariable [QGVAR(painSuppress), (_painSuppress + _painReduce) max 0]; if (!GVAR(painIsOnlySuppressed)) then { _pain = _target getVariable [QGVAR(pain), 0]; @@ -92,9 +89,8 @@ if (_painReduce > 0) then { }; }; -_resistance = _target getVariable [QGVAR(peripheralResistance), 100]; -_resistance = _resistance + _viscosityChange; -_target setVariable [QGVAR(peripheralResistance), _resistance max 0]; +private _resistance = _target getVariable [QGVAR(peripheralResistance), 100]; +_target setVariable [QGVAR(peripheralResistance), (_resistance + _viscosityChange) max 0]; // Call back to ensure that the medication is decreased over time [_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange, _painReduce] call FUNC(onMedicationUsage); diff --git a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf index 3e04ad3bd8..c0411c09e4 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf @@ -21,7 +21,7 @@ private ["_hitSelections", "_hitPoints", "_point", "_damage"]; params ["_caller", "_target", "_selection", "_className"]; if (local _target) then { - ["treatmentBasic_bandageLocal", [_target, _selection]] call EFUNC(common,localEvent); + [QGVAR(treatmentBasic_bandageLocal), [_target, _selection]] call CBA_fnc_localEvent; } else { - ["treatmentBasic_bandageLocal", _target, [_target, _selection]] call EFUNC(common,targetEvent); + [QGVAR(treatmentBasic_bandageLocal), [_target, _selection], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf index 73b40f8a9b..f8c11a7484 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bandageLocal.sqf @@ -18,14 +18,14 @@ params ["_target", "_selectionName"]; -_damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +private _damageBodyParts = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; // Ensure it is a valid bodypart -_part = [_selectionName] call FUNC(selectionNameToNumber); +private _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part < 0) exitwith {false}; if ((_damageBodyParts select _part) > 0) then { - _damageOnPart = (_damageBodyParts select _part); + private _damageOnPart = (_damageBodyParts select _part); // Temp quick fix to change in behaviour of basic medical bandaging if (_damageOnPart - BANDAGEHEAL > 0) then { _damageOnPart = _damageOnPart - (_damageOnPart * BANDAGEHEAL); diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf index f28b634038..6989ac14b8 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -19,7 +19,7 @@ params ["_caller", "_target", "_treatmentClassname"]; if (local _target) then { - ["treatmentBasic_bloodbagLocal", [_target, _treatmentClassname]] call EFUNC(common,localEvent); + [QGVAR(treatmentBasic_bloodbagLocal), [_target, _treatmentClassname]] call CBA_fnc_localEvent; } else { - ["treatmentBasic_bloodbagLocal", _target, [_target, _treatmentClassname]] call EFUNC(common,targetEvent); + [QGVAR(treatmentBasic_bloodbagLocal), [_target, _treatmentClassname], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf index 64ba6e031b..cb4dcf032c 100644 --- a/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbagLocal.sqf @@ -17,13 +17,11 @@ params ["_target", "_treatmentClassname"]; -private ["_blood", "_bloodAdded"]; - -_bloodAdded = switch (true) do { +private _bloodAdded = switch (true) do { case (_treatmentClassname == "BloodIV_250"): {0.25 * BLOODBAGHEAL}; case (_treatmentClassname == "BloodIV_500"): {0.5 * BLOODBAGHEAL}; default {BLOODBAGHEAL}; }; -_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + _bloodAdded) min 100; +private _blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + _bloodAdded) min 100; _target setVariable [QGVAR(bloodVolume), _blood, true]; diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf index d2f7de45a9..f704a67042 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -20,7 +20,7 @@ params ["_caller", "_target"]; if (local _target) then { - ["treatmentBasic_morphineLocal", [_target]] call EFUNC(common,localEvent); + [QGVAR(treatmentBasic_morphineLocal), [_target]] call CBA_fnc_localEvent; } else { - ["treatmentBasic_morphineLocal", _target, [_target]] call EFUNC(common,targetEvent); + [QGVAR(treatmentBasic_morphineLocal), [_target], _target] call CBA_fnc_targetEvent; }; diff --git a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf index 780196819b..bb670c75bd 100644 --- a/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf +++ b/addons/medical/functions/fnc_treatmentBasic_morphineLocal.sqf @@ -15,13 +15,13 @@ #include "script_component.hpp" #define MORPHINEHEAL 0.4 -private ["_morphine", "_pain"]; params ["_target"]; // reduce pain, pain sensitivity -_morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; +private _morphine = ((_target getVariable [QGVAR(morphine), 0]) + MORPHINEHEAL) min 1; _target setVariable [QGVAR(morphine), _morphine, true]; -_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; + +private _pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; _target setVariable [QGVAR(pain), _pain, true]; // @todo overdose diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index 29173fe23b..456c415362 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -23,9 +23,9 @@ if (count _items == 0) exitWith {false}; _removeItem = _items select 0; if (local _target) then { - ["treatmentIVLocal", [_target, _className]] call EFUNC(common,localEvent); + [QGVAR(treatmentIVLocal), [_target, _className]] call CBA_fnc_localEvent; } else { - ["treatmentIVLocal", _target, [_target, _className]] call EFUNC(common,targetEvent); + [QGVAR(treatmentIVLocal), [_target, _className], _target] call CBA_fnc_targetEvent; }; [_target, _removeItem] call FUNC(addToTriageCard); diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf index ef8a83af65..71c6f16b97 100644 --- a/addons/medical/functions/fnc_treatmentIVLocal.sqf +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -15,16 +15,15 @@ #include "script_component.hpp" -private ["_config", "_volumeAdded", "_typeOf", "_varName", "_bloodVolume"]; params ["_target", "_treatmentClassname"]; -_bloodVolume = _target getVariable [QGVAR(bloodVolume), 100]; +private _bloodVolume = _target getVariable [QGVAR(bloodVolume), 100]; if (_bloodVolume >= 100) exitWith {}; // Find the proper attributes for the used IV -_config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); -_volumeAdded = getNumber (_config >> "volume"); -_typeOf = getText (_config >> "type"); +private _config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); +private _volumeAdded = getNumber (_config >> "volume"); +private _typeOf = getText (_config >> "type"); if (isClass (_config >> _treatmentClassname)) then { _config = (_config >> _treatmentClassname); @@ -34,7 +33,7 @@ if (isClass (_config >> _treatmentClassname)) then { ERROR("IV Treatment Classname not found"); }; -_varName = format["ACE_Medical_IVVolume_%1",_typeOf]; +private _varName = format["ACE_Medical_IVVolume_%1",_typeOf]; _target setVariable [_varName, (_target getVariable [_varName, 0]) + _volumeAdded, true]; if !(_varName in GVAR(IVBags)) then { diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index b410a899a4..3fa34a58aa 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -17,38 +17,32 @@ #include "script_component.hpp" -private ["_caller","_target","_part","_selectionName","_removeItem", "_tourniquets", "_items", "_output", "_className"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_className = _this select 3; -_items = _this select 4; +params ["_caller", "_target", "_selectionName", "_className", "_items"]; if (count _items == 0) exitWith {false}; -_part = [_selectionName] call FUNC(selectionNameToNumber); +private _part = [_selectionName] call FUNC(selectionNameToNumber); if (_part == 0 || _part == 1) exitWith { - // ["displayTextStructured", [_caller], ["You cannot apply a CAT on this body part!"]] call EFUNC(common,targetEvent); + // [QEGVAR(common,displayTextStructured), ["You cannot apply a CAT on this body part!"], [_caller]] call CBA_fnc_targetEvent; false; }; -_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; if ((_tourniquets select _part) > 0) exitWith { _output = "There is already a tourniquet on this body part!"; // TODO localization - ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [_output, 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; false; }; -_removeItem = _items select 0; +private _removeItem = _items select 0; if (local _target) then { - ["treatmentTourniquetLocal", [_target, _removeItem, _selectionName]] call EFUNC(common,localEvent); + [QGVAR(treatmentTourniquetLocal), [_target, _removeItem, _selectionName]] call CBA_fnc_localEvent; } else { - ["treatmentTourniquetLocal", _target, [_target, _removeItem, _selectionName]] call EFUNC(common,targetEvent); + [QGVAR(treatmentTourniquetLocal), [_target, _removeItem, _selectionName], _target] call CBA_fnc_targetEvent; }; [_target, _removeItem] call FUNC(addToTriageCard); [_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); [_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message - true diff --git a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf index b8acc27c74..ab24a94a23 100644 --- a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf @@ -13,15 +13,14 @@ */ #include "script_component.hpp" -private ["_tourniquets", "_part", "_applyingTo"]; params ["_target", "_tourniquetItem", "_selectionName"]; //If we're not already tracking vitals, start: [_target] call FUNC(addVitalLoop); -_part = [_selectionName] call FUNC(selectionNameToNumber); +private _part = [_selectionName] call FUNC(selectionNameToNumber); // Place a tourniquet on the bodypart -_tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; _tourniquets set [_part, CBA_missionTime]; _target setVariable [QGVAR(tourniquets), _tourniquets, true]; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf index 826443a154..d81c576feb 100644 --- a/addons/medical/functions/fnc_treatment_failure.sqf +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -17,7 +17,6 @@ #include "script_component.hpp" -private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; params ["_args"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; @@ -25,7 +24,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; + private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); switch (toLower _lastAnim) do { @@ -40,7 +39,7 @@ if (vehicle _caller == _caller) then { }; _caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); +private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { for "_index" from 0 to 99 do { _caller action ["SwitchWeapon", _caller, _caller, _index]; @@ -58,12 +57,12 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") } forEach _usersOfItems; // Record specific callback -_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); }; -_callback = getText (_config >> "callbackFailure"); +private _callback = getText (_config >> "callbackFailure"); _callback = if (isNil _callback) then { compile _callback } else { @@ -72,5 +71,3 @@ _callback = if (isNil _callback) then { if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; _args call _callback; - -// _args call FUNC(createLitter); diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index a9ef534346..4ba3972f5c 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -17,7 +17,6 @@ #include "script_component.hpp" -private ["_config", "_callback", "_weaponSelect", "_lastAnim"]; params ["_args"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; @@ -25,7 +24,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { _caller removeWeapon "ACE_FakePrimaryWeapon"; }; if (vehicle _caller == _caller) then { - _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; + private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; //Don't play another medic animation (when player is rapidily treating) TRACE_2("Reseting to old animation", animationState player, _lastAnim); switch (toLower _lastAnim) do { @@ -40,7 +39,7 @@ if (vehicle _caller == _caller) then { }; _caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; -_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); +private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { for "_index" from 0 to 99 do { _caller action ["SwitchWeapon", _caller, _caller, _index]; @@ -53,12 +52,12 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") }; // Record specific callback -_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); if (GVAR(level) >= 2) then { _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); }; -_callback = getText (_config >> "callbackSuccess"); +private _callback = getText (_config >> "callbackSuccess"); if (isNil _callback) then { _callback = compile _callback; } else { @@ -95,4 +94,4 @@ if (!(_target getVariable [QGVAR(addedToUnitLoop),false])) then { [_target] call FUNC(addVitalLoop); }; -["medical_treatmentSuccess", [_caller, _target, _selectionName, _className]] call EFUNC(common,localEvent); +["ace_treatmentSucceded", [_caller, _target, _selectionName, _className]] call CBA_fnc_localEvent; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index e78c80f3ec..edf2e871fd 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -33,15 +33,15 @@ if (!alive _unit) exitWith { if (GVAR(moveUnitsFromGroupOnUnconscious)) then { [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); }; - [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); + [_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set); [_unit, false] call EFUNC(common,disableAI); //_unit setUnitPos _originalPos; _unit setUnconscious false; [_unit, "isUnconscious"] call EFUNC(common,unmuteUnit); - ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + ["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent; - TRACE_3("ACE_DEBUG_Unconscious_Exit",_unit, (!alive _unit) , QGVAR(unconscious)); + TRACE_3("ACE_DEBUG_Unconscious_Exit",_unit, (!alive _unit) , "ace_unconscious"); [_idPFH] call CBA_fnc_removePerFrameHandler; }; @@ -96,13 +96,13 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith { }; _unit setVariable [QGVAR(vehicleAwakeAnim), nil]; - ["medical_onUnconscious", [_unit, false]] call EFUNC(common,globalEvent); + ["ace_unconscious", [_unit, false]] call CBA_fnc_globalEvent; // EXIT PFH [_idPFH] call CBA_fnc_removePerFrameHandler; }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. - [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); + [_unit, "setCaptive", "ace_unconscious", false] call EFUNC(common,statusEffect_set); // Swhich the unit back to its original group //Unconscious units shouldn't be put in another group #527: @@ -130,13 +130,13 @@ if (_parachuteCheck) then { if (!local _unit) exitWith { TRACE_6("ACE_DEBUG_Unconscious_PFH",_unit, _args, _startingTime, _minWaitingTime, _idPFH, _unit getVariable QGVAR(unconsciousArguments)); - _args set [3, _minWaitingTime - (ACE_time - _startingTime)]; + _args set [3, _minWaitingTime - (CBA_missionTime - _startingTime)]; _unit setVariable [QGVAR(unconsciousArguments), _args, true]; [_idPFH] call CBA_fnc_removePerFrameHandler; }; // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs -if ((ACE_time - _startingTime) >= _minWaitingTime) exitWith { +if ((CBA_missionTime - _startingTime) >= _minWaitingTime) exitWith { TRACE_2("ACE_DEBUG_Unconscious_Temp knock outs",_unit, [_unit] call FUNC(getUnconsciousCondition)); if (!([_unit] call FUNC(getUnconsciousCondition))) then { _unit setVariable ["ACE_isUnconscious", false, true]; diff --git a/addons/medical/functions/fnc_useItem.sqf b/addons/medical/functions/fnc_useItem.sqf index 71b5304c67..63b3f2a696 100644 --- a/addons/medical/functions/fnc_useItem.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -16,7 +16,6 @@ #include "script_component.hpp" -private ["_return","_crew"]; params ["_medic", "_patient", "_item"]; if (isNil QGVAR(setting_allowSharedEquipment)) then { @@ -25,32 +24,32 @@ if (isNil QGVAR(setting_allowSharedEquipment)) then { if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitWith { if (local _patient) then { - ["useItem", [_patient, _item]] call EFUNC(common,localEvent); + ["ace_useItem", [_patient, _item]] call CBA_fnc_localEvent; } else { - ["useItem", _patient, [_patient, _item]] call EFUNC(common,targetEvent); + ["ace_useItem", [_patient, _item], _patient] call CBA_fnc_targetEvent; }; [true, _patient]; }; if ([_medic, _item] call EFUNC(common,hasItem)) exitWith { if (local _medic) then { - ["useItem", [_medic, _item]] call EFUNC(common,localEvent); + ["ace_useItem", [_medic, _item]] call CBA_fnc_localEvent; } else { - ["useItem", _medic, [_medic, _item]] call EFUNC(common,targetEvent); + ["ace_useItem", [_medic, _item], _medic] call CBA_fnc_targetEvent; }; [true, _medic]; }; -_return = [false, objNull]; +private _return = [false, objNull]; if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then { - _crew = crew vehicle _medic; + private _crew = crew vehicle _medic; { if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitWith { _return = [true, _x]; if (local _x) then { - ["useItem", [_x, _item]] call EFUNC(common,localEvent); + ["ace_useItem", [_x, _item]] call CBA_fnc_localEvent; } else { - ["useItem", _x, [_x, _item]] call EFUNC(common,targetEvent); + ["ace_useItem", [_x, _item], _x] call CBA_fnc_targetEvent; }; }; } forEach _crew; diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf index ce45d752a9..aac7b0623a 100644 --- a/addons/medical/functions/fnc_useItems.sqf +++ b/addons/medical/functions/fnc_useItems.sqf @@ -15,22 +15,21 @@ #include "script_component.hpp" -private ["_medic", "_patient", "_items", "_itemUsedInfo", "_itemsUsedBy"]; params ["_medic", "_patient", "_items"]; -_itemsUsedBy = []; +private _itemsUsedBy = []; { // handle a one of type use item if (_x isEqualType []) then { { - _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); + private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; } forEach _x; }; // handle required item if (_x isEqualType "") then { - _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); + private _itemUsedInfo = [_medic, _patient, _x] call FUNC(useItem); if (_itemUsedInfo select 0) exitWith { _itemsUsedBy pushBack [(_itemUsedInfo select 1), _x]}; }; } forEach _items; diff --git a/addons/medical/functions/fnc_vitalLoop.sqf b/addons/medical/functions/fnc_vitalLoop.sqf index c9df4c6e91..6e5bb7fb2b 100644 --- a/addons/medical/functions/fnc_vitalLoop.sqf +++ b/addons/medical/functions/fnc_vitalLoop.sqf @@ -29,7 +29,7 @@ if (!local _unit) exitWith { }; // Handle unit vitals -[_unit, ACE_time - _lastTime] call FUNC(handleUnitVitals); +[_unit, CBA_missionTime - _lastTime] call FUNC(handleUnitVitals); // Play injured sounds private _pain = _unit getVariable [QGVAR(pain), 0]; @@ -45,4 +45,4 @@ if (_pain > (_unit getVariable [QGVAR(painSuppress), 0])) then { }; // Schedule the loop to be executed again 1 sec later -[DFUNC(vitalLoop), [_unit, ACE_time], 1] call EFUNC(common,waitAndExecute); +[DFUNC(vitalLoop), [_unit, CBA_missionTime], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 0af2736f50..bb0db0cd74 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT medical +#define COMPONENT_BEAUTIFIED Medical #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index ef0ccc68a2..811d5cf6e7 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -57,6 +57,7 @@ Injecter de l'adénosine Inietta andenosina Aplikovat adenosine + Injetar Adenosina Inject Atropine @@ -76,7 +77,7 @@ Inyectar Epinefrina Wstrzyknij adrenalinę Aplikovat adrenalin - Injecter de l'épinéphrine + Injecter épinéphrine Ввести адреналин Epinefrin beadása Injetar Epinefrina @@ -89,7 +90,7 @@ Wstrzyknij morfinę Aplikovat morfin Ввести морфин - Injecter de la morphine + Injecter morphine Morfium beadása Injetar Morfina Inietta morfina @@ -101,7 +102,7 @@ Przetocz krew Transfúze krve Перелить кровь - Transfusion + Transfuser du sang Infúzió (vér) Transfundir Sangue Trasfusione di sangue @@ -148,7 +149,7 @@ Venda Bandażuj Obvázat - Pansement + Panser Benda Kötözés Atadura @@ -161,7 +162,7 @@ Bandażuj głowę Obvázat hlavu Перевязать голову - Pansement Tête + Panser Tête Fej kötözése Atar Cabeça Benda la testa @@ -173,7 +174,7 @@ Bandażuj tors Obvázat hruď Перевязать торс - Pansement Torse + Panser Torse Testtörzs kötözése Atar Tronco Benda il torso @@ -185,7 +186,7 @@ Bandażuj lewe ramię Obvázat levou ruku Перевязать левую руку - Pansement Bras Gauche + Panser Bras Gauche Bal kar kötözése Atar Braço Esquerdo Benda il braccio sinistro @@ -197,7 +198,7 @@ Bandażuj prawe ramię Obvázat pravou ruku Перевязать правую руку - Pansement Bras Droit + Panser Bras Droit Jobb kar kötözése Atar Braço Direito Benda il braccio destro @@ -209,7 +210,7 @@ Bandażuj lewą nogę Obvázat levou nohu Перевязать левую ногу - Pansement Jambe Gauche + Panser Jambe Gauche Bal láb kötözése Atar Perna Esquerda Benda la gamba sinistra @@ -221,7 +222,7 @@ Bandażuj prawą nogę Obvázat pravou nohu Перевязать правую ногу - Pansement Jambe Droite + Panser Jambe Droite Jobb láb kötözése Atar Perna Direita Benda la gamba destra @@ -258,6 +259,7 @@ Injection d'adénosine... Inietto l'andenosina Aplikuji adenosine... + Injetando Adenosina... Injecting Atropine... @@ -345,7 +347,7 @@ Field Dressing - Verbandpäckchen + Wundverband Compresa de campaña Бинтовая повязка Obinadlo @@ -789,7 +791,7 @@ Bandage (Basic) - Bandage (Standard) + Bandage (Einfach) Повязка (обычная) Vendaje (Básico) Bandage (Standard) @@ -975,6 +977,7 @@ Auto-injécteur d'adénosine Autoiniettore di adenosina Auto-adenosine + Auto-injetor de Adenosina Used to counter effects of Epinephrine @@ -984,6 +987,7 @@ Utilisé pour contrer les effets de l'adrénaline Usato per contrastare l'effetto dell'epinefrina Slouží jako protiváha Adrenalinu + Usado para combater os efeitos da Epinefrina A drug used to counter the effects of Epinephrine @@ -993,6 +997,7 @@ Un composé utilisé pour contrer les effets de l'adrénaline Medicamento usato per contrastare l'effetto dell'epinefrina Droga používaná k tlumení efektu Adrenalinu + Uma droga usada para combater os efeitos da Epinefrina Atropine autoinjector @@ -1252,7 +1257,7 @@ Vendaje básico (QuickClot) Bandage basique (Hémostatique) Opatrunek QuikClot ACS - Verbandpäckchen (Gerinnungsmittel) + Verbandpäckchen (QuikClot) Általános zárókötszer (QuikClot) Bendaggio emostatico (QuikClot) Bandagem básica (Coagulante) @@ -2906,6 +2911,8 @@ Örtliche Trainingssteigerung Ubicación mejora entrenamiento. Miejsca zwiększają wyszkolenie + Localização melhora treinamento + Locations boost l'entraînement de médecin Boost medic rating in medical vehicles or near medical facilities [untrained becomes medic, medic becomes doctor] @@ -2914,6 +2921,8 @@ Steigert die medizinische Einstufung eines Soldaten in Sanitätsfarhzeugen oder in der Nähe von Sanitätseinrichtungen [untrainiert wird zu Sanitäter, Sanitäter zu Doktor] Mejora el entrenamiento médico dentro de vehículos médicos o cerca de instalaciones médicas (no entrenados se convierten en médicos, médicos se convierten en doctores) Zwiększa poziom wyszkolenia medyków wewnątrz pojazdów medycznych lub w pobliżu budynków medycznych [niedoświadczony zostaje medykiem, medyk zostaje doktorem] + Aumenta a classificação do médico dentro de veículos médicos ou perto de instalações médicas [sem treinamento vira médico, médico vira doutor] + Boost le rang médical dans les véhicules ou bâtiments médicaux [non entraînés deviennent médecins, médecins deviennent docteurs] Disable medics @@ -3211,6 +3220,7 @@ Réglages du système médical basic [ACE] Impostazioni Mediche Di Base [ACE] Základní zdravotnické nastavení [ACE] + Ajustes médicos básicos [ACE] Advanced Medical Settings [ACE] @@ -3328,6 +3338,7 @@ Autoriser l'adrénaline Permette epinefrina Povolit adrenalin + Permitir Epinefrina Who can use Epinephrine for full heal? (Basic medical only) @@ -3337,6 +3348,7 @@ Qui peut utiliser l'adrénaline pour les soins complets ? (Médical basique seulement) Chi può usare l'epinefrina per la cura completa? (solo per sistema medico di base) Kdo může použít adrenalin k úplnému vyléčení? (Pouze základní zdravotní systém) + Quem pode usar Epinefrina para cura completa? (Somente sistema médico básico) Allow PAK @@ -3430,6 +3442,7 @@ Position des adrénalines Ubicazione epinefrina Oblast k použití adrenalinu + Localizações de Epinefrina Where can the Epinephrine be used? (Basic Medical) @@ -3439,6 +3452,7 @@ Où peuvent être utilisées les adrénalines ? (Médical basique) Dove si può usare l'epinefrina? (Sistema medico di base) Kde může být použit adrenalin? (Pouze základní zdravotní systém) + Onde pode-se usar a Epinefrina? (Somente sistema médico básico) Locations PAK @@ -3685,6 +3699,7 @@ Skonfiguruj ustawienia leczenia podstawowego systemu medycznego ACE Configure les réglages de traitement dans ACE médical basique Configura le impostazioni trattamenti per ACE Medical di base + Configura as opções de tratamento do sistema médico básico do ACE Configure the treatment settings from ACE Advanced Medical @@ -4135,6 +4150,7 @@ Entrenamiento médico Entraînement médical Lékařský výcvik + Treino médico Whether or not the object will be a medical vehicle. @@ -4143,12 +4159,15 @@ Legt fest, ob das Objekt ein Sanitätsfahrzeug ist. Es un vehículo médico? Définit si le véhicule est un véhicule médical ou non. + Se o objeto será ou não um veículo médico Delay cease fire of AI while player is unconscious for medical reasons. Verzögert das Ende des KI-Beschusses auf einen Spieler, wenn dieser aus medizinischen Gründen bewustlos wird. Ritarda il cessate il fuoco dell'IA quando il giocatore è svenuto per motivi medici. Prodleva zastavení palby pro AI, pokud je hráč v bezvědomí ze zdravotních důvodů. + Atraso durante cessar fogo da AI durante inconsciência médica + Délai de cessez le feu pour l'IA pendant que le joueur est inconscient pour des raisons médicales Delay cease fire of AI for unconsciousness @@ -4157,6 +4176,8 @@ Opóźnij status captive u nieprzytomnych osób Ritarda il cessate il fuoco dell'IA quando si è svenuti Prodleva zastavení palby AI na bezvědomé + Atraso durante cessar fogo da AI durante inconsciência + Délai de cessez le feu de l'IA pour la perte de conscience \ No newline at end of file diff --git a/addons/medical/ui/CfgInGameUI.hpp b/addons/medical/ui/CfgInGameUI.hpp new file mode 100644 index 0000000000..5a09a11414 --- /dev/null +++ b/addons/medical/ui/CfgInGameUI.hpp @@ -0,0 +1,6 @@ + +class CfgInGameUI { + class PeripheralVision { + bloodTexture = ""; //"A3\ui_f\data\igui\cfg\PeripheralVision\bloodTexture_ca.paa"; + }; +}; diff --git a/addons/medical/ui/RscTitles.hpp b/addons/medical/ui/RscTitles.hpp index 520a431d7b..3f9113a9d2 100644 --- a/addons/medical/ui/RscTitles.hpp +++ b/addons/medical/ui/RscTitles.hpp @@ -19,34 +19,34 @@ class Rsctitles { colorBackground[] = {1,1,1,1}; colorPicture[] = {1,1,1,1}; colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(ui\body_background.paa)); + text = QPATHTOF(ui\body_background.paa); }; class bodyImgHead: bodyImgBackground { idc = 50; colorBackground[] = {1,1,1,1}; colorPicture[] = {1,1,1,1}; colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(ui\body_head.paa)); + text = QPATHTOF(ui\body_head.paa); }; class bodyImgTorso: bodyImgHead { idc = 51; - text = QUOTE(PATHTOF(ui\body_torso.paa)); + text = QPATHTOF(ui\body_torso.paa); }; class bodyImgArms_l: bodyImgHead { idc = 52; - text = QUOTE(PATHTOF(ui\body_arm_left.paa)); + text = QPATHTOF(ui\body_arm_left.paa); }; class bodyImgArms_r: bodyImgHead { idc = 53; - text = QUOTE(PATHTOF(ui\body_arm_right.paa)); + text = QPATHTOF(ui\body_arm_right.paa); }; class bodyImgLegs_l: bodyImgHead { idc = 54; - text = QUOTE(PATHTOF(ui\body_leg_left.paa)); + text = QPATHTOF(ui\body_leg_left.paa); }; class bodyImgLegs_r: bodyImgHead { idc = 55; - text = QUOTE(PATHTOF(ui\body_leg_right.paa)); + text = QPATHTOF(ui\body_leg_right.paa); }; class InjuryListLabel { idc = 199; @@ -110,4 +110,20 @@ class Rsctitles { }; }; }; + + // disables blood texture overlay + class RscHealthTextures { + class controls { + class Flame_1; + class Blood_1: Flame_1 { + text = ""; //"A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_lower_ca.paa"; + }; + class Blood_2: Flame_1 { + text = ""; //"A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_middle_ca.paa"; + }; + class Blood_3: Flame_1 { + text = ""; //"A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_upper_ca.paa"; + }; + }; + }; }; diff --git a/addons/medical/ui/triagecard.hpp b/addons/medical/ui/triagecard.hpp index 1122c2e942..6a5138def8 100644 --- a/addons/medical/ui/triagecard.hpp +++ b/addons/medical/ui/triagecard.hpp @@ -30,11 +30,11 @@ class GVAR(triageCard) { SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {1,1,0,1}; colorBackground[] = {0,0,0,0}; - text = QUOTE(PATHTOF(ui\triage_card_corner_l.paa)); + text = QPATHTOF(ui\triage_card_corner_l.paa); }; class cornor_top_r: cornor_top_l { x = "20 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(ui\triage_card_corner_r.paa)); + text = QPATHTOF(ui\triage_card_corner_r.paa); }; class TriageCardLabel { diff --git a/addons/medical_menu/CfgVehicles.hpp b/addons/medical_menu/CfgVehicles.hpp index d2bbf55fd1..1918511566 100644 --- a/addons/medical_menu/CfgVehicles.hpp +++ b/addons/medical_menu/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class ACE_moduleMedicalMenuSettings: ACE_Module { scope = 2; displayName = CSTRING(module_DisplayName); - icon = QUOTE(PATHTOEF(medical,UI\Icon_Module_Medical_ca.paa)); + icon = QPATHTOEF(medical,UI\Icon_Module_Medical_ca.paa); category = "ACE_medical"; function = QUOTE(DFUNC(module)); functionPriority = 1; @@ -50,7 +50,7 @@ class CfgVehicles { exceptions[] = {"isNotInside"}; condition = QUOTE([ARR_2(ACE_player,_target)] call FUNC(canOpenMenu)); statement = QUOTE([_target] call DFUNC(openMenu)); - icon = PATHTOEF(medical,UI\icons\medical_cross.paa); + icon = QPATHTOEF(medical,UI\icons\medical_cross.paa); }; }; @@ -63,7 +63,7 @@ class CfgVehicles { exceptions[] = {"isNotInside"}; condition = QUOTE([ARR_2(ACE_player,_target)] call FUNC(canOpenMenu)); statement = QUOTE([_target] call DFUNC(openMenu)); - icon = PATHTOEF(medical,UI\icons\medical_cross.paa); + icon = QPATHTOEF(medical,UI\icons\medical_cross.paa); }; }; }; diff --git a/addons/medical_menu/XEH_postInit.sqf b/addons/medical_menu/XEH_postInit.sqf index 92e2af341f..b028a16e75 100644 --- a/addons/medical_menu/XEH_postInit.sqf +++ b/addons/medical_menu/XEH_postInit.sqf @@ -6,16 +6,14 @@ GVAR(MenuPFHID) = -1; GVAR(lastOpenedOn) = -1; GVAR(pendingReopen) = false; -["medical_treatmentSuccess", { - +["ace_treatmentSucceded", { if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then { GVAR(pendingReopen) = false; [{ [GVAR(INTERACTION_TARGET)] call FUNC(openMenu); - }, []] call EFUNC(common,execNextFrame); + }, []] call CBA_fnc_execNextFrame; }; -}] call EFUNC(common,addEventhandler); - +}] call CBA_fnc_addEventHandler; ["ACE3 Common", QGVAR(displayMenuKeyPressed), localize LSTRING(DisplayMenuKey), { @@ -31,10 +29,9 @@ GVAR(pendingReopen) = false; false }, { - if (ACE_time - GVAR(lastOpenedOn) > 0.5) exitWith { + if (CBA_missionTime - GVAR(lastOpenedOn) > 0.5) exitWith { [objNull] call FUNC(openMenu); }; false }, [35, [false, false, false]], false, 0] call CBA_fnc_addKeybind; - diff --git a/addons/medical_menu/config.cpp b/addons/medical_menu/config.cpp index 27e0db03b9..633323c2cf 100644 --- a/addons/medical_menu/config.cpp +++ b/addons/medical_menu/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_medical"}; - author[] = {$STR_ACE_Common_ACETeam, "Glowbal"}; - authorUrl = "http://ace3mod.com"; + author = ECSTRING(common,ACETeam); + authors[] = {"Glowbal"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -16,3 +18,7 @@ class CfgPatches { #include "ui\menu.hpp" #include "ACE_Settings.hpp" #include "CfgVehicles.hpp" + +class ACE_newEvents { + Medical_onMenuOpen = "ace_medicalMenuOpened"; +}; diff --git a/addons/medical_menu/functions/fnc_collectActions.sqf b/addons/medical_menu/functions/fnc_collectActions.sqf index 88f52c417a..af6742188e 100644 --- a/addons/medical_menu/functions/fnc_collectActions.sqf +++ b/addons/medical_menu/functions/fnc_collectActions.sqf @@ -15,27 +15,25 @@ */ #include "script_component.hpp" -private ["_configBasic", "_configAdvanced", "_fnc_compileActionsLevel"]; -_configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic"); -_configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced"); +private _configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic"); +private _configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced"); -_fnc_compileActionsLevel = { - private ["_actions", "_displayName", "_condition", "_category", "_statement"]; +private _fnc_compileActionsLevel = { params ["_config"]; - _actions = []; + private _actions = []; { if (isClass _x) then { - _displayName = getText (_x >> "displayName"); - _category = getText (_x >> "category"); - _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x]; - _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x]; + private _displayName = getText (_x >> "displayName"); + private _category = getText (_x >> "category"); + private _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x]; + private _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x]; _actions pushBack [_displayName, _category, compile _condition, compile _statement]; }; nil } count ("true" configClasses _config); - _actions // return + _actions; }; GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel; @@ -43,20 +41,20 @@ GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel; //Manually add the drag actions, if dragging exists. if (["ace_dragging"] call EFUNC(common,isModLoaded)) then { - _condition = { + private _condition = { (ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canDrag)} }; - _statement = { + private _statement = { GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true [ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startDrag); }; GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement]; GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement]; - _condition = { + private _condition = { (ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canCarry)} }; - _statement = { + private _statement = { GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true [ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startCarry); }; diff --git a/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf index 8cbbe2d32f..6fed994671 100644 --- a/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf +++ b/addons/medical_menu/functions/fnc_getTreatmentOptions.sqf @@ -19,19 +19,16 @@ params ["_player", "_target", "_name"]; -private ["_actions", "_collectedActions", "_bodyPart"]; - if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitWith {[]}; -_actions = if (EGVAR(medical,level) == 2) then { +private _actions = if (EGVAR(medical,level) == 2) then { GVAR(actionsAdvanced); } else { GVAR(actionsBasic); }; -_collectedActions = []; - -_bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart); +private _collectedActions = []; +private _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart); { _x params ["", "_currentCategory", "_currentCondition"]; if (_name == _currentCategory && {call _currentCondition}) then { @@ -40,4 +37,4 @@ _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart); nil } count _actions; -_collectedActions // return +_collectedActions; diff --git a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf index 67e295e22e..97e5c19519 100644 --- a/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf +++ b/addons/medical_menu/functions/fnc_handleUI_DisplayOptions.sqf @@ -44,7 +44,7 @@ if (_name isEqualTo "toggle") exitWith { closeDialog 0; [{ [_this select 0] call FUNC(openMenu); - }, [_newTarget], 0.1] call EFUNC(common,waitAndExecute); + }, [_newTarget], 0.1] call CBA_fnc_waitAndExecute; }; // Clean the dropdown options list from all actions @@ -77,7 +77,7 @@ if (_name isEqualTo "triage") exitWith { _message = localize _message; }; }; - _triageCardTexts pushBack format["%1x - %2 (%3m)", _amount, _message, round((ACE_gameTime - _time) / 60)]; + _triageCardTexts pushBack format["%1x - %2 (%3m)", _amount, _message, round((CBA_missionTime - _time) / 60)]; nil; } count _log; diff --git a/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf b/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf index 33b82e5d78..946ee2d0ef 100644 --- a/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf +++ b/addons/medical_menu/functions/fnc_handleUI_dropDownTriageCard.sqf @@ -15,13 +15,11 @@ */ #include "script_component.hpp" -private ["_display", "_pos", "_ctrl", "_currentPos", "_idc"]; - disableSerialization; -_display = uiNamespace getVariable QGVAR(medicalMenu); -_pos = [0, 0, 0, 0]; -_currentPos = ctrlPosition (_display displayCtrl 2002); +private _display = uiNamespace getVariable QGVAR(medicalMenu); +private _pos = [0, 0, 0, 0]; +private _currentPos = ctrlPosition (_display displayCtrl 2002); _currentPos params ["_currentPosX", "_currentPosY"]; if (_currentPosX == 0 && _currentPosY == 0) then { _pos = ctrlPosition (_display displayCtrl 2001); @@ -29,7 +27,7 @@ if (_currentPosX == 0 && _currentPosY == 0) then { for "_idc" from 2002 to 2006 step 1 do { _pos set [1, (_pos select 1) + (_pos select 3)]; - _ctrl = _display displayCtrl _idc; + private _ctrl = _display displayCtrl _idc; _ctrl ctrlSetPosition _pos; _ctrl ctrlCommit 0; }; diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index d8d1fde35a..58cb9ff74e 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -16,8 +16,6 @@ #include "script_component.hpp" #define MAX_DISTANCE 10 -private "_target"; - params ["_display"]; if (isNil "_display") exitWith {}; @@ -34,7 +32,7 @@ if (isNil QGVAR(LatestDisplayOptionMenu)) then { }; }; -_target = GVAR(INTERACTION_TARGET); +private _target = GVAR(INTERACTION_TARGET); if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then { GVAR(INTERACTION_TARGET_PREVIOUS) = _target; }; @@ -81,10 +79,10 @@ GVAR(MenuPFHID) = [{ closeDialog 314412; //If we failed because of distance check, show UI message: if ((ACE_player distance GVAR(INTERACTION_TARGET)) > GVAR(maxRange)) then { - ["displayTextStructured", [[ELSTRING(medical,DistanceToFar), [GVAR(INTERACTION_TARGET)] call EFUNC(common,getName)], 2, ACE_player]] call EFUNC(common,localEvent); + [[ELSTRING(medical,DistanceToFar), [GVAR(INTERACTION_TARGET)] call EFUNC(common,getName)], 2] call EFUNC(common,displayTextStructured); }; }; }, 0, [_display]] call CBA_fnc_addPerFrameHandler; -["Medical_onMenuOpen", [ACE_player, _target]] call EFUNC(common,localEvent); +["ace_medicalMenuOpened", [ACE_player, _target]] call CBA_fnc_localEvent; diff --git a/addons/medical_menu/functions/fnc_openMenu.sqf b/addons/medical_menu/functions/fnc_openMenu.sqf index a8a51ff028..e0de46dba8 100644 --- a/addons/medical_menu/functions/fnc_openMenu.sqf +++ b/addons/medical_menu/functions/fnc_openMenu.sqf @@ -20,20 +20,15 @@ params ["_interactionTarget"]; if (dialog || {isNull _interactionTarget}) exitWith { disableSerialization; - private ["_display", "_handled"]; - _handled = false; - _display = uiNamespace getVariable QGVAR(medicalMenu); + private _display = uiNamespace getVariable QGVAR(medicalMenu); if (!isNil "_display") then { closeDialog 314412; - _handled = true; }; - - _handled }; GVAR(INTERACTION_TARGET) = _interactionTarget; createDialog QGVAR(medicalMenu); -GVAR(lastOpenedOn) = ACE_time; +GVAR(lastOpenedOn) = CBA_missionTime; true diff --git a/addons/medical_menu/functions/fnc_updateActivityLog.sqf b/addons/medical_menu/functions/fnc_updateActivityLog.sqf index 50acb12e94..7406e25f33 100644 --- a/addons/medical_menu/functions/fnc_updateActivityLog.sqf +++ b/addons/medical_menu/functions/fnc_updateActivityLog.sqf @@ -16,11 +16,9 @@ */ #include "script_component.hpp" -private "_logCtrl"; - params ["_display", "_logs"]; -_logCtrl = _display displayCtrl 214; +private _logCtrl = _display displayCtrl 214; lbClear _logCtrl; { diff --git a/addons/medical_menu/functions/fnc_updateBodyImage.sqf b/addons/medical_menu/functions/fnc_updateBodyImage.sqf index 1e8067a7f6..1d83b54372 100644 --- a/addons/medical_menu/functions/fnc_updateBodyImage.sqf +++ b/addons/medical_menu/functions/fnc_updateBodyImage.sqf @@ -22,11 +22,9 @@ params ["_selectionBloodLoss", "_damaged", "_display"]; // Handle the body image coloring private _availableSelections = [50, 51, 52, 53, 54, 55]; { - private ["_red", "_green", "_blue"]; - - _red = 1; - _green = 1; - _blue = 1; + private _red = 1; + private _green = 1; + private _blue = 1; if (_x > 0) then { if (_damaged select _forEachIndex) then { diff --git a/addons/medical_menu/functions/fnc_updateIcons.sqf b/addons/medical_menu/functions/fnc_updateIcons.sqf index b309938476..37508bd2b0 100644 --- a/addons/medical_menu/functions/fnc_updateIcons.sqf +++ b/addons/medical_menu/functions/fnc_updateIcons.sqf @@ -18,15 +18,13 @@ #define START_IDC 111 #define END_IDC 118 -private ["_display", "_idc", "_options", "_amount"]; - disableSerialization; -_display = uiNamespace getVariable QGVAR(medicalMenu); +private _display = uiNamespace getVariable QGVAR(medicalMenu); +private _options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"]; -_options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"]; for "_idc" from START_IDC to END_IDC step 1 do { - _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions); + private _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions); if ((count _amount) > 0 || _idc == START_IDC || _idc == END_IDC) then { (_display displayCtrl _idc) ctrlSettextColor [1, 1, 1, 1]; } else { diff --git a/addons/medical_menu/functions/fnc_updateInformationLists.sqf b/addons/medical_menu/functions/fnc_updateInformationLists.sqf index 82c0a13746..28818465bc 100644 --- a/addons/medical_menu/functions/fnc_updateInformationLists.sqf +++ b/addons/medical_menu/functions/fnc_updateInformationLists.sqf @@ -14,11 +14,9 @@ */ #include "script_component.hpp" -private ["_lbCtrl", "_amountOfGeneric"]; - params ["_display", "_genericMessages", "_allInjuryTexts"]; -_lbCtrl = _display displayCtrl 213; +private _lbCtrl = _display displayCtrl 213; lbClear _lbCtrl; { _x params ["_add", "_color"]; @@ -26,7 +24,7 @@ lbClear _lbCtrl; _lbCtrl lbSetColor [_forEachIndex, _color]; } forEach _genericMessages; -_amountOfGeneric = count _genericMessages; +private _amountOfGeneric = count _genericMessages; { _x params ["_add", "_color"]; _lbCtrl lbAdd _add; diff --git a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf index 900e375fb7..836ebafca2 100644 --- a/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf +++ b/addons/medical_menu/functions/fnc_updateQuickViewLog.sqf @@ -16,27 +16,21 @@ */ #include "script_component.hpp" -private "_logCtrl"; - params ["_display", "_logs"]; -_logCtrl = _display displayCtrl 215; +private _logCtrl = _display displayCtrl 215; lbClear _logCtrl; { _x params ["_message", "_moment", "", "_arguments"]; - if (isLocalized _message) then { - _message = localize _message; - }; - { if (_x isEqualType "" && {isLocalized _x}) then { _arguments set [_foreachIndex, localize _x]; }; } forEach _arguments; - _message = format ([_message] + _arguments); + _message = format ([([_message, localize _message] select (isLocalized _message))] + _arguments); _logCtrl lbAdd format ["%1 %2", _moment, _message]; nil } count _logs; diff --git a/addons/medical_menu/script_component.hpp b/addons/medical_menu/script_component.hpp index afa50c04f3..cb437060a3 100644 --- a/addons/medical_menu/script_component.hpp +++ b/addons/medical_menu/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT medical_menu +#define COMPONENT_BEAUTIFIED Medical Menu #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/medical_menu/stringtable.xml b/addons/medical_menu/stringtable.xml index e9812128f4..a5b75c00e2 100644 --- a/addons/medical_menu/stringtable.xml +++ b/addons/medical_menu/stringtable.xml @@ -127,7 +127,7 @@ STATUS СОСТОЯНИЕ ESTADO - ÉTATS + ÉTAT STATUS ESTADO STAV @@ -138,7 +138,7 @@ ÜBERSICHT ОБЩАЯ ИНФОРМАЦИЯ DESCRIPCIÓN - DESCRIPTION + APERÇU OPIS VISÃO GERAL PŘEHLED @@ -149,7 +149,7 @@ AKTIVITÄTSVERLAUF ПРОВЕДЕННЫЕ МАНИПУЛЯЦИИ REGISTRO DE ACTIVIDAD - REGISTRE DES SOINS + REGISTRE D'ACTIVITÉ LOGI AKTYWNOŚCI REGISTRO DE ATIVIDADE PROTOKOL @@ -214,7 +214,7 @@ Airway Management Дыхательные пути Vías Aéreas - Gestion Des Voie REspiratoire + Gestion des voies respiratoires Drogi oddechowe Vias aéreas Dýchací systém @@ -226,7 +226,7 @@ Erweiterte Behandlungen Специальная медпомощь Tratamientos Avanzados - Traitement Avancé + Traitements Avancés Zaawansowane zabiegi Tratamentos avançados Pokročilé ošetření @@ -237,7 +237,7 @@ Ziehen/Tragen Тащить/нести Arrastrar/Cargar - Glisser/Porter + Traîner/Porter Ciągnij/Nieś Arrastar/Carregar Táhnout/Nést @@ -247,7 +247,7 @@ Toggle (Self) Umschalter (Selbst) Лечить себя/другого раненого - Activer (sois) + Basculer (soi) Przełącz (na siebie) Alternar Alternar (Si mesmo) @@ -259,7 +259,7 @@ Setze Status auf der Triagekarte Сортировка Seleccionar estado de Triage - Selectioner l'état de Triage + Selectioner l'état de triage Wybierz priorytet Selecionar estado de triagem Vybrat prioritu @@ -512,7 +512,7 @@ Normale Atmung Дыхание в норме Respiración normal - Respiration Normale + Respiration normale Normalny oddech Respiração normal Normální dýchání @@ -523,7 +523,7 @@ Keine Atmung Дыхания нет No respira - Apnée + Aucune respiration Brak oddechu Sem respiração Nedýchá @@ -534,7 +534,7 @@ Schwere Atmung Дыхание затруднено Dificultad para respirar - Difficultée Respiratoire + Respiration difficile Trudności z oddychaniem Dificuldade para respirar Potíže s dýcháním @@ -545,7 +545,7 @@ Beinahe keine Atmung Дыхания почти нет Casi sin respirar - Respiration Faible + Respiration faible Prawie brak oddechu Quase sem respiração Téměř nedýchá diff --git a/addons/medical_menu/ui/menu.hpp b/addons/medical_menu/ui/menu.hpp index c443819caa..16c79e7c6a 100644 --- a/addons/medical_menu/ui/menu.hpp +++ b/addons/medical_menu/ui/menu.hpp @@ -51,7 +51,7 @@ class GVAR(medicalMenu) { y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = QUOTE(PATHTOF(data\background_img.paa)); + text = QPATHTOF(data\background_img.paa); colorText[] = {1, 1, 1, 0.0}; }; class CatagoryLeft: HeaderName { @@ -94,42 +94,42 @@ class GVAR(medicalMenu) { colorBackground[] = {0,0,0,1}; colorPicture[] = {1,1,1,1}; colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(data\icons\triage_card_small.paa)); + text = QPATHTOF(data\icons\triage_card_small.paa); }; class iconImg2: iconImg1 { idc = 112; x = "3 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\examine_patient_small.paa)); + text = QPATHTOF(data\icons\examine_patient_small.paa); }; class iconImg3: iconImg1 { idc = 113; x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\bandage_fracture_small.paa)); + text = QPATHTOF(data\icons\bandage_fracture_small.paa); }; class iconImg4: iconImg1 { idc = 114; x = "6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\medication_small.paa)); + text = QPATHTOF(data\icons\medication_small.paa); }; class iconImg5: iconImg1 { idc = 115; x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\airway_management_small.paa)); + text = QPATHTOF(data\icons\airway_management_small.paa); }; class iconImg6: iconImg1 { idc = 116; x = "9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\advanced_treatment_small.paa)); + text = QPATHTOF(data\icons\advanced_treatment_small.paa); }; class iconImg7: iconImg1 { idc = 117; x = "10.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\icon_carry.paa)); + text = QPATHTOF(data\icons\icon_carry.paa); }; class iconImg8: iconImg1 { idc = 118; x = "12 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\toggle_self_small.paa)); + text = QPATHTOF(data\icons\toggle_self_small.paa); }; @@ -274,7 +274,7 @@ class GVAR(medicalMenu) { colorBackground[] = {1,1,1,1}; colorPicture[] = {1,1,1,1}; colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOEF(medical,ui\body_background.paa)); + text = QPATHTOEF(medical,ui\body_background.paa); }; class bodyImgHead: bodyImgBackground { idc = 50; @@ -286,28 +286,28 @@ class GVAR(medicalMenu) { colorBackground[] = {1,1,1,1}; colorPicture[] = {1,1,1,0.75}; colorText[] = {1,1,1,0.75}; - text = QUOTE(PATHTOEF(medical,ui\body_head.paa)); + text = QPATHTOEF(medical,ui\body_head.paa); }; class bodyImgTorso: bodyImgHead { idc = 51; - text = QUOTE(PATHTOEF(medical,ui\body_torso.paa)); + text = QPATHTOEF(medical,ui\body_torso.paa); }; class bodyImgArms_l: bodyImgHead { idc = 52; - text = QUOTE(PATHTOEF(medical,ui\body_arm_left.paa)); + text = QPATHTOEF(medical,ui\body_arm_left.paa); }; class bodyImgArms_r: bodyImgHead { idc = 53; - text = QUOTE(PATHTOEF(medical,ui\body_arm_right.paa)); + text = QPATHTOEF(medical,ui\body_arm_right.paa); }; class bodyImgLegs_l: bodyImgHead { idc = 54; - text = QUOTE(PATHTOEF(medical,ui\body_leg_left.paa)); + text = QPATHTOEF(medical,ui\body_leg_left.paa); }; class bodyImgLegs_r: bodyImgHead { idc = 55; - text = QUOTE(PATHTOEF(medical,ui\body_leg_right.paa)); + text = QPATHTOEF(medical,ui\body_leg_right.paa); }; diff --git a/addons/microdagr/CfgVehicles.hpp b/addons/microdagr/CfgVehicles.hpp index 3fcf92beaa..cf596c9762 100644 --- a/addons/microdagr/CfgVehicles.hpp +++ b/addons/microdagr/CfgVehicles.hpp @@ -8,21 +8,21 @@ class CfgVehicles { displayName = CSTRING(configure); condition = QUOTE(([DISPLAY_MODE_DIALOG] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DIALOG}); statement = QUOTE([DISPLAY_MODE_DIALOG] call FUNC(openDisplay)); - icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa)); + icon = QPATHTOF(UI\icon_microDAGR.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; class GVAR(show) { //Opens the mini map displayName = CSTRING(show); condition = QUOTE(([DISPLAY_MODE_DISPLAY] call FUNC(canShow)) && {GVAR(currentShowMode) != DISPLAY_MODE_DISPLAY}); statement = QUOTE([DISPLAY_MODE_DISPLAY] call FUNC(openDisplay)); - icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa)); + icon = QPATHTOF(UI\icon_microDAGR.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; class GVAR(close) { displayName = CSTRING(closeUnit); condition = QUOTE(GVAR(currentShowMode) != DISPLAY_MODE_CLOSED); statement = QUOTE([DISPLAY_MODE_CLOSED] call FUNC(openDisplay)); - icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa)); + icon = QPATHTOF(UI\icon_microDAGR.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; @@ -39,7 +39,7 @@ class CfgVehicles { scope = 2; isGlobal = 0; isSingular = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_microDAGR_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_microDAGR_ca.paa); functionPriority = 0; class Arguments { class MapDataAvailable { @@ -72,7 +72,7 @@ class CfgVehicles { displayName = CSTRING(itemName); author = ECSTRING(common,ACETeam); vehicleClass = "Items"; - icon = QUOTE(PATHTOF(UI\icon_microDAGR.paa)); + icon = QPATHTOF(UI\icon_microDAGR.paa); class TransportItems { MACRO_ADDITEM(ACE_microDAGR,1); }; diff --git a/addons/microdagr/CfgWeapons.hpp b/addons/microdagr/CfgWeapons.hpp index 6fa84b6e7b..92ace96c53 100644 --- a/addons/microdagr/CfgWeapons.hpp +++ b/addons/microdagr/CfgWeapons.hpp @@ -7,8 +7,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(itemName); descriptionShort = CSTRING(itemDescription); - model = QUOTE(PATHTOF(data\MicroDAGR.p3d)); - picture = QUOTE(PATHTOF(images\microDAGR_item.paa)); + model = QPATHTOF(data\MicroDAGR.p3d); + picture = QPATHTOF(images\microDAGR_item.paa); class ItemInfo: InventoryItem_Base_F { mass = 2; }; diff --git a/addons/microdagr/XEH_clientInit.sqf b/addons/microdagr/XEH_clientInit.sqf index c918bcf454..46003b9cb1 100644 --- a/addons/microdagr/XEH_clientInit.sqf +++ b/addons/microdagr/XEH_clientInit.sqf @@ -16,11 +16,11 @@ _closeCode = { if (GVAR(currentShowMode) == DISPLAY_MODE_CLOSED) exitWith {}; [DISPLAY_MODE_CLOSED] call FUNC(openDisplay); }; -[(localize LSTRING(itemName)), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); +[(localize LSTRING(itemName)), QPATHTOF(images\microDAGR_item.paa), _conditonCode, _toggleCode, _closeCode] call EFUNC(common,deviceKeyRegisterNew); //Add Eventhandler: -["RangerfinderData", {_this call FUNC(recieveRangefinderData)}] call EFUNC(common,addEventHandler); +[QEGVAR(vector,rangefinderData), {_this call FUNC(recieveRangefinderData)}] call CBA_fnc_addEventHandler; //Global Variables to default: GVAR(gpsPositionASL) = [0,0,0]; diff --git a/addons/microdagr/config.cpp b/addons/microdagr/config.cpp index 7a39df8980..5d33c073e1 100644 --- a/addons/microdagr/config.cpp +++ b/addons/microdagr/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_microDAGR_Item"}; weapons[] = {"ACE_microDAGR"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"PabstMirror"}; - authorUrl = "https://github.com/PabstMirror/"; + author = ECSTRING(common,ACETeam); + authors[] = {"PabstMirror"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,7 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "gui.hpp" #include "ACE_Settings.hpp" + +class ACE_newEvents { + RangerfinderData = QEGVAR(vector,rangefinderData); +}; diff --git a/addons/microdagr/functions/fnc_canShow.sqf b/addons/microdagr/functions/fnc_canShow.sqf index 70e8989031..d339f80794 100644 --- a/addons/microdagr/functions/fnc_canShow.sqf +++ b/addons/microdagr/functions/fnc_canShow.sqf @@ -27,8 +27,10 @@ _returnValue = switch (_showType) do { ("ACE_microDAGR" in (items ACE_player)) && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; case (DISPLAY_MODE_DISPLAY): { - //Can't have minimap up while zoomed in - (cameraview != "GUNNER") && {"ACE_microDAGR" in (items ACE_player)} && {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} + //Can't have minimap up while zoomed in on foot, but allow drivers to use while in "Gunner" to handle non-3d vehicles like most tanks + ((cameraView != "GUNNER") || {(vehicle ACE_player != ACE_player) && {driver vehicle ACE_player == ACE_player}}) && + {"ACE_microDAGR" in (items ACE_player)} && + {[ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)} }; default { false }; }; diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 25f5bc92fd..92d647f348 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -27,7 +27,7 @@ if (GVAR(currentApplicationPage) == 1) then { _theMap ctrlMapAnimAdd [0, DUMMY_ZOOM, DUMMY_POS]; ctrlMapAnimCommit _theMap; _size = 412 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (getDir ACE_player)), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\compass_starInverted.paa)), [1,1,1,1], DUMMY_POS, _size, _size, (-1 * (([ACE_player] call CBA_fnc_headDir) select 0)), '', 0 ]; _theMap drawIcon [QUOTE(PATHTO_R(images\compass_needle.paa)), [0.533,0.769,0.76,1], DUMMY_POS, _size, _size, 0, '', 0 ]; if (GVAR(currentWaypoint) != -1) then { @@ -56,7 +56,7 @@ if (GVAR(currentApplicationPage) == 1) then { ctrlMapAnimCommit _theMap; }; _size = 48 * _mapSize; - _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (getDir ACE_player), '', 0 ]; + _theMap drawIcon [QUOTE(PATHTO_R(images\icon_self.paa)), [0.533,0.769,0.76,0.75], (getPosASL ACE_player), _size, _size, (([ACE_player] call CBA_fnc_headDir) select 0), '', 0 ]; if (GVAR(settingShowAllWaypointsOnMap)) then { _size = 32 * _mapSize; diff --git a/addons/microdagr/functions/fnc_showApplicationPage.sqf b/addons/microdagr/functions/fnc_showApplicationPage.sqf index dba6b54f18..903680e896 100644 --- a/addons/microdagr/functions/fnc_showApplicationPage.sqf +++ b/addons/microdagr/functions/fnc_showApplicationPage.sqf @@ -38,9 +38,9 @@ if (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY) then { (_display displayCtrl IDC_MODEDISPLAY_MODEPOSTIMECG) ctrlShow false; (_display displayCtrl IDC_MODEDISPLAY_MODEPOSTARGETCG) ctrlShow true; if (GVAR(currentWaypoint) == -2) then { - (_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText "\A3\ui_f\data\igui\rscingameui\rscoptics\laser_designator_iconLaserOn.paa" + (_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText QUOTE(PATHTOF(images\icon_menuLaser.paa)); } else { - (_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText QUOTE(PATHTOF(images\icon_menuMark.paa)); + (_display displayCtrl IDC_MODEDISPLAY_TARGETICON) ctrlSetText QPATHTOF(images\icon_menuMark.paa); }; }; }; @@ -100,19 +100,19 @@ if (GVAR(currentApplicationPage) == APP_MODE_MARK) then { //Buttons pushed: if (GVAR(currentApplicationPage) == APP_MODE_INFODISPLAY) then { - (_display displayCtrl IDC_BUTTONBG0) ctrlSetText QUOTE(PATHTOF(images\button_pushedDown.paa)); + (_display displayCtrl IDC_BUTTONBG0) ctrlSetText QPATHTOF(images\button_pushedDown.paa); } else { - (_display displayCtrl IDC_BUTTONBG0) ctrlSetText QUOTE(PATHTOF(images\button_pushedUp.paa)); + (_display displayCtrl IDC_BUTTONBG0) ctrlSetText QPATHTOF(images\button_pushedUp.paa); }; if (GVAR(currentApplicationPage) == APP_MODE_COMPASS) then { - (_display displayCtrl IDC_BUTTONBG1) ctrlSetText QUOTE(PATHTOF(images\button_pushedDown.paa)); + (_display displayCtrl IDC_BUTTONBG1) ctrlSetText QPATHTOF(images\button_pushedDown.paa); } else { - (_display displayCtrl IDC_BUTTONBG1) ctrlSetText QUOTE(PATHTOF(images\button_pushedUp.paa)); + (_display displayCtrl IDC_BUTTONBG1) ctrlSetText QPATHTOF(images\button_pushedUp.paa); }; if (GVAR(currentApplicationPage) == APP_MODE_MAP) then { - (_display displayCtrl IDC_BUTTONBG2) ctrlSetText QUOTE(PATHTOF(images\button_pushedDown.paa)); + (_display displayCtrl IDC_BUTTONBG2) ctrlSetText QPATHTOF(images\button_pushedDown.paa); } else { - (_display displayCtrl IDC_BUTTONBG2) ctrlSetText QUOTE(PATHTOF(images\button_pushedUp.paa)); + (_display displayCtrl IDC_BUTTONBG2) ctrlSetText QPATHTOF(images\button_pushedUp.paa); }; //Update the page now: diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 5042cbac97..7ba92e55ef 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -47,9 +47,9 @@ case (APP_MODE_INFODISPLAY): { //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (([ACE_player] call CBA_fnc_headDir) select 0))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (([ACE_player] call CBA_fnc_headDir) select 0)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODEDISPLAY_HEADINGNUM) ctrlSetText _compassAngleText; @@ -107,9 +107,9 @@ case (APP_MODE_INFODISPLAY): { case (APP_MODE_COMPASS): { //Heading: _compassAngleText = if (GVAR(settingUseMils)) then { - [(floor ((6400 / 360) * (getDir ACE_player))), 4, 0] call CBA_fnc_formatNumber; + [(floor ((6400 / 360) * (([ACE_player] call CBA_fnc_headDir) select 0))), 4, 0] call CBA_fnc_formatNumber; } else { - ([(floor (getDir ACE_player)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 + ([(floor (([ACE_player] call CBA_fnc_headDir) select 0)), 3, 1] call CBA_fnc_formatNumber) + "°" //degree symbol is in UTF-8 }; (_display displayCtrl IDC_MODECOMPASS_HEADING) ctrlSetText _compassAngleText; diff --git a/addons/microdagr/gui_controls.hpp b/addons/microdagr/gui_controls.hpp index a8fbb8f83f..4fd194e1ab 100644 --- a/addons/microdagr/gui_controls.hpp +++ b/addons/microdagr/gui_controls.hpp @@ -10,7 +10,7 @@ class controlsBackground { }; class StatusBarBS: RscPicture { idc = -1; - text = QUOTE(PATHTOF(images\microDAGR_topBar.paa)); + text = QPATHTOF(images\microDAGR_topBar.paa); x = X_PART(0); y = Y_PART(0); w = W_PART(25); @@ -18,7 +18,7 @@ class controlsBackground { }; class RangefinderConnectedIcon: RscPicture { idc = IDC_RANGEFINDERCONNECTEDICON; - text = "\A3\ui_f\data\igui\rscingameui\rscoptics\laser_designator_iconLaserOn.paa"; + text = QUOTE(PATHTOF(images\icon_menuLaser.paa)); x = X_PART(6.35); y = Y_PART(0.1); w = W_PART(2.7); @@ -187,7 +187,7 @@ class controls { }; class selfIcon: RscPicture { idc = -1; - text = QUOTE(PATHTOF(images\icon_self.paa)); + text = QPATHTOF(images\icon_self.paa); x = W_PART(0.5); y = H_PART(2); w = W_PART(4); @@ -242,7 +242,7 @@ class controls { }; class CompasIcon: RscPicture { idc = -1; - text = QUOTE(PATHTOF(images\icon_infoCompass.paa)); + text = QPATHTOF(images\icon_infoCompass.paa); x = W_PART(0.5); y = H_PART(8.5); w = W_PART(2); @@ -284,7 +284,7 @@ class controls { class controls { class TimeIcon: RscPicture { idc = -1; - text = QUOTE(PATHTOF(images\icon_infoClock.paa)); + text = QPATHTOF(images\icon_infoClock.paa); x = W_PART(0.5); y = H_PART(3.5); w = W_PART(2); @@ -315,7 +315,7 @@ class controls { class controls { class TargetIcon: RscPicture { idc = IDC_MODEDISPLAY_TARGETICON; - text = QUOTE(PATHTOF(images\icon_menuMark.paa)); + text = QPATHTOF(images\icon_menuMark.paa); x = W_PART(0.5); y = H_PART(0.5); w = W_PART(2); @@ -440,7 +440,7 @@ class controls { class mapTrackButton: GVAR(RscActiveTextPicture) { onbuttonclick = QUOTE(['autotrack'] call FUNC(modeMapButtons)); idc = IDC_MODEMAP_MAPTRACKBUTTON; - text = QUOTE(PATHTOF(images\icon_mapTrack.paa)); + text = QPATHTOF(images\icon_mapTrack.paa); x = X_PART(11); y = Y_PART(18.75); w = W_PART(3); @@ -449,14 +449,14 @@ class controls { class mapZoomIn: mapTrackButton { onbuttonclick = QUOTE(['zoomin'] call FUNC(modeMapButtons)); idc = IDC_MODEMAP_MAPZOOMIN; - text = QUOTE(PATHTOF(images\icon_mapPlus.paa)); + text = QPATHTOF(images\icon_mapPlus.paa); color[] = {1,1,1,0.4}; x = X_PART(4); }; class mapZoomOut: mapTrackButton { onbuttonclick = QUOTE(['zoomout'] call FUNC(modeMapButtons)); idc = IDC_MODEMAP_MAPZOOMOUT; - text = QUOTE(PATHTOF(images\icon_mapMinus.paa)); + text = QPATHTOF(images\icon_mapMinus.paa); color[] = {1,1,1,0.4}; x = X_PART(18); }; @@ -472,7 +472,7 @@ class controls { class Controls { class ButtonTL: GVAR(RscActiveTextPicture) { idc = -1; - text = QUOTE(PATHTOF(images\icon_menuMark.paa)); + text = QPATHTOF(images\icon_menuMark.paa); x = W_PART(3); y = H_PART(1.5); w = W_PART(8); @@ -480,19 +480,19 @@ class controls { onbuttonclick = QUOTE([4] call FUNC(saveCurrentAndSetNewMode)); }; class ButtonTR: ButtonTL { - text = QUOTE(PATHTOF(images\icon_menuWaypoints.paa)); + text = QPATHTOF(images\icon_menuWaypoints.paa); x = W_PART(14); y = H_PART(1.5); onbuttonclick = QUOTE([5] call FUNC(saveCurrentAndSetNewMode)); }; class ButtonBL: ButtonTL { - text = "\A3\ui_f\data\igui\rscingameui\rscoptics\laser_designator_iconLaserOn.paa"; + text = QUOTE(PATHTOF(images\icon_menuLaser.paa)); x = W_PART(3); y = H_PART(10.5); onbuttonclick = QUOTE(_this call FUNC(appMenuButtonConnectRangefinder)); }; class ButtonBR: ButtonTL { - text = QUOTE(PATHTOF(images\icon_menuSettings.paa)); + text = QPATHTOF(images\icon_menuSettings.paa); x = W_PART(14); y = H_PART(10.5); onbuttonclick = QUOTE([6] call FUNC(saveCurrentAndSetNewMode)); @@ -555,7 +555,7 @@ class controls { }; class DeleteButton: GVAR(RscActiveTextPicture) { idc = -1; - text = QUOTE(PATHTOF(images\icon_deleteButton.paa)); + text = QPATHTOF(images\icon_deleteButton.paa); x = W_PART(20); y = H_PART(2.75); w = W_PART(2); @@ -717,7 +717,7 @@ class controls { class ButtonBG0: RscPicture { idc = IDC_BUTTONBG0; - text = QUOTE(PATHTOF(images\button_pushedDown.paa)); + text = QPATHTOF(images\button_pushedDown.paa); x = X_PART(0 * (25/3)); y = Y_PART(21); w = W_PART((25/3)); @@ -733,7 +733,7 @@ class controls { }; class ButtonIcon0: GVAR(RscActiveTextPicture) { idc = -1; - text = QUOTE(PATHTOF(images\icon_info.paa)); + text = QPATHTOF(images\icon_info.paa); x = X_PART(0 * (25/3)); y = Y_PART(21); w = W_PART((25/3)); @@ -741,19 +741,19 @@ class controls { onbuttonclick = QUOTE([APP_MODE_INFODISPLAY] call FUNC(saveCurrentAndSetNewMode)); }; class ButtonIcon1: ButtonIcon0 { - text = QUOTE(PATHTOF(images\icon_compass.paa)); + text = QPATHTOF(images\icon_compass.paa); x = X_PART(1 * (25/3)); onbuttonclick = QUOTE([APP_MODE_COMPASS] call FUNC(saveCurrentAndSetNewMode)); }; class ButtonIcon2: ButtonIcon0 { - text = QUOTE(PATHTOF(images\icon_map.paa)); + text = QPATHTOF(images\icon_map.paa); x = X_PART(2 * (25/3)); onbuttonclick = QUOTE([APP_MODE_MAP] call FUNC(saveCurrentAndSetNewMode)); }; //At the end: The Big Shell overlay class MicroDagrShell: RscPicture { idc = IDC_MICRODAGRSHELL; - text = QUOTE(PATHTOF(images\microDAGR_shellPicture.paa)); + text = QPATHTOF(images\microDAGR_shellPicture.paa); x = X_PART(-14.77); y = Y_PART(-5.875); w = W_PART(53.62); diff --git a/addons/microdagr/images/button_pushedDown.paa b/addons/microdagr/images/button_pushedDown.paa index fc519a3235..30ac306c5b 100644 Binary files a/addons/microdagr/images/button_pushedDown.paa and b/addons/microdagr/images/button_pushedDown.paa differ diff --git a/addons/microdagr/images/button_pushedUp.paa b/addons/microdagr/images/button_pushedUp.paa index 5aa18986be..cc6981e82a 100644 Binary files a/addons/microdagr/images/button_pushedUp.paa and b/addons/microdagr/images/button_pushedUp.paa differ diff --git a/addons/microdagr/images/icon_compass.paa b/addons/microdagr/images/icon_compass.paa index 777eaffde4..4449ce17bc 100644 Binary files a/addons/microdagr/images/icon_compass.paa and b/addons/microdagr/images/icon_compass.paa differ diff --git a/addons/microdagr/images/icon_info.paa b/addons/microdagr/images/icon_info.paa index 5dc94a444c..00247b8267 100644 Binary files a/addons/microdagr/images/icon_info.paa and b/addons/microdagr/images/icon_info.paa differ diff --git a/addons/microdagr/images/icon_infoClock.paa b/addons/microdagr/images/icon_infoClock.paa index 292cf29afb..5d9b1eeda3 100644 Binary files a/addons/microdagr/images/icon_infoClock.paa and b/addons/microdagr/images/icon_infoClock.paa differ diff --git a/addons/microdagr/images/icon_infoCompass.paa b/addons/microdagr/images/icon_infoCompass.paa index 8390a24509..927940740c 100644 Binary files a/addons/microdagr/images/icon_infoCompass.paa and b/addons/microdagr/images/icon_infoCompass.paa differ diff --git a/addons/microdagr/images/icon_map.paa b/addons/microdagr/images/icon_map.paa index 52c3931c68..7fe52c455b 100644 Binary files a/addons/microdagr/images/icon_map.paa and b/addons/microdagr/images/icon_map.paa differ diff --git a/addons/microdagr/images/icon_menuLaser.paa b/addons/microdagr/images/icon_menuLaser.paa new file mode 100644 index 0000000000..43b546b88d Binary files /dev/null and b/addons/microdagr/images/icon_menuLaser.paa differ diff --git a/addons/microdagr/images/icon_menuMark.paa b/addons/microdagr/images/icon_menuMark.paa index 2c77aac04b..44e62af43d 100644 Binary files a/addons/microdagr/images/icon_menuMark.paa and b/addons/microdagr/images/icon_menuMark.paa differ diff --git a/addons/microdagr/images/icon_menuSettings.paa b/addons/microdagr/images/icon_menuSettings.paa index cfb340247e..f8e307ff55 100644 Binary files a/addons/microdagr/images/icon_menuSettings.paa and b/addons/microdagr/images/icon_menuSettings.paa differ diff --git a/addons/microdagr/images/icon_menuWaypoints.paa b/addons/microdagr/images/icon_menuWaypoints.paa index 74ca3a59c1..92ebdb17ad 100644 Binary files a/addons/microdagr/images/icon_menuWaypoints.paa and b/addons/microdagr/images/icon_menuWaypoints.paa differ diff --git a/addons/microdagr/images/microDAGR_topBar.paa b/addons/microdagr/images/microDAGR_topBar.paa index c4c28307f0..317279a266 100644 Binary files a/addons/microdagr/images/microDAGR_topBar.paa and b/addons/microdagr/images/microDAGR_topBar.paa differ diff --git a/addons/microdagr/script_component.hpp b/addons/microdagr/script_component.hpp index c2f2b9b0a6..60d7caaa80 100644 --- a/addons/microdagr/script_component.hpp +++ b/addons/microdagr/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT microdagr +#define COMPONENT_BEAUTIFIED MicroDAGR #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/minedetector/$PBOPREFIX$ b/addons/minedetector/$PBOPREFIX$ new file mode 100644 index 0000000000..d8c7d764ef --- /dev/null +++ b/addons/minedetector/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\minedetector \ No newline at end of file diff --git a/addons/minedetector/ACE_detector.hpp b/addons/minedetector/ACE_detector.hpp new file mode 100644 index 0000000000..b6effc2436 --- /dev/null +++ b/addons/minedetector/ACE_detector.hpp @@ -0,0 +1,12 @@ +class ACE_detector { + class detectableObjects { + }; + class detectors { + class ACE_VMM3 { + radius = 2.5; + sounds[] = {"ace_detector_1", "ace_detector_2", "ace_detector_3", "ace_detector_4"}; + }; + class ACE_VMH3: ACE_VMM3 { + }; + }; +}; diff --git a/addons/minedetector/CfgAmmo.hpp b/addons/minedetector/CfgAmmo.hpp new file mode 100644 index 0000000000..bd2a3fdca6 --- /dev/null +++ b/addons/minedetector/CfgAmmo.hpp @@ -0,0 +1,30 @@ +class CfgAmmo { + + // seems to not get inherited + class Default; + class TimeBombCore: Default { + GVAR(detectable) = 1; + }; + + // these below do get inherited + class DirectionalBombCore; + class DirectionalBombBase: DirectionalBombCore { + GVAR(detectable) = 1; + }; + + class BoundingMineCore; + class BoundingMineBase: BoundingMineCore { + GVAR(detectable) = 1; + }; + + class MineCore; + class MineBase: MineCore { + GVAR(detectable) = 1; + }; + + class PipeBombCore; + class PipeBombBase: PipeBombCore { + GVAR(detectable) = 1; + }; + +}; diff --git a/addons/minedetector/CfgEventHandlers.hpp b/addons/minedetector/CfgEventHandlers.hpp new file mode 100644 index 0000000000..3daad1425a --- /dev/null +++ b/addons/minedetector/CfgEventHandlers.hpp @@ -0,0 +1,10 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + }; +}; diff --git a/addons/minedetector/CfgSounds.hpp b/addons/minedetector/CfgSounds.hpp new file mode 100644 index 0000000000..544bf94379 --- /dev/null +++ b/addons/minedetector/CfgSounds.hpp @@ -0,0 +1,22 @@ +class CfgSounds { + class ace_detector_1 { + name = "ace_detector_1"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 1}; + titles[] = {}; + }; + class ace_detector_2 { + name = "ace_detector_2"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.9}; + titles[] = {}; + }; + class ace_detector_3 { + name = "ace_detector_3"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.8}; + titles[] = {}; + }; + class ace_detector_4 { + name = "ace_detector_4"; + sound[] = {QUOTE(PATHTOF(sounds\metal_detector.wav)), "db+1", 0.7}; + titles[] = {}; + }; +}; diff --git a/addons/minedetector/CfgVehicles.hpp b/addons/minedetector/CfgVehicles.hpp new file mode 100644 index 0000000000..c486a049e3 --- /dev/null +++ b/addons/minedetector/CfgVehicles.hpp @@ -0,0 +1,51 @@ +class CfgVehicles { + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_VMM3,4); + MACRO_ADDITEM(ACE_VMH3,4); + }; + }; + + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(activate) { + displayName = CSTRING(ActivateDetector); + condition = QUOTE(call FUNC(canActivateDetector)); + statement = QUOTE(call FUNC(activateDetector)); + showDisabled = 0; + priority = 0.1; + icon = QPATHTOF(ui\icon_mineDetectorOn.paa); + exceptions[] = {}; + }; + class GVAR(deactivate) { + displayName = CSTRING(DeactivateDetector); + condition = QUOTE(call FUNC(canDeactivateDetector)); + statement = QUOTE(call FUNC(deactivateDetector)); + showDisabled = 0; + priority = 0.1; + icon = QPATHTOF(ui\icon_mineDetectorOff.paa); + exceptions[] = {}; + }; + }; + }; + }; + class Items_base_F; + class ACE_Explosives_Place: Items_base_F { + GVAR(detectable) = 1; + }; + + // Editor placed mines + class Static; + class MineGeneric: Static { + GVAR(detectable) = 1; + }; + + // Zeus placed mines + class ModuleEmpty_F; + class ModuleMine_F: ModuleEmpty_F { + GVAR(detectable) = 1; + }; +}; diff --git a/addons/minedetector/CfgWeapons.hpp b/addons/minedetector/CfgWeapons.hpp new file mode 100644 index 0000000000..8495aaf32e --- /dev/null +++ b/addons/minedetector/CfgWeapons.hpp @@ -0,0 +1,50 @@ +class Mode_SemiAuto; + +class CfgWeapons { + class Pistol; + class Pistol_Base_F: Pistol { + class WeaponSlotsInfo; + }; + class ACE_VMM3: Pistol_Base_F { + scope = 2; + author = ECSTRING(common,ACETeam); + displayName = "VMM3"; + descriptionShort = CSTRING(VMM3_Description); + model = QUOTE(PATHTOF(ace_wallon_vmm3.p3d)); + picture = QUOTE(PATHTOF(data\equip\w_vmm3_ca.paa)); + magazines[] = { }; + modes[] = { "Single" }; + class Single: Mode_SemiAuto { + displayName = ""; + sounds[] = {}; + begin1[] = { "", 1.77828, 1, 1000 }; + soundBegin[] = { "begin1", 1 }; + reloadTime = 0.075; + recoil = "recoil_pistol_light"; + recoilProne = "recoil_prone_pistol_light"; + dispersion = 0.001; + minRange = 2; + minRangeProbab = 0.3; + midRange = 250; + midRangeProbab = 0.7; + maxRange = 400; + maxRangeProbab = 0.05; + }; + class WeaponSlotsInfo: WeaponSlotsInfo { + holsterScale = 0; + mass = 77; + class CowsSlot {}; + class MuzzleSlot {}; + }; + }; + class ACE_VMH3: ACE_VMM3 { + scope = 2; + displayName = "VMH3"; + author = ECSTRING(common,ACETeam); + model = QUOTE(PATHTOF(ace_wallon_vmh3.p3d)); + picture = QUOTE(PATHTOF(data\equip\w_vmh3_ca.paa)); + class WeaponSlotsInfo: WeaponSlotsInfo { + mass = 55; + }; + }; +}; diff --git a/addons/minedetector/README.md b/addons/minedetector/README.md new file mode 100644 index 0000000000..5de7970013 --- /dev/null +++ b/addons/minedetector/README.md @@ -0,0 +1,11 @@ +ace_minedetector +=========== + +Add mine detectors + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Glowbal](https://github.com/Glowbal) +- [Grey](https://github.com/Grey-Soldierman) diff --git a/addons/minedetector/XEH_PREP.hpp b/addons/minedetector/XEH_PREP.hpp new file mode 100644 index 0000000000..9fdb771723 --- /dev/null +++ b/addons/minedetector/XEH_PREP.hpp @@ -0,0 +1,13 @@ + +PREP(canActivateDetector); +PREP(canDeactivateDetector); +PREP(activateDetector); +PREP(deactivateDetector); +PREP(hasDetector); +PREP(detectorLoop); +PREP(disableDetector); +PREP(enableDetector); +PREP(getDetectedObject); +PREP(isDetectorEnabled); +PREP(playDetectorSound); +PREP(getDetectorConfig); diff --git a/addons/minedetector/XEH_clientInit.sqf b/addons/minedetector/XEH_clientInit.sqf new file mode 100644 index 0000000000..83aca7467a --- /dev/null +++ b/addons/minedetector/XEH_clientInit.sqf @@ -0,0 +1,40 @@ +#include "script_component.hpp" + + +[QGVAR(detectorEnabled), { + params ["_unit", "_type"]; + private _config = [_type] call FUNC(getDetectorConfig); + + private _helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit); + _unit setVariable [QGVAR(helperLogic), _helperObject]; + + [FUNC(detectorLoop), 0.01, [_unit, _type, _config, CBA_missionTime, _helperObject]] call CBA_fnc_addPerFrameHandler; +}] call CBA_fnc_addEventHandler; + +[QGVAR(detectorDisabled), { + params ["_unit", "_type"]; + private _helperObject = _unit getVariable [QGVAR(helperLogic), objNull]; + if !(isNull _helperObject) then { + deleteVehicle _helperObject; + }; +}] call CBA_fnc_addEventHandler; + + + +//Shows detector and mine posistions in 3d when debug is on +#ifdef DEBUG_MODE_FULL +GVAR(debugDetector) = []; +addMissionEventHandler ["Draw3D", { + if (GVAR(debugDetector) isEqualTo []) exitWith {}; + GVAR(debugDetector) params ["_detectorPointAGL", "_mines"]; + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,0,1,1], _detectorPointAGL, 1, 1, 0, "detector", 1, 0.02, "PuristaMedium"]; + { + _name = format ["%1@%2", typeOf _x, (floor ((_x distance _detectorPointAGL) * 10)) / 10]; + if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _x) >> QGVAR(detectable))) == 1) then { + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [1,0,0,1], (ASLtoAGL (getPosASL _x)), 1, 1, 0, _name, 1, 0.02, "PuristaMedium"]; + } else { + drawIcon3D ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [1,1,0,1], (ASLtoAGL (getPosASL _x)), 1, 1, 0, _name, 1, 0.02, "PuristaMedium"]; + }; + } forEach _mines; +}]; +#endif diff --git a/addons/minedetector/XEH_preInit.sqf b/addons/minedetector/XEH_preInit.sqf new file mode 100644 index 0000000000..9529c201c5 --- /dev/null +++ b/addons/minedetector/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +// TODO load from config instead of hardcoded in sqf +GVAR(ALL_DETECTABLE_TYPES) = ["ACE_Explosive_Object", "ACE_Explosive_Helper", "ACE_Explosives_Place", "ModuleMine_F", "TimeBombCore", "MineBase", "DirectionalBombBase", "BoundingMineBase", "PipeBombBase"]; + +ADDON = true; diff --git a/addons/minedetector/ace_wallon_vmh3.p3d b/addons/minedetector/ace_wallon_vmh3.p3d new file mode 100644 index 0000000000..d0fb3a0452 Binary files /dev/null and b/addons/minedetector/ace_wallon_vmh3.p3d differ diff --git a/addons/minedetector/ace_wallon_vmm3.p3d b/addons/minedetector/ace_wallon_vmm3.p3d new file mode 100644 index 0000000000..a072c9250f Binary files /dev/null and b/addons/minedetector/ace_wallon_vmm3.p3d differ diff --git a/addons/minedetector/config.cpp b/addons/minedetector/config.cpp new file mode 100644 index 0000000000..9926d08f8c --- /dev/null +++ b/addons/minedetector/config.cpp @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {"ACE_VMH3","ACE_VMM3"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_explosives"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Grey", "Glowbal", "Rocko"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgWeapons.hpp" +#include "CfgAmmo.hpp" +#include "CfgVehicles.hpp" +#include "CfgSounds.hpp" +#include "ACE_detector.hpp" diff --git a/addons/spottingscope/data/spot_scope_tripod.rvmat b/addons/minedetector/data/ace_vmh3.rvmat similarity index 57% rename from addons/spottingscope/data/spot_scope_tripod.rvmat rename to addons/minedetector/data/ace_vmh3.rvmat index 0403471e5a..30836cbb49 100644 --- a/addons/spottingscope/data/spot_scope_tripod.rvmat +++ b/addons/minedetector/data/ace_vmh3.rvmat @@ -2,43 +2,15 @@ ambient[] = {1.0, 1.0, 1.0, 1.0}; diffuse[] = {1.0, 1.0, 1.0, 1.0}; forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0}; emmisive[] = {0.0, 0.0, 0.0, 1.0}; -specular[] = {0.0, 0.0, 0.0, 0.0}; -specularPower = 0.0; +specular[] = {0.93, 0.93, 0.93, 1.0}; +specularPower = 200.0; PixelShaderID = "Super"; VertexShaderID = "Super"; + class Stage1 { - texture = "z\ace\addons\spottingscope\data\spot_scope_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 = "z\ace\addons\apl\data\metal4_weapons_vehicles_int_512_dt.paa"; - uvSource = "tex"; - class uvTransform { - aside[] = {6.0, 0.0, 0.0}; - up[] = {0.0, 6.0, 0.0}; - dir[] = {0.0, 0.0, 0.0}; - pos[] = {0.0, 0.0, 0.0}; - }; -}; -class Stage3 { - texture = "#(argb,8,8,3)color(0,0,0,0)"; - 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(0,1,1,1)"; + texture="z\ace\addons\minedetector\data\ace_vmh3_nohq.paa"; uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; @@ -46,19 +18,59 @@ class Stage4 { pos[] = {0.0, 0.0, 0.0}; }; }; -class Stage5 { - texture = "z\ace\addons\spottingscope\data\spot_scope_smdi.paa"; - uvSource="tex"; + +class Stage2 { + texture = "a3\weapons_f\data\detailmaps\metal_detail_dt.paa"; + uvSource = "tex"; + class uvTransform { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,0}; - pos[]={0,0,0}; + aside[] = {6.0, 0.0, 0.0}; + up[] = {0.0, 3.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; }; }; -class Stage6 { - texture = "#(ai,32,128,1)fresnel(1.58,0.01)"; + +class Stage3 { + texture = "#(argb,8,8,3)color(0,0,0,0,MC)"; uvSource = "tex"; + + class uvTransform { + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; + }; +}; + +class Stage4 { + texture = "#(argb,8,8,3)color(1,0,0,1,AS)"; + uvSource = "tex"; + + class uvTransform { + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; + }; +}; + +class Stage5 { + texture="z\ace\addons\minedetector\data\ace_vmh3_smdi.paa"; + uvSource = "tex"; + + class uvTransform { + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; + }; +}; + +class Stage6 { + texture = "#(ai,64,64,1)fresnel(1.29,0.5)"; + uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; @@ -70,10 +82,11 @@ class Stage6 { class Stage7 { texture = "a3\data_f\env_land_co.paa"; uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; dir[] = {0.0, 0.0, 0.0}; pos[] = {0.0, 0.0, 0.0}; }; -}; +}; \ No newline at end of file diff --git a/addons/minedetector/data/ace_vmh3_co.paa b/addons/minedetector/data/ace_vmh3_co.paa new file mode 100644 index 0000000000..da4cf3ac6e Binary files /dev/null and b/addons/minedetector/data/ace_vmh3_co.paa differ diff --git a/addons/minedetector/data/ace_vmh3_nohq.paa b/addons/minedetector/data/ace_vmh3_nohq.paa new file mode 100644 index 0000000000..e58b063d7b Binary files /dev/null and b/addons/minedetector/data/ace_vmh3_nohq.paa differ diff --git a/addons/minedetector/data/ace_vmh3_smdi.paa b/addons/minedetector/data/ace_vmh3_smdi.paa new file mode 100644 index 0000000000..9cbdbedfad Binary files /dev/null and b/addons/minedetector/data/ace_vmh3_smdi.paa differ diff --git a/addons/spottingscope/data/spot_scope.rvmat b/addons/minedetector/data/ace_vmm3.rvmat similarity index 57% rename from addons/spottingscope/data/spot_scope.rvmat rename to addons/minedetector/data/ace_vmm3.rvmat index 294d3a75b2..e62993f4e3 100644 --- a/addons/spottingscope/data/spot_scope.rvmat +++ b/addons/minedetector/data/ace_vmm3.rvmat @@ -2,43 +2,51 @@ ambient[] = {1.0, 1.0, 1.0, 1.0}; diffuse[] = {1.0, 1.0, 1.0, 1.0}; forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0}; emmisive[] = {0.0, 0.0, 0.0, 1.0}; -specular[] = {0.0, 0.0, 0.0, 0.0}; -specularPower = 0.0; +specular[] = {0.93, 0.93, 0.93, 1.0}; +specularPower = 200.0; PixelShaderID = "Super"; VertexShaderID = "Super"; + class Stage1 { - texture = "z\ace\addons\spottingscope\data\spot_scope_nohq.paa"; - uvSource="tex"; + texture="z\ace\addons\minedetector\data\ace_vmm3_nohq.paa"; + uvSource = "tex"; + class uvTransform { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,0}; - pos[]={0,0,0}; + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; }; }; + class Stage2 { - texture = "z\ace\addons\apl\data\plastic_512_dt.paa"; + texture = "a3\weapons_f\data\detailmaps\metal_detail_dt.paa"; uvSource = "tex"; + class uvTransform { aside[] = {6.0, 0.0, 0.0}; - up[] = {0.0, 6.0, 0.0}; + up[] = {0.0, 3.0, 0.0}; dir[] = {0.0, 0.0, 0.0}; pos[] = {0.0, 0.0, 0.0}; }; }; + class Stage3 { - texture = "#(argb,8,8,3)color(0,0,0,0)"; + 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}; + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; }; }; + class Stage4 { - texture = "#(argb,8,8,3)color(0,1,1,1)"; + texture = "#(argb,8,8,3)color(1,0,0,1,AS)"; uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; @@ -46,19 +54,11 @@ class Stage4 { pos[] = {0.0, 0.0, 0.0}; }; }; + class Stage5 { - texture = "z\ace\addons\spottingscope\data\spot_scope_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,32,128,1)fresnel(1.58,0.01)"; + texture="z\ace\addons\minedetector\data\ace_vmm3_smdi.paa"; uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; @@ -66,13 +66,27 @@ class Stage6 { pos[] = {0.0, 0.0, 0.0}; }; }; + +class Stage6 { + texture = "#(ai,64,64,1)fresnel(1.29,0.5)"; + uvSource = "tex"; + + class uvTransform { + aside[] = {1.0, 0.0, 0.0}; + up[] = {0.0, 1.0, 0.0}; + dir[] = {0.0, 0.0, 0.0}; + pos[] = {0.0, 0.0, 0.0}; + }; +}; + class Stage7 { texture = "a3\data_f\env_land_co.paa"; uvSource = "tex"; + class uvTransform { aside[] = {1.0, 0.0, 0.0}; up[] = {0.0, 1.0, 0.0}; dir[] = {0.0, 0.0, 0.0}; pos[] = {0.0, 0.0, 0.0}; }; -}; +}; \ No newline at end of file diff --git a/addons/minedetector/data/ace_vmm3_co.paa b/addons/minedetector/data/ace_vmm3_co.paa new file mode 100644 index 0000000000..dbd9885016 Binary files /dev/null and b/addons/minedetector/data/ace_vmm3_co.paa differ diff --git a/addons/minedetector/data/ace_vmm3_nohq.paa b/addons/minedetector/data/ace_vmm3_nohq.paa new file mode 100644 index 0000000000..b4239ee8b0 Binary files /dev/null and b/addons/minedetector/data/ace_vmm3_nohq.paa differ diff --git a/addons/minedetector/data/ace_vmm3_smdi.paa b/addons/minedetector/data/ace_vmm3_smdi.paa new file mode 100644 index 0000000000..b202f5991c Binary files /dev/null and b/addons/minedetector/data/ace_vmm3_smdi.paa differ diff --git a/addons/minedetector/data/equip/w_vmh3_ca.paa b/addons/minedetector/data/equip/w_vmh3_ca.paa new file mode 100644 index 0000000000..10d79f16db Binary files /dev/null and b/addons/minedetector/data/equip/w_vmh3_ca.paa differ diff --git a/addons/minedetector/data/equip/w_vmm3_ca.paa b/addons/minedetector/data/equip/w_vmm3_ca.paa new file mode 100644 index 0000000000..8e75581652 Binary files /dev/null and b/addons/minedetector/data/equip/w_vmm3_ca.paa differ diff --git a/addons/minedetector/functions/fnc_activateDetector.sqf b/addons/minedetector/functions/fnc_activateDetector.sqf new file mode 100644 index 0000000000..f22dae1ee9 --- /dev/null +++ b/addons/minedetector/functions/fnc_activateDetector.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Activate the mine detector + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_minedetector_fnc_activateDetector + * + * Public: No + */ + +#include "script_component.hpp" + +if (call FUNC(canActivateDetector)) then { + [ACE_player, currentWeapon ACE_player] call FUNC(enableDetector); +}; diff --git a/addons/minedetector/functions/fnc_canActivateDetector.sqf b/addons/minedetector/functions/fnc_canActivateDetector.sqf new file mode 100644 index 0000000000..7caf22d95c --- /dev/null +++ b/addons/minedetector/functions/fnc_canActivateDetector.sqf @@ -0,0 +1,19 @@ +/* + * Author: Glowbal + * Check if the mine detector can be activated + * + * Arguments: + * None + * + * Return Value: + * Can be activated + * + * Example: + * [] call ace_minedetector_fnc_canActivateDetector + * + * Public: No + */ + +#include "script_component.hpp" + +([ACE_player] call FUNC(hasDetector)) && !([ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled)); diff --git a/addons/minedetector/functions/fnc_canDeactivateDetector.sqf b/addons/minedetector/functions/fnc_canDeactivateDetector.sqf new file mode 100644 index 0000000000..3423d0685c --- /dev/null +++ b/addons/minedetector/functions/fnc_canDeactivateDetector.sqf @@ -0,0 +1,19 @@ +/* + * Author: Glowbal + * Check if the mine detector can be deactivated + * + * Arguments: + * None + * + * Return Value: + * Can be deactivated + * + * Example: + * [] call ace_minedetector_fnc_canDeactivateDetector + * + * Public: No + */ + +#include "script_component.hpp" + +([ACE_player] call FUNC(hasDetector)) && {[ACE_player, currentWeapon ACE_player] call FUNC(isDetectorEnabled)}; diff --git a/addons/minedetector/functions/fnc_deactivateDetector.sqf b/addons/minedetector/functions/fnc_deactivateDetector.sqf new file mode 100644 index 0000000000..05ce00d978 --- /dev/null +++ b/addons/minedetector/functions/fnc_deactivateDetector.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Deactivate the mine detector + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * [] call ace_minedetector_fnc_deactivateDetector + * + * Public: No + */ + +#include "script_component.hpp" + +if (call FUNC(canDeactivateDetector)) then { + [ACE_player, currentWeapon ACE_player] call FUNC(disableDetector); +}; diff --git a/addons/minedetector/functions/fnc_detectorLoop.sqf b/addons/minedetector/functions/fnc_detectorLoop.sqf new file mode 100644 index 0000000000..4a708147e2 --- /dev/null +++ b/addons/minedetector/functions/fnc_detectorLoop.sqf @@ -0,0 +1,55 @@ +/* + * Author: Glowbal + * Handle mine detection in a PFH loop + * + * Arguments: + * 0: args + * 1: PHD Id + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_args", "_idPFH"]; +_args params ["_unit", "_type", "_detectorConfig", "_lastPlayed"]; + +if !([_unit, _type] call FUNC(hasDetector)) exitWith { + // disable detector type + [_unit, _type] call FUNC(disableDetector); + [_idPFH] call CBA_fnc_removePerFrameHandler; +}; + +if (!alive _unit) exitWith { + [_unit, _type] call FUNC(disableDetector); + [_idPFH] call CBA_fnc_removePerFrameHandler; +}; + +if !([_unit, _type] call FUNC(isDetectorEnabled)) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; +}; + +if (ACE_player == _unit && {currentWeapon _unit == _type}) then { + private _detected = [_unit, _detectorConfig] call FUNC(getDetectedObject); + _detected params ["_hasDetected", "_object", "_distance"]; + private _distanceTiming = switch (true) do { + case (_distance >= 2): {1}; + case (_distance >= 1.25): {0.85}; + case (_distance >= 0.75): {0.7}; + default {0.5}; + }; + if (_hasDetected && {(CBA_missionTime - _lastPlayed > _distanceTiming)}) then { + _args set [3, CBA_missionTime]; + _detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"]; + private _sound = switch (true) do { + case (_distance >= 2): {_sounds select 3}; + case (_distance >= 1.25): {_sounds select 2}; + case (_distance >= 0.5): {_sounds select 1}; + default {_sounds select 0}; + }; + [_unit, _sound, true] call FUNC(playDetectorSound); + }; +}; diff --git a/addons/minedetector/functions/fnc_disableDetector.sqf b/addons/minedetector/functions/fnc_disableDetector.sqf new file mode 100644 index 0000000000..a4e755e6c3 --- /dev/null +++ b/addons/minedetector/functions/fnc_disableDetector.sqf @@ -0,0 +1,24 @@ +/* + * Author: Glowbal + * Disables the mine detector + * + * Arguments: + * 0: Unit + * 1: detecter type + * + * Return Value: + * None + * + * Example: + * [UNIT, DETECTOR_CLASS_NAME] call ace_minedetector_fnc_disableDetector + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_detectorType"]; + +_unit setVariable [format[QGVAR(enable_%1), _detectorType], false]; + +[QGVAR(detectorDisabled), [_unit, _detectorType]] call CBA_fnc_localEvent; diff --git a/addons/minedetector/functions/fnc_enableDetector.sqf b/addons/minedetector/functions/fnc_enableDetector.sqf new file mode 100644 index 0000000000..e8440a730b --- /dev/null +++ b/addons/minedetector/functions/fnc_enableDetector.sqf @@ -0,0 +1,24 @@ +/* + * Author: Glowbal + * Enables the mine detector + * + * Arguments: + * 0: Unit + * 1: detecter type + * + * Return Value: + * None + * + * Example: + * [UNIT, DETECTOR_CLASS_NAME] call ace_minedetector_fnc_enableDetector + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_detectorType"]; + +_unit setVariable [format[QGVAR(enable_%1), _detectorType], true]; + +[QGVAR(detectorEnabled), [_unit, _detectorType]] call CBA_fnc_localEvent; diff --git a/addons/minedetector/functions/fnc_getDetectedObject.sqf b/addons/minedetector/functions/fnc_getDetectedObject.sqf new file mode 100644 index 0000000000..79c20964ca --- /dev/null +++ b/addons/minedetector/functions/fnc_getDetectedObject.sqf @@ -0,0 +1,64 @@ +/* + * Author: Glowbal + * Enables the mine detector + * + * Arguments: + * 0: Unit + * 1: Configuration + * + * Return Value: + * [isDetected , mine , distance ] + * + * Example: + * [ace_player, DETECTOR_CONFIG] call ace_minedetector_fnc_getDetectedObject + * + * Public: No + */ + +#define __DR 1.3 + +#include "script_component.hpp" + +params ["_unit", "_detectorConfig"]; +_detectorConfig params ["_type", "_radius", "_detectableTypes", "_sounds"]; + +private _worldPosition = _unit modelToWorld (_unit selectionPosition "granat"); +private _direction = _unit weaponDirection "Put"; + +private _detectorPointAGL = _worldPosition vectorAdd (_direction vectorMultiply __DR); + +private _nearestObjects = nearestObjects [_detectorPointAGL, [], _radius]; + +#ifdef DEBUG_MODE_FULL +GVAR(debugDetector) = [_detectorPointAGL, _nearestObjects]; +#endif + +private _isDetectable = false; +private _mine = objNull; +private _distance = -1; + +{ + private _object = _x; + + if ({_object isKindOf _x} count _detectableTypes > 0) then { + //Try all unprepared mines in range and use first detectable one: + if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _x) >> QGVAR(detectable))) == 1) exitWith { + _isDetectable = true; + _mine = _x; + _distance = _detectorPointAGL distance _x; + }; + //Try all prepared mines in range and use first detectable one: + if ((getNumber (configFile >> "CfgAmmo" >> (typeOf _x) >> QGVAR(detectable))) == 1) exitWith { + _isDetectable = true; + _mine = _x; + _distance = _detectorPointAGL distance _x; + }; + }; + + if (!isNull _mine) exitWith {}; + +} forEach _nearestObjects; + +TRACE_3("return",_isDetectable,_mine,_distance); + +[_isDetectable, _mine, _distance]; diff --git a/addons/minedetector/functions/fnc_getDetectorConfig.sqf b/addons/minedetector/functions/fnc_getDetectorConfig.sqf new file mode 100644 index 0000000000..87b9d0a88a --- /dev/null +++ b/addons/minedetector/functions/fnc_getDetectorConfig.sqf @@ -0,0 +1,31 @@ +/* + * Author: Glowbal + * Get the mine detector configuration from the config file + * + * Arguments: + * 0: Detector class name + * + * Return Value: + * Detector configuration or empty array if invalid + * + * Example: + * ["my_detector"] call ace_minedetector_fnc_getDetectorConfig + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_detectorType"]; + +private _config = (configFile >> "ACE_detector" >> "detectors" >> _detectorType); +if (isClass _config) then { + [ + _detectorType, + getNumber (_config >> "radius"), + GVAR(ALL_DETECTABLE_TYPES), // TODO read from config and use this as a back up value instead + getArray (_config >> "sounds") + ]; +} else { + []; +}; diff --git a/addons/minedetector/functions/fnc_hasDetector.sqf b/addons/minedetector/functions/fnc_hasDetector.sqf new file mode 100644 index 0000000000..fcd6eb1c19 --- /dev/null +++ b/addons/minedetector/functions/fnc_hasDetector.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Check if unit has a mine detector in hands + * + * Arguments: + * 0: Unit + * + * Return Value: + * Current weapon is a mine detector + * + * Example: + * [ace_player] call ace_minedetector_fnc_hasDetector + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit"]; + +!(([currentWeapon _unit] call FUNC(getDetectorConfig)) isEqualTo []); diff --git a/addons/minedetector/functions/fnc_isDetectorEnabled.sqf b/addons/minedetector/functions/fnc_isDetectorEnabled.sqf new file mode 100644 index 0000000000..9e75788794 --- /dev/null +++ b/addons/minedetector/functions/fnc_isDetectorEnabled.sqf @@ -0,0 +1,21 @@ +/* + * Author: Glowbal + * Check if the mine detector is enabled + * + * Arguments: + * 0: detecter type + * + * Return Value: + * None + * + * Example: + * ["example"] call ace_minedetector_fnc_[functionName] + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_detectorType"]; + +alive _unit && {(_unit getVariable [format[QGVAR(enable_%1), _detectorType], false])}; diff --git a/addons/minedetector/functions/fnc_playDetectorSound.sqf b/addons/minedetector/functions/fnc_playDetectorSound.sqf new file mode 100644 index 0000000000..4da6b5f45c --- /dev/null +++ b/addons/minedetector/functions/fnc_playDetectorSound.sqf @@ -0,0 +1,42 @@ +/* + * Author: Glowbal + * Play the detector sound + * + * Arguments: + * 0: Unit + * 1: Sound class name + * + * Return Value: + * None + * + * Example: + * [player, "ace_buzz_1"] call ace_minedetector_fnc_playDetectorSound + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit", "_detectorSound"]; + +if (isNull _unit) exitWith { + ACE_LOGERROR_1("unit does not exist [%1]",_unit); +}; +if (!alive _unit) exitWith { + ACE_LOGERROR_1("unit is not alive [%1]",_unit); +}; + +private _helperObject = _unit getVariable [QGVAR(helperLogic), objNull]; +if (!isNull _helperObject) then { + deleteVehicle _helperObject; +}; +_helperObject = "ACE_LogicDummy" createVehicleLocal (getPos _unit); + +if !(isNull _helperObject) then { + _helperObject attachTo [_unit,[0,0,-3],""]; + _unit setVariable [QGVAR(helperLogic), _helperObject]; + + [_helperObject, _unit] say3D _detectorSound; +} else { + ACE_LOGERROR_1("helper does not exist [%1]",_helperObject); +}; diff --git a/addons/minedetector/functions/script_component.hpp b/addons/minedetector/functions/script_component.hpp new file mode 100644 index 0000000000..03333c8bae --- /dev/null +++ b/addons/minedetector/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\minedetector\script_component.hpp" diff --git a/addons/minedetector/script_component.hpp b/addons/minedetector/script_component.hpp new file mode 100644 index 0000000000..935825a31c --- /dev/null +++ b/addons/minedetector/script_component.hpp @@ -0,0 +1,18 @@ +#define COMPONENT minedetector +#define COMPONENT_BEAUTIFIED Mine Detector +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_MINEDETECTOR + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MINEDETECTOR + #define DEBUG_SETTINGS DEBUG_SETTINGS_MINEDETECTOR +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/minedetector/sounds/metal_detector.wav b/addons/minedetector/sounds/metal_detector.wav new file mode 100644 index 0000000000..0e4076725f Binary files /dev/null and b/addons/minedetector/sounds/metal_detector.wav differ diff --git a/addons/minedetector/stringtable.xml b/addons/minedetector/stringtable.xml new file mode 100644 index 0000000000..e78c34dab8 --- /dev/null +++ b/addons/minedetector/stringtable.xml @@ -0,0 +1,17 @@ + + + + + Metal detector + Détecteur de métaux + + + Activate Detector + Activer le détecteur + + + Deactivate Detector + Désactiver le détecteur + + + \ No newline at end of file diff --git a/addons/minedetector/ui/icon_mineDetectorOff.paa b/addons/minedetector/ui/icon_mineDetectorOff.paa new file mode 100644 index 0000000000..23e029c2f0 Binary files /dev/null and b/addons/minedetector/ui/icon_mineDetectorOff.paa differ diff --git a/addons/minedetector/ui/icon_mineDetectorOn.paa b/addons/minedetector/ui/icon_mineDetectorOn.paa new file mode 100644 index 0000000000..3c45c7b89e Binary files /dev/null and b/addons/minedetector/ui/icon_mineDetectorOn.paa differ diff --git a/addons/missileguidance/ACE_GuidanceConfig.hpp b/addons/missileguidance/ACE_GuidanceConfig.hpp index 96e417a7e8..f202e7d161 100644 --- a/addons/missileguidance/ACE_GuidanceConfig.hpp +++ b/addons/missileguidance/ACE_GuidanceConfig.hpp @@ -1,61 +1,61 @@ -class GVAR(AttackProfiles) { - class LIN { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_LIN); - }; - class DIR { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_DIR); - }; - class MID { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_MID); - }; - class HI { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_HI); - }; - class JAV_DIR { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_JAV_DIR); - }; - class JAV_TOP { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(attackProfile_JAV_TOP); - }; -}; - -class GVAR(SeekerTypes) { - class SALH { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(seekerType_SALH); - }; - class Optic { - name = ""; - visualName = ""; - description = ""; - - functionName = QFUNC(seekerType_Optic); - }; -}; +class GVAR(AttackProfiles) { + class LIN { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_LIN); + }; + class DIR { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_DIR); + }; + class MID { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_MID); + }; + class HI { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_HI); + }; + class JAV_DIR { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_JAV_DIR); + }; + class JAV_TOP { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(attackProfile_JAV_TOP); + }; +}; + +class GVAR(SeekerTypes) { + class SALH { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(seekerType_SALH); + }; + class Optic { + name = ""; + visualName = ""; + description = ""; + + functionName = QFUNC(seekerType_Optic); + }; +}; diff --git a/addons/missileguidance/ACE_Settings.hpp b/addons/missileguidance/ACE_Settings.hpp index 2ec3326a98..e73d533c08 100644 --- a/addons/missileguidance/ACE_Settings.hpp +++ b/addons/missileguidance/ACE_Settings.hpp @@ -1,10 +1,10 @@ -class ACE_Settings { - class GVAR(enabled) { - value = 2; - typeName = "SCALAR"; - isClientSettable = 1; - displayName = CSTRING(Title); - description = CSTRING(Desc); - values[] = {CSTRING(Off), CSTRING(PlayerOnly), CSTRING(PlayerAndAi)}; - }; +class ACE_Settings { + class GVAR(enabled) { + value = 2; + typeName = "SCALAR"; + isClientSettable = 1; + displayName = CSTRING(Title); + description = CSTRING(Desc); + values[] = {CSTRING(Off), CSTRING(PlayerOnly), CSTRING(PlayerAndAi)}; + }; }; \ No newline at end of file diff --git a/addons/missileguidance/CfgAmmo.hpp b/addons/missileguidance/CfgAmmo.hpp index 9fbc25a7db..31fc4f3cd8 100644 --- a/addons/missileguidance/CfgAmmo.hpp +++ b/addons/missileguidance/CfgAmmo.hpp @@ -1,151 +1,150 @@ -class CfgAmmo { - class MissileBase; - - class M_PG_AT: MissileBase { - model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; - proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; - - irLock = 0; - laserLock = 1; - airLock = 0; - weaponLockSystem = "4 + 16"; - - maxSpeed = 720; - maxControlRange = 5000; - maneuvrability = 8; - timeToLive = 60; - simulationStep = 0.01; - airFriction = 0.1; - sideAirFriction = 0.16; - initTime = 0.002; - thrustTime = 1.07; - thrust = 530; - fuseDistance = 2; - - effectsMissileInit = "MissileDAR1"; - effectsMissile = "missile2"; - whistleDist = 4; - muzzleEffect = ""; - - // Turn off arma crosshair-guidance - manualControl = 0; - - // ACE uses these values - trackOversteer = 1; - trackLead = 0; - }; - - class ACE_Hydra70_DAGR: M_PG_AT { - displayName = CSTRING(Hydra70_DAGR); - displayNameShort = CSTRING(Hydra70_DAGR_Short); - - description = CSTRING(Hydra70_DAGR_Desc); - descriptionShort = CSTRING(Hydra70_DAGR_Desc); - - EGVAR(rearm,caliber) = 70; - - class ADDON { - enabled = 1; - - minDeflection = 0.00025; // Minium flap deflection for guidance - maxDeflection = 0.001; // Maximum flap deflection for guidance - incDeflection = 0.0005; // The incrmeent in which deflection adjusts. - - canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode - - // Guidance type for munitions - defaultSeekerType = "SALH"; - seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; - - defaultSeekerLockMode = "LOAL"; - seekerLockModes[] = { "LOAL", "LOBL" }; - - seekerAngle = 90; // Angle in front of the missile which can be searched - seekerAccuracy = 1; // seeker accuracy multiplier - - seekerMinRange = 1; - seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - - // Attack profile type selection - defaultAttackProfile = "LIN"; - attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; - }; - }; - - class ACE_Hellfire_AGM114K: ACE_Hydra70_DAGR { - displayName = CSTRING(Hellfire_AGM114K); - displayNameShort = CSTRING(Hellfire_AGM114K_Short); - - description = CSTRING(Hellfire_AGM114K_desc); - descriptionShort = CSTRING(Hellfire_AGM114K_desc); - - // @TODO: placeholder model to at least make it look different - model = "\A3\Weapons_F\Ammo\Missile_AT_03_fly_F"; - proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_03_F"; - - hit = 1400; - indirectHit = 71; - indirectHitRange = 4.5; - effectsMissile = "missile2"; - - //Explicity add guidance config - class ADDON: ADDON {}; - }; - - // Titan - class M_Titan_AT: MissileBase {}; - - class ACE_Javelin_FGM148: M_Titan_AT { - irLock = 0; - laserLock = 0; - airLock = 0; - - // Turn off arma crosshair-guidance - manualControl = 0; - - hit = 1400; // default: 800 - indirectHit = 20; - indirectHitRange = 2; - // ACE uses these values - //trackOversteer = 1; - //trackLead = 0; - - initTime = 2; - - // Begin ACE guidance Configs - class ADDON { - enabled = 1; - - minDeflection = 0.00005; // Minium flap deflection for guidance - maxDeflection = 0.025; // Maximum flap deflection for guidance - incDeflection = 0.00005; // The incrmeent in which deflection adjusts. - - canVanillaLock = 0; - - // Guidance type for munitions - defaultSeekerType = "Optic"; - seekerTypes[] = { "Optic" }; - - defaultSeekerLockMode = "LOBL"; - seekerLockModes[] = { "LOBL" }; - - seekerAngle = 180; // Angle in front of the missile which can be searched - seekerAccuracy = 1; // seeker accuracy multiplier - - seekerMinRange = 0; - seekerMaxRange = 2500; // Range from the missile which the seeker can visually search - - // Attack profile type selection - defaultAttackProfile = "JAV_TOP"; - attackProfiles[] = { "JAV_TOP", "JAV_DIR" }; - }; - }; - class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 { - //Take config changes from (M_Titan_AT_static: M_Titan_AT) - initTime = 0.25; //"How long (in seconds) the projectile waits before starting it's engine.", - but doesn't seem to do anything - effectsMissileInit = "RocketBackEffectsStaticRPG"; - - //Explicity add guidance config - class ADDON: ADDON {}; - }; -}; +class CfgAmmo { + class MissileBase; + + class M_PG_AT: MissileBase { + model = "\A3\Weapons_F\Ammo\Rocket_01_fly_F"; + proxyShape = "\A3\Weapons_F\Ammo\Rocket_01_F"; + + // Reenable this settings when ACE laser targeting and missile guidance is reenabled + laserLock = 1; //laserLock = 1; + airLock = 0; //airLock = 0; + weaponLockSystem = "4 + 16"; //irLock = 0; + //weaponLockSystem = "4 + 16"; + //fuseDistance = 2; + //timeToLive = 60; + // Turn off arma crosshair-guidance + //manualControl = 0; + // ACE uses these values + //trackOversteer = 1; + //trackLead = 0; + + maxSpeed = 720; + maxControlRange = 5000; + maneuvrability = 8; + simulationStep = 0.01; + airFriction = 0.1; + sideAirFriction = 0.16; + initTime = 0.002; + thrustTime = 1.07; + thrust = 530; + + effectsMissileInit = "MissileDAR1"; + effectsMissile = "missile2"; + whistleDist = 4; + muzzleEffect = ""; + }; + + class ACE_Hydra70_DAGR: M_PG_AT { + displayName = CSTRING(Hydra70_DAGR); + displayNameShort = CSTRING(Hydra70_DAGR_Short); + + description = CSTRING(Hydra70_DAGR_Desc); + descriptionShort = CSTRING(Hydra70_DAGR_Desc); + + EGVAR(rearm,caliber) = 70; + + class ADDON { + enabled = 1; + + minDeflection = 0.00025; // Minium flap deflection for guidance + maxDeflection = 0.001; // Maximum flap deflection for guidance + incDeflection = 0.0005; // The incrmeent in which deflection adjusts. + + canVanillaLock = 0; // Can this default vanilla lock? Only applicable to non-cadet mode + + // Guidance type for munitions + defaultSeekerType = "SALH"; + seekerTypes[] = { "SALH", "LIDAR", "SARH", "Optic", "Thermal", "GPS", "SACLOS", "MCLOS" }; + + defaultSeekerLockMode = "LOAL"; + seekerLockModes[] = { "LOAL", "LOBL" }; + + seekerAngle = 90; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 1; + seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "LIN"; + attackProfiles[] = { "LIN", "DIR", "MID", "HI" }; + }; + }; + + class ACE_Hellfire_AGM114K: ACE_Hydra70_DAGR { + displayName = CSTRING(Hellfire_AGM114K); + displayNameShort = CSTRING(Hellfire_AGM114K_Short); + + description = CSTRING(Hellfire_AGM114K_desc); + descriptionShort = CSTRING(Hellfire_AGM114K_desc); + + // @TODO: placeholder model to at least make it look different + model = "\A3\Weapons_F\Ammo\Missile_AT_03_fly_F"; + proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_03_F"; + + hit = 1400; + indirectHit = 71; + indirectHitRange = 4.5; + effectsMissile = "missile2"; + + //Explicity add guidance config + class ADDON: ADDON {}; + }; + + // Titan + class M_Titan_AT: MissileBase {}; + + class ACE_Javelin_FGM148: M_Titan_AT { + irLock = 0; + laserLock = 0; + airLock = 0; + + // Turn off arma crosshair-guidance + manualControl = 0; + + hit = 1400; // default: 800 + indirectHit = 20; + indirectHitRange = 2; + // ACE uses these values + //trackOversteer = 1; + //trackLead = 0; + + initTime = 2; + + // Begin ACE guidance Configs + class ADDON { + enabled = 1; + + minDeflection = 0.00005; // Minium flap deflection for guidance + maxDeflection = 0.025; // Maximum flap deflection for guidance + incDeflection = 0.00005; // The incrmeent in which deflection adjusts. + + canVanillaLock = 0; + + // Guidance type for munitions + defaultSeekerType = "Optic"; + seekerTypes[] = { "Optic" }; + + defaultSeekerLockMode = "LOBL"; + seekerLockModes[] = { "LOBL" }; + + seekerAngle = 180; // Angle in front of the missile which can be searched + seekerAccuracy = 1; // seeker accuracy multiplier + + seekerMinRange = 0; + seekerMaxRange = 2500; // Range from the missile which the seeker can visually search + + // Attack profile type selection + defaultAttackProfile = "JAV_TOP"; + attackProfiles[] = { "JAV_TOP", "JAV_DIR" }; + }; + }; + class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 { + //Take config changes from (M_Titan_AT_static: M_Titan_AT) + initTime = 0.25; //"How long (in seconds) the projectile waits before starting it's engine.", - but doesn't seem to do anything + effectsMissileInit = "RocketBackEffectsStaticRPG"; + + //Explicity add guidance config + class ADDON: ADDON {}; + }; +}; diff --git a/addons/missileguidance/CfgEventhandlers.hpp b/addons/missileguidance/CfgEventhandlers.hpp index 5ec1d7d652..7fba1f43c4 100644 --- a/addons/missileguidance/CfgEventhandlers.hpp +++ b/addons/missileguidance/CfgEventhandlers.hpp @@ -1,30 +1,30 @@ - -class Extended_PreStart_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preStart)); - }; -}; - -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - }; -}; - -class Extended_FiredBIS_EventHandlers { - class All { - ADDON = QUOTE(_this call FUNC(onFired)); - }; -}; - -class Extended_IncomingMissile_EventHandlers { - class All { - ADDON = QUOTE(_this call FUNC(onIncomingMissile)); - }; -}; + +class Extended_PreStart_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preStart)); + }; +}; + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + }; +}; + +class Extended_FiredBIS_EventHandlers { + class All { + ADDON = QUOTE(_this call FUNC(onFired)); + }; +}; + +class Extended_IncomingMissile_EventHandlers { + class All { + ADDON = QUOTE(_this call FUNC(onIncomingMissile)); + }; +}; diff --git a/addons/missileguidance/CfgMagazines.hpp b/addons/missileguidance/CfgMagazines.hpp index a7e729cf32..e4a84862ae 100644 --- a/addons/missileguidance/CfgMagazines.hpp +++ b/addons/missileguidance/CfgMagazines.hpp @@ -1,53 +1,53 @@ -class CfgMagazines { - class 12Rnd_PG_missiles; - - class 6Rnd_ACE_Hydra70_DAGR : 12Rnd_PG_missiles { - ammo = "ACE_Hydra70_DAGR"; - count = 12; - displayName = "6 Round DAGR"; - displayNameShort = "6 Round DAGR"; - descriptionShort = "6 Round DAGR"; - weight = 36; - - }; - class 12Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { - count = 12; - displayName = "16 Round DAGR"; - displayNameShort = "16 Round DAGR"; - descriptionShort = "16 Round DAGR"; - weight = 72; - }; - class 24Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { - count = 24; - displayName = "24 Round DAGR"; - displayNameShort = "24 Round DAGR"; - descriptionShort = "24 Round DAGR"; - weight = 72; - }; - - // Hellfires - class 6Rnd_ACE_Hellfire_AGM114K : 12Rnd_PG_missiles { - count = 12; - ammo = "ACE_Hellfire_AGM114K"; - displayName = "6Rnd_ACE_Hellfire_AGM114K"; - displayNameShort = "6Rnd_ACE_Hellfire_AGM114K"; - descriptionShort = "6Rnd_ACE_Hellfire_AGM114K"; - weight = 36; - - }; - class 12Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { - count = 12; - displayName = "12Rnd_ACE_Hellfire_AGM114K"; - displayNameShort = "12Rnd_ACE_Hellfire_AGM114K"; - descriptionShort = "12Rnd_ACE_Hellfire_AGM114K"; - weight = 72; - }; - class 24Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { - count = 24; - displayName = "24Rnd_ACE_Hellfire_AGM114K"; - displayNameShort = "24Rnd_ACE_Hellfire_AGM114K"; - descriptionShort = "24Rnd_ACE_Hellfire_AGM114K"; - weight = 72; - }; - -}; +class CfgMagazines { + class 12Rnd_PG_missiles; + + class 6Rnd_ACE_Hydra70_DAGR : 12Rnd_PG_missiles { + ammo = "ACE_Hydra70_DAGR"; + count = 12; + displayName = "6 Round DAGR"; + displayNameShort = "6 Round DAGR"; + descriptionShort = "6 Round DAGR"; + weight = 36; + + }; + class 12Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { + count = 12; + displayName = "16 Round DAGR"; + displayNameShort = "16 Round DAGR"; + descriptionShort = "16 Round DAGR"; + weight = 72; + }; + class 24Rnd_ACE_Hydra70_DAGR : 6Rnd_ACE_Hydra70_DAGR { + count = 24; + displayName = "24 Round DAGR"; + displayNameShort = "24 Round DAGR"; + descriptionShort = "24 Round DAGR"; + weight = 72; + }; + + // Hellfires + class 6Rnd_ACE_Hellfire_AGM114K : 12Rnd_PG_missiles { + count = 12; + ammo = "ACE_Hellfire_AGM114K"; + displayName = "6Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "6Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "6Rnd_ACE_Hellfire_AGM114K"; + weight = 36; + + }; + class 12Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { + count = 12; + displayName = "12Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "12Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "12Rnd_ACE_Hellfire_AGM114K"; + weight = 72; + }; + class 24Rnd_ACE_Hellfire_AGM114K : 6Rnd_ACE_Hydra70_DAGR { + count = 24; + displayName = "24Rnd_ACE_Hellfire_AGM114K"; + displayNameShort = "24Rnd_ACE_Hellfire_AGM114K"; + descriptionShort = "24Rnd_ACE_Hellfire_AGM114K"; + weight = 72; + }; + +}; diff --git a/addons/missileguidance/CfgVehicles.hpp b/addons/missileguidance/CfgVehicles.hpp index 16b4b87767..be5c31a3f6 100644 --- a/addons/missileguidance/CfgVehicles.hpp +++ b/addons/missileguidance/CfgVehicles.hpp @@ -1,36 +1,36 @@ -class CfgVehicles { - - class AllVehicles; - class Air: AllVehicles { - class Turrets; - }; - - class Helicopter: Air { - class Turrets { - class MainTurret; - }; - }; - class Helicopter_Base_F: Helicopter {}; - class Heli_Attack_01_base_F: Helicopter_Base_F {}; - class B_Heli_Attack_01_F : Heli_Attack_01_base_F { - class Turrets: Turrets { - class MainTurret; - }; - }; - - class ACE_Comanche_Test : B_Heli_Attack_01_F { - scope = 1; - scopeCurator = 0; - displayName = "ACE_Comanche_Test"; - author = "ACE Team"; - class Library { - libTextDesc = "ACE_Comanche_Test"; - }; - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] = {"ACE_500Rnd_20mm_shells_Comanche", "24Rnd_ACE_Hellfire_AGM114K"}; - }; - }; - }; - -}; +class CfgVehicles { + + class AllVehicles; + class Air: AllVehicles { + class Turrets; + }; + + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + }; + class Helicopter_Base_F: Helicopter {}; + class Heli_Attack_01_base_F: Helicopter_Base_F {}; + class B_Heli_Attack_01_F : Heli_Attack_01_base_F { + class Turrets: Turrets { + class MainTurret; + }; + }; + + class ACE_Comanche_Test : B_Heli_Attack_01_F { + scope = 1; + scopeCurator = 0; + displayName = "ACE_Comanche_Test"; + author = "ACE Team"; + class Library { + libTextDesc = "ACE_Comanche_Test"; + }; + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] = {"ACE_500Rnd_20mm_shells_Comanche", "24Rnd_ACE_Hellfire_AGM114K"}; + }; + }; + }; + +}; diff --git a/addons/missileguidance/CfgWeapons.hpp b/addons/missileguidance/CfgWeapons.hpp index 178a55daf7..f57e3ab0df 100644 --- a/addons/missileguidance/CfgWeapons.hpp +++ b/addons/missileguidance/CfgWeapons.hpp @@ -1,12 +1,12 @@ -class Mode_SemiAuto; -class CfgWeapons { - class CannonCore; - class LauncherCore; - - class RocketPods: LauncherCore { - // canLock = 1; - }; - class missiles_DAGR : RocketPods { - canLock = 2; - }; -}; +class Mode_SemiAuto; +class CfgWeapons { + class CannonCore; + class LauncherCore; + + class RocketPods: LauncherCore { + // canLock = 1; + }; + class missiles_DAGR : RocketPods { + canLock = 2; + }; +}; diff --git a/addons/missileguidance/XEH_post_init.sqf b/addons/missileguidance/XEH_post_init.sqf index deaeef669d..282aac5503 100644 --- a/addons/missileguidance/XEH_post_init.sqf +++ b/addons/missileguidance/XEH_post_init.sqf @@ -1,3 +1,3 @@ -#include "script_component.hpp" - -[QGVAR(handoff), {_this call FUNC(handleHandoff)}] call EFUNC(common,addEventHandler); +#include "script_component.hpp" + +[QGVAR(handoff), {_this call FUNC(handleHandoff)}] call CBA_fnc_addEventHandler; diff --git a/addons/missileguidance/XEH_pre_init.sqf b/addons/missileguidance/XEH_pre_init.sqf index c3d42816c1..a7feade1c3 100644 --- a/addons/missileguidance/XEH_pre_init.sqf +++ b/addons/missileguidance/XEH_pre_init.sqf @@ -1,7 +1,7 @@ -#include "script_component.hpp" - -ADDON = false; - -#include "XEH_PREP.hpp" - -ADDON = true; +#include "script_component.hpp" + +ADDON = false; + +#include "XEH_PREP.hpp" + +ADDON = true; diff --git a/addons/missileguidance/config.cpp b/addons/missileguidance/config.cpp index 591a4f1c5e..c97a542a7f 100644 --- a/addons/missileguidance/config.cpp +++ b/addons/missileguidance/config.cpp @@ -1,20 +1,23 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {"ACE_Comanche_Test"}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_laser"}; - VERSION_CONFIG; - }; -}; - -#include "ACE_GuidanceConfig.hpp" -#include "ACE_Settings.hpp" - -#include "CfgEventhandlers.hpp" -#include "CfgAmmo.hpp" -#include "CfgMagazines.hpp" -#include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {"ACE_Comanche_Test"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_laser"}; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "ACE_GuidanceConfig.hpp" +#include "ACE_Settings.hpp" + +#include "CfgEventhandlers.hpp" +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgWeapons.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf index 498b754287..9909124e2f 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_AIR.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf index 498b754287..9909124e2f 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_DIR.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf index 498b754287..9909124e2f 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_HI.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_HI.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf index d84b3b126b..d3f095ee95 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf @@ -1,66 +1,66 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -#define STAGE_LAUNCH 1 -#define STAGE_CLIMB 2 -#define STAGE_COAST 3 -#define STAGE_TERMINAL 4 - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"]; -private["_cruisAlt", "_distanceShooterToTarget", "_shooterPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_state = _this select 2; -if( (count _state) < 1) then { - _state set[0, STAGE_LAUNCH]; -}; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; -_distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -// Add height depending on distance for compensate -_returnTargetPos = _seekerTargetPos; - -switch( (_state select 0) ) do { - case STAGE_LAUNCH: { - TRACE_1("STAGE_LAUNCH",""); - if(_distanceToShooter < 10) then { - _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2]; - } else { - _state set[0, STAGE_CLIMB]; - }; - }; - case STAGE_CLIMB: { - TRACE_1("STAGE_CLIMB",""); - _cruisAlt = 60 * (_distanceShooterToTarget/2000); - - if( ((ASLToATL _projectilePos) select 2) - ((ASLToATL _seekerTargetPos) select 2) >= _cruisAlt) then { - _state set[0, STAGE_TERMINAL]; - } else { - _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*1.5]; - }; - }; - case STAGE_TERMINAL: { - TRACE_1("STAGE_TERMINAL",""); - _returnTargetPos = _seekerTargetPos; - }; -}; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos), (ASLtoATL _seekerTargetPos), [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define STAGE_LAUNCH 1 +#define STAGE_CLIMB 2 +#define STAGE_COAST 3 +#define STAGE_TERMINAL 4 + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"]; +private["_cruisAlt", "_distanceShooterToTarget", "_shooterPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_state = _this select 2; +if( (count _state) < 1) then { + _state set[0, STAGE_LAUNCH]; +}; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; +_distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_returnTargetPos = _seekerTargetPos; + +switch( (_state select 0) ) do { + case STAGE_LAUNCH: { + TRACE_1("STAGE_LAUNCH",""); + if(_distanceToShooter < 10) then { + _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2]; + } else { + _state set[0, STAGE_CLIMB]; + }; + }; + case STAGE_CLIMB: { + TRACE_1("STAGE_CLIMB",""); + _cruisAlt = 60 * (_distanceShooterToTarget/2000); + + if( ((ASLToATL _projectilePos) select 2) - ((ASLToATL _seekerTargetPos) select 2) >= _cruisAlt) then { + _state set[0, STAGE_TERMINAL]; + } else { + _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*1.5]; + }; + }; + case STAGE_TERMINAL: { + TRACE_1("STAGE_TERMINAL",""); + _returnTargetPos = _seekerTargetPos; + }; +}; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos), (ASLtoATL _seekerTargetPos), [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); _returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf index 393abebc19..f26bcc58b0 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf @@ -1,84 +1,84 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -#define STAGE_LAUNCH 1 -#define STAGE_CLIMB 2 -#define STAGE_COAST 3 -#define STAGE_TERMINAL 4 - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"]; -private["_cruisAlt", "_distanceShooterToTarget", "_shooterPos"]; - -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_state = _this select 2; -if( (count _state) < 1) then { - _state set[0, STAGE_LAUNCH]; -}; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; -_distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; - -TRACE_2("", _distanceToTarget, _distanceToShooter); - -// Add height depending on distance for compensate -_returnTargetPos = _seekerTargetPos; - -switch( (_state select 0) ) do { - case STAGE_LAUNCH: { - TRACE_1("STAGE_LAUNCH",""); - if(_distanceToShooter < 10) then { - _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2]; - } else { - _state set[0, STAGE_CLIMB]; - }; - }; - case STAGE_CLIMB: { - TRACE_1("STAGE_CLIMB",""); - _cruisAlt = 140; - if(_distanceShooterToTarget < 1250) then { - _cruisAlt = 140 * (_distanceShooterToTarget/1250); - TRACE_1("_cruisAlt", _cruisAlt); - }; - if( ((ASLToATL _projectilePos) select 2) - ((ASLToATL _seekerTargetPos) select 2) >= _cruisAlt) then { - if(_cruisAlt < 140) then { - _state set[0, STAGE_TERMINAL]; - } else { - _state set[0, STAGE_COAST]; - }; - } else { - _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*1.5]; - }; - }; - case STAGE_COAST: { - TRACE_1("STAGE_COAST",""); - TRACE_1("", ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ); - if(_distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ) * 1.5) then { - _state set[0, STAGE_TERMINAL]; - } else { - _returnTargetPos = _seekerTargetPos vectorAdd [0,0,(_projectilePos select 2)]; - }; - }; - case STAGE_TERMINAL: { - TRACE_1("STAGE_TERMINAL",""); - //_returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget * 0.02]; - _returnTargetPos = _seekerTargetPos; - }; -}; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos), (ASLtoATL _seekerTargetPos), [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define STAGE_LAUNCH 1 +#define STAGE_CLIMB 2 +#define STAGE_COAST 3 +#define STAGE_TERMINAL 4 + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"]; +private["_cruisAlt", "_distanceShooterToTarget", "_shooterPos"]; + +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_state = _this select 2; +if( (count _state) < 1) then { + _state set[0, STAGE_LAUNCH]; +}; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; +_distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; + +TRACE_2("", _distanceToTarget, _distanceToShooter); + +// Add height depending on distance for compensate +_returnTargetPos = _seekerTargetPos; + +switch( (_state select 0) ) do { + case STAGE_LAUNCH: { + TRACE_1("STAGE_LAUNCH",""); + if(_distanceToShooter < 10) then { + _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2]; + } else { + _state set[0, STAGE_CLIMB]; + }; + }; + case STAGE_CLIMB: { + TRACE_1("STAGE_CLIMB",""); + _cruisAlt = 140; + if(_distanceShooterToTarget < 1250) then { + _cruisAlt = 140 * (_distanceShooterToTarget/1250); + TRACE_1("_cruisAlt", _cruisAlt); + }; + if( ((ASLToATL _projectilePos) select 2) - ((ASLToATL _seekerTargetPos) select 2) >= _cruisAlt) then { + if(_cruisAlt < 140) then { + _state set[0, STAGE_TERMINAL]; + } else { + _state set[0, STAGE_COAST]; + }; + } else { + _returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*1.5]; + }; + }; + case STAGE_COAST: { + TRACE_1("STAGE_COAST",""); + TRACE_1("", ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ); + if(_distanceToTarget < ( ((ASLToATL _projectilePos) select 2) - (( ASLToATL _seekerTargetPos) select 2) ) * 1.5) then { + _state set[0, STAGE_TERMINAL]; + } else { + _returnTargetPos = _seekerTargetPos vectorAdd [0,0,(_projectilePos select 2)]; + }; + }; + case STAGE_TERMINAL: { + TRACE_1("STAGE_TERMINAL",""); + //_returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget * 0.02]; + _returnTargetPos = _seekerTargetPos; + }; +}; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos), (ASLtoATL _seekerTargetPos), [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); _returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 8c67e68402..4369f37ef4 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -1,50 +1,50 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; -private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_shooterPos"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; - -_target = _launchParams select 0; -_targetLaunchParams = _launchParams select 1; - -_shooterPos = getPosASL _shooter; -_projectilePos = getPosASL _projectile; - -_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; -_distanceToShooter = _projectilePos vectorDistance _shooterPos; - -TRACE_3("", _distanceToTarget, _distanceToShooter, _seekerTargetPos); - -// Add height depending on distance for compensate -_addHeight = [0,0,0]; - -// Always climb an arc on initial launch if we are close to the round -if( ((ASLtoATL _projectilePos) select 2) < 5 && _distanceToShooter < 15) then { - _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; -} else { - // If we are below the target, increase the climbing arc - if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))]; - }; -}; - -// Handle arcing terminal low for high decent -if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { - _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; -} else { - if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { - _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; - }; -}; - -_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; - -#ifdef DEBUG_MODE_FULL -drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; -#endif - -TRACE_1("Adjusted target position", _returnTargetPos); +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"]; +private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_shooterPos"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; + +_target = _launchParams select 0; +_targetLaunchParams = _launchParams select 1; + +_shooterPos = getPosASL _shooter; +_projectilePos = getPosASL _projectile; + +_distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; +_distanceToShooter = _projectilePos vectorDistance _shooterPos; + +TRACE_3("", _distanceToTarget, _distanceToShooter, _seekerTargetPos); + +// Add height depending on distance for compensate +_addHeight = [0,0,0]; + +// Always climb an arc on initial launch if we are close to the round +if( ((ASLtoATL _projectilePos) select 2) < 5 && _distanceToShooter < 15) then { + _addHeight = _addHeight vectorAdd [0,0,_distanceToTarget]; +} else { + // If we are below the target, increase the climbing arc + if((_projectilePos select 2) < (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, ((_seekerTargetPos select 2) - (_projectilePos select 2))]; + }; +}; + +// Handle arcing terminal low for high decent +if( (_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget < 100) then { + _addHeight = _addHeight vectorDiff [0,0, ((_projectilePos select 2) - (_seekerTargetPos select 2)) * 0.5]; +} else { + if((_projectilePos select 2) > (_seekerTargetPos select 2) && _distanceToTarget > 100) then { + _addHeight = _addHeight vectorAdd [0,0, _distanceToTarget*0.02]; + }; +}; + +_returnTargetPos = _seekerTargetPos vectorAdd _addHeight; + +#ifdef DEBUG_MODE_FULL +drawLine3D [(ASLtoATL _returnTargetPos) vectorAdd _addHeight, ASLtoATL _returnTargetPos, [0,1,0,1]]; +#endif + +TRACE_1("Adjusted target position", _returnTargetPos); _returnTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf index 498b754287..9909124e2f 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_MID.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_MID.sqf @@ -1,4 +1,4 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + _this call FUNC(attackProfile_LIN); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_changeMissileDirection.sqf b/addons/missileguidance/functions/fnc_changeMissileDirection.sqf index fda7ba9d07..f5fdee95a0 100644 --- a/addons/missileguidance/functions/fnc_changeMissileDirection.sqf +++ b/addons/missileguidance/functions/fnc_changeMissileDirection.sqf @@ -1,11 +1,11 @@ -#include "script_component.hpp" -private ["_projectile", "_v", "_l", "_r"]; - -_projectile = _this select 0; -_v = _this select 1; - -_l = sqrt ((_v select 0) ^ 2 + (_v select 1) ^ 2); -_r = -(_v select 2) / _l; - -_projectile setVectorDirAndUp [ _v, [(_v select 0) * _r,(_v select 1) * _r, _l] ]; +#include "script_component.hpp" +private ["_projectile", "_v", "_l", "_r"]; + +_projectile = _this select 0; +_v = _this select 1; + +_l = sqrt ((_v select 0) ^ 2 + (_v select 1) ^ 2); +_r = -(_v select 2) / _l; + +_projectile setVectorDirAndUp [ _v, [(_v select 0) * _r,(_v select 1) * _r, _l] ]; _projectile setVelocity (_v vectorMultiply (vectorMagnitude (velocity _projectile))); \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_checkLos.sqf b/addons/missileguidance/functions/fnc_checkLos.sqf index f21a841367..d1123a95f2 100644 --- a/addons/missileguidance/functions/fnc_checkLos.sqf +++ b/addons/missileguidance/functions/fnc_checkLos.sqf @@ -1,29 +1,29 @@ -/* - * Author: jaynus - * Returns whether the seeker object can see the target position with lineIntersect - * - * Argument: - * 0: Seeker [Object] - * 1: Target [Object] - * - * Return value: - * Boolean - */ -#include "script_component.hpp" -private["_seeker", "_seekerPos", "_target", "_targetPos", "_return", "_vectorTo", "_searchPos"]; -_seeker = _this select 0; -_target = _this select 1; - -_targetPos = getPosASL _target; -_seekerPos = getPosASL _seeker; -_return = true; - -if(!(terrainIntersectASL [ _seekerPos, _targetPos])) then { - if(lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then { - _return = false; - }; -} else { - _return = false; -}; - +/* + * Author: jaynus + * Returns whether the seeker object can see the target position with lineIntersect + * + * Arguments: + * 0: Seeker [Object] + * 1: Target [Object] + * + * Return Value: + * Boolean + */ +#include "script_component.hpp" +private["_seeker", "_seekerPos", "_target", "_targetPos", "_return", "_vectorTo", "_searchPos"]; +_seeker = _this select 0; +_target = _this select 1; + +_targetPos = getPosASL _target; +_seekerPos = getPosASL _seeker; +_return = true; + +if(!(terrainIntersectASL [ _seekerPos, _targetPos])) then { + if(lineIntersects [_seekerPos, _targetPos, _seeker, _target]) then { + _return = false; + }; +} else { + _return = false; +}; + _return; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_checkSeekerAngle.sqf b/addons/missileguidance/functions/fnc_checkSeekerAngle.sqf index e8bc1a16f5..93cf40adfe 100644 --- a/addons/missileguidance/functions/fnc_checkSeekerAngle.sqf +++ b/addons/missileguidance/functions/fnc_checkSeekerAngle.sqf @@ -1,31 +1,31 @@ -/* - * Author: jaynus - * Returns whether the target position is within the maximum angle FOV of the provided seeker - * objects current direction. - * - * Argument: - * 0: Seeker [Object] - * 1: Target [Position] - * 2: Max Angle [Degrees] - * - * Return value: - * Boolean - */ - -#include "script_component.hpp" -private["_seeker", "_targetPos", "_seekerMaxAngle", "_sensorPos", "_testPointVector", "_testDotProduct"]; - -_seeker = _this select 0; -_targetPos = _this select 1; -_seekerMaxAngle = _this select 2; - -_sensorPos = getPosASL _seeker; - -_testPointVector = vectorNormalized (_targetPos vectorDiff _sensorPos); -_testDotProduct = (vectorNormalized (velocity _seeker)) vectorDotProduct _testPointVector; - -if(_testDotProduct < (cos _seekerMaxAngle)) exitWith { - false -}; - +/* + * Author: jaynus + * Returns whether the target position is within the maximum angle FOV of the provided seeker + * objects current direction. + * + * Arguments: + * 0: Seeker [Object] + * 1: Target [Position] + * 2: Max Angle [Degrees] + * + * Return Value: + * Boolean + */ + +#include "script_component.hpp" +private["_seeker", "_targetPos", "_seekerMaxAngle", "_sensorPos", "_testPointVector", "_testDotProduct"]; + +_seeker = _this select 0; +_targetPos = _this select 1; +_seekerMaxAngle = _this select 2; + +_sensorPos = getPosASL _seeker; + +_testPointVector = vectorNormalized (_targetPos vectorDiff _sensorPos); +_testDotProduct = (vectorNormalized (velocity _seeker)) vectorDotProduct _testPointVector; + +if(_testDotProduct < (cos _seekerMaxAngle)) exitWith { + false +}; + true \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doAttackProfile.sqf b/addons/missileguidance/functions/fnc_doAttackProfile.sqf index 171e169651..436cf275fe 100644 --- a/addons/missileguidance/functions/fnc_doAttackProfile.sqf +++ b/addons/missileguidance/functions/fnc_doAttackProfile.sqf @@ -1,29 +1,29 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_testName", "_attackProfilePos", "_attackProfile", "_attackProfileName", "_attackProfilesCfg", "_i", "_launchParams", "_testame", "_testProfile"]; -_launchParams = ((_this select 1) select 1); -_attackProfileName = _launchParams select 3; - -TRACE_1("Attacking profile", _attackProfileName); - -_attackProfilesCfg = ( configFile >> QGVAR(AttackProfiles) ); - -_attackProfile = nil; -for [{_i=0}, {_i< (count _attackProfilesCfg) }, {_i=_i+1}] do { - _testProfile = _attackProfilesCfg select _i; - _testName = configName _testProfile; - TRACE_3("", _testName, _testProfile, _attackProfilesCfg); - - if( _testName == _attackProfileName) exitWith { - _attackProfile = _attackProfilesCfg select _i; - }; -}; - -_attackProfilePos = [0,0,0]; -if(!isNil "_attackProfile") then { - _attackProfilePos = _this call (missionNamespace getVariable (getText (_attackProfile >> "functionName"))); -}; - -_attackProfilePos; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_testName", "_attackProfilePos", "_attackProfile", "_attackProfileName", "_attackProfilesCfg", "_i", "_launchParams", "_testame", "_testProfile"]; +_launchParams = ((_this select 1) select 1); +_attackProfileName = _launchParams select 3; + +TRACE_1("Attacking profile", _attackProfileName); + +_attackProfilesCfg = ( configFile >> QGVAR(AttackProfiles) ); + +_attackProfile = nil; +for [{_i=0}, {_i< (count _attackProfilesCfg) }, {_i=_i+1}] do { + _testProfile = _attackProfilesCfg select _i; + _testName = configName _testProfile; + TRACE_3("", _testName, _testProfile, _attackProfilesCfg); + + if( _testName == _attackProfileName) exitWith { + _attackProfile = _attackProfilesCfg select _i; + }; +}; + +_attackProfilePos = [0,0,0]; +if(!isNil "_attackProfile") then { + _attackProfilePos = _this call (missionNamespace getVariable (getText (_attackProfile >> "functionName"))); +}; + +_attackProfilePos; diff --git a/addons/missileguidance/functions/fnc_doHandoff.sqf b/addons/missileguidance/functions/fnc_doHandoff.sqf index d99998c8c4..011c3d52d1 100644 --- a/addons/missileguidance/functions/fnc_doHandoff.sqf +++ b/addons/missileguidance/functions/fnc_doHandoff.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" -PARAMS_2(_target,_args); - -[QGVAR(handoff), [_target, _args]] call EFUNC(common,globalEvent); \ No newline at end of file +#include "script_component.hpp" +PARAMS_2(_target,_args); + +[QGVAR(handoff), [_target, _args]] call CBA_fnc_globalEvent; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf index bd300effe8..fe73cd5118 100644 --- a/addons/missileguidance/functions/fnc_doSeekerSearch.sqf +++ b/addons/missileguidance/functions/fnc_doSeekerSearch.sqf @@ -1,30 +1,30 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_seekerProfilePos", "_i", "_launchParams", "_seekerType", "_seekerTypeName", "_seekerTypesCfg", "_testName", "_testProfile"]; - -_launchParams = ((_this select 1) select 1); -_seekerTypeName = _launchParams select 2; - -TRACE_1("Seeker type", _seekerTypeName); - -_seekerTypesCfg = ( configFile >> QGVAR(SeekerTypes) ); - -_seekerType = nil; -for [{_i=0}, {_i< (count _seekerTypesCfg) }, {_i=_i+1}] do { - _testProfile = _seekerTypesCfg select _i; - _testName = configName _testProfile; - TRACE_3("", _testName, _testProfile, _seekerTypesCfg); - - if( _testName == _seekerTypeName) exitWith { - _seekerType = _seekerTypesCfg select _i; - }; -}; - -_seekerProfilePos = [0,0,0]; -if(!isNil "_seekerType") then { - _seekerProfilePos = _this call (missionNamespace getVariable (getText (_seekerType >> "functionName"))); -}; - -_seekerProfilePos; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_seekerProfilePos", "_i", "_launchParams", "_seekerType", "_seekerTypeName", "_seekerTypesCfg", "_testName", "_testProfile"]; + +_launchParams = ((_this select 1) select 1); +_seekerTypeName = _launchParams select 2; + +TRACE_1("Seeker type", _seekerTypeName); + +_seekerTypesCfg = ( configFile >> QGVAR(SeekerTypes) ); + +_seekerType = nil; +for [{_i=0}, {_i< (count _seekerTypesCfg) }, {_i=_i+1}] do { + _testProfile = _seekerTypesCfg select _i; + _testName = configName _testProfile; + TRACE_3("", _testName, _testProfile, _seekerTypesCfg); + + if( _testName == _seekerTypeName) exitWith { + _seekerType = _seekerTypesCfg select _i; + }; +}; + +_seekerProfilePos = [0,0,0]; +if(!isNil "_seekerType") then { + _seekerProfilePos = _this call (missionNamespace getVariable (getText (_seekerType >> "functionName"))); +}; + +_seekerProfilePos; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 122d690bae..36c11d58af 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -1,106 +1,106 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -#define TIMESTEP_FACTOR 0.01 - -private["_launchParams", "_targetLaunchParams", "_flightParams", "_seekerParams", "_stateParams"]; -private["_lastRunTime", "_runtimeDelta", "_adjustTime", "_args", "_seekerTargetPos", "_projectilePos"]; -private["_profileAdjustedTargetPos", "_incDeflection", "_minDeflection", "_maxDeflection"]; -private["_targetVector", "_adjustVector", "_finalAdjustVector", "_changeVector", "_pitch", "_yaw", "_roll"]; -private["_PS", "_distanceToTarget", "_targetRelativeVector", "_vectorTo"]; - -_args = _this select 0; -EXPLODE_7_PVT((_args select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - -if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { - [(_this select 1)] call CBA_fnc_removePerFrameHandler; -}; - -_launchParams = _args select 1; -_targetLaunchParams = _launchParams select 1; -_flightParams = _args select 2; -_seekerParams = _args select 3; - -_stateParams = _args select 4; - -_lastRunTime = _stateParams select 0; -_runtimeDelta = ACE_diagTime - _lastRunTime; -_adjustTime = 1; - -if(accTime > 0) then { - _adjustTime = 1/accTime; - _adjustTime = _adjustTime * (_runtimeDelta / TIMESTEP_FACTOR); - TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / TIMESTEP_FACTOR) ); -} else { - _adjustTime = 0; -}; - -_minDeflection = ((_flightParams select 0) - ((_flightParams select 0) * _adjustTime)) max 0; -_maxDeflection = (_flightParams select 1) * _adjustTime; -_incDeflection = _flightParams select 2; - -_projectilePos = getPosASL _projectile; - -// @TODO: placeholder for "last seek target position" -// Last target pos should be optional based on the seeker unit -_seekerTargetPos = [ [0,0,0], _args, (_stateParams select 1)] call FUNC(doSeekerSearch); -if(isNil "_seekerTargetPos") then { - _seekerTargetPos = _seekerTargetPos vectorAdd ((velocity _projectile) vectorMultiply 5); -} else { - if( (vectorMagnitude _seekerTargetPos) == 0) then { - _seekerTargetPos = _seekerTargetPos vectorAdd ((velocity _projectile) vectorMultiply 5); - }; -}; - -_profileAdjustedTargetPos = [_seekerTargetPos,_args, (_stateParams select 2)] call FUNC(doAttackProfile); -_targetVector = _projectilePos vectorFromTo _profileAdjustedTargetPos; -_adjustVector = _targetVector vectorDiff (vectorDir _projectile); - -_yaw = 0; -_pitch = 0; -_roll = 0; -if((_adjustVector select 0) < 0) then { - _yaw = - ( (_minDeflection max (abs(_adjustVector select 0) min _maxDeflection) ) ); -} else { - if((_adjustVector select 0) > 0) then { - _yaw = ( (_minDeflection max ((_adjustVector select 0) min _maxDeflection) ) ); - }; -}; -if((_adjustVector select 1) < 0) then { - _roll = - ( (_minDeflection max (abs(_adjustVector select 1) min _maxDeflection) ) ); -} else { - if((_adjustVector select 1) > 0) then { - _roll = ( (_minDeflection max ((_adjustVector select 1) min _maxDeflection) ) ); - }; -}; -if((_adjustVector select 2) < 0) then { - _pitch = - ( (_minDeflection max (abs(_adjustVector select 2) min _maxDeflection) ) ); -} else { - if((_adjustVector select 2) > 0) then { - _pitch = ( (_minDeflection max ((_adjustVector select 2) min _maxDeflection) ) ); - }; -}; -_finalAdjustVector = [_yaw, _roll, _pitch]; -TRACE_2("", _pitch, _yaw); -TRACE_4("", _targetVector, _targetRelativeVector, _adjustVector, _finalAdjustVector); - -if(accTime > 0) then { - _changeVector = (vectorDir _projectile) vectorAdd _finalAdjustVector; - [_projectile, _changeVector] call FUNC(changeMissileDirection); -}; - -#ifdef DEBUG_MODE_FULL -drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _projectilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; -drawLine3D [ASLtoATL _projectilePos, ASLtoATL _profileAdjustedTargetPos, [1,0,0,1]]; - -_ps = "#particlesource" createVehicleLocal (ASLtoATL _projectilePos); -_PS setParticleParams [["\A3\Data_f\cl_basic", 8, 3, 1], "", "Billboard", 1, 3.0141, [0, 0, 2], [0, 0, 0], 1, 1.275, 1, 0, [1, 1], [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]], [1], 1, 0, "", "", nil]; -_PS setDropInterval 3.0; - -hintSilent format["d: %1", _distanceToTarget]; -#endif - -_stateParams set[0, ACE_diagTime]; - -_args set[4, _stateParams]; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +#define TIMESTEP_FACTOR 0.01 + +private["_launchParams", "_targetLaunchParams", "_flightParams", "_seekerParams", "_stateParams"]; +private["_lastRunTime", "_runtimeDelta", "_adjustTime", "_args", "_seekerTargetPos", "_projectilePos"]; +private["_profileAdjustedTargetPos", "_incDeflection", "_minDeflection", "_maxDeflection"]; +private["_targetVector", "_adjustVector", "_finalAdjustVector", "_changeVector", "_pitch", "_yaw", "_roll"]; +private["_PS", "_distanceToTarget", "_targetRelativeVector", "_vectorTo"]; + +_args = _this select 0; +EXPLODE_7_PVT((_args select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +if(!alive _projectile || isNull _projectile || isNull _shooter) exitWith { + [(_this select 1)] call CBA_fnc_removePerFrameHandler; +}; + +_launchParams = _args select 1; +_targetLaunchParams = _launchParams select 1; +_flightParams = _args select 2; +_seekerParams = _args select 3; + +_stateParams = _args select 4; + +_lastRunTime = _stateParams select 0; +_runtimeDelta = diag_tickTime - _lastRunTime; +_adjustTime = 1; + +if(accTime > 0) then { + _adjustTime = 1/accTime; + _adjustTime = _adjustTime * (_runtimeDelta / TIMESTEP_FACTOR); + TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / TIMESTEP_FACTOR) ); +} else { + _adjustTime = 0; +}; + +_minDeflection = ((_flightParams select 0) - ((_flightParams select 0) * _adjustTime)) max 0; +_maxDeflection = (_flightParams select 1) * _adjustTime; +_incDeflection = _flightParams select 2; + +_projectilePos = getPosASL _projectile; + +// @TODO: placeholder for "last seek target position" +// Last target pos should be optional based on the seeker unit +_seekerTargetPos = [ [0,0,0], _args, (_stateParams select 1)] call FUNC(doSeekerSearch); +if(isNil "_seekerTargetPos") then { + _seekerTargetPos = _seekerTargetPos vectorAdd ((velocity _projectile) vectorMultiply 5); +} else { + if( (vectorMagnitude _seekerTargetPos) == 0) then { + _seekerTargetPos = _seekerTargetPos vectorAdd ((velocity _projectile) vectorMultiply 5); + }; +}; + +_profileAdjustedTargetPos = [_seekerTargetPos,_args, (_stateParams select 2)] call FUNC(doAttackProfile); +_targetVector = _projectilePos vectorFromTo _profileAdjustedTargetPos; +_adjustVector = _targetVector vectorDiff (vectorDir _projectile); + +_yaw = 0; +_pitch = 0; +_roll = 0; +if((_adjustVector select 0) < 0) then { + _yaw = - ( (_minDeflection max (abs(_adjustVector select 0) min _maxDeflection) ) ); +} else { + if((_adjustVector select 0) > 0) then { + _yaw = ( (_minDeflection max ((_adjustVector select 0) min _maxDeflection) ) ); + }; +}; +if((_adjustVector select 1) < 0) then { + _roll = - ( (_minDeflection max (abs(_adjustVector select 1) min _maxDeflection) ) ); +} else { + if((_adjustVector select 1) > 0) then { + _roll = ( (_minDeflection max ((_adjustVector select 1) min _maxDeflection) ) ); + }; +}; +if((_adjustVector select 2) < 0) then { + _pitch = - ( (_minDeflection max (abs(_adjustVector select 2) min _maxDeflection) ) ); +} else { + if((_adjustVector select 2) > 0) then { + _pitch = ( (_minDeflection max ((_adjustVector select 2) min _maxDeflection) ) ); + }; +}; +_finalAdjustVector = [_yaw, _roll, _pitch]; +TRACE_2("", _pitch, _yaw); +TRACE_4("", _targetVector, _targetRelativeVector, _adjustVector, _finalAdjustVector); + +if(accTime > 0) then { + _changeVector = (vectorDir _projectile) vectorAdd _finalAdjustVector; + [_projectile, _changeVector] call FUNC(changeMissileDirection); +}; + +#ifdef DEBUG_MODE_FULL +drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,1,1,1], ASLtoATL _projectilePos, 0.75, 0.75, 0, str _vectorTo, 1, 0.025, "TahomaB"]; +drawLine3D [ASLtoATL _projectilePos, ASLtoATL _profileAdjustedTargetPos, [1,0,0,1]]; + +_ps = "#particlesource" createVehicleLocal (ASLtoATL _projectilePos); +_PS setParticleParams [["\A3\Data_f\cl_basic", 8, 3, 1], "", "Billboard", 1, 3.0141, [0, 0, 2], [0, 0, 0], 1, 1.275, 1, 0, [1, 1], [[1, 0, 0, 1], [1, 0, 0, 1], [1, 0, 0, 1]], [1], 1, 0, "", "", nil]; +_PS setDropInterval 3.0; + +hintSilent format["d: %1", _distanceToTarget]; +#endif + +_stateParams set[0, diag_tickTime]; + +_args set[4, _stateParams]; _this set[0, _args]; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_handleHandoff.sqf b/addons/missileguidance/functions/fnc_handleHandoff.sqf index 7145bc0038..af23ed84d8 100644 --- a/addons/missileguidance/functions/fnc_handleHandoff.sqf +++ b/addons/missileguidance/functions/fnc_handleHandoff.sqf @@ -1,6 +1,6 @@ -#include "script_component.hpp" -PARAMS_2(_target,_args); - -if(isNil "_target" || {isNull _target} || {!local _target} ) exitWith { false }; - +#include "script_component.hpp" +PARAMS_2(_target,_args); + +if(isNil "_target" || {isNull _target} || {!local _target} ) exitWith { false }; + [FUNC(guidancePFH), 0, _args] call CBA_fnc_addPerFrameHandler; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index 26f8d14c6e..2a263721de 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -1,118 +1,118 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); - -// Bail if guidance is disabled -// Bail on locality of the projectile, it should be local to us -if(GVAR(enabled) < 1 || {!local _projectile} ) exitWith { false }; - -//Bail if shooter isn't player AND system not enabled for AI: -if( !isPlayer _shooter && { GVAR(enabled) < 2 } ) exitWith { false }; - -// Bail on not missile -if(! (_ammo isKindOf "MissileBase") ) exitWith { false }; - -private["_config", "_configs", "_enabled", "_target", "_seekerType", "_attackProfile"]; -private["_args", "_canUseLock", "_guidingUnit", "_launchPos", "_lockMode", "_targetPos", "_vanillaTarget"]; - -//Verify ammo has explicity added guidance config (ignore inheritances) -_configs = configProperties [(configFile >> "CfgAmmo" >> _ammo), QUOTE(configName _x == QUOTE(QUOTE(ADDON))), false]; -if( (count _configs) < 1) exitWith {}; - -_config = (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON)); -_enabled = getNumber ( _config >> "enabled"); - -// Bail if guidance is not enabled -if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; - -_target = (vehicle _shooter) getVariable [QGVAR(target), nil]; -_targetPos = (vehicle _shooter) getVariable [QGVAR(targetPosition), nil]; -_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil]; -_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil]; -_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil]; - -// @TODO: make this vehicle shooter, but we need to differentiate where its set in ace_laser -_laserCode = _shooter getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; -_laserInfo = [_laserCode, ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH]; - -_launchPos = getPosASL (vehicle _shooter); - -TRACE_3("Begin guidance", _target, _seekerType, _attackProfile); - -if (isNil "_seekerType" || {!(_seekerType in (getArray (_config >> "seekerTypes")))}) then { - _seekerType = getText (_config >> "defaultSeekerType"); -}; -if (isNil "_attackProfile" || {!(_attackProfile in (getArray (_config >> "attackProfiles")))}) then { - _attackProfile = getText (_config >> "defaultAttackProfile"); -}; -if (isNil "_lockMode" || {!(_lockMode in (getArray (_config >> "seekerLockModes")))}) then { - _lockMode = getText (_config >> "defaultSeekerLockMode"); -}; - -// If we didn't get a target, try to fall back on tab locking -if(isNil "_target") then { - if(!isPlayer _shooter) then { - // This was an AI shot, lets still guide it on the AI target - _target = _shooter getVariable[QGVAR(vanilla_target), nil]; - TRACE_1("Detected AI Shooter!", _target); - } else { - _canUseLock = getNumber (_config >> "canVanillaLock"); - // @TODO: Get vanilla target - if(_canUseLock > 0 || difficulty < 1) then { - _vanillaTarget = cursorTarget; - - TRACE_1("Using Vanilla Locking", _vanillaTarget); - if(!isNil "_vanillaTarget") then { - _target = _vanillaTarget; - }; - }; - }; -}; - -TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); -_args = [_this, - [_shooter, - [_target, _targetPos, _launchPos], - _seekerType, - _attackProfile, - _lockMode, - _laserInfo - ], - [ - getNumber ( _config >> "minDeflection" ), - getNumber ( _config >> "maxDeflection" ), - getNumber ( _config >> "incDeflection" ) - ], - [ - getNumber ( _config >> "seekerAngle" ), - getNumber ( _config >> "seekerAccuracy" ), - getNumber ( _config >> "seekerMaxRange" ) - ], - [ ACE_diagTime, [], [] ] - ]; - -// Hand off to the guiding unit. We just use local player so local PFH fires for now -// Laser code needs to give us a shooter for LOBL, or the seeker unit needs to be able to shift locality -// Based on its homing laser -// Lasers need to be handled in a special LOAL/LOBL case - -//if(isPlayer _shooter) then { -// _guidingUnit = ACE_player; -// -// if(local _guidingUnit) then { -// [FUNC(guidancePFH), 0, _args ] call CBA_fnc_addPerFrameHandler; -// } else { -// [QGVAR(handoff), [_guidingUnit, _args] ] call FUNC(doHandoff); -// }; -//} else { - [FUNC(guidancePFH), 0, _args ] call CBA_fnc_addPerFrameHandler; -//}; - - -/* Clears locking settings -(vehicle _shooter) setVariable [QGVAR(target), nil]; -(vehicle _shooter) setVariable [QGVAR(seekerType), nil]; -(vehicle _shooter) setVariable [QGVAR(attackProfile), nil]; -(vehicle _shooter) setVariable [QGVAR(lockMode), nil]; -*/ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +PARAMS_7(_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Bail if guidance is disabled +// Bail on locality of the projectile, it should be local to us +if(GVAR(enabled) < 1 || {!local _projectile} ) exitWith { false }; + +//Bail if shooter isn't player AND system not enabled for AI: +if( !isPlayer _shooter && { GVAR(enabled) < 2 } ) exitWith { false }; + +// Bail on not missile +if(! (_ammo isKindOf "MissileBase") ) exitWith { false }; + +private["_config", "_configs", "_enabled", "_target", "_seekerType", "_attackProfile"]; +private["_args", "_canUseLock", "_guidingUnit", "_launchPos", "_lockMode", "_targetPos", "_vanillaTarget"]; + +//Verify ammo has explicity added guidance config (ignore inheritances) +_configs = configProperties [(configFile >> "CfgAmmo" >> _ammo), QUOTE(configName _x == QUOTE(QUOTE(ADDON))), false]; +if( (count _configs) < 1) exitWith {}; + +_config = (configFile >> "CfgAmmo" >> _ammo >> QUOTE(ADDON)); +_enabled = getNumber ( _config >> "enabled"); + +// Bail if guidance is not enabled +if(isNil "_enabled" || {_enabled != 1}) exitWith { false }; + +_target = (vehicle _shooter) getVariable [QGVAR(target), nil]; +_targetPos = (vehicle _shooter) getVariable [QGVAR(targetPosition), nil]; +_seekerType = (vehicle _shooter) getVariable [QGVAR(seekerType), nil]; +_attackProfile = (vehicle _shooter) getVariable [QGVAR(attackProfile), nil]; +_lockMode = (vehicle _shooter) getVariable [QGVAR(lockMode), nil]; + +// @TODO: make this vehicle shooter, but we need to differentiate where its set in ace_laser +_laserCode = _shooter getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; +_laserInfo = [_laserCode, ACE_DEFAULT_LASER_WAVELENGTH, ACE_DEFAULT_LASER_WAVELENGTH]; + +_launchPos = getPosASL (vehicle _shooter); + +TRACE_3("Begin guidance", _target, _seekerType, _attackProfile); + +if (isNil "_seekerType" || {!(_seekerType in (getArray (_config >> "seekerTypes")))}) then { + _seekerType = getText (_config >> "defaultSeekerType"); +}; +if (isNil "_attackProfile" || {!(_attackProfile in (getArray (_config >> "attackProfiles")))}) then { + _attackProfile = getText (_config >> "defaultAttackProfile"); +}; +if (isNil "_lockMode" || {!(_lockMode in (getArray (_config >> "seekerLockModes")))}) then { + _lockMode = getText (_config >> "defaultSeekerLockMode"); +}; + +// If we didn't get a target, try to fall back on tab locking +if(isNil "_target") then { + if(!isPlayer _shooter) then { + // This was an AI shot, lets still guide it on the AI target + _target = _shooter getVariable[QGVAR(vanilla_target), nil]; + TRACE_1("Detected AI Shooter!", _target); + } else { + _canUseLock = getNumber (_config >> "canVanillaLock"); + // @TODO: Get vanilla target + if(_canUseLock > 0 || difficulty < 1) then { + _vanillaTarget = cursorTarget; + + TRACE_1("Using Vanilla Locking", _vanillaTarget); + if(!isNil "_vanillaTarget") then { + _target = _vanillaTarget; + }; + }; + }; +}; + +TRACE_4("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile); +_args = [_this, + [_shooter, + [_target, _targetPos, _launchPos], + _seekerType, + _attackProfile, + _lockMode, + _laserInfo + ], + [ + getNumber ( _config >> "minDeflection" ), + getNumber ( _config >> "maxDeflection" ), + getNumber ( _config >> "incDeflection" ) + ], + [ + getNumber ( _config >> "seekerAngle" ), + getNumber ( _config >> "seekerAccuracy" ), + getNumber ( _config >> "seekerMaxRange" ) + ], + [ diag_tickTime, [], [] ] + ]; + +// Hand off to the guiding unit. We just use local player so local PFH fires for now +// Laser code needs to give us a shooter for LOBL, or the seeker unit needs to be able to shift locality +// Based on its homing laser +// Lasers need to be handled in a special LOAL/LOBL case + +//if(isPlayer _shooter) then { +// _guidingUnit = ACE_player; +// +// if(local _guidingUnit) then { +// [FUNC(guidancePFH), 0, _args ] call CBA_fnc_addPerFrameHandler; +// } else { +// [QGVAR(handoff), [_guidingUnit, _args] ] call FUNC(doHandoff); +// }; +//} else { + [FUNC(guidancePFH), 0, _args ] call CBA_fnc_addPerFrameHandler; +//}; + + +/* Clears locking settings +(vehicle _shooter) setVariable [QGVAR(target), nil]; +(vehicle _shooter) setVariable [QGVAR(seekerType), nil]; +(vehicle _shooter) setVariable [QGVAR(attackProfile), nil]; +(vehicle _shooter) setVariable [QGVAR(lockMode), nil]; +*/ diff --git a/addons/missileguidance/functions/fnc_onIncomingMissile.sqf b/addons/missileguidance/functions/fnc_onIncomingMissile.sqf index 33ebeb34e2..14902c32a5 100644 --- a/addons/missileguidance/functions/fnc_onIncomingMissile.sqf +++ b/addons/missileguidance/functions/fnc_onIncomingMissile.sqf @@ -1,8 +1,8 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" -PARAMS_3(_target,_ammo,_shooter); - -if(GVAR(enabled) < 1) exitWith {}; // bail if enabled -if !(local (gunner _shooter) || {local _shooter}) exitWith {}; // bail if not shooter - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" +PARAMS_3(_target,_ammo,_shooter); + +if(GVAR(enabled) < 1) exitWith {}; // bail if enabled +if !(local (gunner _shooter) || {local _shooter}) exitWith {}; // bail if not shooter + _shooter setVariable [QGVAR(vanilla_target),_target, false]; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_rotateVectLine.sqf b/addons/missileguidance/functions/fnc_rotateVectLine.sqf index b9904f0e5a..b42c8d103d 100644 --- a/addons/missileguidance/functions/fnc_rotateVectLine.sqf +++ b/addons/missileguidance/functions/fnc_rotateVectLine.sqf @@ -1,39 +1,39 @@ -#include "script_component.hpp" -private["_d", "_map", "_p", "_theta", "_u"]; - -_map = _this select 0; -_theta = _this select 1; - -_p = _map select 0; -_p1 = _map select 1; -_p2 = _map select 2; - -_q1 = +(_map select 3); -_q2 = +(_map select 4); -_u = _map select 5; -_d = _map select 6; - -/* Step 4 */ -_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; -_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; -_q2 set[2, (_q1 select 2)]; - -/* Inverse of step 3 */ -_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -/* Inverse of step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Inverse of step 1 */ -_q1 set[0, (_q2 select 0) + (_p1 select 0)]; -_q1 set[1, (_q2 select 1) + (_p1 select 1)]; -_q1 set[2, (_q2 select 2) + (_p1 select 2)]; +#include "script_component.hpp" +private["_d", "_map", "_p", "_theta", "_u"]; + +_map = _this select 0; +_theta = _this select 1; + +_p = _map select 0; +_p1 = _map select 1; +_p2 = _map select 2; + +_q1 = +(_map select 3); +_q2 = +(_map select 4); +_u = _map select 5; +_d = _map select 6; + +/* Step 4 */ +_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; +_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; +_q2 set[2, (_q1 select 2)]; + +/* Inverse of step 3 */ +_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; +_q1 set[1, (_q2 select 1)]; +_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; + +/* Inverse of step 2 */ +if (_d != 0) then { + _q2 set[0, (_q1 select 0)]; + _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; + _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; +} else { + _q2 = _q1; +}; + +/* Inverse of step 1 */ +_q1 set[0, (_q2 select 0) + (_p1 select 0)]; +_q1 set[1, (_q2 select 1) + (_p1 select 1)]; +_q1 set[2, (_q2 select 2) + (_p1 select 2)]; _q1; \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_rotateVectLineGetMap.sqf b/addons/missileguidance/functions/fnc_rotateVectLineGetMap.sqf index fdbd6533ef..258cc93ae2 100644 --- a/addons/missileguidance/functions/fnc_rotateVectLineGetMap.sqf +++ b/addons/missileguidance/functions/fnc_rotateVectLineGetMap.sqf @@ -1,37 +1,37 @@ -#include "script_component.hpp" - -private ["_p", "_theta", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; -_p = _this select 0; -_p1 = _this select 1; -_p2 = _this select 2; - -_q1 = []; -_q2 = []; -_u = []; - -/* Step 1 */ -_q1 set[0, (_p select 0) - (_p1 select 0)]; -_q1 set[1, (_p select 1) - (_p1 select 1)]; -_q1 set[2, (_p select 2) - (_p1 select 2)]; - -_u set[0, (_p2 select 0) - (_p1 select 0)]; -_u set[1, (_p2 select 1) - (_p1 select 1)]; -_u set[2, (_p2 select 2) - (_p1 select 2)]; -_u = _u call BIS_fnc_unitVector; -_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); - -/* Step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Step 3 */ -_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - +#include "script_component.hpp" + +private ["_p", "_theta", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; +_p = _this select 0; +_p1 = _this select 1; +_p2 = _this select 2; + +_q1 = []; +_q2 = []; +_u = []; + +/* Step 1 */ +_q1 set[0, (_p select 0) - (_p1 select 0)]; +_q1 set[1, (_p select 1) - (_p1 select 1)]; +_q1 set[2, (_p select 2) - (_p1 select 2)]; + +_u set[0, (_p2 select 0) - (_p1 select 0)]; +_u set[1, (_p2 select 1) - (_p1 select 1)]; +_u set[2, (_p2 select 2) - (_p1 select 2)]; +_u = _u call BIS_fnc_unitVector; +_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); + +/* Step 2 */ +if (_d != 0) then { + _q2 set[0, (_q1 select 0)]; + _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; + _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; +} else { + _q2 = _q1; +}; + +/* Step 3 */ +_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; +_q1 set[1, (_q2 select 1)]; +_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; + [_p, _p1, _p2, _q1, _q2, _u, _d] \ No newline at end of file diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 0d80a2309e..c9b44b8a82 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -1,51 +1,52 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; -private["_angleFov", "_angleOkay", "_losOkay", "_seekerTargetPos", "_sensorPos", "_target"]; - -_seekerTargetPos = _this select 0; - -_launchParams = _this select 1; -_target = (((_launchParams select 1) select 1) select 0); -_seekerParams = _launchParams select 3; - -TRACE_1("", _this); -TRACE_1("", _launchParams); - -// TODO:: Make sure the missile maintains LOS -_foundTargetPos = [0,0,0]; -if(!isNil "_target") then { - _foundTargetPos = aimPos _target ; - //_foundTargetPos = (_target modelToWorldVisual (getCenterOfMass _target)); -}; - -// @TODO: This is seeker LOS and angle checks for LOAL only; LOBL does not need visual -_angleFov = _seekerParams select 0; -_angleOkay = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle); - -_losOkay = false; -if(_angleOkay) then { - _losOkay = [_projectile, _target] call FUNC(checkSeekerLos); //Note: Func does not exist? probably FUNC(checkLos)?? -}; -TRACE_2("", _angleOkay, _losOkay); - -// If we got here, it was an invalid target, just return a spot 5m in front of the missile -if(!_angleOkay || !_losOkay) then { - _foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5); -} else { - TRACE_2("", _target, _foundTargetPos); - private["_projectileSpeed", "_distanceToTarget", "_eta", "_adjustVelocity"]; - // @TODO: Configurable lead for seekers - _projectileSpeed = (vectorMagnitude velocity _projectile); - _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos; - - _eta = _distanceToTarget / _projectileSpeed; - - _adjustVelocity = (velocity _target) vectorMultiply _eta; - _foundTargetPos = _foundTargetPos vectorAdd _adjustVelocity; -}; - - -_foundTargetPos; +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_targets", "_foundTargetPos", "_launchParams", "_seekerParams", "_targetLaunchParams"]; +private["_angleFov", "_angleOkay", "_losOkay", "_seekerTargetPos", "_sensorPos", "_target"]; + +_seekerTargetPos = _this select 0; + +_launchParams = _this select 1; +_target = (((_launchParams select 1) select 1) select 0); +_seekerParams = _launchParams select 3; + +TRACE_1("", _this); +TRACE_1("", _launchParams); + +// TODO:: Make sure the missile maintains LOS +_foundTargetPos = [0,0,0]; +if(!isNil "_target") then { + _foundTargetPos = aimPos _target ; + //_foundTargetPos = (_target modelToWorldVisual (getCenterOfMass _target)); +}; + +// @TODO: This is seeker LOS and angle checks for LOAL only; LOBL does not need visual +_angleFov = _seekerParams select 0; +_angleOkay = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle); + +_losOkay = false; +if(_angleOkay) then { + _losOkay = [_projectile, _target] call FUNC(checkLos); +}; +TRACE_2("", _angleOkay, _losOkay); + +// If we got here, it was an invalid target, just return a spot 5m in front of the missile +if(!_angleOkay || !_losOkay) then { + _foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5); +} else { + TRACE_2("", _target, _foundTargetPos); + private["_projectileSpeed", "_distanceToTarget", "_eta", "_adjustDistance"]; + // @TODO: Configurable lead for seekers + _projectileSpeed = (vectorMagnitude velocity _projectile); + _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos; + + _eta = _distanceToTarget / _projectileSpeed; + + _adjustDistance = (velocity _target) vectorMultiply _eta; + TRACE_3("leading target",_distanceToTarget,_eta,_adjustDistance); + _foundTargetPos = _foundTargetPos vectorAdd _adjustDistance; +}; + +TRACE_2("return",_foundTargetPos,(aimPos _target) distance _foundTargetPos); +_foundTargetPos; diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf index 6297d21dfa..415e516617 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -1,32 +1,32 @@ -//#define DEBUG_MODE_FULL -#include "script_component.hpp" - -EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -private["_angleFov", "_canSeeTarget", "_foundTargetPos", "_laserResult", "_launchParams", "_seekerParams", "_laserCode", "_laserParams", "_seekerTargetPos", "_sensorPos", "_target"]; -_seekerTargetPos = _this select 0; -_launchParams = _this select 1; -_seekerParams = _launchParams select 3; -_angleFov = _seekerParams select 0; - -_laserParams = (_launchParams select 1) select 5; -TRACE_2("", _launchParams, _laserParams); -if(!isNil "_target") then { - // Handle AI or moving vanilla lasers - _foundTargetPos = getPosASL _target; -} else { - _laserResult = [(getPosASL _projectile), (velocity _projectile), _angleFov, [(_laserParams select 1),(_laserParams select 2)], (_laserParams select 0)] call EFUNC(laser,seekerFindLaserSpot); - _foundTargetPos = _laserResult select 0; - TRACE_1("Search", _laserResult); -}; - -if(!isNil "_foundTargetPos") then { - //_canSeeTarget = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle); - - // If we got here, it was an invalid target, just return a spot 5m in front of the missile - if(!_canSeeTarget) then { - _foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5); - }; - -}; - +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); +private["_angleFov", "_canSeeTarget", "_foundTargetPos", "_laserResult", "_launchParams", "_seekerParams", "_laserCode", "_laserParams", "_seekerTargetPos", "_sensorPos", "_target"]; +_seekerTargetPos = _this select 0; +_launchParams = _this select 1; +_seekerParams = _launchParams select 3; +_angleFov = _seekerParams select 0; + +_laserParams = (_launchParams select 1) select 5; +TRACE_2("", _launchParams, _laserParams); +if(!isNil "_target") then { + // Handle AI or moving vanilla lasers + _foundTargetPos = getPosASL _target; +} else { + _laserResult = [(getPosASL _projectile), (velocity _projectile), _angleFov, [(_laserParams select 1),(_laserParams select 2)], (_laserParams select 0)] call EFUNC(laser,seekerFindLaserSpot); + _foundTargetPos = _laserResult select 0; + TRACE_1("Search", _laserResult); +}; + +if(!isNil "_foundTargetPos") then { + //_canSeeTarget = [_projectile, _foundTargetPos, _angleFov] call FUNC(checkSeekerAngle); + + // If we got here, it was an invalid target, just return a spot 5m in front of the missile + if(!_canSeeTarget) then { + _foundTargetPos = _sensorPos vectorAdd ((velocity _projectile) vectorMultiply 5); + }; + +}; + _foundTargetPos; \ No newline at end of file diff --git a/addons/missileguidance/script_component.hpp b/addons/missileguidance/script_component.hpp index 25e98bea60..beac3e318d 100644 --- a/addons/missileguidance/script_component.hpp +++ b/addons/missileguidance/script_component.hpp @@ -1,19 +1,20 @@ -#define COMPONENT missileguidance -#include "\z\ace\addons\main\script_mod.hpp" - -// #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE -// #define CBA_DEBUG_SYNCHRONOUS -// #define ENABLE_PERFORMANCE_COUNTERS - -#ifdef DEBUG_ENABLED_MISSILEGUIDANCE - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_MISSILEGUIDANCE - #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSILEGUIDANCE -#endif - -#include "\z\ace\addons\main\script_macros.hpp" - -#define FIREMODE_DIRECT_LOAL 1 \ No newline at end of file +#define COMPONENT missileguidance +#define COMPONENT_BEAUTIFIED Missile Guidance +#include "\z\ace\addons\main\script_mod.hpp" + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + +#ifdef DEBUG_ENABLED_MISSILEGUIDANCE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MISSILEGUIDANCE + #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSILEGUIDANCE +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + +#define FIREMODE_DIRECT_LOAL 1 diff --git a/addons/missionmodules/CfgVehicles.hpp b/addons/missionmodules/CfgVehicles.hpp index ebf0b04f66..6a2f74b934 100644 --- a/addons/missionmodules/CfgVehicles.hpp +++ b/addons/missionmodules/CfgVehicles.hpp @@ -9,9 +9,9 @@ class CfgVehicles { class ACE_moduleAmbianceSound: Module_F { scope = 2; displayName = CSTRING(AmbianceSounds_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Ambient_Sounds_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Ambient_Sounds_ca.paa); category = "ACE_missionModules"; - function = QUOTE(FUNC(moduleAmbianceSound)); + function = QFUNC(moduleAmbianceSound); functionPriority = 1; isGlobal = 1; isTriggerActivated = 0; diff --git a/addons/missionmodules/config.cpp b/addons/missionmodules/config.cpp index c373b84615..3a92c65ebc 100644 --- a/addons/missionmodules/config.cpp +++ b/addons/missionmodules/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Glowbal"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"Glowbal"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf index 3ee45f324e..eb44a68f15 100644 --- a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -74,7 +74,7 @@ if (_activated && local _logic) then { [_pfhHandle] call CBA_fnc_removePerFrameHandler; }; - if (ACE_time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { + if (CBA_missionTime - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { // Find all players in session. _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; @@ -109,11 +109,11 @@ if (_activated && local _logic) then { // If no unit is to close to this position, we will play the sound. if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { playSound3D [selectRandom _ambianceSounds, objNull, false, _newPos, _volume, 1, 1000]; - _args set [8, ACE_time]; + _args set [8, CBA_missionTime]; }; }; }; - }, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, ACE_time] ] call CBA_fnc_addPerFrameHandler; + }, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, CBA_missionTime] ] call CBA_fnc_addPerFrameHandler; }; true; diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp index 8146b5cb8a..d1fdd10580 100644 --- a/addons/missionmodules/script_component.hpp +++ b/addons/missionmodules/script_component.hpp @@ -1,4 +1,5 @@ -#define COMPONENT missionModules +#define COMPONENT missionmodules +#define COMPONENT_BEAUTIFIED Mission Modules #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSIONMODULES #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/mk6mortar/CfgMagazines.hpp b/addons/mk6mortar/CfgMagazines.hpp index 679539e1a2..a726bc5a9f 100644 --- a/addons/mk6mortar/CfgMagazines.hpp +++ b/addons/mk6mortar/CfgMagazines.hpp @@ -8,8 +8,8 @@ class cfgMagazines { displayName = CSTRING(magazine_HE_displayName); displayNameShort = ""; descriptionShort = CSTRING(magazine_descriptionShort); - model = PATHTOF(data\l16_ammo_he.p3d); - picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + model = QPATHTOF(data\l16_ammo_he.p3d); + picture = QPATHTOF(UI\w_l16_ammo_he_ca.paa); mass = 50; }; class 8Rnd_82mm_Mo_Smoke_white; @@ -21,8 +21,8 @@ class cfgMagazines { displayName = CSTRING(magazine_Smoke_displayName); displayNameShort = ""; descriptionShort = CSTRING(magazine_descriptionShort); - model = PATHTOF(data\l16_ammo_smk_white.p3d); - picture = PATHTOF(UI\w_l16_ammo_smk_white_ca.paa); + model = QPATHTOF(data\l16_ammo_smk_white.p3d); + picture = QPATHTOF(UI\w_l16_ammo_smk_white_ca.paa); mass = 50; }; class 8Rnd_82mm_Mo_Flare_white; @@ -34,8 +34,8 @@ class cfgMagazines { displayName = CSTRING(magazine_Illum_displayName); displayNameShort = ""; descriptionShort = CSTRING(magazine_descriptionShort); - model = PATHTOF(data\l16_ammo_illum.p3d); - picture = PATHTOF(UI\w_l16_ammo_illum_ca.paa); + model = QPATHTOF(data\l16_ammo_illum.p3d); + picture = QPATHTOF(UI\w_l16_ammo_illum_ca.paa); mass = 50; }; class 8Rnd_82mm_Mo_guided; @@ -47,8 +47,8 @@ class cfgMagazines { displayName = CSTRING(magazine_HE_Guided_displayName); displayNameShort = ""; descriptionShort = CSTRING(magazine_descriptionShort); - model = PATHTOF(data\l16_ammo_he.p3d); - picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + model = QPATHTOF(data\l16_ammo_he.p3d); + picture = QPATHTOF(UI\w_l16_ammo_he_ca.paa); mass = 50; }; class 8Rnd_82mm_Mo_LG; @@ -60,8 +60,8 @@ class cfgMagazines { displayName = CSTRING(magazine_HE_LaserGuided_displayName); displayNameShort = ""; descriptionShort = CSTRING(magazine_descriptionShort); - model = PATHTOF(data\l16_ammo_he.p3d); - picture = PATHTOF(UI\w_l16_ammo_he_ca.paa); + model = QPATHTOF(data\l16_ammo_he.p3d); + picture = QPATHTOF(UI\w_l16_ammo_he_ca.paa); mass = 50; }; }; diff --git a/addons/mk6mortar/CfgVehicles.hpp b/addons/mk6mortar/CfgVehicles.hpp index fa6667f874..75b0277192 100644 --- a/addons/mk6mortar/CfgVehicles.hpp +++ b/addons/mk6mortar/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { condition = QUOTE(_this call FUNC(rangeTableCanUse)); statement = QUOTE(_this call FUNC(rangeTableOpen)); priority = 0; - icon = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); + icon = QPATHTOF(UI\icon_rangeTable.paa); exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; @@ -102,7 +102,7 @@ class CfgVehicles { scope = 2; isGlobal = 0; isSingular = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_mk6_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_mk6_ca.paa); functionPriority = 0; class Arguments { class airResistanceEnabled { diff --git a/addons/mk6mortar/CfgWeapons.hpp b/addons/mk6mortar/CfgWeapons.hpp index f535840e99..cb5454321d 100644 --- a/addons/mk6mortar/CfgWeapons.hpp +++ b/addons/mk6mortar/CfgWeapons.hpp @@ -7,7 +7,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(rangetable_name); descriptionShort = CSTRING(rangetable_description); - picture = QUOTE(PATHTOF(UI\icon_rangeTable.paa)); + picture = QPATHTOF(UI\icon_rangeTable.paa); class ItemInfo: InventoryItem_Base_F { mass = 0.5; }; diff --git a/addons/mk6mortar/RscInGameUI.hpp b/addons/mk6mortar/RscInGameUI.hpp index a114896044..7d32512827 100644 --- a/addons/mk6mortar/RscInGameUI.hpp +++ b/addons/mk6mortar/RscInGameUI.hpp @@ -3,7 +3,7 @@ class RscInGameUI { class CA_IGUI_elements_group: RscControlsGroup {}; }; class ACE_Mk6_RscWeaponRangeArtillery: RscWeaponRangeArtillery { - onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_Mk6_RscWeaponRangeArtillery', _this select 0)]; [ARR_2('infoDisplayChanged', [ARR_2(_this select 0, 'Mk6Mortar')])] call EFUNC(common,localEvent);); + onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_Mk6_RscWeaponRangeArtillery', _this select 0)]; [ARR_2('ace_infoDisplayChanged', [ARR_2(_this select 0, 'Mk6Mortar')])] call CBA_fnc_localEvent;); controls[] = {"ACE_ChargeDisplay", "ACE_MILS_GROUP", "CA_IGUI_elements_group","CA_RangeElements_group"}; class ACE_ChargeDisplay: RscStructuredText { idc = 80085; diff --git a/addons/mk6mortar/RscRangeTable.hpp b/addons/mk6mortar/RscRangeTable.hpp index 6bf0e51619..c719dd7ee4 100644 --- a/addons/mk6mortar/RscRangeTable.hpp +++ b/addons/mk6mortar/RscRangeTable.hpp @@ -7,7 +7,7 @@ class ACE_82mm_RangeTable_Dialog { class ControlsBackground { class TableBackground: RscPicture { idc = -1; - text = QUOTE(PATHTOF(UI\RangeTable_background.paa)); + text = QPATHTOF(UI\RangeTable_background.paa); x = "18 *(safeZoneH / 40) + (safezoneX + (safezoneW - safeZoneH)/2)"; y = "1 * ((safeZoneH / 1.2) / 25) + (safezoneY + (safezoneH - (safeZoneH / 1.2))/2)"; w = "16.2634559672906 * (safeZoneH / 40)"; diff --git a/addons/mk6mortar/XEH_postInit.sqf b/addons/mk6mortar/XEH_postInit.sqf index 9c098b8cdd..aceb721d70 100644 --- a/addons/mk6mortar/XEH_postInit.sqf +++ b/addons/mk6mortar/XEH_postInit.sqf @@ -3,21 +3,21 @@ [QGVAR(addMagazine), { params ["_static", "_magazine"]; _static addMagazineTurret [_magazine,[0]]; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; [QGVAR(removeMagazine), { params ["_static", "_magazine"]; _static removeMagazineTurret [_magazine,[0]]; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; [QGVAR(setAmmo), { params ["_static", "_magazine","_ammoCount"]; _static setMagazineTurretAmmo [_magazine, _ammoCount, [0]]; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; -["initMortar", {_this call FUNC(mortarInit);}] call EFUNC(common,addEventHandler); +["ace_initMortar", {_this call FUNC(mortarInit);}] call CBA_fnc_addEventHandler; if (!hasInterface) exitWith {}; -["playerVehicleChanged", {_this call FUNC(handlePlayerVehicleChanged);}] call EFUNC(common,addEventHandler); -["infoDisplayChanged", {_this call FUNC(turretDisplayLoaded);}] call EFUNC(common,addEventHandler); +["vehicle", FUNC(handlePlayerVehicleChanged)] call CBA_fnc_addPlayerEventHandler; +["ace_infoDisplayChanged", FUNC(turretDisplayLoaded)] call CBA_fnc_addEventHandler; diff --git a/addons/mk6mortar/config.cpp b/addons/mk6mortar/config.cpp index 102875a195..a63f7086f9 100644 --- a/addons/mk6mortar/config.cpp +++ b/addons/mk6mortar/config.cpp @@ -2,13 +2,15 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Box_82mm_Mo_HE","ACE_Box_82mm_Mo_Smoke", "ACE_Box_82mm_Mo_Illum","ACE_Box_82mm_Mo_Combo"}; weapons[] = {"ACE_RangeTable_82mm","ace_mortar_82mm"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"PabstMirror","Grey","VKing"}; - authorUrl = "https://github.com/acemod"; + author = ECSTRING(common,ACETeam); + authors[] = {"PabstMirror","Grey","VKing"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -32,3 +34,7 @@ class RscStructuredText; #include "RscInGameUI.hpp" #include "RscRangeTable.hpp" + +class ACE_newEvents { + initMortar = "ace_initMortar"; +}; diff --git a/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf b/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf index 9d8b292070..d1e0a8dd05 100644 --- a/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf +++ b/addons/mk6mortar/functions/fnc_dev_simulateCalcRangeTableLine.sqf @@ -21,7 +21,7 @@ Example: private ["_startTime", "_muzzleVelocity", "_rangeToHit", "_airFriction", "_vacElevation", "_radicand", "_maxElev", "_minElev", "_error", "_solutionElevation", "_lastTestResult", "_numberOfAttempts", "_lineElevation", "_lineTimeOfFlight", "_lineHeightElevation", "_lineHeightTimeDelta", "_lineCrosswindDeg", "_lineHeadwindMeters", "_lineTailWindMeters", "_result"]; -_startTime = ACE_diagTime; +_startTime = diag_tickTime; _muzzleVelocity = _this select 0; _rangeToHit = _this select 1; @@ -74,6 +74,6 @@ _lineAirDensDec = (_rangeToHit - (_lastTestResult select 0)) / 10; _lastTestResult = [_lineElevation, _muzzleVelocity, _airFriction, 15, 1.1, 0, 0, 0, TIME_STEP] call FUNC(dev_simulateShot); _lineAirDensInc = (_rangeToHit - (_lastTestResult select 0)) / 10; -// systemChat format ["debug: Range %1 - in %2 sec", _rangeToHit, (ACE_diagTime - _startTime)]; +// systemChat format ["debug: Range %1 - in %2 sec", _rangeToHit, (diag_tickTime - _startTime)]; [_rangeToHit, _lineElevation, _lineHeightElevation, _lineHeightTimeDelta, _lineTimeOfFlight, _lineCrosswindDeg, _lineHeadwindMeters, _lineTailWindMeters, _lineTempDec, _lineTempInc, _lineAirDensDec, _lineAirDensInc] diff --git a/addons/mk6mortar/functions/fnc_handleFired.sqf b/addons/mk6mortar/functions/fnc_handleFired.sqf index e14fd77f6a..483a69d42b 100644 --- a/addons/mk6mortar/functions/fnc_handleFired.sqf +++ b/addons/mk6mortar/functions/fnc_handleFired.sqf @@ -70,8 +70,8 @@ if (_newMuzzleVelocityCoefficent != 1) then { [_pfID] call CBA_fnc_removePerFrameHandler; }; - _deltaT = ACE_time - _time; - _args set[2, ACE_time]; + _deltaT = CBA_missionTime - _time; + _args set[2, CBA_missionTime]; _bulletVelocity = velocity _shell; _bulletSpeed = vectorMagnitude _bulletVelocity; @@ -85,4 +85,4 @@ if (_newMuzzleVelocityCoefficent != 1) then { _shell setVelocity _bulletVelocity; -}, 0, [_projectile, MK6_82mm_AIR_FRICTION, ACE_time, _relativeDensity]] call CBA_fnc_addPerFrameHandler; +}, 0, [_projectile, MK6_82mm_AIR_FRICTION, CBA_missionTime, _relativeDensity]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf index 2d921973d4..8c8760bc15 100644 --- a/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf +++ b/addons/mk6mortar/functions/fnc_handlePlayerVehicleChanged.sqf @@ -29,8 +29,8 @@ if (!(_newVehicle getVariable [QGVAR(initialized),false]) && !(_newVehicle getVa if (GVAR(useAmmoHandling) && {!(_mortar getVariable [QGVAR(initialized),false]) && !(_mortar getVariable [QGVAR(exclude),false])}) then { //wait for proper turret locality change [{ - ["initMortar", [_this], [_this]] call EFUNC(common,globalEvent); - }, _mortar, 0.05] call EFUNC(common,waitAndExecute); + ["ace_initMortar", [_this], [_this]] call CBA_fnc_globalEvent; + }, _mortar, 0.05] call CBA_fnc_waitAndExecute; }; }, _newVehicle] call EFUNC(common,runAfterSettingsInit); }; @@ -71,7 +71,7 @@ if (_lastFireMode != -1) then { _display = uiNamespace getVariable ["ACE_Mk6_RscWeaponRangeArtillery", displayNull]; if (isNull _display) exitWith {}; //It may be null for the first frame - _chargeText = format ["%1: %2 ", (localize LSTRING(rangetable_charge)), _currentChargeMode, QUOTE(PATHTOF(UI\ui_charges.paa))]; + _chargeText = format ["%1: %2 ", (localize LSTRING(rangetable_charge)), _currentChargeMode, QPATHTOF(UI\ui_charges.paa)]; //Hud should hidden in 3rd person _notGunnerView = cameraView != "GUNNER"; diff --git a/addons/mk6mortar/functions/fnc_loadMagazine.sqf b/addons/mk6mortar/functions/fnc_loadMagazine.sqf index 41b0162151..37fa2f4db4 100644 --- a/addons/mk6mortar/functions/fnc_loadMagazine.sqf +++ b/addons/mk6mortar/functions/fnc_loadMagazine.sqf @@ -24,7 +24,7 @@ private ["_weapon","_currentMagazine","_count","_magazines","_magazineDetails"," //If function has been called with an optional classname hten add that magazine to the static weapon. Otherwise add the compatible magazine if(_magazineClassOptional != "") then { _unit removeMagazine _magazineClassOptional; - [QGVAR(addMagazine), [_static, _magazineClassOptional]] call EFUNC(common,globalEvent); + [QGVAR(addMagazine), [_static, _magazineClassOptional]] call CBA_fnc_globalEvent; } else { //Get weapon & magazine information of static weapon _weapon = (_static weaponsTurret [0]) select 0; @@ -49,7 +49,7 @@ if(_magazineClassOptional != "") then { } forEach _magazines; //If the static weapon already has an empty magazine then remove it if (_count == 0) then { - [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent); + [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call CBA_fnc_globalEvent; }; //Find out the ammo count of the compatible magazine found if (_magazineClassDetails != "") then{ @@ -60,6 +60,6 @@ if(_magazineClassOptional != "") then { }; _unit removeMagazine _magazineClass; - [QGVAR(addMagazine), [_static, _magazineClass]] call EFUNC(common,globalEvent); - [QGVAR(setAmmo), _static, [_static, _magazineClass,_roundsLeft]] call EFUNC(common,targetEvent); + [QGVAR(addMagazine), [_static, _magazineClass]] call CBA_fnc_globalEvent; + [QGVAR(setAmmo), [_static, _magazineClass,_roundsLeft], _static] call CBA_fnc_targetEvent; }; diff --git a/addons/mk6mortar/functions/fnc_unloadMagazine.sqf b/addons/mk6mortar/functions/fnc_unloadMagazine.sqf index 537cc931d8..c485a39a3a 100644 --- a/addons/mk6mortar/functions/fnc_unloadMagazine.sqf +++ b/addons/mk6mortar/functions/fnc_unloadMagazine.sqf @@ -35,5 +35,5 @@ if (_ammoCount > 0) then { _unit addMagazineAmmoCargo [_currentMagazineClass, 1, _ammoCount]; _unit setPosATL _pos; }; - [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call EFUNC(common,globalEvent); + [QGVAR(removeMagazine), [_static, _currentMagazineClass]] call CBA_fnc_globalEvent; }; diff --git a/addons/mk6mortar/script_component.hpp b/addons/mk6mortar/script_component.hpp index 97e1c8b50a..d7f0b92cee 100644 --- a/addons/mk6mortar/script_component.hpp +++ b/addons/mk6mortar/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT mk6mortar +#define COMPONENT_BEAUTIFIED Mk6 Mortar #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -16,4 +17,4 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define MK6_82mm_AIR_FRICTION -0.0001 \ No newline at end of file +#define MK6_82mm_AIR_FRICTION -0.0001 diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index 1de69ece38..ba13c57627 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -151,6 +151,7 @@ Aktywuj obsługę amunicji Utiliser la gestion des munitions Utilizza la gestione delle munizioni + Usar manejo de munição Removes mortar magazines, requiring individual rounds to be loaded by the gunner or loader. Does not affect AI mortars. @@ -159,6 +160,7 @@ Usuwa magazynki moździerza, wymagając ładowania pojedynczych pocisków przez strzelca lub ładowniczego. Nie dotyczy moździerzy AI. Enlever les chargeurs de mortier, requiert des obus individuels qui doivent être chargés par le tireur ou le servant. N'affect pas les mortiers IA. Toglie i proiettili dal mortaio. I colpi singoli devono essere caricati dall'operatore. Non cambia quado l'IA spara. + Elimina os carregadores do morteiro, requerendo que o atirador ou carregador utilize de forma individual a munição. Não afeta os morteiros controlados pela IA. Remove Round @@ -168,6 +170,7 @@ Enlever l'obus Togli proiettile Odstranit náboj + Remover munição Load Mortar @@ -177,6 +180,7 @@ Charger le mortier Carica mortaio Nabít minomet + Carregar morteiro Unloading Round @@ -185,6 +189,7 @@ Rozładowywanie moździerza Déchargement de l'obus Scarica proiettile + Descarregar munição Preparing Round @@ -194,6 +199,7 @@ Praparation de l'obus Prepara il proiettile Připavuji náboj + Preparar munição Load HE @@ -203,6 +209,7 @@ Charger HE Carica proiettile esplosivo ad alto potenziale (HE) Nabít HE + Carregar HE Load Smoke @@ -212,6 +219,7 @@ Charger Fumigène Carica fumogeno Nabít Dýmovnici + Carregar Fumaça Load Illumination @@ -221,6 +229,7 @@ Charger Eclairante Carica illuminante Nabít Světlici + Carregar Iluminação Load Guided HE @@ -230,6 +239,7 @@ Charger HE guidé Carica HE guidata Nabít HE (Naváděné) + Carregar HE Guiada Load Laser Guided HE @@ -239,6 +249,7 @@ Charger HE guidé au laser Carica HE a guida laser Nabít HE (Naváděné laserem) + Carregar HE Guiada por Laser 82mm HE Round @@ -248,6 +259,7 @@ Obus de 82mm HE Proiettile da 82mm HE 82mm HE náboj + Munição 82mm HE 82mm Smoke Round @@ -257,6 +269,7 @@ Obus de 82mm fumigène Proiettile Fumogeno da 82mm 82mm Kouřový náboj + Munição 82mm Fumaça 82mm Illumination Round @@ -266,6 +279,7 @@ Obus de 82mm éclairant Proiettile illuminante da 82mm 82mm Osvětlovací náboj + Munição 82mm Iluminação 82mm Guided HE Round @@ -275,6 +289,7 @@ Obus de 82mm HE guidé Proiettile HE guidato 82mm HE náboj (naváděný) + Munição 82mm HE Guiada 82mm Laser Guided HE Round @@ -284,6 +299,7 @@ Obus de 82mm HE guidé au laser Proiettile HE a guida laser 82mm HE náboj (naváděný laserem) + Munição 82mm HE Guiada por Laser Used in Mk6 mortar @@ -293,6 +309,7 @@ Utilisé dans le mortier Mk6 Usato nel mortaio Mk6 Používá se u minometu Mk6 + Usada no Morteiro MK6 [ACE] 82mm HE Rounds Box @@ -302,6 +319,7 @@ [ACE] Obus de 82mm HE [ACE] Scatola proiettili espolisvi ad alto potenziale (HE) da 82mm [ACE] Bedna s municí (82mm HE) + [ACE] Caixa de Munição 82mm HE [ACE] 82mm Smoke Rounds Box @@ -311,6 +329,7 @@ [ACE] Obus de 82mm fumigène [ACE] Scatola fumogeni da 82mm [ACE] Bedna s municí (82mm Dýmovnice) + [ACE] Caixa de Munição 82mm Fumaça [ACE] 82mm Illumination Rounds Box @@ -320,6 +339,7 @@ [ACE] Obus de 82mm éclairants [ACE] Scatola illuminanti da 82mm [ACE] Bedna s municí (82mm Světlice) + [ACE] Caixa de Munição 82mm Iluminação [ACE] 82mm Default Loadout Box @@ -329,6 +349,7 @@ [ACE] Obus de 82mm par défaut [ACE] Scatola proiettili 82mm standard [ACE] Bedna se standardní 82mm municí + [ACE] Caixa de Munição 82mm Padrão \ No newline at end of file diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index 8f0c430db2..293b946897 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" -["InitSettingsFromModules", { +[QEGVAR(common,initSettingsFromModules), { // TODO This is a basic and limited implementation that mimics some of the functionality from the A3 module framework, but not all of it. // We have to execute this in the postInit XEH because on object init, the parameters of the modules are not yet available. They are if we execute it at the start of postInit execution. @@ -49,4 +49,4 @@ GVAR(serverModulesRead) = true; publicVariable QGVAR(serverModulesRead); }; -}] call EFUNC(common,addEventhandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/modules/config.cpp b/addons/modules/config.cpp index d25e193d32..662b1cb349 100644 --- a/addons/modules/config.cpp +++ b/addons/modules/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_main"}; - author[] = {"Glowbal"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"Glowbal"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -25,4 +27,4 @@ class CfgVehicles { }; }; -#include "CfgEventHandlers.hpp" \ No newline at end of file +#include "CfgEventHandlers.hpp" diff --git a/addons/modules/script_component.hpp b/addons/modules/script_component.hpp index 4e4e64e8e3..0ba8e441e8 100644 --- a/addons/modules/script_component.hpp +++ b/addons/modules/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT modules +#define COMPONENT_BEAUTIFIED Modules #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/movement/CfgInventoryGlobalVariable.hpp b/addons/movement/CfgInventoryGlobalVariable.hpp deleted file mode 100644 index cf25595254..0000000000 --- a/addons/movement/CfgInventoryGlobalVariable.hpp +++ /dev/null @@ -1,3 +0,0 @@ -class CfgInventoryGlobalVariable { - maxSoldierLoad = 1200; -}; diff --git a/addons/movement/XEH_postInit.sqf b/addons/movement/XEH_postInit.sqf index d9179a912a..f64b92603b 100644 --- a/addons/movement/XEH_postInit.sqf +++ b/addons/movement/XEH_postInit.sqf @@ -3,11 +3,10 @@ if (!hasInterface) exitWith {}; -["playerChanged", FUNC(handleVirtualMass)] call FUNC(addEventHandler); -["playerInventoryChanged", FUNC(handleVirtualMass)] call FUNC(addEventHandler); +["unit", FUNC(handleVirtualMass)] call CBA_fnc_addPlayerEventHandler; +["loadout", FUNC(handleVirtualMass)] call CBA_fnc_addPlayerEventHandler; -["ACE3 Movement", QGVAR(climb), localize LSTRING(Climb), -{ +["ACE3 Movement", QGVAR(climb), localize LSTRING(Climb), { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific diff --git a/addons/movement/config.cpp b/addons/movement/config.cpp index 8ea42fbf0c..14a3b8f68d 100644 --- a/addons/movement/config.cpp +++ b/addons/movement/config.cpp @@ -2,19 +2,20 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2","KoffeinFlummi","Tachii"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","KoffeinFlummi","Tachii"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgFatigue.hpp" -//#include "CfgInventoryGlobalVariable.hpp" #include "CfgMoves.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" diff --git a/addons/movement/functions/fnc_canClimb.sqf b/addons/movement/functions/fnc_canClimb.sqf index ec4202dbd5..260f76105b 100644 --- a/addons/movement/functions/fnc_canClimb.sqf +++ b/addons/movement/functions/fnc_canClimb.sqf @@ -40,14 +40,29 @@ private _checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3); private _checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5]; private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3); -/* -drawLine3D [ASLToATL _checkPos0beg, ASLToATL _checkPos0end, [0,1,0,1]]; -drawLine3D [ASLToATL _checkPos1beg, ASLToATL _checkPos1end, [1,0,0,1]]; -drawLine3D [ASLToATL _checkPos2beg, ASLToATL _checkPos2end, [1,0.5,0.5,1]]; -drawLine3D [ASLToATL _checkPos3beg, ASLToATL _checkPos3end, [1,0.5,0.5,1]]; -drawLine3D [ASLToATL _checkPos4beg, ASLToATL _checkPos4end, [1,0.5,0.5,1]]; -drawLine3D [ASLToATL _checkPos5beg, ASLToATL _checkPos5end, [1,0.5,0.5,1]]; -*/ +#ifdef DEBUG_MODE_FULL + [{ + params ["_args", "_idPFH"]; + + if (diag_tickTime > (_args select 0) + 5) exitWith { + [_idPFH] call CBA_fnc_removePerFrameHandler; + }; + + drawLine3D [ASLToATL (_args select 1), ASLToATL (_args select 2), [0,1,0,1]]; + drawLine3D [ASLToATL (_args select 3), ASLToATL (_args select 4), [1,0,0,1]]; + drawLine3D [ASLToATL (_args select 5), ASLToATL (_args select 6), [1,0.5,0.5,1]]; + drawLine3D [ASLToATL (_args select 7), ASLToATL (_args select 8), [1,0.5,0.5,1]]; + drawLine3D [ASLToATL (_args select 9), ASLToATL (_args select 10), [1,0.5,0.5,1]]; + drawLine3D [ASLToATL (_args select 11), ASLToATL (_args select 12), [1,0.5,0.5,1]]; + }, 0, [ diag_tickTime, + _checkPos0beg, _checkPos0end, + _checkPos1beg, _checkPos1end, + _checkPos2beg, _checkPos2end, + _checkPos3beg, _checkPos3end, + _checkPos4beg, _checkPos4end, + _checkPos5beg, _checkPos5end + ]] call CBA_fnc_addPerFrameHandler; +#endif lineIntersects [_checkPos0beg, _checkPos0end] && {!(lineIntersects [_checkPos1beg, _checkPos1end])} diff --git a/addons/movement/functions/fnc_handleVirtualMass.sqf b/addons/movement/functions/fnc_handleVirtualMass.sqf index 13a7b77f9a..8e33197089 100644 --- a/addons/movement/functions/fnc_handleVirtualMass.sqf +++ b/addons/movement/functions/fnc_handleVirtualMass.sqf @@ -14,6 +14,8 @@ params ["_unit"]; +if (isNull _unit) exitWith {}; + // add sum of virtual loads private _virtualLoad = 0; @@ -27,7 +29,7 @@ private _virtualLoad = 0; ]; // get absolute vanilla load -private _absLoad = loadAbs _unit / load _unit; +private _absLoad = getNumber (configFile >> "CfgInventoryGlobalVariable" >> "maxSoldierLoad"); // try to preserve other changes to the "LoadCoef" unitTrait private _loadCoef = _unit getVariable QGVAR(loadCoef); diff --git a/addons/movement/script_component.hpp b/addons/movement/script_component.hpp index 14728cbcbb..f64f10fdd4 100644 --- a/addons/movement/script_component.hpp +++ b/addons/movement/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT movement +#define COMPONENT_BEAUTIFIED Movement #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/mx2a/CfgWeapons.hpp b/addons/mx2a/CfgWeapons.hpp index 6f590e2ed4..7ff5943a88 100644 --- a/addons/mx2a/CfgWeapons.hpp +++ b/addons/mx2a/CfgWeapons.hpp @@ -5,9 +5,9 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(DisplayName); descriptionShort = CSTRING(Description); - model = PATHTOF(data\ace_mx2a.p3d); - modelOptics = QUOTE(PATHTOEF(apl,LWTS_optic.p3d)); - picture = PATHTOF(UI\w_mx2a_ca.paa); + model = QPATHTOF(data\ace_mx2a.p3d); + modelOptics = QPATHTOEF(apl,LWTS_optic.p3d); + picture = QPATHTOF(UI\w_mx2a_ca.paa); opticsZoomMax = 0.1; distanceZoomMax = 120; opticsZoomMin = 0.05; diff --git a/addons/mx2a/config.cpp b/addons/mx2a/config.cpp index 45b1643ed2..3892b9bb99 100644 --- a/addons/mx2a/config.cpp +++ b/addons/mx2a/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_MX2A"}; weapons[] = {"ACE_MX2A"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl"}; - author[] = {"Spooner", "tcp"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Spooner", "tcp"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/mx2a/script_component.hpp b/addons/mx2a/script_component.hpp index 9b36572497..c2fc0e12e6 100644 --- a/addons/mx2a/script_component.hpp +++ b/addons/mx2a/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT mx2a +#define COMPONENT_BEAUTIFIED MX-2A #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_MX2A #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 7ca13b5aeb..6b8b8956ae 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { scope = 2; isGlobal = 1; isSingular = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_NameTags_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_NameTags_ca.paa); class Arguments { class showPlayerNames { displayName = CSTRING(ShowPlayerNames); diff --git a/addons/nametags/UI/icons_russia/captain_gs.paa b/addons/nametags/UI/icons_russia/captain_gs.paa new file mode 100644 index 0000000000..e346178118 Binary files /dev/null and b/addons/nametags/UI/icons_russia/captain_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/colonel_gs.paa b/addons/nametags/UI/icons_russia/colonel_gs.paa new file mode 100644 index 0000000000..55023e5034 Binary files /dev/null and b/addons/nametags/UI/icons_russia/colonel_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/corporal_gs.paa b/addons/nametags/UI/icons_russia/corporal_gs.paa new file mode 100644 index 0000000000..7e1ec60e95 Binary files /dev/null and b/addons/nametags/UI/icons_russia/corporal_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/lieutenant_gs.paa b/addons/nametags/UI/icons_russia/lieutenant_gs.paa new file mode 100644 index 0000000000..8ca42e4040 Binary files /dev/null and b/addons/nametags/UI/icons_russia/lieutenant_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/major_gs.paa b/addons/nametags/UI/icons_russia/major_gs.paa new file mode 100644 index 0000000000..92343ae3a9 Binary files /dev/null and b/addons/nametags/UI/icons_russia/major_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/private_gs.paa b/addons/nametags/UI/icons_russia/private_gs.paa new file mode 100644 index 0000000000..8509568254 Binary files /dev/null and b/addons/nametags/UI/icons_russia/private_gs.paa differ diff --git a/addons/nametags/UI/icons_russia/sergeant_gs.paa b/addons/nametags/UI/icons_russia/sergeant_gs.paa new file mode 100644 index 0000000000..f00db77656 Binary files /dev/null and b/addons/nametags/UI/icons_russia/sergeant_gs.paa differ diff --git a/addons/nametags/XEH_PREP.hpp b/addons/nametags/XEH_PREP.hpp index 93a8ff6626..5d99258d27 100644 --- a/addons/nametags/XEH_PREP.hpp +++ b/addons/nametags/XEH_PREP.hpp @@ -8,3 +8,4 @@ PREP(moduleNameTags); PREP(onDraw3d); PREP(setText); PREP(updateSettings); +PREP(setFactionRankIcons); diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index 46d0e287d8..bebe840b47 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -14,7 +14,7 @@ GVAR(showNamesTime) = -10; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement - GVAR(showNamesTime) = ACE_time; + GVAR(showNamesTime) = CBA_missionTime; if (call FUNC(canShow)) then{ call FUNC(doShow); }; // Return false so it doesn't block other actions false @@ -23,15 +23,15 @@ GVAR(showNamesTime) = -10; [29, [false, false, false]], false] call CBA_fnc_addKeybind; //LeftControl Key // Wait until the colors are defined before starting to draw the nametags -["SettingsInitialized", { +["ace_settingsInitialized", { // Draw handle call FUNC(updateSettings); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Change settings accordingly when they are changed -["SettingChanged", { +["ace_settingChanged", { params ["_name"]; if (_name == QGVAR(showPlayerNames)) then { call FUNC(updateSettings); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index a2d38254f1..0f491efce1 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = { "commy2", "esteldunedain" }; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = { "commy2", "esteldunedain" }; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/nametags/functions/common.hpp b/addons/nametags/functions/common.hpp index 6aeb24fc5a..ef3706cd32 100644 --- a/addons/nametags/functions/common.hpp +++ b/addons/nametags/functions/common.hpp @@ -17,6 +17,6 @@ "a3\ui_f\data\IGUI\Cfg\Actions\getindriver_ca.paa", \ "a3\ui_f\data\IGUI\Cfg\Actions\getincommander_ca.paa", \ "a3\ui_f\data\IGUI\Cfg\Actions\getingunner_ca.paa", \ - QUOTE(PATHTOF(UI\icon_position_ffv.paa)), \ + QPATHTOF(UI\icon_position_ffv.paa), \ "a3\ui_f\data\IGUI\Cfg\Actions\getincargo_ca.paa" \ ] diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 95c3f5228b..a765f1b802 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -11,7 +11,7 @@ * 5: Draw rank * 6: Draw soundwave * - * Return value: + * Return Value: * None * * Example: @@ -33,11 +33,16 @@ _fnc_parameters = { private _icon = ""; private _size = 0; if (_drawSoundwave) then { - _icon = format [QUOTE(PATHTOF(UI\soundwave%1.paa)), floor random 10]; + _icon = format [QPATHTOF(UI\soundwave%1.paa), floor random 10]; _size = 1; } else { if (_drawRank && {rank _target != ""}) then { - _icon = format["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", toLower rank _target]; + _icon = GVAR(factionRanks) getVariable faction _target; + if (!isNil "_icon") then { + _icon = _icon param [ALL_RANKS find rank _target, ""]; + } else { + _icon = format ["\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa", rank _target]; + }; _size = 1; }; }; @@ -55,7 +60,7 @@ _fnc_parameters = { _color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings) _color set [3, (_color select 3) * _alpha]; } else { - _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (assignedTeam _target)) max 0); + _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select ((["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find ([assignedTeam _target] param [0, "MAIN"])) max 0); }; private _scale = [0.333, 0.5, 0.666, 0.83333, 1] select GVAR(tagSize); diff --git a/addons/nametags/functions/fnc_initIsSpeaking.sqf b/addons/nametags/functions/fnc_initIsSpeaking.sqf index 7f9ced67f7..08a72e57b3 100644 --- a/addons/nametags/functions/fnc_initIsSpeaking.sqf +++ b/addons/nametags/functions/fnc_initIsSpeaking.sqf @@ -28,14 +28,13 @@ if (isServer) then { if (!hasInterface) exitWith {}; -["playerChanged", { +["unit", { //When player changes, make sure to reset old unit's variable params ["", "_oldUnit"]; if ((!isNull _oldUnit) && {_oldUnit getVariable [QGVAR(isSpeakingInGame), false]}) then { _oldUnit setVariable [QGVAR(isSpeakingInGame), false, true]; }; -}] call EFUNC(common,addEventHandler); - +}] call CBA_fnc_addPlayerEventHandler; if (isClass (configFile >> "CfgPatches" >> "acre_api")) then { ACE_LOGINFO("ACRE Detected."); diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf index eed96b3101..d9d26cd0ac 100644 --- a/addons/nametags/functions/fnc_onDraw3d.sqf +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -47,13 +47,13 @@ switch (GVAR(showPlayerNames)) do { }; case 3: { // Player names Only Keypress - _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - ACE_time); + _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - CBA_missionTime); _enabledTagsNearby = (_onKeyPressAlphaMax) > 0 || (GVAR(showSoundWaves) == 2); _enabledTagsCursor = false; }; case 4: { // Player names Only Cursor and Keypress - _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - ACE_time); + _onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - CBA_missionTime); _enabledTagsNearby = (GVAR(showSoundWaves) == 2); _enabledTagsCursor = _onKeyPressAlphaMax > 0; }; diff --git a/addons/nametags/functions/fnc_setFactionRankIcons.sqf b/addons/nametags/functions/fnc_setFactionRankIcons.sqf new file mode 100644 index 0000000000..c0a315636b --- /dev/null +++ b/addons/nametags/functions/fnc_setFactionRankIcons.sqf @@ -0,0 +1,37 @@ +/* + * Author: commy2 + * Sets a custom set of icons for a specified faction. + * + * Arguments: + * 0: Faction + * 1: Rank Icons + * + * Return Value: + * Successful? + * + * Example: + * ["BLU_F", [ + * "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\corporal_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\lieutenant_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", + * "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" + * ]] call ace_nametags_fnc_setFactionRankIcons + * + * Public: Yes + */ +#include "script_component.hpp" + +if (isNil QGVAR(factionRanks)) then { + GVAR(factionRanks) = [] call CBA_fnc_createNamespace; +}; + +params [["_faction", "", [""]], ["_icons", [], [[]], [7]]]; + +if !(_faction != "" && {_icons isEqualTypeAll ""}) exitWith {false}; + +GVAR(factionRanks) setVariable [_faction, _icons]; + +true diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp index 5b777aee71..fff9a31de3 100644 --- a/addons/nametags/script_component.hpp +++ b/addons/nametags/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT nametags +#define COMPONENT_BEAUTIFIED Name Tags #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -21,3 +22,5 @@ #define ICON_NAME_RANK 2 #define ICON_NAME_SPEAK 3 #define ICON_SPEAK 4 + +#define ALL_RANKS ["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] diff --git a/addons/nightvision/CfgVehicles.hpp b/addons/nightvision/CfgVehicles.hpp index 8b489ad64f..c540251dbb 100644 --- a/addons/nightvision/CfgVehicles.hpp +++ b/addons/nightvision/CfgVehicles.hpp @@ -19,9 +19,9 @@ class CfgVehicles { class GVAR(ModuleSettings): ACE_Module { scope = 2; displayName = CSTRING(Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_ca.paa); category = "ACE"; - function = QUOTE(FUNC(initModule)); + function = QFUNC(initModule); functionPriority = 1; isGlobal = 1; isTriggerActivated = 0; diff --git a/addons/nightvision/CfgWeapons.hpp b/addons/nightvision/CfgWeapons.hpp index 8a053a3262..72be31d8cf 100644 --- a/addons/nightvision/CfgWeapons.hpp +++ b/addons/nightvision/CfgWeapons.hpp @@ -47,7 +47,7 @@ class CfgWeapons { }; class ACE_NVG_Wide: NVGoggles { author = ECSTRING(common,ACETeam); - modelOptics = QUOTE(PATHTOF(models\ACE_nvg_wide_optics)); + modelOptics = QPATHTOF(models\ACE_nvg_wide_optics); displayName = CSTRING(NVG_FullScreen); ACE_NightVision_grain = 0.75; ACE_NightVision_blur = 0.055; diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index 96badd59af..de0b629d76 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -29,22 +29,16 @@ GVAR(ppEffectMuzzleFlash) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [0, 0, 0, 1], [ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; // Setup the event handlers -["playerInventoryChanged", FUNC(updatePPEffects)] call EFUNC(common,addEventHandler); -["playerVisionModeChanged", { - _this call FUNC(updatePPEffects); - _this call FUNC(onVisionModeChanged); -}] call EFUNC(common,addEventHandler); - -["cameraViewChanged", { - _this call FUNC(updatePPEffects); - _this call FUNC(onCameraViewChanged); -}] call EFUNC(common,addEventHandler); -["playerVehicleChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); -["playerTurretChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); +["loadout", FUNC(updatePPEffects)] call CBA_fnc_addPlayerEventHandler; +["visionMode", FUNC(updatePPEffects)] call CBA_fnc_addPlayerEventHandler; +["visionMode", FUNC(onVisionModeChanged)] call CBA_fnc_addPlayerEventHandler; +["cameraView", FUNC(updatePPEffects)] call CBA_fnc_addPlayerEventHandler; +["cameraView", FUNC(onCameraViewChanged)] call CBA_fnc_addPlayerEventHandler; +["vehicle", FUNC(updatePPEffects)] call CBA_fnc_addPlayerEventHandler; +["turret", FUNC(updatePPEffects)] call CBA_fnc_addPlayerEventHandler; // Add keybinds -["ACE3 Equipment", QGVAR(IncreaseNVGBrightness), localize LSTRING(IncreaseNVGBrightness), -{ +["ACE3 Equipment", QGVAR(IncreaseNVGBrightness), localize LSTRING(IncreaseNVGBrightness), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotEscorting", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -53,12 +47,9 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; // Statement [ACE_player, 1] call FUNC(changeNVGBrightness); true -}, -{false}, -[201, [false, false, true]], false] call CBA_fnc_addKeybind; //PageUp + ALT +}, {false}, [201, [false, false, true]], false] call CBA_fnc_addKeybind; //PageUp + ALT -["ACE3 Equipment", QGVAR(DecreaseNVGBrightness), localize LSTRING(DecreaseNVGBrightness), -{ +["ACE3 Equipment", QGVAR(DecreaseNVGBrightness), localize LSTRING(DecreaseNVGBrightness), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotEscorting", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -67,10 +58,8 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; // Statement [ACE_player, -1] call FUNC(changeNVGBrightness); true -}, -{false}, -[209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT +}, {false}, [209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT // Register fire event handler -["firedPlayer", DFUNC(blending)] call EFUNC(common,addEventHandler); -["firedPlayerVehicle", DFUNC(blending)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(blending)] call CBA_fnc_addEventHandler; +["ace_firedPlayerVehicle", DFUNC(blending)] call CBA_fnc_addEventHandler; diff --git a/addons/nightvision/config.cpp b/addons/nightvision/config.cpp index 1edeca6e5b..673a7d31c0 100644 --- a/addons/nightvision/config.cpp +++ b/addons/nightvision/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_NVG_Gen1", "ACE_NVG_Gen2", /*"ACE_NVG_Gen3",*/ "ACE_NVG_Gen4", "ACE_NVG_Wide"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index b34584a5d0..2616cb83f5 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -18,44 +18,33 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -private "_player"; -_player = ACE_player; +private _player = ACE_player; -//If our vehicle didn't shoot, or we're not in NVG mode, exit -if ((currentVisionMode _player) != 1) exitWith {}; +//If we're not in NVG mode, or it's a grenade, exit +if (currentVisionMode _player != 1 || {toLower _weapon in ["throw", "put"]}) exitWith {}; -private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"]; +private _silencer = _player weaponAccessories _weapon select 0; -_silencer = switch (_weapon) do { - case (primaryWeapon _player): {(primaryWeaponItems _player) select 0}; - case (secondaryWeapon _player): {(secondaryWeaponItems _player) select 0}; - case (handgunWeapon _player): {(handgunItems _player) select 0}; - default {""}; -}; +private _visibleFireCoef = 1; +private _visibleFireTimeCoef = 1; -_visibleFireCoef = 1; -_visibleFireTimeCoef = 1; if (_silencer != "") then { _visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire"); _visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime"); }; -_visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire"); -_visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTime"); - -_nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4; - -_fnc_isTracer = { - private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"]; +private _visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire"); +private _visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTime"); +private _fnc_isTracer = { if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; - _indexShot = (_player ammo _weapon) + 1; + private _indexShot = (_player ammo _weapon) + 1; - _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); + private _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); if (_indexShot <= _lastRoundsTracer) exitWith {true}; - _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); + private _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); if (_tracersEvery == 0) exitWith {false}; (_indexShot - _lastRoundsTracer) % _tracersEvery == 0 @@ -66,7 +55,8 @@ if (call _fnc_isTracer) then { _visibleFireTime = _visibleFireTime + 2; }; -_darkness = 1 - (call EFUNC(common,ambientBrightness)); +private _darkness = 1 - (call EFUNC(common,ambientBrightness)); +private _nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4; _visibleFire = _darkness * _visibleFireCoef * _visibleFire * _nvgBrightnessCoef / 10 min 1; _visibleFireTime = _darkness * _visibleFireTimeCoef * _visibleFireTime * _nvgBrightnessCoef / 10 min 0.5; diff --git a/addons/nightvision/script_component.hpp b/addons/nightvision/script_component.hpp index ffe3ba3ff5..32ded9ac5a 100644 --- a/addons/nightvision/script_component.hpp +++ b/addons/nightvision/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT nightvision +#define COMPONENT_BEAUTIFIED Night Vision #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_NIGHTVISION #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/noidle/config.cpp b/addons/noidle/config.cpp index 3c2ac1a9d6..961d84d81a 100644 --- a/addons/noidle/config.cpp +++ b/addons/noidle/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/noidle/script_component.hpp b/addons/noidle/script_component.hpp index bf20a9a420..4931efb771 100644 --- a/addons/noidle/script_component.hpp +++ b/addons/noidle/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT noidle +#define COMPONENT_BEAUTIFIED No Idle #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_NOIDLE #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/noradio/XEH_postInit.sqf b/addons/noradio/XEH_postInit.sqf index 4aeccffd62..e3b98f1a3a 100644 --- a/addons/noradio/XEH_postInit.sqf +++ b/addons/noradio/XEH_postInit.sqf @@ -11,7 +11,7 @@ if (isServer) then { if (!hasInterface) exitWith {}; // mutes/unmutes units when the player changes -["playerChanged", { +["unit", { params ["_newPlayer", "_oldPlayer"]; // mute the new player @@ -21,4 +21,4 @@ if (!hasInterface) exitWith {}; if (alive _oldPlayer) then { [_oldPlayer, "isPlayer"] call EFUNC(common,unmuteUnit); }; -}] call EFUNC(common,addEventhandler); +}] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/noradio/config.cpp b/addons/noradio/config.cpp index 86697535f8..a4a390caac 100644 --- a/addons/noradio/config.cpp +++ b/addons/noradio/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/noradio/script_component.hpp b/addons/noradio/script_component.hpp index 0a60edb063..d55efd222b 100644 --- a/addons/noradio/script_component.hpp +++ b/addons/noradio/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT noradio +#define COMPONENT_BEAUTIFIED No Radio #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/norearm/config.cpp b/addons/norearm/config.cpp index 3477258612..269b763d7a 100644 --- a/addons/norearm/config.cpp +++ b/addons/norearm/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/norearm/script_component.hpp b/addons/norearm/script_component.hpp index 3f09149587..f5b481fe0d 100644 --- a/addons/norearm/script_component.hpp +++ b/addons/norearm/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT norearm +#define COMPONENT_BEAUTIFIED No Rearm #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_NOREARM #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/optics/CfgRscTitles.hpp b/addons/optics/CfgRscTitles.hpp index 3bbd6b62bc..42a2326a0e 100644 --- a/addons/optics/CfgRscTitles.hpp +++ b/addons/optics/CfgRscTitles.hpp @@ -33,7 +33,7 @@ class RscInGameUI { style = 48; size = 1; sizeEx = 0; - text = QUOTE(PATHTOF(reticles\ace_shortdot_reticle_1.paa)); + text = QPATHTOF(reticles\ace_shortdot_reticle_1.paa); w = 0; h = 0; }; @@ -115,73 +115,73 @@ class RscInGameUI { class ACE_RscWeapon_Hamr: ACE_RscWeapon_base { class ReticleDay: ReticleDay { - text = QUOTE(PATHTOF(reticles\hamr-reticle65_ca.paa)); + text = QPATHTOF(reticles\hamr-reticle65_ca.paa); }; class ReticleNight: ReticleNight { - text = QUOTE(PATHTOF(reticles\hamr-reticle65Illum_ca.paa)); + text = QPATHTOF(reticles\hamr-reticle65Illum_ca.paa); }; class BodyDay: BodyDay { - text = QUOTE(PATHTOF(reticles\hamr-body_ca.paa)); + text = QPATHTOF(reticles\hamr-body_ca.paa); }; class BodyNight: BodyNight { - text = QUOTE(PATHTOF(reticles\hamr-bodyNight_ca.paa)); + text = QPATHTOF(reticles\hamr-bodyNight_ca.paa); }; }; class ACE_RscWeapon_Arco: ACE_RscWeapon_base { class ReticleDay: ReticleDay { - text = QUOTE(PATHTOF(reticles\arco-reticle65_ca.paa)); + text = QPATHTOF(reticles\arco-reticle65_ca.paa); }; class ReticleNight: ReticleNight { - text = QUOTE(PATHTOF(reticles\arco-reticle65Illum_ca.paa)); + text = QPATHTOF(reticles\arco-reticle65Illum_ca.paa); }; class BodyDay: BodyDay { - text = QUOTE(PATHTOF(reticles\arco-body_ca.paa)); + text = QPATHTOF(reticles\arco-body_ca.paa); }; class BodyNight: BodyNight { - text = QUOTE(PATHTOF(reticles\arco-bodyNight_ca.paa)); + text = QPATHTOF(reticles\arco-bodyNight_ca.paa); }; }; class ACE_RscWeapon_MRCO: ACE_RscWeapon_base { class ReticleDay: ReticleDay { - text = QUOTE(PATHTOF(reticles\mrco-reticle556_ca.paa)); + text = QPATHTOF(reticles\mrco-reticle556_ca.paa); }; class ReticleNight: ReticleNight { - text = QUOTE(PATHTOF(reticles\mrco-reticle556Illum_ca.paa)); + text = QPATHTOF(reticles\mrco-reticle556Illum_ca.paa); }; class BodyDay: BodyDay { - text = QUOTE(PATHTOF(reticles\mrco-body_ca.paa)); + text = QPATHTOF(reticles\mrco-body_ca.paa); }; class BodyNight: BodyNight { - text = QUOTE(PATHTOF(reticles\mrco-bodyNight_ca.paa)); + text = QPATHTOF(reticles\mrco-bodyNight_ca.paa); }; }; class ACE_RscWeapon_SOS: ACE_RscWeapon_base { class ReticleDay: ReticleDay { - text = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa)); + text = QPATHTOF(reticles\sos-reticleMLR_ca.paa); }; class ReticleNight: ReticleNight { - text = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa)); + text = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa); }; class BodyDay: BodyDay { - text = QUOTE(PATHTOF(reticles\sos-body_ca.paa)); + text = QPATHTOF(reticles\sos-body_ca.paa); }; class BodyNight: BodyNight { - text = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa)); + text = QPATHTOF(reticles\sos-bodyNight_ca.paa); }; }; }; diff --git a/addons/optics/CfgWeapons.hpp b/addons/optics/CfgWeapons.hpp index 2089a1dc80..75b0319b62 100644 --- a/addons/optics/CfgWeapons.hpp +++ b/addons/optics/CfgWeapons.hpp @@ -38,7 +38,7 @@ class CfgWeapons { weaponInfoType = "ACE_RscWeaponZeroing"; class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_shortdot_optics.p3d)); + modelOptics = QPATHTOF(models\ace_shortdot_optics.p3d); class OpticsModes: OpticsModes { class Snip: Snip { @@ -65,10 +65,10 @@ class CfgWeapons { }; class ACE_optic_Hamr_2D: optic_Hamr { - GVAR(BodyDay) = QUOTE(PATHTOF(reticles\hamr-body_ca.paa)); - GVAR(BodyNight) = QUOTE(PATHTOF(reticles\hamr-bodyNight_ca.paa)); - GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\hamr-reticle65_ca.paa)); - GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\hamr-reticle65Illum_ca.paa)); + GVAR(BodyDay) = QPATHTOF(reticles\hamr-body_ca.paa); + GVAR(BodyNight) = QPATHTOF(reticles\hamr-bodyNight_ca.paa); + GVAR(ReticleDay) = QPATHTOF(reticles\hamr-reticle65_ca.paa); + GVAR(ReticleNight) = QPATHTOF(reticles\hamr-reticle65Illum_ca.paa); author = ECSTRING(common,ACETeam); _generalMacro = "ACE_optic_Hamr_2D"; @@ -76,7 +76,7 @@ class CfgWeapons { weaponInfoType = "ACE_RscWeapon_Hamr"; class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_reticle90.p3d)); + modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d); class OpticsModes: OpticsModes { class Hamr2Collimator: Hamr2Collimator {}; @@ -101,7 +101,7 @@ class CfgWeapons { displayName = CSTRING(hamr_pip); class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_pip.p3d)); + modelOptics = QPATHTOF(models\ace_optics_pip.p3d); }; }; @@ -115,10 +115,10 @@ class CfgWeapons { }; class ACE_optic_Arco_2D: optic_Arco { - GVAR(BodyDay) = QUOTE(PATHTOF(reticles\arco-body_ca.paa)); - GVAR(BodyNight) = QUOTE(PATHTOF(reticles\arco-bodyNight_ca.paa)); - GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\arco-reticle65_ca.paa)); - GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\arco-reticle65Illum_ca.paa)); + GVAR(BodyDay) = QPATHTOF(reticles\arco-body_ca.paa); + GVAR(BodyNight) = QPATHTOF(reticles\arco-bodyNight_ca.paa); + GVAR(ReticleDay) = QPATHTOF(reticles\arco-reticle65_ca.paa); + GVAR(ReticleNight) = QPATHTOF(reticles\arco-reticle65Illum_ca.paa); author = ECSTRING(common,ACETeam); _generalMacro = "ACE_optic_Arco_2D"; @@ -126,7 +126,7 @@ class CfgWeapons { weaponInfoType = "ACE_RscWeapon_Arco"; class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_reticle90.p3d)); + modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d); class OpticsModes: OpticsModes { class ARCO2collimator: ARCO2collimator {}; @@ -150,7 +150,7 @@ class CfgWeapons { displayName = CSTRING(arco_pip); class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_pip.p3d)); + modelOptics = QPATHTOF(models\ace_optics_pip.p3d); }; }; @@ -164,10 +164,10 @@ class CfgWeapons { }; class ACE_optic_MRCO_2D: optic_MRCO { - GVAR(BodyDay) = QUOTE(PATHTOF(reticles\mrco-body_ca.paa)); - GVAR(BodyNight) = QUOTE(PATHTOF(reticles\mrco-bodyNight_ca.paa)); - GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\mrco-reticle556_ca.paa)); - GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\mrco-reticle556Illum_ca.paa)); + GVAR(BodyDay) = QPATHTOF(reticles\mrco-body_ca.paa); + GVAR(BodyNight) = QPATHTOF(reticles\mrco-bodyNight_ca.paa); + GVAR(ReticleDay) = QPATHTOF(reticles\mrco-reticle556_ca.paa); + GVAR(ReticleNight) = QPATHTOF(reticles\mrco-reticle556Illum_ca.paa); author = ECSTRING(common,ACETeam); _generalMacro = "ACE_optic_MRCO_2D"; @@ -175,7 +175,7 @@ class CfgWeapons { weaponInfoType = "ACE_RscWeapon_MRCO"; class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_reticle90.p3d)); + modelOptics = QPATHTOF(models\ace_optics_reticle90.p3d); class OpticsModes: OpticsModes { class MRCOcq: MRCOcq {}; @@ -200,7 +200,7 @@ class CfgWeapons { displayName = CSTRING(valdada_pip); class ItemInfo: ItemInfo { - modelOptics = QUOTE(PATHTOF(models\ace_optics_pip.p3d)); + modelOptics = QPATHTOF(models\ace_optics_pip.p3d); }; }; @@ -214,10 +214,10 @@ class CfgWeapons { }; class ACE_optic_SOS_2D: optic_SOS { - GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa)); - GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa)); - GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa)); - GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa)); + GVAR(BodyDay) = QPATHTOF(reticles\sos-body_ca.paa); + GVAR(BodyNight) = QPATHTOF(reticles\sos-bodyNight_ca.paa); + GVAR(ReticleDay) = QPATHTOF(reticles\sos-reticleMLR_ca.paa); + GVAR(ReticleNight) = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa); author = ECSTRING(common,ACETeam); _generalMacro = "ACE_optic_SOS_2D"; @@ -227,7 +227,7 @@ class CfgWeapons { class ItemInfo: ItemInfo { class OpticsModes: OpticsModes { class Snip: Snip { - modelOptics[] = {QUOTE(PATHTOF(models\ace_optics_reticle90.p3d)),QUOTE(PATHTOF(models\ace_optics_reticle90.p3d))}; + modelOptics[] = {QPATHTOF(models\ace_optics_reticle90.p3d),QPATHTOF(models\ace_optics_reticle90.p3d)}; useModelOptics = 1; opticsZoomInit = 0.0116; opticsZoomMax = 0.0464; @@ -250,7 +250,7 @@ class CfgWeapons { class ItemInfo: ItemInfo { class OpticsModes: OpticsModes { class Snip: Snip { - modelOptics[] = {QUOTE(PATHTOF(models\ace_optics_pip.p3d)),QUOTE(PATHTOF(models\ace_optics_pip.p3d))}; + modelOptics[] = {QPATHTOF(models\ace_optics_pip.p3d),QPATHTOF(models\ace_optics_pip.p3d)}; }; class Iron: Iron {}; }; @@ -266,10 +266,10 @@ class CfgWeapons { }; class ACE_optic_LRPS_2D: optic_LRPS { - GVAR(BodyDay) = QUOTE(PATHTOF(reticles\sos-body_ca.paa)); - GVAR(BodyNight) = QUOTE(PATHTOF(reticles\sos-bodyNight_ca.paa)); - GVAR(ReticleDay) = QUOTE(PATHTOF(reticles\sos-reticleMLR_ca.paa)); - GVAR(ReticleNight) = QUOTE(PATHTOF(reticles\sos-reticleMLRIllum_ca.paa)); + GVAR(BodyDay) = QPATHTOF(reticles\sos-body_ca.paa); + GVAR(BodyNight) = QPATHTOF(reticles\sos-bodyNight_ca.paa); + GVAR(ReticleDay) = QPATHTOF(reticles\sos-reticleMLR_ca.paa); + GVAR(ReticleNight) = QPATHTOF(reticles\sos-reticleMLRIllum_ca.paa); author = ECSTRING(common,ACETeam); _generalMacro = "ACE_optic_LRPS_2D"; @@ -279,7 +279,7 @@ class CfgWeapons { class ItemInfo: ItemInfo { class OpticsModes: OpticsModes { class Snip: Snip { - modelOptics[] = {QUOTE(PATHTOF(models\ace_optics_reticle90.p3d)),QUOTE(PATHTOF(models\ace_optics_reticle90.p3d))}; + modelOptics[] = {QPATHTOF(models\ace_optics_reticle90.p3d),QPATHTOF(models\ace_optics_reticle90.p3d)}; useModelOptics = 1; opticsZoomInit = 0.0116; opticsZoomMax = 0.0464; @@ -301,7 +301,7 @@ class CfgWeapons { class ItemInfo: ItemInfo { class OpticsModes: OpticsModes { class Snip: Snip { - modelOptics[] = {QUOTE(PATHTOF(models\ace_optics_pip.p3d)),QUOTE(PATHTOF(models\ace_optics_pip.p3d))}; + modelOptics[] = {QPATHTOF(models\ace_optics_pip.p3d),QPATHTOF(models\ace_optics_pip.p3d)}; }; }; }; diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index c9667f3931..a4f118619b 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -5,51 +5,27 @@ if (!hasInterface) exitWith {}; GVAR(camera) = objNull; -0 = 0 spawn { - // Workarround for the ThreeDen Editor Camera - if ((!isNil {is3DEN}) && {is3DEN}) exitWith { - ACE_LOGINFO("Eden detected: disabling Optics PIP Camera"); - }; - - waitUntil {!isNull ACE_player}; - waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; - - GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; - camDestroy GVAR(camera); - - // PiP technique by BadBenson - GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; - GVAR(camera) camSetFov 0.7; - GVAR(camera) camSetTarget ACE_player; - GVAR(camera) camCommit 1; - - "ace_optics_rendertarget0" setPiPEffect [0]; - GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; -}; - // save control for fired EH -["infoDisplayChanged", { +["ace_infoDisplayChanged", { + TRACE_1("ace_infoDisplayChanged",_this); if (!isNull ((_this select 0) displayCtrl 1713001)) then { uiNamespace setVariable [QGVAR(RscWeaponInfo2D), _this select 0]; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // camera has to be re-created every time another camera is created. Otherwise r2t is either black or transparent. @todo Add popular custom cameras to the event in ACE_common. -["activeCameraChanged", { - if !(_this select 1) then { - GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; - camDestroy GVAR(camera); - - // PiP technique by BadBenson - GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; - GVAR(camera) camSetFov 0.7; - GVAR(camera) camSetTarget ACE_player; - GVAR(camera) camCommit 1; - - "ace_optics_rendertarget0" setPiPEffect [0]; - GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; +["ace_activeCameraChanged", { + params ["", "_isfeatureCameraActive"]; + TRACE_1("ace_activeCameraChanged",_isfeatureCameraActive); + if (!_isfeatureCameraActive) then { + //Destroy the camera, and it will be re-created in the onDrawScope2d helper + if (!isNull GVAR(camera)) then { + GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; + camDestroy GVAR(camera); + TRACE_1("destroying pip camera for restart",GVAR(camera)); + }; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Register fire event handler -["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler; diff --git a/addons/optics/config.cpp b/addons/optics/config.cpp index 79f71842ee..c1524320c7 100644 --- a/addons/optics/config.cpp +++ b/addons/optics/config.cpp @@ -2,6 +2,7 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = { "ACE_optic_Hamr_2D", @@ -18,8 +19,9 @@ class CfgPatches { }; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Taosenai","KoffeinFlummi","commy2"}; - authorUrl = "http://www.ryanschultz.org/tmr/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Taosenai","KoffeinFlummi","commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index 299b2c30f4..2a740ac54d 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -16,8 +16,7 @@ TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // check if compatible scope is used -private "_display"; -_display = uiNamespace getVariable [QGVAR(RscWeaponInfo2D), displayNull]; +private _display = uiNamespace getVariable [QGVAR(RscWeaponInfo2D), displayNull]; if (isNull _display) exitWith {}; diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index 9ea038f877..6e8ba739d8 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -1,12 +1,59 @@ -// by commy2 +/* + * Author: commy2 + * Helper function for updating the 2d and 3d scope controls + * Called from a dummy map controls onDraw. + * + * Arguments: + * 0: Display (RscInGameUI for a weapon) + * + * Return Value: + * Nothing + * + * Example: + * [ACE_RscWeapon_Arco's Display] call ace_optics_fnc_onDrawScope2D + * + * Public: No + */ #include "script_component.hpp" disableSerialization; -private "_display"; +private _display = _this select 0; -_display = _this select 0; +// @todo, all weapon types +private _optic = (primaryWeaponItems ACE_player) select 2; +private _isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QPATHTOF(models\ace_optics_pip.p3d); +if (_isPIP) then { + GVAR(pipLastFrame) = diag_frameno; + if (isNull GVAR(camera)) then { + if ((({_x != GVAR(camera)} count allMissionObjects "camera") > 0) || {!isNull curatorCamera}) exitWith { + TRACE_1("waiting for feature camera to end",GVAR(camera)); + }; + + // PiP technique by BadBenson + GVAR(camera) = "camera" camCreate positionCameraToWorld [0,0,0]; + GVAR(camera) camSetFov 0.7; + GVAR(camera) camSetTarget ACE_player; + GVAR(camera) camCommit 1; + + "ace_optics_rendertarget0" setPiPEffect [0]; + GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; + + TRACE_2("created new pip camera",GVAR(camera),isNull GVAR(camera)); + + //Start a waitUntil to handle destruction after GVAR(pipLastFrame) is no longer updated + [{ + (abs (diag_frameno - GVAR(pipLastFrame))) > 1 + }, { + GVAR(camera) cameraEffect ["TERMINATE", "BACK"]; + camDestroy GVAR(camera); + TRACE_2("destroyed pip camera",GVAR(camera),isNull GVAR(camera)); + }, []] call CBA_fnc_waitUntilAndExecute; + }; +}; + +//If we are not zoomed into the actual scope (not collimator) if (!ctrlShown (_display displayCtrl 154)) exitWith { (_display displayCtrl 1713001) ctrlShow false; (_display displayCtrl 1713002) ctrlShow false; @@ -16,11 +63,6 @@ if (!ctrlShown (_display displayCtrl 154)) exitWith { (_display displayCtrl 1713011) ctrlShow false; }; -// @todo, all weapon types -private ["_optic", "_isPIP"]; -_optic = (primaryWeaponItems ACE_player) select 2; -_isPIP = (getText (configFile >> "CfgWeapons" >> _optic >> "ItemInfo" >> "modelOptics")) == QUOTE(PATHTOF(models\ace_optics_pip.p3d)); - if (_isPIP) then { GVAR(camera) setPosATL positionCameraToWorld [0,0,0.4]; GVAR(camera) camPrepareTarget positionCameraToWorld [0,0,50]; @@ -37,10 +79,8 @@ if (_isPIP) then { }; // calculate lighting -private ["_dayOpacity", "_nightOpacity"]; - -_dayOpacity = call EFUNC(common,ambientBrightness); -_nightOpacity = [1,0] select (_dayOpacity == 1); +private _dayOpacity = call EFUNC(common,ambientBrightness); +private _nightOpacity = [1,0] select (_dayOpacity == 1); // Apply lighting and make layers visible (_display displayCtrl 1713001) ctrlSetTextColor [1,1,1,1]; diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index ca0176360c..428017bda8 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT optics +#define COMPONENT_BEAUTIFIED Optics #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf index 4736d72623..2ef332446a 100644 --- a/addons/optionsmenu/XEH_postInit.sqf +++ b/addons/optionsmenu/XEH_postInit.sqf @@ -1,11 +1,11 @@ #include "script_component.hpp" -["SettingsInitialized", { +["ace_settingsInitialized", { GVAR(categories) pushBack ""; //Ensure All Catagories is at top { if !(_x select 8 in GVAR(categories)) then { GVAR(categories) pushBack (_x select 8); }; }forEach EGVAR(common,settings); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/optionsmenu/config.cpp b/addons/optionsmenu/config.cpp index 4acfef321f..a239e55498 100644 --- a/addons/optionsmenu/config.cpp +++ b/addons/optionsmenu/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_moduleAllowConfigExport"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Glowbal", "PabstMirror"}; - authorUrl = "http://github.com/Glowbal"; + author = ECSTRING(common,ACETeam); + authors[] = {"Glowbal", "PabstMirror"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf index be771f7a3a..dd2c187bf7 100644 --- a/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf +++ b/addons/optionsmenu/functions/fnc_debugDumpToClipboard.sqf @@ -17,7 +17,7 @@ private ["_var", "_unit", "_outputText", "_text"]; -#define MIN_ARRAY_SIZE 10 +#define MIN_ARRAY_SIZE 50 _outputText = { diag_log text (_this select 0); @@ -30,12 +30,20 @@ time = %1 ------Performance------ diag_fps = %2 -count ace_common_waitAndExecArray = %3 -count cba_common_perFrameHandlerArray = %4 (max %5) -count diag_activeSQFScripts = %6 -count diag_activeSQSScripts = %7 -count diag_activeMissionFSMs = %8", -time, diag_fps, count ace_common_waitAndExecArray, {!isNil "_x"} count cba_common_perFrameHandlerArray, count cba_common_perFrameHandlerArray, count diag_activeSQFScripts, count diag_activeSQSScripts,count diag_activeMissionFSMs]; +count cba_common_waitAndExecArray = %3 +count cba_common_waitUntilAndExecArray = %4 +count cba_common_perFrameHandlerArray = %5 (max %6) +count diag_activeSQFScripts = %7 +count diag_activeSQSScripts = %8 +count diag_activeMissionFSMs = %9", +time, +diag_fps, +count cba_common_waitAndExecArray, +count cba_common_waitUntilAndExecArray, +{!isNil "_x"} count cba_common_perFrameHandlerArray, count cba_common_perFrameHandlerArray, +count diag_activeSQFScripts, +count diag_activeSQSScripts, +count diag_activeMissionFSMs]; [_text] call _outputText; diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index 8e09608e07..43c17cd619 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -54,7 +54,7 @@ GVAR(serverSideValues) = []; } forEach EGVAR(common,settings); //Delay a frame -[{ [MENU_TAB_SERVER_OPTIONS] call FUNC(onServerListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); +[{ [MENU_TAB_SERVER_OPTIONS] call FUNC(onServerListBoxShowSelectionChanged) }, []] call CBA_fnc_execNextFrame; disableSerialization; _menu = uiNamespace getVariable "ACE_serverSettingsMenu"; diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index bef61b73e7..42157f230f 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -43,7 +43,7 @@ private _clientSettableCategories = [""]; } forEach EGVAR(common,settings); //Delay a frame -[{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); +[{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call CBA_fnc_execNextFrame; disableSerialization; _menu = uiNamespace getVariable "ACE_settingsMenu"; diff --git a/addons/optionsmenu/script_component.hpp b/addons/optionsmenu/script_component.hpp index b257b0a5ba..2bb7482252 100644 --- a/addons/optionsmenu/script_component.hpp +++ b/addons/optionsmenu/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT optionsmenu +#define COMPONENT_BEAUTIFIED Options Menu // #define DEBUG_MODE_FULL // #define DISABLE_COMPILE_CACHE diff --git a/addons/overheating/CfgSounds.hpp b/addons/overheating/CfgSounds.hpp index c32fc02abf..bd2831eeb6 100644 --- a/addons/overheating/CfgSounds.hpp +++ b/addons/overheating/CfgSounds.hpp @@ -1,26 +1,26 @@ class CfgSounds { class ACE_BarrelSwap { - sound[] = {QUOTE(PATHTOF(sounds\barrelswap.ogg)),5,1,200}; + sound[] = {QPATHTOF(sounds\barrelswap.ogg),5,1,200}; titles[] = {}; }; class GVAR(jamming_rifle) { name=QGVAR(jamming_rifle); - sound[]={QUOTE(PATHTOF(sounds\jamming_rifle.wav)),1,1}; + sound[]={QPATHTOF(sounds\jamming_rifle.wav),1,1}; titles[]={}; }; class GVAR(jamming_pistol) { name=QGVAR(jamming_pistol); - sound[]={QUOTE(PATHTOF(sounds\jamming_pistol.wav)),1,1}; + sound[]={QPATHTOF(sounds\jamming_pistol.wav),1,1}; titles[]={}; }; class GVAR(fixing_rifle) { name=QGVAR(fixing_rifle); - sound[]={QUOTE(PATHTOF(sounds\fixing_rifle.wav)),1,1}; + sound[]={QPATHTOF(sounds\fixing_rifle.wav),1,1}; titles[]={}; }; class GVAR(fixing_pistol) { name= QGVAR(fixing_pistol); - sound[]={QUOTE(PATHTOF(sounds\fixing_pistol.wav)),1,1}; + sound[]={QPATHTOF(sounds\fixing_pistol.wav),1,1}; titles[]={}; }; }; diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp index 23a2b613f5..f7700fd7df 100644 --- a/addons/overheating/CfgVehicles.hpp +++ b/addons/overheating/CfgVehicles.hpp @@ -11,7 +11,7 @@ class CfgVehicles { statement = QUOTE( [ARR_2(_player, currentMuzzle _player)] call FUNC(clearJam); ); showDisabled = 0; priority = 4; - icon = QUOTE(PATHTOF(UI\unjam_ca.paa)); + icon = QPATHTOF(UI\unjam_ca.paa); }; class GVAR(SwapBarrel) { displayName = CSTRING(SwapBarrel); @@ -19,7 +19,7 @@ class CfgVehicles { statement = QUOTE( [ARR_3(_player, _player, currentWeapon _player)] call FUNC(swapBarrel); ); showDisabled = 0; priority = 3; - icon = QUOTE(PATHTOF(UI\spare_barrel_ca.paa)); + icon = QPATHTOF(UI\spare_barrel_ca.paa); }; class GVAR(CheckTemperature) { displayName = CSTRING(CheckTemperatureShort); @@ -28,7 +28,7 @@ class CfgVehicles { statement = QUOTE( [ARR_3(_player, _player, currentWeapon _player)] call FUNC(checkTemperature); ); showDisabled = 0; priority = 2.9; - icon = QUOTE(PATHTOF(UI\temp_ca.paa)); + icon = QPATHTOF(UI\temp_ca.paa); }; class GVAR(CheckTemperatureSpareBarrels) { displayName = CSTRING(CheckTemperatureSpareBarrelsShort); diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index c7a83eec6e..12cfe6e498 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -2,6 +2,17 @@ class CfgWeapons { class ACE_ItemCore; class InventoryItem_Base_F; + class ACE_SpareBarrel: ACE_ItemCore { + displayname = CSTRING(SpareBarrelName); + descriptionshort = CSTRING(SpareBarrelDescription); + //model = ""; + picture = QPATHTOF(UI\spare_barrel_ca.paa); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 30; + }; + }; + class RifleCore; class Rifle: RifleCore { //Mean Rounds Between Stoppages (this will be scaled based on the barrel temp) diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index e4935b8831..bc3dfad795 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -19,7 +19,7 @@ if (hasInterface) then { [19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key }; -["SettingsInitialized", { +["ace_settingsInitialized", { TRACE_1("SettingsInitialized eh", GVAR(enabled)); if (!GVAR(enabled)) exitWith {}; @@ -35,8 +35,8 @@ if (hasInterface) then { GVAR(storedSpareBarrels) = [] call CBA_fnc_hashCreate; // Install event handlers for spare barrels - ["spareBarrelsSendTemperatureHint", FUNC(sendSpareBarrelsTemperaturesHint)] call EFUNC(common,addEventHandler); - ["spareBarrelsLoadCoolest", FUNC(loadCoolestSpareBarrel)] call EFUNC(common,addEventHandler); + [QGVAR(sendSpareBarrelTemperatureHint), FUNC(sendSpareBarrelsTemperaturesHint)] call CBA_fnc_addEventHandler; + [QGVAR(loadCoolestSpareBarrel), FUNC(loadCoolestSpareBarrel)] call CBA_fnc_addEventHandler; // Schedule cool down calculation of stored spare barrels [] call FUNC(updateSpareBarrelsTemperaturesThread); @@ -52,18 +52,18 @@ if (hasInterface) then { ["CAManBase", "Take", {_this call FUNC(handleTakeEH);}] call CBA_fnc_addClassEventHandler; // Register fire event handler - ["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler; // Only add eh to non local players if dispersion is enabled if (GVAR(overheatingDispersion)) then { - ["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler; }; // Schedule cool down calculation of player weapons at (infrequent) regular intervals [] call FUNC(updateTemperatureThread); - - // Install event handler to display temp when a barrel was swapped - ["showWeaponTemperature", DFUNC(displayTemperature)] call EFUNC(common,addEventHandler); - // Install event handler to initiate an assisted barrel swap - ["initiateSwapBarrelAssisted", DFUNC(swapBarrel)] call EFUNC(common,addEventHandler); -}] call EFUNC(common,addEventHandler); + // Install event handler to display temp when a barrel was swapped + [QGVAR(showWeaponTemperature), DFUNC(displayTemperature)] call CBA_fnc_addEventHandler; + // Install event handler to initiate an assisted barrel swap + [QGVAR(initiateSwapBarrelAssisted), DFUNC(swapBarrel)] call CBA_fnc_addEventHandler; + +}] call CBA_fnc_addEventHandler; diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index 673edcf77f..1d8e2d3755 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_SpareBarrel"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2", "KoffeinFlummi", "esteldunedain"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "KoffeinFlummi", "esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -49,4 +51,11 @@ class CfgGesturesMale { speed = 0.3; }; }; -}; \ No newline at end of file +}; +class ACE_newEvents { + initiateSwapBarrelAssisted = QGVAR(initiateSwapBarrelAssisted); + showWeaponTemperature = QGVAR(showWeaponTemperature); + loadCoolestSpareBarrel = QGVAR(loadCoolestSpareBarrel); + sendSpareBarrelTemperatureHint = QGVAR(sendSpareBarrelTemperatureHint); + weaponJammed = "ace_weaponJammed"; +}; diff --git a/addons/overheating/functions/fnc_calculateCooling.sqf b/addons/overheating/functions/fnc_calculateCooling.sqf index 955c41441e..ced682d6d7 100644 --- a/addons/overheating/functions/fnc_calculateCooling.sqf +++ b/addons/overheating/functions/fnc_calculateCooling.sqf @@ -2,12 +2,12 @@ * Author: esteldunedain * Calculate the cooling down of a weapon over a time interval. * - * Argument: + * Arguments: * 0: Initial temperature * 1: Barrel mass * 2: Time interval * - * Return value: + * Return Value: * Final temperature * * Example: diff --git a/addons/overheating/functions/fnc_checkSpareBarrelsTemperatures.sqf b/addons/overheating/functions/fnc_checkSpareBarrelsTemperatures.sqf index e8dbaabec0..8a634409ee 100644 --- a/addons/overheating/functions/fnc_checkSpareBarrelsTemperatures.sqf +++ b/addons/overheating/functions/fnc_checkSpareBarrelsTemperatures.sqf @@ -29,7 +29,7 @@ if (!([_player, objNull, ["isNotInside", "isNotSitting"]] call EFUNC(common,canI params ["_args", "_elapsedTime", "_totalTime", "_errorCode"]; _args params ["_player"]; // Time has enlapsed, ask the server to send the hint - ['spareBarrelsSendTemperatureHint', [_player, _player]] call EFUNC(common,serverEvent); + [QGVAR(sendSpareBarrelTemperatureHint), [_player, _player]] call CBA_fnc_serverEvent; }, {}, (localize LSTRING(CheckingSpareBarrelsTemperatures)), diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index fd2ac5f56c..0fb600f83a 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -31,4 +31,4 @@ if (_assistant isEqualTo _gunner) then { _assistant playActionNow _action; // Waits a sec before displaying the temperature -[FUNC(displayTemperature), [_gunner, _weapon], 1.0] call EFUNC(common,waitAndExecute); +[FUNC(displayTemperature), [_gunner, _weapon], 1.0] call CBA_fnc_waitAndExecute; diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 086e7dce43..7011385c02 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -55,14 +55,14 @@ if (_weapon in _jammedWeapons) then { if (GVAR(DisplayTextOnJam)) then { [{ [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); - }, [], _delay] call EFUNC(common,waitAndExecute); + }, [], _delay] call CBA_fnc_waitAndExecute; }; } else { // Failure if (GVAR(DisplayTextOnJam)) then { [{ [localize LSTRING(WeaponUnjamFailed)] call EFUNC(common,displayTextStructured); - }, [], _delay] call EFUNC(common,waitAndExecute); + }, [], _delay] call CBA_fnc_waitAndExecute; }; }; }; diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index 2cf607945c..e392190bb0 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -2,10 +2,10 @@ * Author: Commy2 and esteldunedain * Handle weapon fire. Called from the unified fired EH 1- always for the local player 2- and for non local players if dispersion is simulated. * - * Argument: + * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) * - * Return value: + * Return Value: * None * * Public: No @@ -65,8 +65,8 @@ if (_unit != ACE_player && (!GVAR(showParticleEffectsForEveryone) || {_unit dist }; //Particle Effects: -if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { - _unit setVariable [QGVAR(lastDrop), ACE_time]; +if (GVAR(showParticleEffects) && {(CBA_missionTime > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { + _unit setVariable [QGVAR(lastDrop), CBA_missionTime]; private _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; private _position = (position _projectile) vectorAdd (_direction vectorMultiply (4*(random 0.30))); diff --git a/addons/overheating/functions/fnc_getWeaponData.sqf b/addons/overheating/functions/fnc_getWeaponData.sqf index e7da350e91..b1525f0f41 100644 --- a/addons/overheating/functions/fnc_getWeaponData.sqf +++ b/addons/overheating/functions/fnc_getWeaponData.sqf @@ -2,10 +2,10 @@ * Author: PabstMirror and esteldunedain * Get weapon data with caching * - * Argument: + * Arguments: * 0: weapon type * - * Return value: + * Return Value: * 0: dispresion * 1: slowdownFactor * 2: jamChance diff --git a/addons/overheating/functions/fnc_handleTakeEH.sqf b/addons/overheating/functions/fnc_handleTakeEH.sqf index ffcead342f..b4eecbf236 100644 --- a/addons/overheating/functions/fnc_handleTakeEH.sqf +++ b/addons/overheating/functions/fnc_handleTakeEH.sqf @@ -3,12 +3,12 @@ * Handle "take" event * I think it fixs jams when manually dragging a new magazine in from player's inventory * - * Argument: + * Arguments: * 0: unit - Object the event handler is assigned to * 1: container * 2: item * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index b6cacdbea3..02966d0067 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -2,11 +2,11 @@ * Author: Commy2, based on KK_fnc_playerWeaponMulfunction from KillzoneKid * Jam the weapon * - * Argument: + * Arguments: * 0: Unit * 1: Weapon * - * Return value: + * Return Value: * None * * Example: @@ -37,13 +37,13 @@ if (_ammo > 0) then { [{ params ["_unit", "_weapon", "_ammo"]; _unit setAmmo [_weapon, _ammo]; - }, [_unit, _weapon, _ammo]] call EFUNC(common,execNextFrame); + }, [_unit, _weapon, _ammo]] call CBA_fnc_execNextFrame; }; // only display the hint once, after you try to shoot an already jammed weapon GVAR(knowAboutJam) = false; -["weaponJammed", [_unit,_weapon]] call EFUNC(common,localEvent); +["ace_weaponJammed", [_unit,_weapon]] call CBA_fnc_localEvent; if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { diff --git a/addons/overheating/functions/fnc_loadCoolestSpareBarrel.sqf b/addons/overheating/functions/fnc_loadCoolestSpareBarrel.sqf index 08cb85083c..d6a9ccfe37 100644 --- a/addons/overheating/functions/fnc_loadCoolestSpareBarrel.sqf +++ b/addons/overheating/functions/fnc_loadCoolestSpareBarrel.sqf @@ -3,14 +3,14 @@ * Collect the temperature of all the spare barrels a unit has and load the * coolest on the unit weapon. Runs on the server. * - * Argument: + * Arguments: * 0: Unit that has the spare barrels * 1: Unit that has the weapon * 2: Weapon * 3: Weapon temp before switching * 4: Mass of the removed barrel * - * Return value: + * Return Value: * None * * @@ -47,7 +47,7 @@ TRACE_3("loadCoolestSpareBarrel5",_coolestTemp,_coolestMag,_weaponTemp); _gunner setVariable [format [QGVAR(%1_temp), _weapon], _coolestTemp, true]; // Heat up the coolest barrel to the former weapon temperature -[GVAR(storedSpareBarrels), _coolestMag, [_weaponTemp, ACE_Time, _barrelMass]] call CBA_fnc_hashSet; +[GVAR(storedSpareBarrels), _coolestMag, [_weaponTemp, CBA_missionTime, _barrelMass]] call CBA_fnc_hashSet; // Send an event so the machines of the assistant and gunner can show the hint -["showWeaponTemperature", [_assistant, _gunner], [_gunner, _weapon]] call EFUNC(common,targetEvent); +[QGVAR(showWeaponTemperature), _gunner], [_gunner, _weapon], [_assistant] call CBA_fnc_targetEvent; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 57a4bd7cba..84ab7e152f 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -2,7 +2,7 @@ * Author: Commy2 and esteldunedain * Handle weapon fire, heat up the weapon * - * Argument: + * Arguments: * 0: Unit * 1: Weapon * 3: Muzzle @@ -10,7 +10,7 @@ * 5: Magazine * 6: Projectile * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/overheating/functions/fnc_sendSpareBarrelsTemperaturesHint.sqf b/addons/overheating/functions/fnc_sendSpareBarrelsTemperaturesHint.sqf index 2ff248016d..8bca16c589 100644 --- a/addons/overheating/functions/fnc_sendSpareBarrelsTemperaturesHint.sqf +++ b/addons/overheating/functions/fnc_sendSpareBarrelsTemperaturesHint.sqf @@ -3,11 +3,11 @@ * Collect the temperature of all the spare barrels a unit has and send a hint * to a client. Runs on the server. * - * Argument: + * Arguments: * 0: Target unit of the hint * 1: Unit that has the spare barrels * - * Return value: + * Return Value: * None * * @@ -73,4 +73,4 @@ if (_countExtremelyHot > 0) then { }; TRACE_1("_output",_output); -["displayTextStructured", [_player], [_output, _size, _player]] call EFUNC(common,targetEvent); +[QEGVAR(common,displayTextStructured), [_output, _size, _player], [_player]] call CBA_fnc_targetEvent; diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index a63ef5a36a..b904936403 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -2,12 +2,12 @@ * Author: Commy2 * Make a unit start swapping it's barrel * - * Argument: + * Arguments: * 0: Unit initiating the action * 1: Unit that has the weapon * 2: Weapon * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/overheating/functions/fnc_swapBarrelAssistant.sqf b/addons/overheating/functions/fnc_swapBarrelAssistant.sqf index 5e3c31fc5e..2a98e0fa8b 100644 --- a/addons/overheating/functions/fnc_swapBarrelAssistant.sqf +++ b/addons/overheating/functions/fnc_swapBarrelAssistant.sqf @@ -2,12 +2,12 @@ * Author: esteldunedain, Commy2 * Make a unit start swapping the barrel of another unit * - * Argument: + * Arguments: * 0: Unit initiating the action * 1: Unit that has the weapon * 2: Weapon * - * Return value: + * Return Value: * None * * Example: @@ -30,4 +30,4 @@ playSound "ACE_BarrelSwap"; [3, [_assistant, _gunner, _weapon], {}, {}, (localize LSTRING(SwappingBarrel))] call EFUNC(common,progressBar); -["initiateSwapBarrelAssisted", _gunner, [_assistant, _gunner, _weapon]] call EFUNC(common,objectEvent); +[QGVAR(initiateSwapBarrelAssisted), [_assistant, _gunner, _weapon], _gunner] call CBA_fnc_targetEvent; diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 403989deca..b2d559d1e2 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -2,12 +2,12 @@ * Author: Commy2, esteldunedain * Swap barrel callback * - * Argument: + * Arguments: * 0: Unit initiating the action * 1: Unit that has the weapon * 2: Weapon * - * Return value: + * Return Value: * None * * Example: @@ -27,6 +27,9 @@ if (_assistant isEqualTo _gunner) then { playSound "ACE_BarrelSwap"; }; +// don't consume the barrel, but rotate through them. +[localize LSTRING(SwappedBarrel), QPATHTOF(UI\spare_barrel_ca.paa)] call EFUNC(common,displayTextPicture); + private _temp = _gunner getVariable [format [QGVAR(%1_temp), _weapon], 0]; private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; @@ -34,7 +37,7 @@ private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon > // store the removed barrel with the former weapon temperature. The server // also updates the current weapon temperature to match that of the new // loaded barrel. -["spareBarrelsLoadCoolest", [_assistant, _gunner, _weapon, _temp, _barrelMass]] call EFUNC(common,serverEvent); +[QGVAR(loadCoolestSpareBarrel), [_assistant, _gunner, _weapon, _temp, _barrelMass]] call CBA_fnc_serverEvent; // Store the update time -_gunner setVariable [format [QGVAR(%1_time), _weapon], ACE_time]; +_gunner setVariable [format [QGVAR(%1_time), _weapon], CBA_missionTime]; diff --git a/addons/overheating/functions/fnc_updateSpareBarrelsTemperaturesThread.sqf b/addons/overheating/functions/fnc_updateSpareBarrelsTemperaturesThread.sqf index d6b74f6769..0bb240533c 100644 --- a/addons/overheating/functions/fnc_updateSpareBarrelsTemperaturesThread.sqf +++ b/addons/overheating/functions/fnc_updateSpareBarrelsTemperaturesThread.sqf @@ -2,10 +2,10 @@ * Author: esteldunedain * Calculate cooldown of all the stored spare barrels. * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -25,16 +25,16 @@ TRACE_1("updateSpareBarrelsTemperaturesThread2",_pairs); _value params ["_initialTemp","_initialTime", "_barrelMass"]; // Calculate cooling - private _finalTemp = [_initialTemp, _barrelMass, ACE_time - _initialTime] call FUNC(calculateCooling); + private _finalTemp = [_initialTemp, _barrelMass, CBA_missionTime - _initialTime] call FUNC(calculateCooling); TRACE_4("updateSpareBarrelsTemperaturesThread3",_barrelMagazineID,_initialTemp,_finalTemp,_barrelMass); if (_finalTemp < 5) then { // The barrel is cool enough to keep calculating. Remove it from the hash [GVAR(storedSpareBarrels), _barrelMagazineID] call CBA_fnc_hashRem; } else { // Store the new temp - [GVAR(storedSpareBarrels), _barrelMagazineID, [_finalTemp, ACE_time, _barrelMass]] call CBA_fnc_hashSet; + [GVAR(storedSpareBarrels), _barrelMagazineID, [_finalTemp, CBA_missionTime, _barrelMass]] call CBA_fnc_hashSet; }; } forEach _pairs; // Schedule for execution again after 10 seconds -[DFUNC(updateSpareBarrelsTemperaturesThread), [], 10] call EFUNC(common,waitAndExecute); +[DFUNC(updateSpareBarrelsTemperaturesThread), [], 10] call CBA_fnc_waitAndExecute; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf index 1643fe55b4..51b4b13ae3 100644 --- a/addons/overheating/functions/fnc_updateTemperature.sqf +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -2,12 +2,12 @@ * Author: esteldunedain * Update temperature of a weapon. * - * Argument: + * Arguments: * 0: Unit * 1: Weapon * 2: Heat increment (J) * - * Return value: + * Return Value: * Current temperature * * Example: @@ -30,7 +30,8 @@ private _lastTime = _unit getVariable [_timeVarName, 0]; private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; // Calculate cooling -_temperature = [_temperature, _barrelMass, ACE_time - _lastTime] call FUNC(calculateCooling); +_temperature = [_temperature, _barrelMass, CBA_missionTime - _lastTime] call FUNC(calculateCooling); + TRACE_1("cooledTo",_temperature); // Calculate heating // Steel Heat Capacity = 466 J/(Kg.K) @@ -39,6 +40,6 @@ _temperature = _temperature + _heatIncrement / (_barrelMass * 466); // Publish the temperature variable [_unit, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); // Store the update time locally -_unit setVariable [_timeVarName, ACE_time]; +_unit setVariable [_timeVarName, CBA_missionTime]; _temperature diff --git a/addons/overheating/functions/fnc_updateTemperatureThread.sqf b/addons/overheating/functions/fnc_updateTemperatureThread.sqf index 76a332e480..1d1574b1ed 100644 --- a/addons/overheating/functions/fnc_updateTemperatureThread.sqf +++ b/addons/overheating/functions/fnc_updateTemperatureThread.sqf @@ -2,10 +2,10 @@ * Author: esteldunedain * Update cooldown calculation of all player weapons at regular intervals. * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -22,4 +22,4 @@ if ((_currentWeapon != "") && {_currentWeapon == primaryWeapon ACE_player || {_c }; // Schedule for execution again after 5 seconds -[DFUNC(updateTemperatureThread), [], 5] call EFUNC(common,waitAndExecute); +[DFUNC(updateTemperatureThread), [], 5] call CBA_fnc_waitAndExecute; diff --git a/addons/overheating/script_component.hpp b/addons/overheating/script_component.hpp index 262accc43b..6d2db895aa 100644 --- a/addons/overheating/script_component.hpp +++ b/addons/overheating/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT overheating +#define COMPONENT_BEAUTIFIED Overheating #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index e49ad433fc..7fd24bb39a 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -33,6 +33,7 @@ Efectos de partículas Effet de surchauffe Částicové efekty přehřívání + Efeito de parícula de superaquecimento Show particle effects when weapon overheats @@ -41,6 +42,7 @@ Mostra effetti particellari quando l'arma si surriscalda Muestra efectos de partículas cuando el arma del jugador se sobreacalienta Montrer les effets lorsque l'arme surchauffe. + Mostra efeitos de párticula quando a arma superaquece Overheating Particle Effects for everyone @@ -50,6 +52,7 @@ Efectos de partículas para todos Effets de surchauffe pour tout le monde. Částicové efekty přehřívání pro všechny + Efeito de partícula de superaquecimento para todos Show particle effects when other players weapon overheats @@ -58,6 +61,7 @@ Mostra effetti particellari quando l'arma di altri giocatori si surriscalda Muestra efectos de partículas cuando el arma de jugadores cercanos se sobreacalienta Montrer les effets de surchauffe des autres joueurs. + Mostra efeito de partículas quando a arma de outros jogadores superaquece Overheating Dispersion @@ -66,6 +70,7 @@ Dispersione Surriscaldamento Dispersión Disperssion dûe à la surchauffe + Disperção de superaquecimento Overheated weapons will be less accurate and have decreased muzzle velocity. Applys for all players. @@ -74,6 +79,7 @@ Armi surriscaldate saranno meno precise ed avranno una ridotta velocità alla volata. Applica per tutti i giocatori. Las armas sobrecalentadas pierden precisión y tienen una velocidad de disparo reducida. Se aplica a todos los jugadores. Les armes en surchauffe seront moins précises et auront une vitesse en sortie de bouche plus faible. S'applique pour tous les joueurs. + Armas superaquecidas irão ser menos precisas e ter velocidade de disparo reduzidas. Aplica a todos os jogadores. Unjam weapon on reload @@ -83,6 +89,7 @@ Des-enrayer l'arme au rechargement. Disinceppa l'arma quando si ricarica Uvolnit zbraň při přebití + Desemperrar arma no recarregamento Reloading clears a weapon jam. @@ -92,6 +99,7 @@ Recharger vide la chambre de l'arme L'arma si disinceppa quando si ricarica Přebití uvolní zaseknutou zbraň. + Recarregar desemperra arma. Chance of unjam failing @@ -101,6 +109,7 @@ Chance de rater le des-enrayement Probabilità di sbagliare a disinceppare l'arma Šance, že uvolnění zbraně selže + Chance de falha de desemperramento Probability that an unjam action might fail, requiring to be repeated. @@ -109,6 +118,7 @@ Szansa na to, że przy przeładowaniu broni zacięcie nie zostanie usunięte, przez co czynność będzie musiała zostać powtórzona ponownie. Probabilité qu'une action de des-enrayement échoue, nécessitant de recommencer. Probabilità che si possa sbagliare a caso a disinceppare l'arma. Richiede di ripetere. + Probabilidade que uma ação de desemperramento falhe, tendo que ser repetida Spare barrel @@ -116,7 +126,7 @@ Cañón de repuesto Zapasowa lufa Náhradní hlaveň - Deuxième canon + Canon de rechange Запасной ствол Tartalék cső Cano Reserva @@ -178,6 +188,7 @@ Toujours enrayé ! Non si è disinceppata! Zbrań se nepodařilo uvolnit + Falha no desemperramento Swap barrel @@ -253,9 +264,13 @@ Check spare barrels temperatures + Verifica temperatura de canos reservas + Vérifier la température des canons de rechange Checking spare barrels temperatures... + Verificando temperatura de canos reservas + Vérification de la température des canons de rechange... Temperature @@ -271,26 +286,40 @@ Cool Spare Barrel/s + Cano/s reserva/s frio/s + Canon(s) de rechange froid Warm Spare Barrel/s + Cano/s reserva/s morno/s + Canon(s) de rechange tiède Hot Spare Barrel/s + Cano/s reserva/s quente/s + Canon(s) de rechange chaud Very Hot Spare Barrel/s + Cano/s reserva/s muito quente/s + Canon(s) de rechange très chaud Extremely Hot Spare Barrel/s + Cano/s reserva/s extremamente quente/s + Canon(s) de rechange extrêmement chaud Overheating Enabled Überhitzen Aktiviert Activada Sobrecalentamiento + Superaquecimento ativado + Surchauffe activée Master enable for the overheating/jamming module + Chave mestra para o módulo de superaquecimento/emperramento + Activateur maître pour le module de surchauffe / enrayement \ No newline at end of file diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index f7f0bc2ace..dd74ec5c3a 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" -["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); +["ace_overpressure", FUNC(overpressureDamage)] call CBA_fnc_addEventHandler; // Register fire event handler -["firedPlayer", DFUNC(firedEHBB)] call EFUNC(common,addEventHandler); -["firedPlayerVehicle", DFUNC(firedEHOP)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(firedEHBB)] call CBA_fnc_addEventHandler; +["ace_firedPlayerVehicle", DFUNC(firedEHOP)] call CBA_fnc_addEventHandler; diff --git a/addons/overpressure/config.cpp b/addons/overpressure/config.cpp index 0524f6e4c9..0aa455de7d 100644 --- a/addons/overpressure/config.cpp +++ b/addons/overpressure/config.cpp @@ -2,15 +2,21 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2","KoffeinFlummi","esteldunedain"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","KoffeinFlummi","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgWeapons.hpp" + +class ACE_newEvents { + overpressure = "ace_overpressure"; +}; diff --git a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf index 273843ce8f..4b447b5012 100644 --- a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf +++ b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf @@ -3,12 +3,12 @@ * Cache the shot data for a given weapon/mag/ammo combination. * Will use the config that has the highest priority. * - * Argument: + * Arguments: * 0: Weapon * 1: Magazine * 2: Ammo * - * Return value: + * Return Value: * Shot Config : * 0: Angle * 1: Range diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index 8dc15e0f0a..ad7234b08c 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -5,7 +5,7 @@ * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) * - * Return value: + * Return Value: * None * * Example: @@ -37,7 +37,7 @@ private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; // Let each client handle their own affected units -["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); +["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent; // Damage to the firer private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance)); diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index dff9215a52..a846d723a1 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -5,7 +5,7 @@ * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) * - * Return value: + * Return Value: * None * * Example: @@ -40,7 +40,7 @@ private _direction = vectorDir _projectile; private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units -["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); +["ace_overpressure", [_unit, _position, _direction, _weapon, _magazine, _ammo], _affected] call CBA_fnc_targetEvent; // Draw debug lines #ifdef DEBUG_MODE_FULL diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index 616feb8660..febb4ea747 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -8,7 +8,7 @@ * 2: Max distance to search * 3: Shooter * - * Return value: + * Return Value: * Distance to intersection (999 if distance is greater than max) * * Example: diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index 3b8d4ea6f2..5852cf3bfd 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -3,7 +3,7 @@ * Calculate and apply backblast damage to potentially affected local units * Handles the "overpressure" event. * - * Argument: + * Arguments: * 0: Unit that fired * 1: Pos ASL of the projectile * 2: Direction of the projectile (reversed for launcher backblast) @@ -11,7 +11,7 @@ * 4: Magazine * 5: Ammo * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp index 5f4005374b..c9e5ff587d 100644 --- a/addons/overpressure/script_component.hpp +++ b/addons/overpressure/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT overpressure +#define COMPONENT_BEAUTIFIED Overpressure #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/parachute/CfgVehicles.hpp b/addons/parachute/CfgVehicles.hpp index 4127bad166..e734962a0e 100644 --- a/addons/parachute/CfgVehicles.hpp +++ b/addons/parachute/CfgVehicles.hpp @@ -19,7 +19,7 @@ class CfgVehicles { statement = QUOTE([_player] call FUNC(cutParachute)); showDisabled = 0; priority = 2.9; - icon = QUOTE(PATHTOF(UI\cut_ca.paa)); + icon = QPATHTOF(UI\cut_ca.paa); }; }; }; diff --git a/addons/parachute/CfgWeapons.hpp b/addons/parachute/CfgWeapons.hpp index 4ca785a1ea..b5dad94425 100644 --- a/addons/parachute/CfgWeapons.hpp +++ b/addons/parachute/CfgWeapons.hpp @@ -6,6 +6,6 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); descriptionShort = CSTRING(AltimeterDescription); displayName = CSTRING(AltimeterDisplayName); - picture = PATHTOF(UI\watch_altimeter.paa); + picture = QPATHTOF(UI\watch_altimeter.paa); }; }; diff --git a/addons/parachute/RscTitles.hpp b/addons/parachute/RscTitles.hpp index c6f41a7362..277db4d2f9 100644 --- a/addons/parachute/RscTitles.hpp +++ b/addons/parachute/RscTitles.hpp @@ -12,7 +12,7 @@ class RscTitles { class controls { class AltimeterImage: RscPicture { idc = 1200; - text = PATHTOF(UI\watch_altimeter.paa); + text = QPATHTOF(UI\watch_altimeter.paa); x = 0.118437 * safezoneW + safezoneX; y = 0.621 * safezoneH + safezoneY; w = 0.20625 * safezoneW; diff --git a/addons/parachute/XEH_postInit.sqf b/addons/parachute/XEH_postInit.sqf index ad4044e6e5..1570d3cd98 100644 --- a/addons/parachute/XEH_postInit.sqf +++ b/addons/parachute/XEH_postInit.sqf @@ -17,8 +17,7 @@ if (!hasInterface) exitWith {}; -["ACE3 Equipment", QGVAR(showAltimeter), localize LSTRING(showAltimeter), -{ +["ACE3 Equipment", QGVAR(showAltimeter), localize LSTRING(showAltimeter), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; if (!('ACE_Altimeter' in assignedItems ace_player)) exitWith {false}; @@ -28,19 +27,17 @@ if (!hasInterface) exitWith {}; call FUNC(hideAltimeter); }; true -}, -{false}, -[24, [false, false, false]], false] call CBA_fnc_addKeybind; +}, {false}, [24, [false, false, false]], false] call CBA_fnc_addKeybind; GVAR(PFH) = false; -["playerVehicleChanged",{ +["vehicle",{ if (!GVAR(PFH) && {(vehicle ACE_player) isKindOf "ParachuteBase"}) then { GVAR(PFH) = true; [FUNC(onEachFrame), 0.1, []] call CALLSTACK(CBA_fnc_addPerFrameHandler); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addPlayerEventHandler; // don't show speed and height when in expert mode -["infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call EFUNC(common,addEventHandler); +["ace_infoDisplayChanged", {_this call FUNC(handleInfoDisplayChanged)}] call CBA_fnc_addEventHandler; -["playerInventoryChanged", FUNC(storeParachute)] call EFUNC(common,addEventHandler); +["loadout", FUNC(storeParachute)] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/parachute/config.cpp b/addons/parachute/config.cpp index 3671177e28..a251f3d6a6 100644 --- a/addons/parachute/config.cpp +++ b/addons/parachute/config.cpp @@ -1,14 +1,16 @@ #include "script_component.hpp" class CfgPatches { - class ACE_Parachute { + class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_NonSteerableParachute"}; weapons[] = {"ACE_Altimeter"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; VERSION_CONFIG; - author[] = {"Garth 'LH' de Wet"}; - authorUrl = "http://garth.snakebiteink.co.za/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Garth 'LH' de Wet"}; + url = ECSTRING(main,URL); }; }; diff --git a/addons/parachute/functions/fnc_doLanding.sqf b/addons/parachute/functions/fnc_doLanding.sqf index cc32724e9d..213bf10887 100644 --- a/addons/parachute/functions/fnc_doLanding.sqf +++ b/addons/parachute/functions/fnc_doLanding.sqf @@ -20,8 +20,8 @@ GVAR(PFH) = false; [_unit, "AmovPercMevaSrasWrflDf_AmovPknlMstpSrasWrflDnon", 2] call EFUNC(common,doAnimation); _unit setVariable [QGVAR(chuteIsCut), false, true]; [{ - if (ACE_time >= ((_this select 0) select 0) + 1) then { + if (CBA_missionTime >= ((_this select 0) select 0) + 1) then { ((_this select 0) select 1) playActionNow "Crouch"; [(_this select 1)] call CALLSTACK(CBA_fnc_removePerFrameHandler); }; -}, 1, [ACE_time,_unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler); +}, 1, [CBA_missionTime,_unit]] call CALLSTACK(CBA_fnc_addPerFrameHandler); diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf index 466abfb77e..b8ee8add6d 100644 --- a/addons/parachute/functions/fnc_showAltimeter.sqf +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -37,7 +37,7 @@ GVAR(AltimeterActive) = true; _minute = floor ((daytime - _hour) * 60); _height = ((getPosASL _unit) select 2) + EGVAR(common,mapAltitude); - _curTime = ACE_time; + _curTime = CBA_missionTime; _timeDiff = _curTime - _prevTime; _descentRate = if(_timeDiff > 0) then {floor((_oldHeight - _height) / _timeDiff)} else {0}; @@ -47,4 +47,4 @@ GVAR(AltimeterActive) = true; (_this select 0) set [2, _height]; (_this select 0) set [3, _curTime]; -}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit,floor ((getPosASL _unit) select 2), ACE_time]] call CALLSTACK(CBA_fnc_addPerFrameHandler); +}, 0.2, [uiNamespace getVariable ["ACE_Altimeter", displayNull], _unit,floor ((getPosASL _unit) select 2), CBA_missionTime]] call CALLSTACK(CBA_fnc_addPerFrameHandler); diff --git a/addons/parachute/functions/fnc_storeParachute.sqf b/addons/parachute/functions/fnc_storeParachute.sqf index 55e887f3e6..8980a8ff82 100644 --- a/addons/parachute/functions/fnc_storeParachute.sqf +++ b/addons/parachute/functions/fnc_storeParachute.sqf @@ -7,7 +7,6 @@ * * Return Value: * 0: Unit - * 1: getAllGear-Array * * Example: * None @@ -16,8 +15,8 @@ */ #include "script_component.hpp" -params ["_unit", "_gear"]; -private _backpack = _gear select 6; +params ["_unit"]; +private _backpack = backpack _unit; if ((vehicle _unit) isKindOf "ParachuteBase" && {backpack _unit == ""} && {!(_unit getVariable [QGVAR(chuteIsCut),false])} && {_unit getVariable [QGVAR(hasReserve),false]}) then { _unit addBackpackGlobal (_unit getVariable[QGVAR(backpackClass),"ACE_NonSteerableParachute"]); diff --git a/addons/parachute/script_component.hpp b/addons/parachute/script_component.hpp index d86d153f22..cb341ba5ce 100644 --- a/addons/parachute/script_component.hpp +++ b/addons/parachute/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT parachute +#define COMPONENT_BEAUTIFIED Parachute #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/rangecard/CfgVehicles.hpp b/addons/rangecard/CfgVehicles.hpp index 9e0793e36b..e7df701409 100644 --- a/addons/rangecard/CfgVehicles.hpp +++ b/addons/rangecard/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { distance = 2.0; condition = QUOTE(_target call FUNC(canCopy)); statement = QUOTE(_target call FUNC(updateClassNames)); - icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + icon = QPATHTOF(UI\RangeCard_Icon.paa); }; }; }; @@ -20,7 +20,7 @@ class CfgVehicles { statement = QUOTE(false call FUNC(openRangeCard)); showDisabled = 0; priority = 0.1; - icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + icon = QPATHTOF(UI\RangeCard_Icon.paa); exceptions[] = {"notOnMap"}; class GVAR(openCopy) { displayName = CSTRING(OpenRangeCardCopy); @@ -28,7 +28,7 @@ class CfgVehicles { statement = QUOTE(true call FUNC(openRangeCard)); showDisabled = 0; priority = 0.1; - icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + icon = QPATHTOF(UI\RangeCard_Icon.paa); exceptions[] = {"notOnMap"}; }; class GVAR(makeCopy) { @@ -37,7 +37,7 @@ class CfgVehicles { statement = QUOTE(GVAR(ammoClassCopy) = GVAR(ammoClass); GVAR(magazineClassCopy) = GVAR(magazineClass); GVAR(weaponClassCopy) = GVAR(ammoClass);); showDisabled = 0; priority = 0.1; - icon = QUOTE(PATHTOF(UI\RangeCard_Icon.paa)); + icon = QPATHTOF(UI\RangeCard_Icon.paa); exceptions[] = {"notOnMap"}; }; }; diff --git a/addons/rangecard/CfgWeapons.hpp b/addons/rangecard/CfgWeapons.hpp index 7195c0a008..dfc643fa47 100644 --- a/addons/rangecard/CfgWeapons.hpp +++ b/addons/rangecard/CfgWeapons.hpp @@ -8,7 +8,7 @@ class CfgWeapons { scope = 2; displayName = CSTRING(Name); descriptionShort = CSTRING(Description); - picture = PATHTOF(UI\RangeCard_Icon.paa); + picture = QPATHTOF(UI\RangeCard_Icon.paa); icon = "iconObject_circle"; mapSize = 0.034; diff --git a/addons/rangecard/RscTitles.hpp b/addons/rangecard/RscTitles.hpp index bc4101c483..8a2007b2b2 100644 --- a/addons/rangecard/RscTitles.hpp +++ b/addons/rangecard/RscTitles.hpp @@ -79,7 +79,7 @@ class ACE_RangeCard_Dialog { h="1.62727"; colorBackground[]={1,1,1,1}; colorText[]={1,1,1,1}; - text=QUOTE(PATHTOF(UI\RangeCard.paa)); + text=QPATHTOF(UI\RangeCard.paa); }; class CAPTION_TEXT_1: RangeCard_RscText { idc=770000; diff --git a/addons/rangecard/config.cpp b/addons/rangecard/config.cpp index abe4e859f2..9017583606 100644 --- a/addons/rangecard/config.cpp +++ b/addons/rangecard/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_RangeCard"}; weapons[] = {"ACE_RangeCard"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Advanced_Ballistics"}; - author = "Ruthberg"; + author = ECSTRING(common,ACETeam); + authors[] = {"Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -14,4 +17,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#include "RscTitles.hpp" \ No newline at end of file +#include "RscTitles.hpp" diff --git a/addons/rangecard/script_component.hpp b/addons/rangecard/script_component.hpp index 251fb7263f..95344973fe 100644 --- a/addons/rangecard/script_component.hpp +++ b/addons/rangecard/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT rangecard +#define COMPONENT_BEAUTIFIED Range Card #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/realisticnames/config.cpp b/addons/realisticnames/config.cpp index 6a8ea59290..c97c9a82e0 100644 --- a/addons/realisticnames/config.cpp +++ b/addons/realisticnames/config.cpp @@ -2,13 +2,18 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","TaoSensai","commy2"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi","TaoSensai","commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; + + // this prevents any patched class from requiring this addon + addonRootClass = "A3_Characters_F"; }; }; diff --git a/addons/realisticnames/script_component.hpp b/addons/realisticnames/script_component.hpp index 33cd56777a..dda1fc93c5 100644 --- a/addons/realisticnames/script_component.hpp +++ b/addons/realisticnames/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT realisticnames +#define COMPONENT_BEAUTIFIED Realistic Names #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_REALISTICNAMES #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/rearm/CfgVehicles.hpp b/addons/rearm/CfgVehicles.hpp index 8bee12de85..44b7fe38af 100644 --- a/addons/rearm/CfgVehicles.hpp +++ b/addons/rearm/CfgVehicles.hpp @@ -8,7 +8,7 @@ condition = QUOTE(_this call FUNC(canRearm)); \ statement = QUOTE(_player call FUNC(rearm)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_rearm_interact.paa); \ + icon = QPATHTOF(ui\icon_rearm_interact.paa); \ }; \ }; \ }; @@ -24,7 +24,7 @@ exceptions[] = {"isNotInside"}; \ showDisabled = 0; \ priority = 2; \ - icon = PATHTOF(ui\icon_rearm_interact.paa); \ + icon = QPATHTOF(ui\icon_rearm_interact.paa); \ }; \ class GVAR(StoreAmmo) { \ displayName = CSTRING(StoreAmmo); \ @@ -32,7 +32,7 @@ condition = QUOTE(_this call FUNC(canStoreAmmo)); \ statement = QUOTE(_this call FUNC(storeAmmo)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_rearm_interact.paa); \ + icon = QPATHTOF(ui\icon_rearm_interact.paa); \ }; \ }; \ }; @@ -44,7 +44,7 @@ class CfgVehicles { class ACE_moduleRearmSettings: ACE_Module { scope = 2; displayName = CSTRING(RearmSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(ui\icon_module_rearm.paa)); + icon = QPATHTOF(ui\icon_module_rearm.paa); category = "ACE_Logistics"; function = QFUNC(moduleRearmSettings); functionPriority = 1; @@ -143,24 +143,21 @@ class CfgVehicles { MACRO_REARM_TRUCK_ACTIONS }; - class Pod_Heli_Transport_04_base_F: StaticWeapon {}; + class ThingX; + class ReammoBox_F: ThingX { + class ACE_Actions { + class ACE_MainActions {}; + }; + }; + class Slingload_base_F: ReammoBox_F {}; + class Slingload_01_Base_F: Slingload_base_F {}; + + class Pod_Heli_Transport_04_base_F: Slingload_base_F {}; class Land_Pod_Heli_Transport_04_ammo_F: Pod_Heli_Transport_04_base_F { transportAmmo = 0; MACRO_REARM_TRUCK_ACTIONS }; - class Slingload_base_F; - class Slingload_01_Base_F: Slingload_base_F { - class ACE_Actions { - class ACE_MainActions { - displayName = ECSTRING(interaction,MainAction); - selection = ""; - distance = 10; - condition = "true"; - }; - }; - }; - class B_Slingload_01_Ammo_F: Slingload_01_Base_F { transportAmmo = 0; MACRO_REARM_TRUCK_ACTIONS @@ -168,7 +165,6 @@ class CfgVehicles { // Dummy Vehicles - class ThingX; class GVAR(defaultCarriedObject): ThingX { class EventHandlers { class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; @@ -188,7 +184,7 @@ class CfgVehicles { exceptions[] = {"isNotInside"}; showDisabled = 0; priority = 2; - icon = PATHTOF(ui\icon_rearm_interact.paa); + icon = QPATHTOF(ui\icon_rearm_interact.paa); }; }; }; diff --git a/addons/rearm/XEH_postInit.sqf b/addons/rearm/XEH_postInit.sqf index c22b84ffb4..cfbbdf9d4d 100644 --- a/addons/rearm/XEH_postInit.sqf +++ b/addons/rearm/XEH_postInit.sqf @@ -1,8 +1,15 @@ #include "script_component.hpp" -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventHandler); -["playerVehicleChanged", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}] call EFUNC(common,addEventHandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; +["vehicle", { + params ["_unit"]; + [_unit] call FUNC(dropAmmo); +}] call CBA_fnc_addPlayerEventHandler; if (isServer) then { addMissionEventHandler ["HandleDisconnect", {params ["_unit"]; [_unit] call FUNC(dropAmmo)}]; }; + +[QGVAR(makeDummyEH), FUNC(makeDummy)] call CBA_fnc_addEventHandler; +[QGVAR(rearmEntireVehicleSuccessLocalEH), FUNC(rearmEntireVehicleSuccessLocal)] call CBA_fnc_addEventHandler; +[QGVAR(rearmSuccessLocalEH), FUNC(rearmSuccessLocal)] call CBA_fnc_addEventHandler; diff --git a/addons/rearm/config.cpp b/addons/rearm/config.cpp index c15721c9df..a4c130c974 100644 --- a/addons/rearm/config.cpp +++ b/addons/rearm/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"GitHawk", "Jonpas"}; - authorUrl = "https://ace3mod.com"; + author = ECSTRING(common,ACETeam); + authors[] = {"GitHawk", "Jonpas"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/rearm/functions/fnc_addRearmActions.sqf b/addons/rearm/functions/fnc_addRearmActions.sqf index 6040fd6fc5..db92df470d 100644 --- a/addons/rearm/functions/fnc_addRearmActions.sqf +++ b/addons/rearm/functions/fnc_addRearmActions.sqf @@ -2,10 +2,10 @@ * Author: GitHawk * Show the resupplyable ammunition of all surrounding vehicles. * - * Argument: + * Arguments: * 0: Target * - * Return value: + * Return Value: * ChildActions * * Example: diff --git a/addons/rearm/functions/fnc_dropAmmo.sqf b/addons/rearm/functions/fnc_dropAmmo.sqf index 48433c2f4a..eafc8bee50 100644 --- a/addons/rearm/functions/fnc_dropAmmo.sqf +++ b/addons/rearm/functions/fnc_dropAmmo.sqf @@ -20,6 +20,8 @@ private ["_dummy", "_actionID"]; params [["_unit", objNull, [objNull]], ["_delete", false, [false]], ["_unholster", true, [true]]]; +if (isNull _unit) exitWith {}; + _dummy = _unit getVariable [QGVAR(dummy), objNull]; if !(isNull _dummy) then { detach _dummy; diff --git a/addons/rearm/functions/fnc_pickUpAmmo.sqf b/addons/rearm/functions/fnc_pickUpAmmo.sqf index 546fc318b7..1368b4e959 100644 --- a/addons/rearm/functions/fnc_pickUpAmmo.sqf +++ b/addons/rearm/functions/fnc_pickUpAmmo.sqf @@ -25,7 +25,7 @@ if !(isNull _dummy) exitWith {}; //_target attachTo [_unit, [0,0.7,0], "pelvis"]; _target attachTo [_unit, [0,1,0], "pelvis"]; { - [[_target, [[-1,0,0],[0,0,1]]], QFUNC(makeDummy), _x] call EFUNC(common,execRemoteFnc); + [QGVAR(makeDummyEH), [_dummy, [[-1,0,0],[0,0,1]]], _x] call CBA_fnc_targetEvent; } count (position _unit nearObjects ["CAManBase", 100]); _unit setVariable [QGVAR(dummy), _target]; //_unit setVariable [QEGVAR(dragging,isCarrying), true, true]; // breaks things, since it hides interact menu on _target diff --git a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf index c12286516c..f82936b24a 100644 --- a/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmEntireVehicleSuccess.sqf @@ -22,12 +22,11 @@ if (isServer) then { { _turretOwnerID = _vehicle turretOwner _x; if (_turretOwnerID == 0) then { - [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _truck] call CBA_fnc_targetEvent; } else { - EGVAR(common,remoteFnc) = [[_vehicle, _x], QFUNC(rearmEntireVehicleSuccessLocal), 0]; - _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), [_truck, _vehicle, _x], _turretOwnerID] call CBA_fnc_targetEvent; }; } count REARM_TURRET_PATHS; } else { - [_this, QFUNC(rearmEntireVehicleSuccess), 1] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmEntireVehicleSuccessLocalEH), _this] call CBA_fnc_serverEvent; }; diff --git a/addons/rearm/functions/fnc_rearmSuccess.sqf b/addons/rearm/functions/fnc_rearmSuccess.sqf index 81cda9f262..f8608817ea 100644 --- a/addons/rearm/functions/fnc_rearmSuccess.sqf +++ b/addons/rearm/functions/fnc_rearmSuccess.sqf @@ -34,11 +34,10 @@ if (local _unit) then { if (isServer) then { _turretOwnerID = _target turretOwner _turretPath; if (_turretOwnerID == 0) then { - [_this, QFUNC(rearmSuccessLocal), _target] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmSuccessLocalEH), _this, _vehicle] call CBA_fnc_targetEvent; } else { - EGVAR(common,remoteFnc) = [_this, QFUNC(rearmSuccessLocal), 0]; - _turretOwnerID publicVariableClient QEGVAR(common,remoteFnc); + [QGVAR(rearmSuccessLocalEH), _this, _turretOwnerID] call CBA_fnc_targetEvent; }; } else { - [_this, QFUNC(rearmSuccess), 1] call EFUNC(common,execRemoteFnc); + [QGVAR(rearmSuccessLocalEH), _this] call CBA_fnc_serverEvent; }; diff --git a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf index 1789767cfd..44761d3d17 100644 --- a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf +++ b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf @@ -40,15 +40,23 @@ if (_maxMagazines == 1) then { if (GVAR(level) == 1) then { // Fill magazine completely _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; - ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds, + [QEGVAR(common,displayTextStructured), + [ + [LSTRING(Hint_RearmedTriple), _rounds, getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), - getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit + ], + [_unit]] call CBA_fnc_targetEvent; } else { // Fill only at most _numRounds _target setMagazineTurretAmmo [_magazineClass, ((_target magazineTurretAmmo [_magazineClass, _turretPath]) + _numRounds) min _rounds, _turretPath]; - ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds, + [QEGVAR(common,displayTextStructured), + [ + [LSTRING(Hint_RearmedTriple), _numRounds, getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), - getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit + ], + [_unit]] call CBA_fnc_targetEvent; }; } else { for "_idx" from 1 to (_maxMagazines+1) do { @@ -69,9 +77,13 @@ if (_maxMagazines == 1) then { } else { _target setMagazineTurretAmmo [_magazineClass, _currentRounds + _numRounds, _turretPath]; }; - ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _numRounds, + [QEGVAR(common,displayTextStructured), + [ + [LSTRING(Hint_RearmedTriple), _numRounds, getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), - getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit + ], + [_unit]] call CBA_fnc_targetEvent; } else { // Fill current magazine completely and fill next magazine partially _target setMagazineTurretAmmo [_magazineClass, _rounds, _turretPath]; @@ -79,9 +91,13 @@ if (_maxMagazines == 1) then { _target addMagazineTurret [_magazineClass, _turretPath]; _target setMagazineTurretAmmo [_magazineClass, _currentRounds, _turretPath]; }; - ["displayTextStructured", [_unit], [[LSTRING(Hint_RearmedTriple), _rounds, + [QEGVAR(common,displayTextStructured), + [ + [LSTRING(Hint_RearmedTriple), _rounds, getText(configFile >> "CfgMagazines" >> _magazineClass >> "displayName"), - getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit]] call EFUNC(common,targetEvent); + getText(configFile >> "CfgVehicles" >> (typeOf _target) >> "displayName")], 3, _unit + ], + [_unit]] call CBA_fnc_targetEvent; }; }; _target removeMagazineTurret [_magazineClass, _turretPath]; diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp index 5d69987a56..43b9a8bb5f 100644 --- a/addons/rearm/script_component.hpp +++ b/addons/rearm/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT rearm +#define COMPONENT_BEAUTIFIED Rearm #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -32,5 +33,8 @@ #define REARM_UNHOLSTER_WEAPON \ _weaponSelect = _unit getVariable QGVAR(selectedWeaponOnRearm); \ - _unit selectWeapon _weaponSelect; \ - _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; + TRACE_2("REARM_UNHOLSTER_WEAPON",_unit,_weaponSelect); \ + if (!isNil "_weaponSelect") then { \ + _unit selectWeapon _weaponSelect; \ + _unit setVariable [QGVAR(selectedWeaponOnRearm), nil]; \ + }; diff --git a/addons/recoil/XEH_postInit.sqf b/addons/recoil/XEH_postInit.sqf index e6b694646f..29e5464612 100644 --- a/addons/recoil/XEH_postInit.sqf +++ b/addons/recoil/XEH_postInit.sqf @@ -1,4 +1,4 @@ #include "script_component.hpp" // Register fire event handler -["firedPlayer", DFUNC(camShake)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(camShake)] call CBA_fnc_addEventHandler; diff --git a/addons/recoil/config.cpp b/addons/recoil/config.cpp index 5b8002bc37..1a80a3b945 100644 --- a/addons/recoil/config.cpp +++ b/addons/recoil/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/recoil/script_component.hpp b/addons/recoil/script_component.hpp index aa80910be1..d3147f056b 100644 --- a/addons/recoil/script_component.hpp +++ b/addons/recoil/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT recoil +#define COMPONENT_BEAUTIFIED Recoil #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_RECOIL #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 665d217d39..6774140cc7 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -9,41 +9,41 @@ statement = ""; \ showDisabled = 0; \ priority = 2; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ class GVAR(TakeNozzle) { \ displayName = CSTRING(TakeNozzle); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ statement = QUOTE([ARR_3(_player,_target,objNull)] call FUNC(TakeNozzle)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(CheckFuelCounter) { \ displayName = CSTRING(CheckFuelCounter); \ condition = "true"; \ statement = QUOTE([ARR_2(_player,_target)] call FUNC(readFuelCounter)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(CheckFuel) { \ displayName = CSTRING(CheckFuel); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckFuel)); \ statement = QUOTE([ARR_2(_player,_target)] call FUNC(checkFuel)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(Connect) { \ displayName = CSTRING(Connect); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(Return) { \ displayName = CSTRING(Return); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canReturnNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(returnNozzle)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ }; \ }; \ @@ -59,13 +59,13 @@ statement = ""; \ showDisabled = 0; \ priority = 2; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ class GVAR(Connect) { \ displayName = CSTRING(Connect); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canConnectNozzle)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(connectNozzle)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ }; \ }; \ @@ -80,34 +80,34 @@ statement = ""; \ showDisabled = 0; \ priority = 2; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ class GVAR(PickUpNozzle) { \ displayName = CSTRING(TakeNozzle); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeNozzle)); \ statement = QUOTE([ARR_3(_player,objNull,_target)] call FUNC(TakeNozzle)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(TurnOn) { \ displayName = CSTRING(TurnOn); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOn)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOn)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(TurnOff) { \ displayName = CSTRING(TurnOff); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTurnOff)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(turnOff)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ class GVAR(Disconnect) { \ displayName = CSTRING(Disconnect); \ condition = QUOTE([ARR_2(_player,_target)] call FUNC(canDisconnect)); \ statement = QUOTE([ARR_2(_player,_target)] call DFUNC(disconnect)); \ exceptions[] = {"isNotInside"}; \ - icon = PATHTOF(ui\icon_refuel_interact.paa); \ + icon = QPATHTOF(ui\icon_refuel_interact.paa); \ }; \ }; \ }; @@ -119,7 +119,7 @@ class CfgVehicles { class ACE_moduleRefuelSettings: ACE_Module { scope = 2; displayName = CSTRING(RefuelSettings_Module_DisplayName); - icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); + icon = QPATHTOF(ui\icon_module_refuel.paa); category = "ACE_Logistics"; function = QFUNC(moduleRefuelSettings); functionPriority = 1; @@ -146,7 +146,7 @@ class CfgVehicles { displayName = QGVAR(fuelNozzle); scope = 1; scopeCurator = 1; - model = PATHTOF(data\nozzle.p3d); + model = QPATHTOF(data\nozzle.p3d); }; class All; @@ -480,18 +480,22 @@ class CfgVehicles { GVAR(fuelCargo) = 10000; }; - class Slingload_base_F; - class Slingload_01_Base_F: Slingload_base_F { + class ReammoBox_F: ThingX { class ACE_Actions { - class ACE_MainActions { - displayName = ECSTRING(interaction,MainAction); - selection = ""; - distance = 10; - condition = "true"; - }; + class ACE_MainActions {}; }; }; + class Slingload_base_F: ReammoBox_F {}; + class Pod_Heli_Transport_04_base_F: Slingload_base_F {}; + class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F { + transportFuel = 0; //3k + MACRO_REFUEL_ACTIONS + GVAR(hooks)[] = {{-1.49,1.41,-.3}}; + GVAR(fuelCargo) = 10000; + }; + + class Slingload_01_Base_F: Slingload_base_F {}; class B_Slingload_01_Fuel_F: Slingload_01_Base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS @@ -506,13 +510,6 @@ class CfgVehicles { GVAR(fuelCargo) = 10000; }; - class Pod_Heli_Transport_04_base_F: StaticWeapon {}; - class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F { - transportFuel = 0; //3k - MACRO_REFUEL_ACTIONS - GVAR(hooks)[] = {{-1.49,1.41,-.3}}; - GVAR(fuelCargo) = 10000; - }; class StorageBladder_base_F: NonStrategic { class ACE_Actions { diff --git a/addons/refuel/XEH_postInit.sqf b/addons/refuel/XEH_postInit.sqf index 5078d808a2..8c28464287 100644 --- a/addons/refuel/XEH_postInit.sqf +++ b/addons/refuel/XEH_postInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventHandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; if (isServer) then { addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}]; @@ -8,4 +8,4 @@ if (isServer) then { [QGVAR(resetLocal), { _this call FUNC(resetLocal); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/refuel/config.cpp b/addons/refuel/config.cpp index 6140cefe8c..ffdd202c54 100644 --- a/addons/refuel/config.cpp +++ b/addons/refuel/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_refuel_fuelNozzle"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"GitHawk"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"GitHawk"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index 140021419d..49d62b1e44 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -27,9 +27,9 @@ private _fuel = [_target] call FUNC(getFuel); params ["_args"]; _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_fuel", 0, [0]]]; if (_fuel > 0 ) then { - ["displayTextStructured", _unit, [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,objectEvent); + [QEGVAR(common,displayTextStructured), [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit], _unit] call CBA_fnc_targetEvent; } else { - ["displayTextStructured", _unit, [LSTRING(Hint_Empty), 2, _unit]] call EFUNC(common,objectEvent); + [QEGVAR(common,displayTextStructured), [LSTRING(Hint_Empty), 2, _unit], _unit] call CBA_fnc_targetEvent; }; true }, diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index d6b599b771..a124a331d5 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -28,7 +28,7 @@ if (isNull _nozzle) exitWith {}; GVAR(placeAction) = PLACE_WAITING; -[{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); +[{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call CBA_fnc_execNextFrame; _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; private _actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 1df5f1e208..250da51e21 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -119,7 +119,7 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; }; }; }; - ["setVectorDirAndUp", _nozzle, [_nozzle, _dirAndUp]] call EFUNC(common,objectEvent); + [QEGVAR(common,setVectorDirAndUp), [_nozzle, _dirAndUp], _nozzle] call CBA_fnc_targetEvent; _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf index 7a9552cfe3..c826948fa2 100644 --- a/addons/refuel/functions/fnc_makeJerryCan.sqf +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -29,7 +29,7 @@ _target setVariable [QGVAR(source), _target, true]; // Main Action private _action = [QGVAR(Refuel), localize LSTRING(Refuel), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + QPATHTOF(ui\icon_refuel_interact.paa), {}, {true}, {}, @@ -41,7 +41,7 @@ private _action = [QGVAR(Refuel), // Add pickup _action = [QGVAR(PickUpNozzle), localize LSTRING(TakeNozzle), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + QPATHTOF(ui\icon_refuel_interact.paa), {[_player, objNull, _target] call FUNC(TakeNozzle)}, {[_player, _target] call FUNC(canTakeNozzle)}, {}, @@ -53,7 +53,7 @@ _action = [QGVAR(PickUpNozzle), // Add turnOn _action = [QGVAR(TurnOn), localize LSTRING(TurnOn), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + QPATHTOF(ui\icon_refuel_interact.paa), {[_player, _target] call FUNC(turnOn)}, {[_player, _target] call FUNC(canTurnOn)}, {}, @@ -65,7 +65,7 @@ _action = [QGVAR(TurnOn), // Add turnOff _action = [QGVAR(TurnOff), localize LSTRING(TurnOff), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + QPATHTOF(ui\icon_refuel_interact.paa), {[_player, _target] call FUNC(turnOff)}, {[_player, _target] call FUNC(canTurnOff)}, {}, @@ -77,7 +77,7 @@ _action = [QGVAR(TurnOff), // Add disconnect _action = [QGVAR(Disconnect), localize LSTRING(Disconnect), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + QPATHTOF(ui\icon_refuel_interact.paa), {[_player, _target] call FUNC(disconnect)}, {[_player, _target] call FUNC(canDisconnect)}, {}, diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 62a006cda9..2f7131bd9f 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -79,7 +79,7 @@ private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> }; _unit setVariable [QGVAR(tempFuel), _fuelInSink]; - ["setFuel", _sink, [_sink, _fuelInSink]] call EFUNC(common,objectEvent); + [QEGVAR(common,setFuel), [_sink, _fuelInSink], _sink] call CBA_fnc_targetEvent; [_source, _fuelInSource] call FUNC(setFuel); } else { _unit setVariable [QGVAR(tempFuel), fuel _sink]; diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf index 767e4b6c88..d58f0a48ad 100644 --- a/addons/refuel/functions/fnc_reset.sqf +++ b/addons/refuel/functions/fnc_reset.sqf @@ -33,7 +33,7 @@ if !(isNil "_nozzle") then { }; { - [QGVAR(resetLocal), _x, [_x, _nozzle]] call EFUNC(common,objectEvent); + [QGVAR(resetLocal), [_x, _nozzle], _x] call CBA_fnc_targetEvent; } count allPlayers; deleteVehicle _nozzle; }; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index f05018d3e8..124b5acd64 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT refuel +#define COMPONENT_BEAUTIFIED Refuel #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/reload/ACE_UI.hpp b/addons/reload/ACE_UI.hpp new file mode 100644 index 0000000000..6dae3e5147 --- /dev/null +++ b/addons/reload/ACE_UI.hpp @@ -0,0 +1,7 @@ +class ACE_UI { + class ammoCount { + class conditions { + ADDON = "false"; + }; + }; +}; diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index 16f3d9b40e..b4579a96ee 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -18,16 +18,16 @@ if (!hasInterface) exitWith {}; {false}, [19, [false, true, false]], false] call CBA_fnc_addKeybind; -["setAmmoSync", { +[QGVAR(syncAmmo), { //To propagate the setAmmo change, do it on all clients params ["_unit", "_weapon", "_ammo"]; - TRACE_3("setAmmoSync EH",_unit,_weapon,_ammo); + TRACE_3("syncAmmo EH",_unit,_weapon,_ammo); _unit setAmmo [_weapon, _ammo]; -}] call EFUNC(common,addEventhandler); +}] call CBA_fnc_addEventHandler; // Listen for attempts to link ammo -["linkedAmmo", { +[QGVAR(ammoLinked), { params ["_receiver", "_giver", "_magazine"]; private _magazineType = currentMagazine _receiver; @@ -35,7 +35,7 @@ if (!hasInterface) exitWith {}; // Return the magazine if it's the wrong type if (_magazineType != (_magazine select 0)) exitWith { - ["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent); + [QGVAR(ammoReturned), [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent; }; private _ammoCount = _receiver ammo currentWeapon _receiver; @@ -43,22 +43,22 @@ if (!hasInterface) exitWith {}; // Return the magazine if the belt is full or empty if ((_ammoCount == 0) || _ammoMissing == 0) exitWith { - ["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent); + [QGVAR(ammoReturned), [_giver,_receiver,_magazine], [_giver]] call CBA_fnc_targetEvent; }; // Add the ammo private _ammoAdded = _ammoMissing min (_magazine select 1); - ["setAmmoSync", [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call EFUNC(common,globalEvent); + [QGVAR(syncAmmo), [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call CBA_fnc_globalEvent; if ((_magazine select 1) - _ammoAdded > 0) then { - ["returnedAmmo", [_giver], [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent); + [QGVAR(ammoReturned), [_giver, _receiver, [_magazineType, (_magazine select 1) - _ammoAdded]], [_giver]] call CBA_fnc_targetEvent; }; -}] call EFUNC(common,addEventhandler); +}] call CBA_fnc_addEventHandler; // Listen for returned magazines -["returnedAmmo", { +[QGVAR(ammoReturned), { params ["_receiver", "", "_magazine"]; - TRACE_2("returnedAmmo EH",_receiver,_magazine); + TRACE_2("ammoReturned EH",_receiver,_magazine); _receiver addMagazine _magazine; -}] call EFUNC(common,addEventhandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/reload/config.cpp b/addons/reload/config.cpp index 86ba809a93..9c66dd4828 100644 --- a/addons/reload/config.cpp +++ b/addons/reload/config.cpp @@ -2,22 +2,27 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2","KoffeinFlummi","esteldunedain"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","KoffeinFlummi","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgVehicles.hpp" - #include "CfgMagazines.hpp" - #include "CfgEventHandlers.hpp" - #include "CfgActions.hpp" - #include "ACE_Settings.hpp" +#include "ACE_UI.hpp" + +class ACE_newEvents { + setAmmoSync = QGVAR(syncAmmo); + returnedAmmo = QGVAR(ammoReturned); + linkedAmmo = QGVAR(ammoLinked); +}; diff --git a/addons/reload/functions/fnc_canCheckAmmo.sqf b/addons/reload/functions/fnc_canCheckAmmo.sqf index 41a46ea465..7f38e3fbfa 100644 --- a/addons/reload/functions/fnc_canCheckAmmo.sqf +++ b/addons/reload/functions/fnc_canCheckAmmo.sqf @@ -2,11 +2,11 @@ * Author: CAA-Picard * Check if the player can check the ammo of the target. * - * Argument: + * Arguments: * 0: Unit * 1: Target * - * Return value: + * Return Value: * Can link belt * * Example: diff --git a/addons/reload/functions/fnc_canLinkBelt.sqf b/addons/reload/functions/fnc_canLinkBelt.sqf index 13fad4d460..7d25b5ea22 100644 --- a/addons/reload/functions/fnc_canLinkBelt.sqf +++ b/addons/reload/functions/fnc_canLinkBelt.sqf @@ -2,11 +2,11 @@ * Author: esteldunedain * Check if the target has an MG equiped with belt system that the player can link * - * Argument: + * Arguments: * 0: Player * 1: Target * - * Return value: + * Return Value: * Can link belt */ #include "script_component.hpp" diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index b0581a143a..49a1f0728d 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -2,11 +2,11 @@ * Author: commy2 and esteldunedain * Count the ammo of the currently loaded magazine or count rifle grenades. Play animation and display message. * - * Argument: + * Arguments: * 0: Player * 1: Target. Optional, if not suplied the player counts his personal or static weapon ammo * - * Return value: + * Return Value: * Nothing */ #include "script_component.hpp" @@ -34,4 +34,4 @@ if (_unit == _target) then { _unit playActionNow "Gear"; }; -[FUNC(displayAmmo), [_target], 1, 0.1] call EFUNC(common,waitAndExecute); +[FUNC(displayAmmo), [_target], 1, 0.1] call CBA_fnc_waitAndExecute; diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index 7fff5564c0..6aa8f013d9 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -2,10 +2,10 @@ * Author: commy2 and esteldunedain * Display the ammo of the currently loaded magazine of the target or count rifle grenades. * - * Argument: + * Arguments: * 0: Target * - * Return value: + * Return Value: * Nothing */ #include "script_component.hpp" diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf index 5924e1b4e1..1590abbfab 100644 --- a/addons/reload/functions/fnc_startLinkingBelt.sqf +++ b/addons/reload/functions/fnc_startLinkingBelt.sqf @@ -2,11 +2,11 @@ * Author: esteldunedain * Start linking the belt * - * Argument: + * Arguments: * 0: Player * 1: Target * - * Return value: + * Return Value: * None */ #include "script_component.hpp" @@ -46,7 +46,7 @@ private _onFinish = { (_this select 0) params ["_player", "_target", "_magazine"]; // Raise event on remote unit - ["linkedAmmo", [_target], [_target, _player, _magazine]] call EFUNC(common,targetEvent); + [QGVAR(ammoLinked), [_target, _player, _magazine], [_target]] call CBA_fnc_targetEvent; }; private _onFailure = { diff --git a/addons/reload/script_component.hpp b/addons/reload/script_component.hpp index 09993faaa4..c2dc3b55a1 100644 --- a/addons/reload/script_component.hpp +++ b/addons/reload/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT reload +#define COMPONENT_BEAUTIFIED Reload #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_RELOAD #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/reloadlaunchers/XEH_postInit.sqf b/addons/reloadlaunchers/XEH_postInit.sqf index 437927602a..8c18d430c4 100644 --- a/addons/reloadlaunchers/XEH_postInit.sqf +++ b/addons/reloadlaunchers/XEH_postInit.sqf @@ -1,4 +1,4 @@ // by commy2 #include "script_component.hpp" -["reloadLauncher", {_this call DFUNC(reloadLauncher)}] call EFUNC(common,addEventhandler); +[QGVAR(reloadLauncher), {_this call DFUNC(reloadLauncher)}] call CBA_fnc_addEventHandler; diff --git a/addons/reloadlaunchers/config.cpp b/addons/reloadlaunchers/config.cpp index 6a04f6339a..16ae8cb867 100644 --- a/addons/reloadlaunchers/config.cpp +++ b/addons/reloadlaunchers/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -16,3 +18,7 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + +class ACE_newEvents { + reloadLauncher = QGVAR(reloadLauncher); +}; diff --git a/addons/reloadlaunchers/functions/fnc_addMissileReloadActions.sqf b/addons/reloadlaunchers/functions/fnc_addMissileReloadActions.sqf index f6cd923845..6a9d779d02 100644 --- a/addons/reloadlaunchers/functions/fnc_addMissileReloadActions.sqf +++ b/addons/reloadlaunchers/functions/fnc_addMissileReloadActions.sqf @@ -2,11 +2,11 @@ * Author: commy2 * Create one action per reloadable missile * - * Argument: + * Arguments: * 1: Target (Object) * 0: Player (Object) * - * Return value: + * Return Value: * Children actions (Array) * * Public: No diff --git a/addons/reloadlaunchers/functions/fnc_canLoad.sqf b/addons/reloadlaunchers/functions/fnc_canLoad.sqf index 116a900092..5072d44a48 100644 --- a/addons/reloadlaunchers/functions/fnc_canLoad.sqf +++ b/addons/reloadlaunchers/functions/fnc_canLoad.sqf @@ -2,13 +2,13 @@ * Author: commy2 * Check of the unit can reload the launcher of target unit. * - * Argument: + * Arguments: * 0: Unit to do the reloading (Object) * 1: Unit eqipped with launcher (Object) * 2: weapon name (String) * 3: missile name (String) * - * Return value: + * Return Value: * NONE * * Public: No diff --git a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf index f466490b64..40766a5905 100644 --- a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf +++ b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf @@ -2,11 +2,11 @@ * Author: commy2 * Return all magazine types from reloaders inventory that are compatible with given weapon. * - * Argument: + * Arguments: * 0: Unit to to the reload (Object) * 1: A launcher (String) * - * Return value: + * Return Value: * Reloable magazines (Array) * * Public: No diff --git a/addons/reloadlaunchers/functions/fnc_load.sqf b/addons/reloadlaunchers/functions/fnc_load.sqf index db18e7edaa..2f822bb6d7 100644 --- a/addons/reloadlaunchers/functions/fnc_load.sqf +++ b/addons/reloadlaunchers/functions/fnc_load.sqf @@ -2,13 +2,13 @@ * Author: commy2 * Reload a launcher * - * Argument: + * Arguments: * 0: Unit with magazine (Object) * 1: Unit with launcher (Object) * 2: weapon name (String) * 3: missile name (String) * - * Return value: + * Return Value: * NONE * * Public: No @@ -32,7 +32,7 @@ private ["_onSuccess", "_onFailure", "_condition"]; _onSuccess = { (_this select 0 select 0) removeMagazine (_this select 0 select 3); - ["reloadLauncher", _this select 0 select 1, _this select 0] call DEFUNC(common,targetEvent); + [QGVAR(reloadLauncher), _this select 0, _this select 0 select 1] call CBA_fnc_targetEvent; [localize LSTRING(LauncherLoaded)] call DEFUNC(common,displayTextStructured); }; diff --git a/addons/reloadlaunchers/functions/fnc_reloadLauncher.sqf b/addons/reloadlaunchers/functions/fnc_reloadLauncher.sqf index 2aec180d22..96db7cdca5 100644 --- a/addons/reloadlaunchers/functions/fnc_reloadLauncher.sqf +++ b/addons/reloadlaunchers/functions/fnc_reloadLauncher.sqf @@ -2,13 +2,13 @@ * Author: commy2 * Reload a launcher * - * Argument: + * Arguments: * 0: Unit to do the reloading (Object) * 1: Target to rload (Object) * 2: weapon name (String) * 3: missile name (String) * - * Return value: + * Return Value: * NONE * * Public: No diff --git a/addons/reloadlaunchers/script_component.hpp b/addons/reloadlaunchers/script_component.hpp index fc78723f2a..9051d0c36f 100644 --- a/addons/reloadlaunchers/script_component.hpp +++ b/addons/reloadlaunchers/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT reloadlaunchers +#define COMPONENT_BEAUTIFIED Reload Launchers #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_RELOADLAUNCHERS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/repair/CfgEden.hpp b/addons/repair/CfgEden.hpp index d8885fddf9..ca315d68ec 100644 --- a/addons/repair/CfgEden.hpp +++ b/addons/repair/CfgEden.hpp @@ -16,9 +16,9 @@ class Cfg3DEN { class Value: ctrlToolbox { idc = 100; style = "0x02"; - x = "48 * (pixelW * 1.25 * 4)"; - w = "82 * (pixelW * 1.25 * 4)"; - h = "5 * (pixelH * 1.25 * 4)"; + x = "48 * (pixelW * pixelGrid * 0.25)"; + w = "82 * (pixelW * pixelGrid * 0.25)"; + h = "5 * (pixelH * pixelGrid * 0.25)"; rows = 1; columns = 4; strings[] = {"$STR_3DEN_Attributes_Lock_Default_text", CSTRING(AssignEngineerRole_role_none), CSTRING(AssignEngineerRole_role_engineer), CSTRING(AssignEngineerRole_role_specialist)}; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index da5f42e9a8..c2f2bfacc7 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -22,7 +22,7 @@ class CfgVehicles { class ACE_moduleRepairSettings: ACE_Module { scope = 2; displayName = CSTRING(moduleName); - icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_Repair_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleRepairSettings); functionPriority = 1; @@ -120,7 +120,7 @@ class CfgVehicles { class ACE_moduleAssignEngineerRoles: Module_F { scope = 2; displayName = CSTRING(AssignEngineerRole_Module_DisplayName); - icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_Repair_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleAssignEngineer); functionPriority = 10; @@ -164,7 +164,7 @@ class CfgVehicles { class ACE_moduleAssignRepairVehicle: Module_F { scope = 2; displayName = CSTRING(AssignRepairVehicle_Module_DisplayName); - icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_Repair_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleAssignRepairVehicle); functionPriority = 10; @@ -236,7 +236,7 @@ class CfgVehicles { class ACE_moduleAddSpareParts: Module_F { scope = 2; displayName = CSTRING(AddSpareParts_Module_DisplayName); - icon = QUOTE(PATHTOF(ui\Icon_Module_Repair_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_Repair_ca.paa); category = "ACE_Logistics"; function = QFUNC(moduleAddSpareParts); functionPriority = 10; @@ -326,7 +326,7 @@ class CfgVehicles { EGVAR(cargo,canLoad) = 1; author = "Hawkins"; scope = 2; - model = QUOTE(PATHTOF(data\ace_track.p3d)); + model = QPATHTOF(data\ace_track.p3d); displayName = CSTRING(SpareTrack); }; @@ -335,9 +335,9 @@ class CfgVehicles { EGVAR(cargo,canLoad) = 1; author = "Hawkins"; scope = 2; - model = QUOTE(PATHTOF(data\ace_wheel.p3d)); + model = QPATHTOF(data\ace_wheel.p3d); displayName = CSTRING(SpareWheel); - picture = QUOTE(PATHTOF(ui\tire_ca.paa)); + picture = QPATHTOF(ui\tire_ca.paa); }; // disable vanilla repair diff --git a/addons/repair/XEH_postInit.sqf b/addons/repair/XEH_postInit.sqf index 44ca157b0c..2f0bbe7869 100644 --- a/addons/repair/XEH_postInit.sqf +++ b/addons/repair/XEH_postInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" -["setVehicleDamage", {_this call FUNC(setDamage)}] call EFUNC(common,addEventHandler); -["setVehicleHitPointDamage", {_this call FUNC(setHitPointDamage)}] call EFUNC(common,addEventHandler); +[QGVAR(setVehicleDamage), {_this call FUNC(setDamage)}] call CBA_fnc_addEventHandler; +[QGVAR(setVehicleHitPointDamage), {_this call FUNC(setHitPointDamage)}] call CBA_fnc_addEventHandler; // wheels -["setWheelHitPointDamage", {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call EFUNC(common,addEventHandler); +[QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler; diff --git a/addons/repair/config.cpp b/addons/repair/config.cpp index d377342adf..dab412eb93 100644 --- a/addons/repair/config.cpp +++ b/addons/repair/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Wheel", "ACE_Track"}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"commy2", "Glowbal", "Jonpas"}; - authorUrl = "https://ace3mod.com"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2", "Glowbal", "Jonpas"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -18,3 +20,10 @@ class CfgPatches { #include "CfgActions.hpp" #include "CfgVehicles.hpp" #include "CfgEden.hpp" + +class ACE_newEvents { + setWheelHitPointDamage = QGVAR(setWheelHitPointDamage); + setVehicleHitPointDamage = QGVAR(setVehicleHitPointDamage); + setVehicleDamage = QGVAR(setVehicleDamage); + AddCargoByClass = "ace_addCargoByClass"; +}; diff --git a/addons/repair/functions/fnc_addSpareParts.sqf b/addons/repair/functions/fnc_addSpareParts.sqf index 3d7247fcaa..2d133da3c1 100644 --- a/addons/repair/functions/fnc_addSpareParts.sqf +++ b/addons/repair/functions/fnc_addSpareParts.sqf @@ -33,4 +33,4 @@ if (!EGVAR(common,settingsInitFinished)) exitWith { if (!_force && !GVAR(addSpareParts)) exitWith {}; // Load -["AddCargoByClass", [_part, _vehicle, _amount]] call EFUNC(common,localEvent); +["ace_addCargoByClass", [_part, _vehicle, _amount]] call CBA_fnc_localEvent; diff --git a/addons/repair/functions/fnc_doRemoveTrack.sqf b/addons/repair/functions/fnc_doRemoveTrack.sqf index d36407b197..ca6ac58ffd 100644 --- a/addons/repair/functions/fnc_doRemoveTrack.sqf +++ b/addons/repair/functions/fnc_doRemoveTrack.sqf @@ -27,14 +27,14 @@ private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; if (_hitPointDamage >= 1) exitWith {}; // don't die by spawning / moving the wheel -["fixCollision", _unit] call EFUNC(common,localEvent); +[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent; // spawn track private _newTrack = ["ACE_Track", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); TRACE_2("new track created",_newTrack,damage _newTrack); // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); +[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, 1], _vehicle] call CBA_fnc_targetEvent; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_doRemoveWheel.sqf b/addons/repair/functions/fnc_doRemoveWheel.sqf index 21a152c597..dafe603a18 100644 --- a/addons/repair/functions/fnc_doRemoveWheel.sqf +++ b/addons/repair/functions/fnc_doRemoveWheel.sqf @@ -27,14 +27,14 @@ private _hitPointDamage = _vehicle getHitPointDamage _hitPoint; if (_hitPointDamage >= 1) exitWith {}; // don't die by spawning / moving the wheel -["fixCollision", _unit] call EFUNC(common,localEvent); +[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent; // spawn wheel private _newWheel = ["ACE_Wheel", getPosASL _unit, _hitPointDamage] call FUNC(spawnObject); TRACE_2("new wheel created",_newWheel,damage _newWheel); // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, 1]] call EFUNC(common,targetEvent); +[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, 1], _vehicle] call CBA_fnc_targetEvent; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index 4c063c6c73..ede096a1fb 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -34,7 +34,7 @@ private _hitPointNewDamage = (_hitPointCurDamage - 0.5) max _postRepairDamageMin if (_hitPointNewDamage < _hitPointCurDamage) then { // raise event to set the new hitpoint damage TRACE_3("repairing main point", _vehicle, _hitPointIndex, _hitPointNewDamage); - ["setVehicleHitPointDamage", _vehicle, [_vehicle, _hitPointIndex, _hitPointNewDamage]] call EFUNC(common,targetEvent); + [QGVAR(setVehicleHitPointDamage), [_vehicle, _hitPointIndex, _hitPointNewDamage], _vehicle] call CBA_fnc_targetEvent; _hitPointCurDamage = _hitPointNewDamage; }; @@ -55,7 +55,7 @@ if (isArray _hitpointGroupConfig) then { private _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin; if (_subPointNewDamage < _subPointCurDamage) then { TRACE_3("repairing sub point", _vehicle, _subHitIndex, _subPointNewDamage); - ["setVehicleHitPointDamage", _vehicle, [_vehicle, _subHitIndex, _subPointNewDamage]] call EFUNC(common,targetEvent); + [QGVAR(setVehicleHitPointDamage), [_vehicle, _subHitIndex, _subPointNewDamage], _vehicle] call CBA_fnc_targetEvent; }; }; } forEach _subHitArray; diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf index 46c94c29f9..34f29506a3 100644 --- a/addons/repair/functions/fnc_doRepairTrack.sqf +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -41,7 +41,7 @@ _hitPointDamage = (_hitPointDamage - _damageRepaired) min 0; deleteVehicle _track; // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _hitPointDamage]] call EFUNC(common,targetEvent); +[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, _hitPointDamage], _vehicle] call CBA_fnc_targetEvent; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf index 9eafe68c9e..b0b71e5b61 100644 --- a/addons/repair/functions/fnc_doReplaceTrack.sqf +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -44,7 +44,7 @@ if (_newHitPointDamage >= 1) exitWith {}; deleteVehicle _track; // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _newHitPointDamage]] call EFUNC(common,targetEvent); +[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, _newHitPointDamage], _vehicle] call CBA_fnc_targetEvent; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index ce5e9220dd..24b995a45f 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -44,7 +44,7 @@ if (_newHitPointDamage >= 1) exitWith {}; deleteVehicle _wheel; // raise event to set the new hitpoint damage -["setWheelHitPointDamage", _vehicle, [_vehicle, _hitPoint, _newHitPointDamage]] call EFUNC(common,targetEvent); +[QGVAR(setWheelHitPointDamage), [_vehicle, _hitPoint, _newHitPointDamage], _vehicle] call CBA_fnc_targetEvent; // display text message if enabled if (GVAR(DisplayTextOnRepair)) then { diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index f5b7d8cbfc..5577057241 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -38,10 +38,10 @@ _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then { if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; if ((isEngineOn _target) && {GVAR(autoShutOffEngineWhenStartingRepair)}) then { - ["engineOn", _target, [_target, false]] call EFUNC(common,objectEvent); + [QEGVAR(common,engineOn), [_target, false], _target] call CBA_fnc_targetEvent; }; if ((isEngineOn _target) && {!GVAR(autoShutOffEngineWhenStartingRepair)}) exitWith { - ["displayTextStructured", [LSTRING(shutOffEngineWarning), 1.5, _caller]] call EFUNC(common,localEvent); + [LSTRING(shutOffEngineWarning), 1.5, _caller] call EFUNC(common,displayTextStructured); false }; @@ -235,7 +235,7 @@ if (_target != _caller) then { }; if (_displayText != "") then { - ["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); + [QEGVAR(common,displayTextStructured), [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller], [_caller]] call CBA_fnc_targetEvent; }; true; diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index ba04cdb7eb..0f809b345c 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 * Set the hitpoint damage and change the structural damage acordingly, requires local vehicle. - * Handles the "setVehicleHitPointDamage" event + * Handles the "ace_repair_setVehicleHitPointDamage" event * * Arguments: * 0: Local Vehicle to Damage diff --git a/addons/repair/functions/fnc_spawnObject.sqf b/addons/repair/functions/fnc_spawnObject.sqf index 86d0b563ac..e927a19651 100644 --- a/addons/repair/functions/fnc_spawnObject.sqf +++ b/addons/repair/functions/fnc_spawnObject.sqf @@ -28,7 +28,7 @@ _newObject setPosASL _position; _newObject setDamage _damage; -["fixCollision", _newObject] call EFUNC(common,localEvent); -["fixPosition", _newObject] call EFUNC(common,localEvent); +[QEGVAR(common,fixCollision), _newObject] call CBA_fnc_localEvent; +[QEGVAR(common,fixPosition), _newObject] call CBA_fnc_localEvent; _newObject diff --git a/addons/repair/functions/fnc_useItem.sqf b/addons/repair/functions/fnc_useItem.sqf index 024ee76c29..02daeed33e 100644 --- a/addons/repair/functions/fnc_useItem.sqf +++ b/addons/repair/functions/fnc_useItem.sqf @@ -20,7 +20,7 @@ params ["_unit", "_item"]; TRACE_2("params",_unit,_item); if ([_unit, _item] call EFUNC(common,hasItem)) exitWith { - [[_unit, _item], QUOTE(EFUNC(common,useItem)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["ace_useItem", [_unit, _item], _unit] call CBA_fnc_targetEvent; [true, _unit]; }; diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index adae522925..c2bad9328d 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT repair +#define COMPONENT_BEAUTIFIED Repair #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 0bce5cd685..7f82d9c881 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -765,6 +765,7 @@ Reaktivpanzerung ERA ERA + ERA Repair Settings @@ -1321,6 +1322,8 @@ Motor muss ausgeschaltet zu reparieren sein El motor necesita desactivado para la reparación Pro opravu je zapotřebí vypnout motor + O motor deve estar desligado para manutenção + Le moteur doit être éteins pour réparer \ No newline at end of file diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index 4650e8ffbe..103fab0537 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { function = QFUNC(module); scope = 2; isGlobal = 0; - icon = QUOTE(PATHTOF(UI\Icon_Module_Respawn_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Respawn_ca.paa); class Arguments { class SavePreDeathGear { @@ -40,7 +40,7 @@ class CfgVehicles { function = QFUNC(moduleFriendlyFire); scope = 2; isGlobal = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_FriendlyFire_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_FriendlyFire_ca.paa); class Arguments {}; class ModuleDescription { @@ -55,7 +55,7 @@ class CfgVehicles { function = QFUNC(moduleRallypoint); scope = 2; isGlobal = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_Rallypoint_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Rallypoint_ca.paa); class Arguments {}; class ModuleDescription { diff --git a/addons/respawn/XEH_postInit.sqf b/addons/respawn/XEH_postInit.sqf index 22be7b86ac..6c1b1e9961 100644 --- a/addons/respawn/XEH_postInit.sqf +++ b/addons/respawn/XEH_postInit.sqf @@ -1,5 +1,7 @@ // by commy2 #include "script_component.hpp" -["rallypointMoved", {_this call FUNC(updateRallypoint)}] call EFUNC(common,addEventhandler); -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); // hide enemy rallypoint markers +["ace_rallypointMoved", FUNC(updateRallypoint)] call CBA_fnc_addEventHandler; +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; // hide enemy rallypoint markers + +[QGVAR(showFriendlyFireMessageEvent), FUNC(showFriendlyFireMessage)] call CBA_fnc_addEventHandler; diff --git a/addons/respawn/XEH_serverPostInit.sqf b/addons/respawn/XEH_serverPostInit.sqf index d472bb0d5c..727b04d68d 100644 --- a/addons/respawn/XEH_serverPostInit.sqf +++ b/addons/respawn/XEH_serverPostInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -["SettingsInitialized", { +["ace_settingsInitialized", { if (GVAR(RemoveDeadBodiesDisconnected)) then { addMissionEventHandler ["HandleDisconnect", { [{ @@ -10,8 +10,8 @@ deleteVehicle _unit; }; }, - _this, 4] call EFUNC(common,waitAndExecute); + _this, 4] call CBA_fnc_waitAndExecute; false }]; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp index 4a23d1f650..cd87087e20 100644 --- a/addons/respawn/config.cpp +++ b/addons/respawn/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {"ACE_Rallypoint_West", "ACE_Rallypoint_East", "ACE_Rallypoint_Independent", "ACE_Rallypoint_West_Base", "ACE_Rallypoint_East_Base", "ACE_Rallypoint_Independent_Base"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = { "ace_common" }; - author[] = { "bux578", "commy2" }; - authorUrl = "https://github.com/bux578/"; + author = ECSTRING(common,ACETeam); + authors[] = { "bux578", "commy2" }; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -17,3 +19,8 @@ class CfgPatches { #include "CfgVehicleClasses.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" + +class ACE_newEvents { + rallypointMoved = "ace_rallypointMoved"; + killedByFriendly = "ace_killedByFriendly"; +}; diff --git a/addons/respawn/functions/fnc_handleKilled.sqf b/addons/respawn/functions/fnc_handleKilled.sqf index 2b9509f39d..6ca816e8a4 100644 --- a/addons/respawn/functions/fnc_handleKilled.sqf +++ b/addons/respawn/functions/fnc_handleKilled.sqf @@ -25,5 +25,5 @@ if (ACE_player == _unit && {GVAR(SavePreDeathGear)}) then { }; if (missionNamespace getVariable [QGVAR(showFriendlyFireMessage), false]) then { - [_this, QUOTE(DFUNC(showFriendlyFireMessage)), 2] call EFUNC(common,execRemoteFnc); + [QGVAR(showFriendlyFireMessageEvent), _this] call CBA_fnc_globalEvent; }; diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index dba1ae5d0a..b012344379 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -19,49 +19,46 @@ params ["_rallypoint", "_respawnMarker", "_side"]; -private "_name"; -_name = typeOf _rallypoint; +private _name = typeOf _rallypoint; + +if (isNil _name) then { + missionNamespace setVariable [_name, _rallypoint]; + + _rallypoint setVariable [QGVAR(side), _side]; + + if (isServer) then { + if (_respawnMarker != "" && {!(_respawnMarker in allMapMarkers)}) then { + createMarker [_respawnMarker, _rallypoint]; + }; + + ["ace_rallypointMoved", [_rallypoint, _side]] call CBA_fnc_globalEvent; + }; +} else { + deleteVehicle _rallypoint; + ACE_LOGERROR("Multiple Rallypoints of same type."); +}; // init visible marker if (hasInterface) then { [{ params ["_rallypoint", "_respawnMarker", "_side", "_name"]; - private ["_marker", "_type", "_date"]; - - _marker = format ["ACE_Marker_%1", _name]; + private _marker = format ["ACE_Marker_%1", _name]; // exit if marker already exist if (_marker in allMapMarkers) exitWith {}; _marker = createMarkerLocal [_marker, getPosASL _rallypoint]; - _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); + + private _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); _marker setMarkerTypeLocal _type; _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init - _date = _rallypoint getVariable [QGVAR(markerDate), ""]; + private _date = _rallypoint getVariable [QGVAR(markerDate), ""]; _marker setMarkerTextLocal _date; _rallypoint setVariable [QGVAR(marker), _marker]; - }, [_rallypoint, _respawnMarker, _side, _name], 0.1] call EFUNC(common,waitAndExecute); -}; - -if (!isServer) exitWith {}; - -if (isNil _name) then { - missionNamespace setVariable [_name, _rallypoint]; - publicVariable _name; - - _rallypoint setVariable [QGVAR(side), _side, true]; - - if (_respawnMarker != "" && {!(_respawnMarker in allMapMarkers)}) then { - createMarker [_respawnMarker, _rallypoint]; - }; - - ["rallypointMoved", [_rallypoint, _side]] call EFUNC(common,globalEvent); -} else { - deleteVehicle _rallypoint; - ACE_LOGERROR("Multiple Rallypoints of same type."); + }, [_rallypoint, _respawnMarker, _side, _name], 0.1] call CBA_fnc_waitAndExecute; }; diff --git a/addons/respawn/functions/fnc_moduleFriendlyFire.sqf b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf index f5b982f0ea..3c3c02b3c9 100644 --- a/addons/respawn/functions/fnc_moduleFriendlyFire.sqf +++ b/addons/respawn/functions/fnc_moduleFriendlyFire.sqf @@ -27,7 +27,7 @@ if (isServer) then { missionNamespace setVariable [QGVAR(showFriendlyFireMessage), true]; publicVariable QGVAR(showFriendlyFireMessage); }, - [], 0.1] call EFUNC(common,waitAndExecute); + [], 0.1] call CBA_fnc_waitAndExecute; }; ACE_LOGINFO("Friendly Fire Messages Module Initialized."); diff --git a/addons/respawn/functions/fnc_moveRallypoint.sqf b/addons/respawn/functions/fnc_moveRallypoint.sqf index fa8aae40a5..353d90e56a 100644 --- a/addons/respawn/functions/fnc_moveRallypoint.sqf +++ b/addons/respawn/functions/fnc_moveRallypoint.sqf @@ -48,7 +48,7 @@ _position set [2, 0]; _rallypoint setVariable [QGVAR(markerDate), [dayTime, "HH:MM"] call BIS_fnc_timeToString, true]; - ["rallypointMoved", [_rallypoint, _side, _position]] call EFUNC(common,globalEvent); + ["ace_rallypointMoved", [_rallypoint, _side, _position]] call CBA_fnc_globalEvent; [localize LSTRING(Deployed)] call EFUNC(common,displayTextStructured); -}, [_rallypoint, _unit, _position], 5] call EFUNC(common,waitAndExecute); +}, [_rallypoint, _unit, _position], 5] call CBA_fnc_waitAndExecute; diff --git a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf index 1079ef6e6d..388302150d 100644 --- a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf +++ b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf @@ -22,5 +22,5 @@ if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} systemChat format ["%1 was killed by %2", [_unit, false, true] call EFUNC(common,getName), [_killer, false, true] call EFUNC(common,getName)]; // Raise ACE globalEvent - ["killedByFriendly", [_unit, _killer]] call EFUNC(common,globalEvent); + ["ace_killedByFriendly", [_unit, _killer]] call CBA_fnc_globalEvent; }; diff --git a/addons/respawn/functions/fnc_teleportToRallypoint.sqf b/addons/respawn/functions/fnc_teleportToRallypoint.sqf index 88bd0d6d52..8e766ce0e3 100644 --- a/addons/respawn/functions/fnc_teleportToRallypoint.sqf +++ b/addons/respawn/functions/fnc_teleportToRallypoint.sqf @@ -22,7 +22,7 @@ params ["_unit", "_side", "_rallypoint"]; private "_toBase"; _toBase = _rallypoint find "_Base" != -1; -_rallypoint = missionNamespace getVariable [_rallypoint, objNull], +_rallypoint = missionNamespace getVariable [_rallypoint, objNull]; if (isNull _rallypoint) exitWith {}; diff --git a/addons/respawn/script_component.hpp b/addons/respawn/script_component.hpp index ee681d1d98..2fcd01ee37 100644 --- a/addons/respawn/script_component.hpp +++ b/addons/respawn/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT respawn +#define COMPONENT_BEAUTIFIED Respawn #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/safemode/XEH_postInit.sqf b/addons/safemode/XEH_postInit.sqf index d9be666426..42f9dc3dd5 100644 --- a/addons/safemode/XEH_postInit.sqf +++ b/addons/safemode/XEH_postInit.sqf @@ -11,9 +11,9 @@ if (!hasInterface) exitWith {}; ["ACE3 Weapons", QGVAR(safeMode), localize LSTRING(SafeMode), { // Conditions: canInteract - if !([ACE_player, objNull, ["isNotEscorting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call CBA_fnc_canUseWeapon && {currentWeapon ACE_player != binocular ACE_player}) exitWith {false}; + if !([ACE_player] call CBA_fnc_canUseWeapon && {currentWeapon ACE_player != binocular ACE_player} && {currentWeapon ACE_player != ""}) exitWith {false}; // Statement [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player] call FUNC(lockSafety); diff --git a/addons/safemode/config.cpp b/addons/safemode/config.cpp index 8371e7f35f..bb1016792e 100644 --- a/addons/safemode/config.cpp +++ b/addons/safemode/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/safemode/script_component.hpp b/addons/safemode/script_component.hpp index 8afc534fa2..d9972b6226 100644 --- a/addons/safemode/script_component.hpp +++ b/addons/safemode/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT safemode +#define COMPONENT_BEAUTIFIED Safe Mode #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index 64d62ad424..df18b42c06 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -9,11 +9,11 @@ class CfgVehicles { displayName = CSTRING(DeploySandbag); condition = QUOTE(_this call FUNC(canDeploy)); //wait a frame to handle "Do When releasing action menu key" option - statement = QUOTE([ARR_2({_this call FUNC(deploy)},_this)] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(deploy)},_this)] call CBA_fnc_execNextFrame); exceptions[] = {"isNotSwimming"}; showDisabled = 0; priority = 4; - icon = PATHTOF(UI\icon_sandbag_ca.paa); + icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; }; }; @@ -53,14 +53,14 @@ class CfgVehicles { author = ECSTRING(common,ACETeam); scope = 2; side = 3; - model = PATHTOF(data\ace_sandbag_build.p3d); + model = QPATHTOF(data\ace_sandbag_build.p3d); displayName = CSTRING(sandbag_displayName); vehicleClass = "ACE_Logistics_Items"; typicalCargo[] = {}; armor = 12000; // Withstand 200 5.56 bullets before sandbag hull is cheese mapSize = 0.4; nameSound = "Bunker"; - icon = PATHTOF(UI\icon_sandbag_ca.paa); + icon = QPATHTOF(UI\icon_sandbag_ca.paa); accuracy = 1000; destrType = "DestructDefault"; @@ -90,7 +90,7 @@ class CfgVehicles { showDisabled = 0; exceptions[] = {}; priority = 5; - icon = PATHTOF(UI\icon_sandbag_ca.paa); + icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; }; }; @@ -98,7 +98,7 @@ class CfgVehicles { class ACE_SandbagObject_NoGeo: ACE_SandbagObject { scope = 1; - model = PATHTOF(data\ace_sandbag_nogeo.p3d); + model = QPATHTOF(data\ace_sandbag_nogeo.p3d); }; class Box_NATO_Support_F; diff --git a/addons/sandbag/CfgWeapons.hpp b/addons/sandbag/CfgWeapons.hpp index 5f8ef61315..6a5fe29b79 100644 --- a/addons/sandbag/CfgWeapons.hpp +++ b/addons/sandbag/CfgWeapons.hpp @@ -7,8 +7,8 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); scope = 2; displayName = CSTRING(sandbagEmpty_displayName); - model = PATHTOF(data\ace_sandbag_m.p3d); - picture = PATHTOF(data\m_sandbag_ca.paa); + model = QPATHTOF(data\ace_sandbag_m.p3d); + picture = QPATHTOF(data\m_sandbag_ca.paa); class ItemInfo: InventoryItem_Base_F { mass = 8; @@ -19,8 +19,8 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); scope = 2; displayName = CSTRING(sandbag_displayName); - model = PATHTOF(data\ace_sandbag_build.p3d); - picture = PATHTOF(data\m_sandbag_ca.paa); + model = QPATHTOF(data\ace_sandbag_build.p3d); + picture = QPATHTOF(data\m_sandbag_ca.paa); class ItemInfo: InventoryItem_Base_F { mass = 160; diff --git a/addons/sandbag/XEH_postInit.sqf b/addons/sandbag/XEH_postInit.sqf index d6e4c0aadc..a03f6076a1 100644 --- a/addons/sandbag/XEH_postInit.sqf +++ b/addons/sandbag/XEH_postInit.sqf @@ -12,14 +12,14 @@ GVAR(deployPFH) = -1; GVAR(deployDirection) = 0; // Cancel deploy sandbag if interact menu opened -["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call CBA_fnc_addEventHandler; // Cancel deploy on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerInventoryChanged", {_this call FUNC(handlePlayerInventoryChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["unit", {_this call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler; +["loadout", {_this call FUNC(handlePlayerInventoryChanged)}] call CBA_fnc_addPlayerEventHandler; +["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler; // handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; //@todo Captivity? diff --git a/addons/sandbag/config.cpp b/addons/sandbag/config.cpp index 6b7ce1a456..9c28b948ac 100644 --- a/addons/sandbag/config.cpp +++ b/addons/sandbag/config.cpp @@ -2,15 +2,22 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_Sandbag", "ACE_Item_Sandbag_empty"}; weapons[] = {"ACE_Sandbag", "ACE_Sandbag_empty"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Rocko", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rocko", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgWeapons.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index 735a736bbb..0cbe0c5012 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -27,7 +27,7 @@ _sandBag = createVehicle ["ACE_SandbagObject_NoGeo", [0, 0, 0], [], 0, "NONE"]; GVAR(sandBag) = _sandBag; // prevent collisions with sandbag -["enableSimulationGlobal", [_sandBag, false]] call EFUNC(common,serverEvent); +[QEGVAR(common,enableSimulationGlobal), [_sandBag, false]] call CBA_fnc_serverEvent; GVAR(deployDirection) = 0; diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index c560bc15ba..c37e0ed0d9 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -41,7 +41,7 @@ _unit removeItem "ACE_Sandbag_empty"; _sandBag setDir _direction; GVAR(sandBag) = objNull; -}, [_unit], 1] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call CBA_fnc_waitAndExecute; // remove deployment pfh [GVAR(deployPFH)] call CBA_fnc_removePerFrameHandler; diff --git a/addons/sandbag/functions/fnc_pickup.sqf b/addons/sandbag/functions/fnc_pickup.sqf index 7e04d047fd..fd4560fdec 100644 --- a/addons/sandbag/functions/fnc_pickup.sqf +++ b/addons/sandbag/functions/fnc_pickup.sqf @@ -37,4 +37,4 @@ _unit setVariable [QGVAR(isUsingSandbag), true]; } count (_unit nearObjects ["ACE_SandbagObject", 5]); [_unit, "ACE_Sandbag_empty"] call EFUNC(common,addToInventory); -}, [_unit, _sandbag], 1.5] call EFUNC(common,waitAndExecute); +}, [_unit, _sandbag], 1.5] call CBA_fnc_waitAndExecute; diff --git a/addons/sandbag/script_component.hpp b/addons/sandbag/script_component.hpp index 422e1b203e..a7ce4ddb59 100644 --- a/addons/sandbag/script_component.hpp +++ b/addons/sandbag/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT sandbag +#define COMPONENT_BEAUTIFIED Sand Bag #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/scopes/CfgSounds.hpp b/addons/scopes/CfgSounds.hpp index 9063c7f730..2da106d79b 100644 --- a/addons/scopes/CfgSounds.hpp +++ b/addons/scopes/CfgSounds.hpp @@ -1,12 +1,12 @@ class CfgSounds { class ACE_Sound_Click; class ACE_Scopes_Click_1: ACE_Sound_Click { - sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)),3, 2, 200}; + sound[] = {QPATHTOF(sounds\ACE_scopes_click.wav),3, 2, 200}; }; class ACE_Scopes_Click_2: ACE_Scopes_Click_1 { - sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)), 3.3, 1.8, 200}; + sound[] = {QPATHTOF(sounds\ACE_scopes_click.wav), 3.3, 1.8, 200}; }; class ACE_Scopes_Click_3: ACE_Scopes_Click_1 { - sound[] = {QUOTE(PATHTOF(sounds\ACE_scopes_click.wav)), 2.8, 2.3, 200}; + sound[] = {QPATHTOF(sounds\ACE_scopes_click.wav), 2.8, 2.3, 200}; }; }; diff --git a/addons/scopes/CfgVehicles.hpp b/addons/scopes/CfgVehicles.hpp index 81756249e1..8a17384933 100644 --- a/addons/scopes/CfgVehicles.hpp +++ b/addons/scopes/CfgVehicles.hpp @@ -10,7 +10,7 @@ class CfgVehicles { statement = QUOTE([ACE_player] call FUNC(adjustZero)); showDisabled = 0; priority = 0.2; - //icon = QUOTE(PATHTOF(UI\...)); // TODO + //icon = QPATHTOF(UI\...); // TODO exceptions[] = {"notOnMap", "isNotInside", "isNotSitting"}; }; }; diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 7aec20458c..1a4bcc99c3 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -17,7 +17,7 @@ class RscTitles { class ACE_Scopes_Zeroing_BG : RscPicture { idc = 11; type = 0; - text = PATHTOF(UI\scopes_bg.paa); + text = QPATHTOF(UI\scopes_bg.paa); style = 48 + 0x800; scale = 1; sizeEx = 1; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 1763bb7a32..bef16a0bc1 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -10,28 +10,25 @@ if (!hasInterface) exitWith {}; // Check inventory when it changes -["playerInventoryChanged", FUNC(inventoryCheck)] call EFUNC(common,addEventhandler); +["loadout", FUNC(inventoryCheck)] call CBA_fnc_addPlayerEventHandler; // Instantly hide knobs when scoping in -["cameraViewChanged", { - EXPLODE_2_PVT(_this,_player,_newCameraView); - if (_newCameraView == "GUNNER") then { - private "_layer"; - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - _layer cutText ["", "PLAIN", 0]; +["cameraView", { + params ["_player", "_newCameraView"]; + if (_newCameraView == "GUNNER") then { + private _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; + _layer cutText ["", "PLAIN", 0]; if !(isNil QGVAR(fadePFH)) then { [GVAR(fadePFH)] call CBA_fnc_removePerFrameHandler; GVAR(fadePFH) = nil; }; }; -}] call EFUNC(common,addEventhandler); - +}] call CBA_fnc_addPlayerEventHandler; // Add keybinds -["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustUpMinor), localize LSTRING(AdjustUpMinor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -41,12 +38,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, ELEVATION_UP, MINOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[201, [false, false, false]], true] call CBA_fnc_addKeybind; +}, {false}, [201, [false, false, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustDownMinor), localize LSTRING(AdjustDownMinor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -56,12 +50,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, ELEVATION_DOWN, MINOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[209, [false, false, false]], true] call CBA_fnc_addKeybind; +}, {false}, [209, [false, false, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustLeftMinor), localize LSTRING(AdjustLeftMinor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -71,12 +62,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, WINDAGE_LEFT, MINOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[209, [false, true, false]], true] call CBA_fnc_addKeybind; +}, {false}, [209, [false, true, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustRightMinor), localize LSTRING(AdjustRightMinor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -86,12 +74,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, WINDAGE_RIGHT, MINOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[201, [false, true, false]], true] call CBA_fnc_addKeybind; +}, {false}, [201, [false, true, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustUpMajor), localize LSTRING(AdjustUpMajor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -101,12 +86,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, ELEVATION_UP, MAJOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[201, [true, false, false]], true] call CBA_fnc_addKeybind; +}, {false}, [201, [true, false, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustDownMajor), localize LSTRING(AdjustDownMajor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -116,12 +98,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, ELEVATION_DOWN, MAJOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[209, [true, false, false]], true] call CBA_fnc_addKeybind; +}, {false}, [209, [true, false, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustLeftMajor), localize LSTRING(AdjustLeftMajor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -131,12 +110,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, WINDAGE_LEFT, MAJOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[209, [true, true, false]], true] call CBA_fnc_addKeybind; +}, {false}, [209, [true, true, false]], true] call CBA_fnc_addKeybind; -["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), -{ +["ACE3 Scope Adjustment", QGVAR(AdjustRightMajor), localize LSTRING(AdjustRightMajor), { // Conditions: canInteract if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific @@ -146,11 +122,9 @@ if (!hasInterface) exitWith {}; // Statement [ACE_player, WINDAGE_RIGHT, MAJOR_INCREMENT] call FUNC(adjustScope); -}, -{false}, -[201, [true, true, false]], true] call CBA_fnc_addKeybind; +}, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind; // Register fire event handler -["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); -["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(firedEH)] call CBA_fnc_addEventHandler; +["ace_firedPlayerNonLocal", DFUNC(firedEH)] call CBA_fnc_addEventHandler; diff --git a/addons/scopes/config.cpp b/addons/scopes/config.cpp index 42be283044..8388b2d04b 100644 --- a/addons/scopes/config.cpp +++ b/addons/scopes/config.cpp @@ -2,22 +2,20 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = { "ace_common" }; - author[] = {"KoffeinFlummi", "esteldunedain"}; - authorUrl = "https://github.com/KoffeinFlummi"; + author = ECSTRING(common,ACETeam); + authors[] = {"KoffeinFlummi", "esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - #include "CfgSounds.hpp" - #include "CfgVehicles.hpp" - #include "CfgWeapons.hpp" - #include "RscTitles.hpp" diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 5b0c6d11a6..9a38ef40cb 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -2,12 +2,12 @@ * Author: KoffeinFlummi, Ruthberg * Changes the adjustment for the current scope * - * Argument: + * Arguments: * 0: Unit * 1: Turret and Direction * 2: Major Step * - * Return value: + * Return Value: * Did we adjust anything? * * Example: diff --git a/addons/scopes/functions/fnc_adjustZero.sqf b/addons/scopes/functions/fnc_adjustZero.sqf index 363407e090..9e953d0523 100644 --- a/addons/scopes/functions/fnc_adjustZero.sqf +++ b/addons/scopes/functions/fnc_adjustZero.sqf @@ -2,10 +2,10 @@ * Author: KoffeinFlummi, Ruthberg * Updates the zero reference for the current scope * - * Argument: + * Arguments: * 0: Unit * - * Return value: + * Return Value: * true * * Example: diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index af2f018e11..7067b0442c 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -2,13 +2,13 @@ * Author: KoffeinFlummi, Ruthberg * Applies the adjustment for the current scope * - * Argument: + * Arguments: * 0: Unit * 1: Absolute elevation * 2: Absolute windage * 3: Absolute zero reference * - * Return value: + * Return Value: * True * * Example: diff --git a/addons/scopes/functions/fnc_canAdjustZero.sqf b/addons/scopes/functions/fnc_canAdjustZero.sqf index 36ea4ac793..477dc12635 100644 --- a/addons/scopes/functions/fnc_canAdjustZero.sqf +++ b/addons/scopes/functions/fnc_canAdjustZero.sqf @@ -2,10 +2,10 @@ * Author: KoffeinFlummi, Ruthberg * Changes the adjustment for the current scope * - * Argument: + * Arguments: * 0: Unit * - * Return value: + * Return Value: * Can we update the zero reference? * * Example: diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 07eadb5620..444b768eb5 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -2,10 +2,10 @@ * Author: KoffeinFlummi, esteldunedain * Adjusts the flight path of the bullet according to the zeroing. Called from the unified fired EH only for local and non-local players on foot. * - * Argument: + * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) * - * Return value: + * Return Value: * None * * Public: No diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index 43595bde87..eb47c692bf 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -45,13 +45,13 @@ _vertical ctrlSetText (str _elevation); _horizontal ctrlSetText (str _windage); // Set the time when to hide the knobs -GVAR(timeToHide) = ACE_diagTime + 3.0; +GVAR(timeToHide) = diag_tickTime + 3.0; if !(isNil QGVAR(fadePFH)) exitWith {}; // Launch a PFH to wait and fade out the knobs GVAR(fadePFH) = [{ - if (ACE_diagTime >= GVAR(timeToHide)) exitWith { + if (diag_tickTime >= GVAR(timeToHide)) exitWith { private "_layer"; params ["", "_pfhId"]; _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index 0266705af2..402f390f63 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT scopes +#define COMPONENT_BEAUTIFIED Scopes #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -22,4 +23,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_SCOPES #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/sitting/CfgVehicles.hpp b/addons/sitting/CfgVehicles.hpp index d92d92fc49..95deed0dd6 100644 --- a/addons/sitting/CfgVehicles.hpp +++ b/addons/sitting/CfgVehicles.hpp @@ -8,10 +8,10 @@ class CfgVehicles { category = "ACE"; displayName = CSTRING(ModuleDisplayName); function = QFUNC(moduleInit); - scope = 2; + scope = 1; isGlobal = 1; isSingular = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_Sitting_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Sitting_ca.paa); class Arguments { class enable { displayName = CSTRING(Enable); @@ -34,7 +34,7 @@ class CfgVehicles { exceptions[] = {"isNotSitting"}; statement = QUOTE(_player call FUNC(stand)); priority = 0; - icon = PATHTOF(UI\stand_ca.paa); + icon = QPATHTOF(UI\stand_ca.paa); }; }; }; diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index e15017d715..3b6b0ba6c8 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -3,9 +3,8 @@ // Exit on Headless if (!hasInterface) exitWith {}; -["SettingsInitialized", { - TRACE_1("SettingInit", GVAR(enable)); - +["ace_settingsInitialized", { + if ([[QUOTE(ADDON), QGVAR(enable)], ["acex_sitting", "acex_sitting_enable"], "3.8.0"] call EFUNC(common,deprecateComponent)) exitwith {}; //If not enabled, then do not add CanInteractWith Condition or event handlers: if (!GVAR(enable)) exitWith {}; @@ -13,6 +12,6 @@ if (!hasInterface) exitWith {}; ["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition); // Handle interruptions - ["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); - ["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); -}] call EFUNC(common,addEventHandler); + ["ace_unconscious", {_this call DFUNC(handleInterrupt)}] call CBA_fnc_addEventHandler; + [QEGVAR(captives,setHandcuffed), {_this call DFUNC(handleInterrupt)}] call CBA_fnc_addEventHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/sitting/config.cpp b/addons/sitting/config.cpp index 96d3edab7b..785cb75aeb 100644 --- a/addons/sitting/config.cpp +++ b/addons/sitting/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Jonpas"}; - authorUrl = "https://github.com/jonpas"; + author = ECSTRING(common,ACETeam); + authors[] = {"Jonpas"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -16,3 +18,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgMoves.hpp" #include "CfgVehicles.hpp" + +class ACE_newEvents { + SetHandcuffed = QEGVAR(captives,setHandcuffed); +}; diff --git a/addons/sitting/functions/fnc_addSitActions.sqf b/addons/sitting/functions/fnc_addSitActions.sqf index 98c9aba99f..4c449bac52 100644 --- a/addons/sitting/functions/fnc_addSitActions.sqf +++ b/addons/sitting/functions/fnc_addSitActions.sqf @@ -40,7 +40,7 @@ TRACE_1("Adding Sit Action",_type); private _sitAction = [ QGVAR(Sit), localize LSTRING(Sit), - QUOTE(PATHTOF(UI\sit_ca.paa)), + QPATHTOF(UI\sit_ca.paa), {_this call FUNC(sit)}, {_this call FUNC(canSit)}, {}, diff --git a/addons/sitting/functions/fnc_canSit.sqf b/addons/sitting/functions/fnc_canSit.sqf index 1dd0c9676f..0ea8f06bc8 100644 --- a/addons/sitting/functions/fnc_canSit.sqf +++ b/addons/sitting/functions/fnc_canSit.sqf @@ -19,5 +19,5 @@ params ["_seat"]; // Sitting enabled, is seat object, not occupied and standing up (or not on a big slope) GVAR(enable) && -{isNil {_seat getVariable QGVAR(seatOccupied)}} && +{!(_seat call EFUNC(common,owned))} && {round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 7aa1c4c55b..c2ca725d5d 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -49,7 +49,7 @@ _player setPosASL (AGLtoASL (_seat modelToWorld _sitPosition)); // Set variables, save seat object on player _player setVariable [QGVAR(isSitting), [_seat, _actionID]]; -_seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat +[_player, _seat] call EFUNC(common,claim); // To prevent multiple people sitting on one seat // Add automatical stand PFH in case of interruptions diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index a51f4203fc..7c6a93c662 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -35,4 +35,4 @@ private _animation = switch (currentWeapon _player) do { // Set variables to nil _player setVariable [QGVAR(isSitting), nil]; if (isNull _seat) exitWith {}; -_seat setVariable [QGVAR(seatOccupied), nil, true]; +[objNull, _seat] call EFUNC(common,claim); diff --git a/addons/sitting/script_component.hpp b/addons/sitting/script_component.hpp index 40afbe8450..7324da1875 100644 --- a/addons/sitting/script_component.hpp +++ b/addons/sitting/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT sitting +#define COMPONENT_BEAUTIFIED Sitting #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_SITTING #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/slideshow/CfgVehicles.hpp b/addons/slideshow/CfgVehicles.hpp index 7e82d48ffc..af3108eb59 100644 --- a/addons/slideshow/CfgVehicles.hpp +++ b/addons/slideshow/CfgVehicles.hpp @@ -9,7 +9,7 @@ class CfgVehicles { isGlobal = 1; isTriggerActivated = 0; isDisposable = 0; - icon = QUOTE(PATHTOF(UI\Icon_Module_Slideshow_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Slideshow_ca.paa); class Arguments { class Objects { displayName = CSTRING(Objects_DisplayName); diff --git a/addons/slideshow/config.cpp b/addons/slideshow/config.cpp index 3af3bd5354..6149ad71d7 100644 --- a/addons/slideshow/config.cpp +++ b/addons/slideshow/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[]= {"Jonpas", "DaC"}; - authorUrl = "https://github.com/jonpas"; + author = ECSTRING(common,ACETeam); + authors[] = {"Jonpas", "DaC"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/slideshow/functions/fnc_autoTransition.sqf b/addons/slideshow/functions/fnc_autoTransition.sqf index 4c31c4ff6a..d54d629b66 100644 --- a/addons/slideshow/functions/fnc_autoTransition.sqf +++ b/addons/slideshow/functions/fnc_autoTransition.sqf @@ -37,4 +37,4 @@ missionNamespace setVariable [_varString, _currentSlide]; // Log current slide and execute Next slide TRACE_4("Auto-transition",_images select _currentSlide,_currentSlide,count _images,_duration); -[FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call EFUNC(common,waitAndExecute); +[FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call CBA_fnc_waitAndExecute; diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 792905db0f..42d1498b88 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -80,5 +80,5 @@ if (_duration == 0) then { missionNamespace setVariable [_varString, 0]; // Automatic transitions handler - [FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call EFUNC(common,waitAndExecute); + [FUNC(autoTransition), [_objects, _images, _varString, _duration], _duration] call CBA_fnc_waitAndExecute; }; diff --git a/addons/slideshow/script_component.hpp b/addons/slideshow/script_component.hpp index cf4272325d..eb8b8746ee 100644 --- a/addons/slideshow/script_component.hpp +++ b/addons/slideshow/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT slideshow +#define COMPONENT_BEAUTIFIED Slideshow #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/smallarms/config.cpp b/addons/smallarms/config.cpp index e5731df7b3..23fd1e49a7 100644 --- a/addons/smallarms/config.cpp +++ b/addons/smallarms/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"TaoSensai", "KoffeinFlummi"}; - authorUrl = "https://github.com/Taosenai/tmr"; + author = ECSTRING(common,ACETeam); + authors[] = {"TaoSensai", "KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/smallarms/script_component.hpp b/addons/smallarms/script_component.hpp index 63d516cee5..ebb2d1539d 100644 --- a/addons/smallarms/script_component.hpp +++ b/addons/smallarms/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT smallarms +#define COMPONENT_BEAUTIFIED Small Arms #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/spectator/CfgVehicles.hpp b/addons/spectator/CfgVehicles.hpp index f6869462ac..268aabbef5 100644 --- a/addons/spectator/CfgVehicles.hpp +++ b/addons/spectator/CfgVehicles.hpp @@ -3,7 +3,7 @@ class CfgVehicles { class GVAR(moduleSettings): ACE_Module { scope = 2; displayName = CSTRING(Settings_DisplayName); - icon = PATHTOF(UI\Icon_Module_Spectator_ca.paa); + icon = QPATHTOF(UI\Icon_Module_Spectator_ca.paa); category = "ACE"; function = QFUNC(moduleSpectatorSettings); isGlobal = 1; diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index 43c812d1a2..72c53a2af0 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -4,10 +4,10 @@ // Add interaction menu exception ["isNotSpectating", {!(GETVAR((_this select 0),GVAR(isStaged),false))}] call EFUNC(common,addCanInteractWithCondition); -["SettingsInitialized", { +["ace_settingsInitialized", { GVAR(availableModes) = [[0,1,2], [1,2], [0], [1], [2]] select GVAR(restrictModes); GVAR(availableVisions) = [[-2,-1,0,1], [-2,-1], [-2,0,1], [-2]] select GVAR(restrictVisions); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; // Create a radio channel for any spectators to text chat in if (isServer) then { @@ -18,7 +18,7 @@ if (isServer) then { // Should prevent unending spectator on mission end if (isServer) then { addMissionEventHandler ["Ended", { - [QGVAR(endMission), []] call EFUNC(common,globalEvent); + [QGVAR(endMission), []] call CBA_fnc_globalEvent; }]; }; @@ -26,4 +26,6 @@ if (isServer) then { if (GVAR(isSet)) then { [false] call FUNC(setSpectator); }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; + +[QGVAR(stageSpectator), FUNC(stageSpectator)] call CBA_fnc_addEventHandler; diff --git a/addons/spectator/config.cpp b/addons/spectator/config.cpp index 6db15f50e5..2476239a00 100644 --- a/addons/spectator/config.cpp +++ b/addons/spectator/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"F3 Project","Head","SilentSpike","voiper"}; - authorUrl = "https://github.com/acemod"; + author = ECSTRING(common,ACETeam); + authors[] = {"F3 Project","Head","SilentSpike","voiper"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -23,3 +25,8 @@ class CfgRespawnTemplates { onPlayerRespawn = QFUNC(respawnTemplate); }; }; + +class ACE_newEvents { + spectatorStaged = "ace_spectatorStaged"; + spectatorSet = "ace_spectatorSet"; +}; \ No newline at end of file diff --git a/addons/spectator/functions/fnc_handleInterface.sqf b/addons/spectator/functions/fnc_handleInterface.sqf index 381f64505c..3a69bb1383 100644 --- a/addons/spectator/functions/fnc_handleInterface.sqf +++ b/addons/spectator/functions/fnc_handleInterface.sqf @@ -111,7 +111,7 @@ switch (toLower _mode) do { _timer ctrlCommit 0; _frame ctrlCommit 0; }; - },[],0.5] call EFUNC(common,waitAndExecute); + },[],0.5] call CBA_fnc_waitAndExecute; }; case "onunload": { // Kill GUI PFHs @@ -490,7 +490,7 @@ switch (toLower _mode) do { [_this select 1] call CBA_fnc_removePerFrameHandler; },0] call CBA_fnc_addPerFrameHandler; - },[],5] call EFUNC(common,waitAndExecute); + },[],5] call CBA_fnc_waitAndExecute; true }; diff --git a/addons/spectator/functions/fnc_handleUnits.sqf b/addons/spectator/functions/fnc_handleUnits.sqf index c32961024c..f51c922b8e 100644 --- a/addons/spectator/functions/fnc_handleUnits.sqf +++ b/addons/spectator/functions/fnc_handleUnits.sqf @@ -36,5 +36,5 @@ if !(GVAR(camUnit) in GVAR(unitList)) then { // Reduce overhead when unit tree is hidden if (ctrlShown (_display displayCtrl IDC_UNIT)) then { // Reduce overhead by spreading across frames - [FUNC(handleInterface),["onUnitsUpdate",[(_display displayCtrl IDC_UNIT) controlsGroupCtrl IDC_UNIT_TREE]],1] call EFUNC(common,waitAndExecute); + [FUNC(handleInterface),["onUnitsUpdate",[(_display displayCtrl IDC_UNIT) controlsGroupCtrl IDC_UNIT_TREE]],1] call CBA_fnc_waitAndExecute; }; diff --git a/addons/spectator/functions/fnc_respawnTemplate.sqf b/addons/spectator/functions/fnc_respawnTemplate.sqf index 4584a1fc3c..dc83bf7458 100644 --- a/addons/spectator/functions/fnc_respawnTemplate.sqf +++ b/addons/spectator/functions/fnc_respawnTemplate.sqf @@ -21,11 +21,6 @@ params [["_unit",objNull,[objNull]], ["_killer",objNull,[objNull]], ["_respawn",0,[0]], ["_respawnDelay",0,[0]]]; private ["_vision","_pos"]; -// When all are dead with respawn type "None" the mission should end -if ((_respawn == 0) && {{alive _x} count allPlayers <= 0}) exitWith { - [["endDeath",false],"BIS_fnc_endMission"] call EFUNC(common,execRemoteFnc); -}; - // Some environment information can be used for the initial camera attributes if (isNull _killer) then {_killer = _unit}; _vision = [-2,-1] select (sunOrMoon < 1); diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 1f010962b5..45bb15df42 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -97,7 +97,7 @@ if (_set) then { }; }]; }; - }, !_force] call EFUNC(common,execNextFrame); + }, !_force] call CBA_fnc_execNextFrame; // Cache and disable nametag settings if (["ace_nametags"] call EFUNC(common,isModLoaded)) then { @@ -170,4 +170,4 @@ GVAR(interrupts) = []; // Mark spectator state for reference GVAR(isSet) = _set; -["spectatorSet",[_set]] call EFUNC(common,localEvent); +["ace_spectatorSet", [_set]] call CBA_fnc_localEvent; diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 926ac008dc..8e6c32f568 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -27,7 +27,7 @@ params [["_unit",player,[objNull]], ["_set",true,[true]]]; if !(_set || (GETVAR(_unit,GVAR(isStaged),false))) exitWith {}; if !(local _unit) exitWith { - [[_unit, _set], QFUNC(stageSpectator), _unit] call EFUNC(common,execRemoteFnc); + [QGVAR(stageSpectator), [_unit, _set], _unit] call CBA_fnc_targetEvent; }; // Prevent unit falling into water @@ -64,7 +64,7 @@ if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { // Mark spectator state for reference _unit setVariable [QGVAR(isStaged), _set, true]; - ["spectatorStaged",[_set]] call EFUNC(common,localEvent); + ["ace_spectatorStaged", [_set]] call CBA_fnc_localEvent; }; //BandAid for #2677 - if player in unitList weird before being staged, weird things can happen @@ -73,6 +73,6 @@ if ((player in GVAR(unitList)) || {ACE_player in GVAR(unitList)}) then { if (!(isNull (findDisplay 12249))) then {//If display is open now, close it and restart ACE_LOGWARNING("Player in unitList, call ace_spectator_fnc_stageSpectator before ace_spectator_fnc_setSpectator"); ["fixWeirdList", true] call FUNC(interrupt); - [{["fixWeirdList", false] call FUNC(interrupt);}, []] call EFUNC(common,execNextFrame); + [{["fixWeirdList", false] call FUNC(interrupt);}, []] call CBA_fnc_execNextFrame; }; }; diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index 575765a01d..7084a88a6d 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT spectator +#define COMPONENT_BEAUTIFIED Spectator #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index bdb88a2675..1a6fef2473 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -424,6 +424,7 @@ Cámara panorámica Otáčet kameru Camera Panoramica + Tourner la caméra Dolly Camera @@ -434,6 +435,7 @@ Cámara dolly Posouvat kameru Camera dolly + Bouger la caméra Lock Camera to Target diff --git a/addons/spottingscope/CfgEventHandlers.hpp b/addons/spottingscope/CfgEventHandlers.hpp index 13d369b097..b34b3ac099 100644 --- a/addons/spottingscope/CfgEventHandlers.hpp +++ b/addons/spottingscope/CfgEventHandlers.hpp @@ -7,13 +7,13 @@ class Extended_PreStart_EventHandlers { class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/spottingscope/CfgVehicles.hpp b/addons/spottingscope/CfgVehicles.hpp index 418eea5a15..f86b9d16c7 100644 --- a/addons/spottingscope/CfgVehicles.hpp +++ b/addons/spottingscope/CfgVehicles.hpp @@ -1,5 +1,5 @@ -class CBA_Extended_EventHandlers; +class CBA_Extended_EventHandlers_base; class CfgVehicles { class Man; @@ -12,12 +12,146 @@ class CfgVehicles { statement = QUOTE([ARR_2(_player,'ACE_SpottingScope')] call FUNC(place)); showDisabled = 0; priority = 2; - icon = PATHTOF(UI\w_spottingscope_ca.paa); + icon = QPATHTOF(UI\w_spottingscope_ca.paa); }; }; }; }; + class LandVehicle; + class StaticWeapon: LandVehicle { + class Turrets; + class ACE_Actions { + class ACE_MainActions; + }; + }; + + class StaticATWeapon: StaticWeapon { + class Turrets: Turrets { + class MainTurret; + }; + + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions {}; + }; + }; + + class ACE_SpottingScopeObject: StaticATWeapon { + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition)[] = {0,1,0}; + EGVAR(dragging,dragDirection) = 0; + + class ACE_Actions: ACE_Actions{ + class ACE_MainActions: ACE_MainActions { + selection = "main_gun"; + class ACE_Pickup { + selection = ""; + displayName = CSTRING(PickUp); + distance = 5; + condition = QUOTE((alive _target) && (count (crew _target) == 0)); + statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = QPATHTOF(UI\w_spottingscope_ca.paa); + }; + }; + }; + + class EventHandlers { + class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers_base {}; + }; + + author = ECSTRING(common,ACETeam); + scope = 1; + side = 1; + typicalCargo[] = {"Soldier"}; + displayName = CSTRING(DisplayName); + model = QPATHTOF(data\ace_spottingscope.p3d); + mapSize = 0.5; + transportSoldier = 0; + getInAction = "GetInLow"; + getOutAction = "GetOutLow"; + editorSubcategory = "EdSubcat_Turrets"; + + class Turrets: Turrets { + class MainTurret: MainTurret { + minTurn = -45; + maxTurn = 45; + initTurn = 0; + minElev = -10; + maxElev = 40; + initElev = 0; + + class ViewGunner { + initAngleX = 5; + minAngleX = -30; + maxAngleX = 30; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + initFov = 0.75; + minFov = 0.25; + maxFov = 1.25; + }; + + class ViewOptics { + initAngleX = 0; + minAngleX = -30; + maxAngleX = 30; + initAngleY = 0; + minAngleY = -100; + maxAngleY = 100; + minFov = 0.0025; + maxFov = 0.05; + initFov= 0.05; + }; + + weapons[] = {}; + magazines[] = {}; + gunnerOpticsColor[] = {1,1,1,1}; + gunnerOpticsModel = "\A3\Weapons_F\empty"; + gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"}; + gunnerOutOpticsShowCursor = 0; + gunnerOpticsShowCursor = 0; + gunnerAction = "ACE_SpottingScope"; + gunnerGetInAction = "GetInLow"; + gunnerGetOutAction = "GetOutLow"; + gunnerForceOptics = 0; + ejectDeadGunner = 0; + turretInfoType = QGVAR(RscUnitInfo); + opticsDisablePeripherialVision = 1; + }; + }; + }; + + class ACE_B_SpottingScope: ACE_SpottingScopeObject { + author = ECSTRING(common,ACETeam); + _generalMacro = "ACE_B_SpottingScope"; + scope = 2; + side = 1; + faction = "BLU_F"; + crew = "B_spotter_F"; + }; + + class ACE_O_SpottingScope: ACE_SpottingScopeObject { + author = ECSTRING(common,ACETeam); + _generalMacro = "ACE_O_SpottingScope"; + scope = 2; + side = 0; + faction = "OPF_F"; + crew = "O_spotter_F"; + }; + + class ACE_I_SpottingScope: ACE_SpottingScopeObject { + author = ECSTRING(common,ACETeam); + _generalMacro = "ACE_I_SpottingScope"; + scope = 2; + side = 2; + faction = "IND_F"; + crew = "I_spotter_F"; + }; + class Item_Base_F; class ACE_Item_SpottingScope: Item_Base_F { author[] = {"Rocko", "Scubaman3D"}; @@ -33,102 +167,7 @@ class CfgVehicles { class Box_NATO_Support_F; class ACE_Box_Misc: Box_NATO_Support_F { class TransportItems { - MACRO_ADDITEM(ACE_Item_SpottingScope,2); - }; - }; - - class LandVehicle; - class StaticWeapon: LandVehicle { - class Turrets; - class ACE_Actions { - class ACE_MainActions {}; - }; - }; - class StaticATWeapon: StaticWeapon { - class Turrets: Turrets { - class MainTurret; - }; - class ACE_Actions: ACE_Actions{ - class ACE_MainActions: ACE_MainActions {}; - }; - }; - class ACE_SpottingScopeObject: StaticATWeapon { - class EventHandlers { - class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {}; - }; - - scope = 1; - side = 1; - typicalCargo[] = {"Soldier"}; - displayName = CSTRING(DisplayName); - model = PATHTOF(data\ace_spottingscope.p3d); - mapSize = 0.5; - transportSoldier = 0; - getInAction = "GetInLow"; - getOutAction = "GetOutLow"; - class Turrets: Turrets { - class MainTurret: MainTurret { - minTurn = -45; - maxTurn = 45; - initTurn = 0; - minElev = -10; - maxElev = 40; - initElev = 0; - - weapons[] = {}; - magazines[] = {}; - gunnerOpticsColor[] = {1,1,1,1}; - gunnerOpticsmodel = PATHTOF(data\m144_optic.p3d); - gunnerOpticsEffect[] = {"OpticsCHAbera1","OpticsBlur2"}; - gunnerOutOpticsShowCursor = 0; - gunnerOpticsShowCursor = 0; - gunnerAction = "ACE_SpottingScope"; - gunnerGetInAction = "GetInLow"; - gunnerGetOutAction = "GetOutLow"; - gunnerForceOptics = 0; - ejectDeadGunner = 0; - class ViewGunner { - initAngleX = 5; - minAngleX = -30; - maxAngleX = 30; - initAngleY = 0; - minAngleY = -100; - maxAngleY = 100; - initFov = 0.75; - minFov = 0.25; - maxFov = 1.25; - }; - class ViewOptics { - initAngleX = 0; - minAngleX = -30; - maxAngleX = 30; - initAngleY = 0; - minAngleY = -100; - maxAngleY = 100; - minFov = 0.0025; - maxFov = 0.05; - initFov= 0.05; - }; - }; - }; - EGVAR(dragging,canDrag) = 1; - EGVAR(dragging,dragPosition)[] = {0,1,0}; - EGVAR(dragging,dragDirection) = 0; - class ACE_Actions: ACE_Actions{ - class ACE_MainActions: ACE_MainActions { - selection = "osaveze"; - class ACE_Pickup { - selection = ""; - displayName = CSTRING(PickUp); - distance = 5; - condition = QUOTE((alive _target) && (count (crew _target) == 0)); - statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); - showDisabled = 0; - exceptions[] = {}; - priority = 5; - icon = PATHTOF(UI\w_spottingscope_ca.paa); - }; - }; + MACRO_ADDITEM(ACE_SpottingScope,2); }; }; }; diff --git a/addons/spottingscope/CfgWeapons.hpp b/addons/spottingscope/CfgWeapons.hpp index 3b550f9f5d..acdf7c910f 100644 --- a/addons/spottingscope/CfgWeapons.hpp +++ b/addons/spottingscope/CfgWeapons.hpp @@ -7,8 +7,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(DisplayName); descriptionShort = ""; - picture = PATHTOF(UI\w_spottingscope_ca.paa); - model = PATHTOF(data\ace_spottingscope.p3d); + picture = QPATHTOF(UI\w_spottingscope_ca.paa); + model = QPATHTOF(data\ace_spottingscope.p3d); class ItemInfo: InventoryItem_Base_F { mass = 40; diff --git a/addons/spottingscope/RscInGameUI.hpp b/addons/spottingscope/RscInGameUI.hpp new file mode 100644 index 0000000000..bf4f086dd7 --- /dev/null +++ b/addons/spottingscope/RscInGameUI.hpp @@ -0,0 +1,56 @@ + +class RscOpticsValue; +class RscMapControl; +class RscText; +class RscPicture; + +class RscInGameUI { + class RscUnitInfo; + class GVAR(RscUnitInfo): RscUnitInfo { + onLoad = QUOTE([ARR_4(""onLoad"",_this,""RscUnitInfo"",'IGUI')] call (uinamespace getvariable 'BIS_fnc_initDisplay'); {((_this select 0) displayCtrl _x) ctrlShow false} forEach [ARR_4(IDC_RETICLE,IDC_BODY,IDC_BLACK_LEFT,IDC_BLACK_RIGHT)]); + controls[] = {"CA_FOVMode","ScriptedReticleHelper","trippleHeadLeft","trippleHeadRight","Reticle","Body"}; // don't change this order + + class CA_FOVMode: RscOpticsValue { // idea by Taosenai. Apparently this can be used via isNil check to determine wheter the scope or the kolimator is used + idc = 154; + w = 0; + h = 0; + }; + + class ScriptedReticleHelper: RscMapControl { + onDraw = QUOTE(ctrlParent (_this select 0) call FUNC(animateReticle)); + idc = -1; + w = 0; + h = 0; + }; + + class Reticle: RscPicture { + idc = IDC_RETICLE; + text = QPATHTOF(rsc\spotting_scope_reticle_co.paa); + x = POS_X; + y = POS_Y; + w = POS_W; + h = POS_H; + }; + + class Body: Reticle { + idc = IDC_BODY; + text = QPATHTOF(rsc\spotting_scope_body_co.paa); + }; + + //These are just black side panels to cover the areas that the optics p3d doesn't cover + //It will ONLY effect tripple head users as (safezoneX == safeZoneXAbs) for everyone else + class trippleHeadLeft: RscText { + idc = IDC_BLACK_LEFT; + x = "safeZoneXAbs"; + Y = "safezoneY"; + w = QUOTE(POS_X_BASE(SIZEX) - safeZoneXAbs); + h = "safeZoneH"; + colorBackground[] = {0,0,0,1}; + }; + + class trippleHeadRight: trippleHeadLeft { + idc = IDC_BLACK_RIGHT; + x = QUOTE(safeZoneXAbs + safeZoneWAbs - (POS_X_BASE(SIZEX) - safeZoneXABS)); + }; + }; +}; diff --git a/addons/spottingscope/XEH_PREP.hpp b/addons/spottingscope/XEH_PREP.hpp index ebb99df96b..9839872360 100644 --- a/addons/spottingscope/XEH_PREP.hpp +++ b/addons/spottingscope/XEH_PREP.hpp @@ -1,3 +1,4 @@ PREP(pickup); PREP(place); +PREP(animateReticle); diff --git a/addons/spottingscope/config.cpp b/addons/spottingscope/config.cpp index c3541eed39..4fa5bd4d58 100644 --- a/addons/spottingscope/config.cpp +++ b/addons/spottingscope/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { - units[] = {"ACE_Item_SpottingScope"}; + name = COMPONENT_NAME; + units[] = {"ACE_B_SpottingScope", "ACE_O_SpottingScope", "ACE_I_SpottingScope", "ACE_Item_SpottingScope"}; weapons[] = {"ACE_SpottingScope"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_interaction"}; - author[] = {"Rocko", "Scubaman3D", "Ruthberg", "commy2", "p1nga"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rocko", "Scubaman3D", "Ruthberg", "commy2", "p1nga"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,3 +18,5 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" #include "CfgMoves.hpp" + +#include "RscInGameUI.hpp" diff --git a/addons/spottingscope/data/PSO_ring.paa b/addons/spottingscope/data/PSO_ring.paa deleted file mode 100644 index e1502aa5e2..0000000000 Binary files a/addons/spottingscope/data/PSO_ring.paa and /dev/null differ diff --git a/addons/spottingscope/data/ace_spottingscope.p3d b/addons/spottingscope/data/ace_spottingscope.p3d index fc6bc45354..0afe9952cf 100644 Binary files a/addons/spottingscope/data/ace_spottingscope.p3d and b/addons/spottingscope/data/ace_spottingscope.p3d differ diff --git a/addons/spottingscope/data/ace_ssvzs.p3d b/addons/spottingscope/data/ace_ssvzs.p3d deleted file mode 100644 index a4d58c13f4..0000000000 Binary files a/addons/spottingscope/data/ace_ssvzs.p3d and /dev/null differ diff --git a/addons/spottingscope/data/m144_optic.p3d b/addons/spottingscope/data/m144_optic.p3d deleted file mode 100644 index 15ad16fe92..0000000000 Binary files a/addons/spottingscope/data/m144_optic.p3d and /dev/null differ diff --git a/addons/spottingscope/data/optic_ssvzs.p3d b/addons/spottingscope/data/optic_ssvzs.p3d deleted file mode 100644 index ffb5834768..0000000000 Binary files a/addons/spottingscope/data/optic_ssvzs.p3d and /dev/null differ diff --git a/addons/spottingscope/data/scopering.paa b/addons/spottingscope/data/scopering.paa deleted file mode 100644 index ecf236b025..0000000000 Binary files a/addons/spottingscope/data/scopering.paa and /dev/null differ diff --git a/addons/spottingscope/data/sniper_peri.rvmat b/addons/spottingscope/data/sniper_peri.rvmat deleted file mode 100644 index 35069be267..0000000000 --- a/addons/spottingscope/data/sniper_peri.rvmat +++ /dev/null @@ -1,78 +0,0 @@ -ambient[] = {1.0, 1.0, 1.0, 1.0}; -diffuse[] = {1.0, 1.0, 1.0, 1.0}; -forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0}; -emmisive[] = {0.0, 0.0, 0.0, 1.0}; -specular[] = {0.0, 0.0, 0.0, 0.0}; -specularPower = 0.0; -PixelShaderID = "Super"; -VertexShaderID = "Super"; -class Stage1 { - texture = "z\ace\addons\spottingscope\data\sniper_peri_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 = "z\ace\addons\apl\data\metal4_weapons_vehicles_int_512_dt.paa"; - uvSource = "tex"; - class uvTransform { - aside[] = {6.0, 0.0, 0.0}; - up[] = {0.0, 6.0, 0.0}; - dir[] = {0.0, 0.0, 0.0}; - pos[] = {0.0, 0.0, 0.0}; - }; -}; -class Stage3 { - texture = "#(argb,8,8,3)color(0,0,0,0)"; - 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(0,1,1,1)"; - uvSource = "tex"; - class uvTransform { - aside[] = {1.0, 0.0, 0.0}; - up[] = {0.0, 1.0, 0.0}; - dir[] = {0.0, 0.0, 0.0}; - pos[] = {0.0, 0.0, 0.0}; - }; -}; -class Stage5 { - texture = "z\ace\addons\spottingscope\data\sniper_peri_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,32,128,1)fresnel(1.58,0.01)"; - uvSource = "tex"; - class uvTransform { - aside[] = {1.0, 0.0, 0.0}; - up[] = {0.0, 1.0, 0.0}; - dir[] = {0.0, 0.0, 0.0}; - pos[] = {0.0, 0.0, 0.0}; - }; -}; -class Stage7 { - texture = "a3\data_f\env_land_co.paa"; - uvSource = "tex"; - class uvTransform { - aside[] = {1.0, 0.0, 0.0}; - up[] = {0.0, 1.0, 0.0}; - dir[] = {0.0, 0.0, 0.0}; - pos[] = {0.0, 0.0, 0.0}; - }; -}; diff --git a/addons/spottingscope/data/sniper_peri_co.paa b/addons/spottingscope/data/sniper_peri_co.paa deleted file mode 100644 index 6466dc6d82..0000000000 Binary files a/addons/spottingscope/data/sniper_peri_co.paa and /dev/null differ diff --git a/addons/spottingscope/data/sniper_peri_nohq.paa b/addons/spottingscope/data/sniper_peri_nohq.paa deleted file mode 100644 index cc84eab64d..0000000000 Binary files a/addons/spottingscope/data/sniper_peri_nohq.paa and /dev/null differ diff --git a/addons/spottingscope/data/sniper_peri_smdi.paa b/addons/spottingscope/data/sniper_peri_smdi.paa deleted file mode 100644 index 4cb94ce7d1..0000000000 Binary files a/addons/spottingscope/data/sniper_peri_smdi.paa and /dev/null differ diff --git a/addons/spottingscope/data/spot_scope_co.paa b/addons/spottingscope/data/spot_scope_co.paa deleted file mode 100644 index c0168053a3..0000000000 Binary files a/addons/spottingscope/data/spot_scope_co.paa and /dev/null differ diff --git a/addons/spottingscope/data/spot_scope_nohq.paa b/addons/spottingscope/data/spot_scope_nohq.paa deleted file mode 100644 index 674ad1d0ec..0000000000 Binary files a/addons/spottingscope/data/spot_scope_nohq.paa and /dev/null differ diff --git a/addons/spottingscope/data/spot_scope_smdi.paa b/addons/spottingscope/data/spot_scope_smdi.paa deleted file mode 100644 index b6e2d763fe..0000000000 Binary files a/addons/spottingscope/data/spot_scope_smdi.paa and /dev/null differ diff --git a/addons/spottingscope/data/spottingscope.p3d b/addons/spottingscope/data/spottingscope.p3d deleted file mode 100644 index fba9d66b91..0000000000 Binary files a/addons/spottingscope/data/spottingscope.p3d and /dev/null differ diff --git a/addons/spottingscope/data/w_spottingscope.p3d b/addons/spottingscope/data/w_spottingscope.p3d deleted file mode 100644 index 040ef5158e..0000000000 Binary files a/addons/spottingscope/data/w_spottingscope.p3d and /dev/null differ diff --git a/addons/spottingscope/functions/fnc_animateReticle.sqf b/addons/spottingscope/functions/fnc_animateReticle.sqf new file mode 100644 index 0000000000..10bbf9b564 --- /dev/null +++ b/addons/spottingscope/functions/fnc_animateReticle.sqf @@ -0,0 +1,44 @@ +/* + * Author: commy2 + * Animate scripted reticle of spotting scope. + * + * Arguments: + * 0: Reticles RSC info display + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; + +params ["_display"]; +uinamespace setVariable [QGVAR(dlgSpottingScope), _display]; + +private _ctrlReticle = _display displayCtrl IDC_RETICLE; +private _ctrlBody = _display displayCtrl IDC_BODY; +private _ctrlBlackLeft = _display displayCtrl IDC_BLACK_LEFT; +private _ctrlBlackRight = _display displayCtrl IDC_BLACK_RIGHT; + +// check if optics are used +// hide all controls otherwise +private _isUsingOptic = ctrlShown (_display displayCtrl 154); + +_ctrlReticle ctrlShow _isUsingOptic; +_ctrlBody ctrlShow _isUsingOptic; +_ctrlBlackLeft ctrlShow _isUsingOptic; +_ctrlBlackRight ctrlShow _isUsingOptic; + +// animate reticle +private _zoom = ([] call EFUNC(common,getZoom)) * MAGIC_SCOPE_NUMBER; + +_ctrlReticle ctrlSetPosition [ + POS_X_BASE(_zoom), + POS_Y_BASE(_zoom), + POS_W_BASE(_zoom), + POS_H_BASE(_zoom) +]; + +_ctrlReticle ctrlCommit 0; diff --git a/addons/spottingscope/functions/fnc_pickup.sqf b/addons/spottingscope/functions/fnc_pickup.sqf index 81c9bc10a5..1a15bd7880 100644 --- a/addons/spottingscope/functions/fnc_pickup.sqf +++ b/addons/spottingscope/functions/fnc_pickup.sqf @@ -6,7 +6,7 @@ * 0: spotting scope * 1: unit * - * Return value: + * Return Value: * None * * Example: @@ -27,4 +27,4 @@ if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { [_unit, "ACE_SpottingScope"] call EFUNC(common,addToInventory); deleteVehicle _spottingScope; -}, [_spottingScope, _unit], 1, 0]call EFUNC(common,waitAndExecute); +}, [_spottingScope, _unit], 1, 0]call CBA_fnc_waitAndExecute; diff --git a/addons/spottingscope/functions/fnc_place.sqf b/addons/spottingscope/functions/fnc_place.sqf index 09f756c109..06f0e0d63a 100644 --- a/addons/spottingscope/functions/fnc_place.sqf +++ b/addons/spottingscope/functions/fnc_place.sqf @@ -6,7 +6,7 @@ * 0: unit * 1: scope class * - * Return value: + * Return Value: * None * * Example: @@ -27,15 +27,30 @@ if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { [{ params ["_unit"]; - private ["_direction", "_position", "_spottingScope"]; - _direction = getDir _unit; - _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; + // prevent collision damage + [QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent; - _spottingScope = "ACE_SpottingScopeObject" createVehicle [0, 0, 0]; + // Check for a place to land the spotting scope + private _direction = getDir _unit; + private _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0]; + private _vectorUp = [0, 0, 1]; + private _intersections = lineIntersectsSurfaces [_position vectorAdd [0, 0, 1.5], _position vectorDiff [0, 0, 1.5], _unit, objNull, true, 1, "GEOM", "FIRE"]; + if (_intersections isEqualTo []) then { + TRACE_1("No intersections",_intersections); + } else { + (_intersections select 0) params ["_touchingPoint", "_surfaceNormal"]; + _position = _touchingPoint vectorAdd [0, 0, 0.05]; + _vectorUp = _surfaceNormal; + }; + + // Create the scope and set its position and orientation + private _spottingScope = "ACE_SpottingScopeObject" createVehicle [0, 0, 0]; _spottingScope setDir _direction; _spottingScope setPosASL _position; - if ((getPosATL _spottingScope select 2) - (getPos _spottingScope select 2) < 1E-5) then { - _spottingScope setVectorUp (surfaceNormal (position _spottingScope)); - }; + _spottingScope setVectorUp _vectorUp; + [QEGVAR(common,fixPosition), _spottingScope, _spottingScope] call CBA_fnc_targetEvent; + [QEGVAR(common,fixFloating), _spottingScope, _spottingScope] call CBA_fnc_targetEvent; + _unit reveal _spottingScope; -}, [_unit], 1, 0] call EFUNC(common,waitAndExecute); + +}, [_unit], 1, 0] call CBA_fnc_waitAndExecute; diff --git a/addons/spottingscope/rsc/spotting_scope_body_co.paa b/addons/spottingscope/rsc/spotting_scope_body_co.paa new file mode 100644 index 0000000000..71e1984c6e Binary files /dev/null and b/addons/spottingscope/rsc/spotting_scope_body_co.paa differ diff --git a/addons/spottingscope/data/m144_ca.paa b/addons/spottingscope/rsc/spotting_scope_reticle_co.paa similarity index 100% rename from addons/spottingscope/data/m144_ca.paa rename to addons/spottingscope/rsc/spotting_scope_reticle_co.paa diff --git a/addons/spottingscope/script_component.hpp b/addons/spottingscope/script_component.hpp index 48f14b7398..f6cc09af7a 100644 --- a/addons/spottingscope/script_component.hpp +++ b/addons/spottingscope/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT spottingscope +#define COMPONENT_BEAUTIFIED Spotting Scope #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -15,3 +16,23 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define IDC_RETICLE 10000 +#define IDC_BODY 10001 +#define IDC_BLACK_LEFT 10002 +#define IDC_BLACK_RIGHT 10003 + +#define MAGIC_SCOPE_NUMBER 0.0235 +//#define MAGIC_SCOPE_NUMBER (uiNamespace getVariable ['magic', 1]) + +#define POS_X_BASE(size) safezoneX + 0.5 * safezoneW - 0.5 * (size) / (getResolution select 5) +#define POS_Y_BASE(size) safezoneY + 0.5 * safezoneH - 0.5 * (size) / (getResolution select 5) * 4/3 +#define POS_W_BASE(size) (size) / (getResolution select 5) +#define POS_H_BASE(size) (size) / (getResolution select 5) * 4/3 + +#define SIZEX 1.05 + +#define POS_X QUOTE(POS_X_BASE(SIZEX)) +#define POS_Y QUOTE(POS_Y_BASE(SIZEX)) +#define POS_W QUOTE(POS_W_BASE(SIZEX)) +#define POS_H QUOTE(POS_H_BASE(SIZEX)) diff --git a/addons/switchunits/CfgVehicles.hpp b/addons/switchunits/CfgVehicles.hpp index f0549cb00e..1e12cc03d6 100644 --- a/addons/switchunits/CfgVehicles.hpp +++ b/addons/switchunits/CfgVehicles.hpp @@ -7,7 +7,7 @@ class CfgVehicles { function = FUNC(module); scope = 2; isGlobal = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_SwitchUnits_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_SwitchUnits_ca.paa); class Arguments { class SwitchToWest { displayName = CSTRING(SwitchToWest_DisplayName); diff --git a/addons/switchunits/XEH_postInit.sqf b/addons/switchunits/XEH_postInit.sqf index 5928804d7b..dc143bc6ac 100644 --- a/addons/switchunits/XEH_postInit.sqf +++ b/addons/switchunits/XEH_postInit.sqf @@ -20,10 +20,18 @@ if (missionNamespace getVariable [QGVAR(EnableSwitchUnits), false]) then { [player] call FUNC(startSwitchUnits); } else { - ["SettingChanged", { + ["ace_settingChanged", { PARAMS_2(_name,_value); if ((_name == QGVAR(EnableSwitchUnits)) && {_value}) then { [player] call FUNC(startSwitchUnits); }; - }] call EFUNC(common,addEventhandler); + }] call CBA_fnc_addEventHandler; +}; + +if (isServer) then { + [QGVAR(switchLocality), { + params ["_unit", "_player"]; + _unit setVariable [QGVAR(OriginalOwner), owner _unit, true]; + _unit setOwner (owner _player); + }] call CBA_fnc_addEventHandler; }; diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index 22a4924709..f722219562 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"bux578"}; - authorUrl = "https://github.com/bux578/"; + author = ECSTRING(common,ACETeam); + authors[] = {"bux578"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index a26b2d474a..84b766de4d 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -40,14 +40,7 @@ if (_leave) exitWith { // should switch locality // This doesn't work anymore, because one's now able to switch to units from a different side //[_unit] joinSilent group player; -[ - [_unit, player], - QUOTE({ - (_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; - (_this select 0) setOwner owner (_this select 1) - }), - 1 -] call EFUNC(common,execRemoteFnc); +[QGVAR(switchLocality), [_unit, player]] call CBA_fnc_serverEvent; [{ params ["_args", "_pfhId"]; @@ -79,12 +72,7 @@ if (_leave) exitWith { // set owner back to original owner private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; if (_oldOwner > -1) then { - [ - [_oldUnit, _oldOwner], - QUOTE({ - (_this select 0) setOwner (_this select 1) - }), 1 - ] call EFUNC(common,execRemoteFnc); + ["ace_setOwner", [_oldUnit, _oldOwner]] call CBA_fnc_serverEvent; }; [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); diff --git a/addons/switchunits/script_component.hpp b/addons/switchunits/script_component.hpp index 938d34d9a8..868fbc0a5d 100644 --- a/addons/switchunits/script_component.hpp +++ b/addons/switchunits/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT switchunits +#define COMPONENT_BEAUTIFIED Switch Units #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml index 60d7fb0ecd..b1635cfae6 100644 --- a/addons/switchunits/stringtable.xml +++ b/addons/switchunits/stringtable.xml @@ -21,6 +21,7 @@ Sto provando a cambiare Intentando cambiar Essaye de basculer + Tentando trocar This unit is too close to the enemy. diff --git a/addons/tacticalladder/CfgVehicles.hpp b/addons/tacticalladder/CfgVehicles.hpp index ed0ed0eb8c..564a034614 100644 --- a/addons/tacticalladder/CfgVehicles.hpp +++ b/addons/tacticalladder/CfgVehicles.hpp @@ -5,13 +5,15 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class ACE_TacticalLadders { - displayName = CSTRING(Deploy); - condition = QUOTE(backpack _player == 'ACE_TacticalLadder_Pack'); - statement = QUOTE([_player] call FUNC(deployTL)); - exceptions[] = {}; - showDisabled = 1; - priority = 4; + class ACE_Equipment { + class ACE_TacticalLadders { + displayName = CSTRING(Deploy); + condition = QUOTE(backpack _player == 'ACE_TacticalLadder_Pack'); + statement = QUOTE([_player] call FUNC(deployTL)); + exceptions[] = {}; + showDisabled = 1; + priority = 4; + }; }; }; }; @@ -21,8 +23,8 @@ class CfgVehicles { scope = 2; displayName = CSTRING(DisplayName); descriptionShort = ""; - model = PATHTOF(data\ace_tacticalladder_pack.p3d); - picture = PATHTOF(UI\ace_tactical_ladder_pack_ca.paa); + model = QPATHTOF(data\ace_tacticalladder_pack.p3d); + picture = QPATHTOF(UI\ace_tactical_ladder_pack_ca.paa); maximumLoad = 0; mass = 50; }; @@ -42,7 +44,7 @@ class CfgVehicles { displayName = CSTRING(DisplayName); class DestructionEffects {}; - model = PATHTOF(data\ace_tacticalladder.p3d); + model = QPATHTOF(data\ace_tacticalladder.p3d); animated = 1; autocenter = 0; featureSize = 12; @@ -92,7 +94,7 @@ class CfgVehicles { distance = 4; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(positionTL)},[ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(positionTL)},[ARR_2(_player,_target)])] call CBA_fnc_execNextFrame); showDisabled = 0; exceptions[] = {}; priority = 5; diff --git a/addons/tacticalladder/XEH_postInit.sqf b/addons/tacticalladder/XEH_postInit.sqf index 465f514d14..1a6f356fb0 100644 --- a/addons/tacticalladder/XEH_postInit.sqf +++ b/addons/tacticalladder/XEH_postInit.sqf @@ -7,20 +7,20 @@ GVAR(cancelTime) = 0; GVAR(currentStep) = 3; GVAR(currentAngle) = 0; -/*["interactMenuOpened", { - if ((ACE_time > GVAR(cancelTime)) && !isNull GVAR(ladder)) then { +/*["ace_interactMenuOpened", { + if ((CBA_missionTime > GVAR(cancelTime)) && !isNull GVAR(ladder)) then { GVAR(ladder) call FUNC(cancelTLdeploy); }; -}] call EFUNC(common,addEventHandler);*/ +}] call CBA_fnc_addEventHandler;*/ // Cancel adjustment if interact menu opens -["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call CBA_fnc_addEventHandler; // Cancel adjusting on player change. -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; +["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler; // handle falling unconscious -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; // @todo captivity? diff --git a/addons/tacticalladder/config.cpp b/addons/tacticalladder/config.cpp index 02740639fe..eddca58449 100644 --- a/addons/tacticalladder/config.cpp +++ b/addons/tacticalladder/config.cpp @@ -2,14 +2,21 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_interaction"}; - author[] = {"Rocko", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rocko", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 27ea683b5a..c47733dd5a 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -37,7 +37,7 @@ _ladder animate ["rotate", 0]; } count ["extract_1", "extract_2", "extract_3"]; // Extract ladder at head height (extract_3) GVAR(ladder) = _ladder; -GVAR(cancelTime) = ACE_time + 1; // Workaround to prevent accidental canceling +GVAR(cancelTime) = CBA_missionTime + 1; // Workaround to prevent accidental canceling GVAR(currentStep) = 3; GVAR(currentAngle) = 0; diff --git a/addons/tacticalladder/script_component.hpp b/addons/tacticalladder/script_component.hpp index 1341795f37..b58aa42e38 100644 --- a/addons/tacticalladder/script_component.hpp +++ b/addons/tacticalladder/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT tacticalladder +#define COMPONENT_BEAUTIFIED Tactical Ladder #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/tagging/CfgVehicles.hpp b/addons/tagging/CfgVehicles.hpp index 4425b646ad..2a71c773a0 100644 --- a/addons/tagging/CfgVehicles.hpp +++ b/addons/tagging/CfgVehicles.hpp @@ -9,25 +9,25 @@ class CfgVehicles { statement = QUOTE([ARR_2(ACE_player,'black' call FUNC(getTexture))] call FUNC(tag)); showDisabled = 0; priority = 3; - icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlack.paa)); + icon = QPATHTOF(UI\icons\iconTaggingBlack.paa); }; class ACE_TagRed: ACE_TagBlack { displayName = CSTRING(TagRed); condition = QUOTE(('ACE_SpraypaintRed' in items ACE_player) && {[] call FUNC(checkTaggable)}); statement = QUOTE([ARR_2(ACE_player,'red' call FUNC(getTexture))] call FUNC(tag)); - icon = QUOTE(PATHTOF(UI\icons\iconTaggingRed.paa)); + icon = QPATHTOF(UI\icons\iconTaggingRed.paa); }; class ACE_TagGreen: ACE_TagBlack { displayName = CSTRING(TagGreen); condition = QUOTE(('ACE_SpraypaintGreen' in items ACE_player) && {[] call FUNC(checkTaggable)}); statement = QUOTE([ARR_2(ACE_player,'green' call FUNC(getTexture))] call FUNC(tag)); - icon = QUOTE(PATHTOF(UI\icons\iconTaggingGreen.paa)); + icon = QPATHTOF(UI\icons\iconTaggingGreen.paa); }; class ACE_TagBlue: ACE_TagBlack { displayName = CSTRING(TagBlue); condition = QUOTE(('ACE_SpraypaintBlue' in items ACE_player) && {[] call FUNC(checkTaggable)}); statement = QUOTE([ARR_2(ACE_player,'blue' call FUNC(getTexture))] call FUNC(tag)); - icon = QUOTE(PATHTOF(UI\icons\iconTaggingBlue.paa)); + icon = QPATHTOF(UI\icons\iconTaggingBlue.paa); }; }; }; diff --git a/addons/tagging/CfgWeapons.hpp b/addons/tagging/CfgWeapons.hpp index a805a75679..1984b3b14a 100644 --- a/addons/tagging/CfgWeapons.hpp +++ b/addons/tagging/CfgWeapons.hpp @@ -6,28 +6,28 @@ class CfgWeapons { author = "jokoho48"; displayname = CSTRING(spraypaintBlack); descriptionShort = CSTRING(descSpraypaint); - picture = QUOTE(PATHTOF(UI\items\itemSpraypaintBlack.paa)); - model = QUOTE(PATHTOF(data\SprayCan.p3d)); + picture = QPATHTOF(UI\items\itemSpraypaintBlack.paa); + model = QPATHTOF(data\SprayCan.p3d); scope = 2; hiddenSelections[] = {"camo"}; - hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanBlack_co.paa))}; + hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanBlack_co.paa)}; class ItemInfo: InventoryItem_Base_F { mass = 10; }; }; class ACE_SpraypaintRed : ACE_SpraypaintBlack { displayname = CSTRING(spraypaintRed); - picture = QUOTE(PATHTOF(UI\items\itemSpraypaintRed.paa)); - hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanRed_co.paa))}; + picture = QPATHTOF(UI\items\itemSpraypaintRed.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanRed_co.paa)}; }; class ACE_SpraypaintGreen : ACE_SpraypaintBlack { displayname = CSTRING(spraypaintGreen); - picture = QUOTE(PATHTOF(UI\items\itemSpraypaintGreen.paa)); - hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanGreen_co.paa))}; + picture = QPATHTOF(UI\items\itemSpraypaintGreen.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanGreen_co.paa)}; }; class ACE_SpraypaintBlue : ACE_SpraypaintBlack { displayname = CSTRING(spraypaintBlue); - picture = QUOTE(PATHTOF(UI\items\itemSpraypaintBlue.paa)); - hiddenSelectionsTextures[] = {QUOTE(PATHTOF(data\spraycanBlue_co.paa))}; + picture = QPATHTOF(UI\items\itemSpraypaintBlue.paa); + hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanBlue_co.paa)}; }; }; diff --git a/addons/tagging/XEH_postInit.sqf b/addons/tagging/XEH_postInit.sqf index 31fd73d913..055cb59cfd 100644 --- a/addons/tagging/XEH_postInit.sqf +++ b/addons/tagging/XEH_postInit.sqf @@ -44,4 +44,4 @@ if (!isServer) exitWith {}; GVAR(testingThread) = false; GVAR(tagsToTest) = []; -["createTag", DFUNC(createTag)] call EFUNC(common,addEventHandler); +[QGVAR(createTag), DFUNC(createTag)] call CBA_fnc_addEventHandler; diff --git a/addons/tagging/config.cpp b/addons/tagging/config.cpp index dcd1fb845d..634f7c57af 100644 --- a/addons/tagging/config.cpp +++ b/addons/tagging/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_SpraypaintBlack", "ACE_Item_SpraypaintRed", "ACE_Item_SpraypaintGreen", "ACE_Item_SpraypaintBlue"}; weapons[] = {"ACE_SpraypaintBlack", "ACE_SpraypaintRed", "ACE_SpraypaintGreen", "ACE_SpraypaintBlue"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"BaerMitUmlaut","esteldunedain"}; - authorUrl = "https://github.com/BaerMitUmlaut"; + author = ECSTRING(common,ACETeam); + authors[] = {"BaerMitUmlaut","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,3 +17,8 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + +class ACE_newEvents { + createTag = QGVAR(createTag); + tagCreated = "ace_tagCreated"; +}; diff --git a/addons/tagging/functions/fnc_createTag.sqf b/addons/tagging/functions/fnc_createTag.sqf index 4f83196524..20ca33bd2e 100644 --- a/addons/tagging/functions/fnc_createTag.sqf +++ b/addons/tagging/functions/fnc_createTag.sqf @@ -34,7 +34,7 @@ _tag setPosASL _tagPosASL; _tag setVectorDirAndUp _vectorDirAndUp; // Throw a global event for mision makers -["tagCreated", [_tag, _texture, _object, _unit]] call EFUNC(common,globalEvent); +["ace_tagCreated", [_tag, _texture, _object, _unit]] call CBA_fnc_globalEvent; if (isNull _object) exitWith {true}; diff --git a/addons/tagging/functions/fnc_tag.sqf b/addons/tagging/functions/fnc_tag.sqf index 43e951629e..165441f80e 100644 --- a/addons/tagging/functions/fnc_tag.sqf +++ b/addons/tagging/functions/fnc_tag.sqf @@ -72,6 +72,11 @@ if (_surfaceNormal vectorDotProduct (_endPosASL vectorDiff _startPosASL) > 0) t // Check if its a valid surface: big enough, reasonably plane private _v1 = vectorNormalized (_surfaceNormal vectorMultiply -1); private _v2 = vectorNormalized (_v1 vectorCrossProduct (_endPosASL vectorDiff _startPosASL)); +// If the surface is not horizontal (>20º), create vup _v2 pointing upward instead of away +if (abs (_v1 select 2) < 0.94) then { + private _v3Temp = _v1 vectorCrossProduct [0, 0, 1]; + _v2 = _v3Temp vectorCrossProduct _v1; +}; private _v3 = _v2 vectorCrossProduct _v1; TRACE_3("Reference:", _v1, _v2, _v3); @@ -109,7 +114,7 @@ _unit playActionNow "PutDown"; playSound3D [QUOTE(PATHTO_R(sounds\spray.ogg)), _unit, false, (eyePos _unit), 10, 1, 15]; // Tell the server to create the tag and handle its destruction - ["createTag", _this] call EFUNC(common,serverEvent); -}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _texture, _object, _unit], 0.6] call EFUNC(common,waitAndExecute); + [QGVAR(createTag), _this] call CBA_fnc_serverEvent; +}, [_touchingPoint vectorAdd (_surfaceNormal vectorMultiply 0.06), _vectorDirAndUp, _texture, _object, _unit], 0.6] call CBA_fnc_waitAndExecute; true diff --git a/addons/tagging/functions/fnc_tagTestingThread.sqf b/addons/tagging/functions/fnc_tagTestingThread.sqf index 0e3bb8075d..ead21f8d91 100644 --- a/addons/tagging/functions/fnc_tagTestingThread.sqf +++ b/addons/tagging/functions/fnc_tagTestingThread.sqf @@ -41,5 +41,5 @@ if (GVAR(tagsToTest) isEqualTo []) exitWith { }; // Schedule for execution again after 5 seconds -[DFUNC(tagTestingThread), [], 5] call EFUNC(common,waitAndExecute); +[DFUNC(tagTestingThread), [], 5] call CBA_fnc_waitAndExecute; GVAR(testingThread) = true; diff --git a/addons/tagging/script_component.hpp b/addons/tagging/script_component.hpp index 4836d2f209..18066d4c0d 100644 --- a/addons/tagging/script_component.hpp +++ b/addons/tagging/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT tagging +#define COMPONENT_BEAUTIFIED Tagging #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/tagging/stringtable.xml b/addons/tagging/stringtable.xml index bf4056df49..43f6a1e2d4 100644 --- a/addons/tagging/stringtable.xml +++ b/addons/tagging/stringtable.xml @@ -9,6 +9,7 @@ Tag noir Marca nero Označit černě + Marcar em preto Tag red @@ -18,6 +19,7 @@ Tag rouge Marca rosso Označit červeně + Marcar em vermelho Tag green @@ -27,6 +29,7 @@ Tag vert Marca verde Označit zeleně + Marcar em verde Tag blue @@ -36,6 +39,7 @@ Tag bleu Marca blu Označit modře + Marcar em azul Black spray paint @@ -45,6 +49,7 @@ Peinture pulvérisée noire Bomboletta spray nera Černý sprej + Spray de tinta preta Red spray paint @@ -54,6 +59,7 @@ Peinture pulvérisée rouge Bomboletta spray rossa Červený sprej + Spray de tinta vermelha Green spray paint @@ -63,6 +69,7 @@ Peinture pulvérisée verte Bomboletta spray verde Zelený sprej + Spray de tinta verde Blue spray paint @@ -72,6 +79,7 @@ Peinture pulvérisée bleue Bomboletta spray blu Modrý sprej + Spray de tinta azul A can of spray paint for tagging walls. @@ -81,6 +89,7 @@ Un spray de peinture pour taguer les murs. Una bomboletta di spay per contrassegnare i muri. Plechovka se sprejem k vytváření značek. + Uma lata de tinta spray para marcar paredes. \ No newline at end of file diff --git a/addons/thermals/config.cpp b/addons/thermals/config.cpp index 07d19d1b50..a61598929d 100644 --- a/addons/thermals/config.cpp +++ b/addons/thermals/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"[TF]Nkey"}; - authorUrl = "https://github.com/michail-nikolaev/"; + author = ECSTRING(common,ACETeam); + authors[] = {"[TF]Nkey"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/thermals/script_component.hpp b/addons/thermals/script_component.hpp index bd829f035e..c7ac2263ce 100644 --- a/addons/thermals/script_component.hpp +++ b/addons/thermals/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT thermals +#define COMPONENT_BEAUTIFIED Thermals #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_THERMALS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp index 8e1eb41fd0..9c93e555ac 100644 --- a/addons/trenches/CfgVehicles.hpp +++ b/addons/trenches/CfgVehicles.hpp @@ -30,21 +30,21 @@ class CfgVehicles { displayName = CSTRING(DigEnvelopeSmall); condition = QUOTE(_player call FUNC(canDigTrench)); //wait a frame to handle "Do When releasing action menu key" option - statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ACE_envelope_small')])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ACE_envelope_small')])] call CBA_fnc_execNextFrame); exceptions[] = {}; showDisabled = 0; priority = 4; - //icon = PATHTOF(UI\icon_sandbag_ca.paa); + //icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; class GVAR(digEnvelopeBig) { displayName = CSTRING(DigEnvelopeBig); condition = QUOTE(_player call FUNC(canDigTrench)); //wait a frame to handle "Do When releasing action menu key" option - statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ACE_envelope_big')])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ACE_envelope_big')])] call CBA_fnc_execNextFrame); exceptions[] = {}; showDisabled = 0; priority = 4; - //icon = PATHTOF(UI\icon_sandbag_ca.paa); + //icon = QPATHTOF(UI\icon_sandbag_ca.paa); }; }; }; @@ -55,7 +55,7 @@ class CfgVehicles { author = ECSTRING(common,ACETeam); displayName = CSTRING(EnvelopeSmallName); descriptionShort = CSTRING(EnevlopeSmallDescription); - model = QUOTE(PATHTOEF(apl,ace_envelope_small4.p3d)); + model = QPATHTOEF(apl,ace_envelope_small4.p3d); scope = 2; GVAR(diggingDuration) = 20; GVAR(removalDuration) = 12; @@ -71,7 +71,7 @@ class CfgVehicles { author = ECSTRING(common,ACETeam); displayName = CSTRING(EnvelopeBigName); descriptionShort = CSTRING(EnevlopeBigDescription); - model = QUOTE(PATHTOEF(apl,ace_envelope_big4.p3d)); + model = QPATHTOEF(apl,ace_envelope_big4.p3d); scope = 2; GVAR(diggingDuration) = 25; GVAR(removalDuration) = 15; @@ -87,12 +87,12 @@ class CfgVehicles { class ACE_envelope_small_NoGeo: ACE_envelope_small { scope = 1; //@todo: replace by a no geo model - model = QUOTE(PATHTOEF(apl,ace_envelope_small4_nogeo.p3d)); + model = QPATHTOEF(apl,ace_envelope_small4_nogeo.p3d); }; class ACE_envelope_big_NoGeo: ACE_envelope_big { scope = 1; //@todo: replace by a no geo model - model = QUOTE(PATHTOEF(apl,ace_envelope_big4_nogeo.p3d)); + model = QPATHTOEF(apl,ace_envelope_big4_nogeo.p3d); }; class Box_NATO_Support_F; diff --git a/addons/trenches/CfgWeapons.hpp b/addons/trenches/CfgWeapons.hpp index 5b20e9e4c1..9f9049360a 100644 --- a/addons/trenches/CfgWeapons.hpp +++ b/addons/trenches/CfgWeapons.hpp @@ -6,8 +6,8 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(EntrenchingToolName); descriptionShort = CSTRING(EntrenchingToolDescription); - model = QUOTE(PATHTOEF(apl,ace_entrchtool.p3d)); - picture = QUOTE(PATHTOF(ui\w_entrchtool_ca.paa)); + model = QPATHTOEF(apl,ace_entrchtool.p3d); + picture = QPATHTOF(ui\w_entrchtool_ca.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 10; diff --git a/addons/trenches/XEH_postInit.sqf b/addons/trenches/XEH_postInit.sqf index ba84123009..1fbfa24116 100644 --- a/addons/trenches/XEH_postInit.sqf +++ b/addons/trenches/XEH_postInit.sqf @@ -13,14 +13,14 @@ GVAR(digPFH) = -1; GVAR(digDirection) = 0; // Cancel dig sandbag if interact menu opened -["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call CBA_fnc_addEventHandler; // Cancel dig on player change. This does work when returning to lobby, but not when hard disconnecting. -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerInventoryChanged", {_this call FUNC(handlePlayerInventoryChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; +["loadout", FUNC(handlePlayerInventoryChanged)] call CBA_fnc_addPlayerEventHandler; +["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler; // handle waking up dragged unit and falling unconscious while dragging -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; //@todo Captivity? diff --git a/addons/trenches/config.cpp b/addons/trenches/config.cpp index e1b14fa37c..2b4f3c9051 100644 --- a/addons/trenches/config.cpp +++ b/addons/trenches/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_envelope_small","ACE_envelope_big"}; weapons[] = {"ACE_EntrenchingTool"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Grey", "esteldunedain"}; - authorUrl = ""; + author = ECSTRING(common,ACETeam); + authors[] = {"Grey", "esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,3 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; diff --git a/addons/trenches/functions/fnc_continueDiggingTrench.sqf b/addons/trenches/functions/fnc_continueDiggingTrench.sqf index 223dc42df6..954eed1ca3 100644 --- a/addons/trenches/functions/fnc_continueDiggingTrench.sqf +++ b/addons/trenches/functions/fnc_continueDiggingTrench.sqf @@ -84,7 +84,7 @@ for "_i" from _progressLeft to 10 do { private _vectorDiffZ = 1 - (_i / 10); private _delay = _digTime * ((_i / 10) - _actualProgress); private _progress = _i / 10; - [DFUNC(setTrenchPlacement), [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, _vectorDiffZ], _vecDirAndUp, _progress], _delay] call EFUNC(common,waitAndExecute); + [DFUNC(setTrenchPlacement), [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, _vectorDiffZ], _vecDirAndUp, _progress], _delay] call CBA_fnc_waitAndExecute; }; // Play animation diff --git a/addons/trenches/functions/fnc_placeTrench.sqf b/addons/trenches/functions/fnc_placeTrench.sqf index 35a6706d30..f7a643d882 100644 --- a/addons/trenches/functions/fnc_placeTrench.sqf +++ b/addons/trenches/functions/fnc_placeTrench.sqf @@ -36,7 +36,7 @@ _trench = createVehicle [_noGeoModel, [0, 0, 0], [], 0, "NONE"]; GVAR(trench) = _trench; // prevent collisions with trench -["enableSimulationGlobal", [_trench, false]] call EFUNC(common,serverEvent); +[QEGVAR(common,enableSimulationGlobal), [_trench, false]] call CBA_fnc_serverEvent; GVAR(digDirection) = 0; diff --git a/addons/trenches/functions/fnc_removeTrench.sqf b/addons/trenches/functions/fnc_removeTrench.sqf index dd51bbbae5..53059f34bf 100644 --- a/addons/trenches/functions/fnc_removeTrench.sqf +++ b/addons/trenches/functions/fnc_removeTrench.sqf @@ -70,7 +70,7 @@ for "_i" from _progressLeft to 10 do { private _delay = _removeTime * ((_i / 10) - (1 - _actualProgress)); private _progress = 1 - (_i / 10); - [DFUNC(setTrenchPlacement), [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, _vectorDiffZ], _vecDirAndUp, _progress], _delay] call EFUNC(common,waitAndExecute); + [DFUNC(setTrenchPlacement), [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, _vectorDiffZ], _vecDirAndUp, _progress], _delay] call CBA_fnc_waitAndExecute; }; // Play animation diff --git a/addons/trenches/script_component.hpp b/addons/trenches/script_component.hpp index 432308fa51..f3e97493e5 100644 --- a/addons/trenches/script_component.hpp +++ b/addons/trenches/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT trenches +#define COMPONENT_BEAUTIFIED Trenches #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/trenches/stringtable.xml b/addons/trenches/stringtable.xml index dc9bee1815..b3ec6d14ca 100644 --- a/addons/trenches/stringtable.xml +++ b/addons/trenches/stringtable.xml @@ -9,6 +9,7 @@ Pala para trincheras Outil de tranchée Polní lopatka + Ferramenta de trincheira Entrenching Tool @@ -18,6 +19,7 @@ Pala para trincheras Outil de tranchée Polní lopatky se používají k zákopovým a jiným pracem. + Ferramenta de trincheira Envelope - Small @@ -26,6 +28,7 @@ Fascia - Piccola Trinchera pequeña Envelope - petite + Trincheira - Pequena Small Personal Trench @@ -35,6 +38,7 @@ Trinchera personal pequeña Petite tranchée personelle Malý zákop pro jednoho + Trincheira pessoal pequena Dig Small Trench @@ -44,6 +48,7 @@ Cavar trinchera pequeña Creuser une petite tranchée Vykopat malý zákop + Cavar trincheira pequena Envelope - Big @@ -52,6 +57,7 @@ Fascia - Grande Trinchera grande Enveloppe - grande + Trincheira - Grande Large Personal Trench @@ -61,6 +67,7 @@ Trinchera personal grande Grande tranchée personelle Velký zákop pro jednoho + Trincheira pessoal grande Dig Big Trench @@ -70,6 +77,7 @@ Cavar trinchera grande Creuser une grande tranchée Vykopat velký zákop + Cavar trincheira grande Confirm Dig @@ -79,6 +87,7 @@ Confirmar cavado Confirmer la creusée Potvrdit kopání + Confirmar excavação Cancel Dig @@ -88,6 +97,7 @@ Cancelar cavado Annuler la creusée Zrušit kopání + Cancelar excavação Rotate @@ -109,18 +119,25 @@ Cavando trinchera Creuse la tranchée Vykopat zákop + Cavando trincheira Continue Digging Trench Wzów kopanie wnęki + Continuar cavando trincheira + Continuer à creuser la tranchée Remove Trench Usuń wnękę + Remover trincheira + Retirer la tranchée Removing Trench Usuwanie wnęki + Removendo tricnheira + Retirement de la tranchée \ No newline at end of file diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index 418b32e550..b1d804e393 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -5,13 +5,15 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_SelfActions { - class GVAR(place) { - displayName = CSTRING(Placedown); - condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); - statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); - showDisabled = 0; - priority = 2; - icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + class ACE_Equipment { + class GVAR(place) { + displayName = CSTRING(Placedown); + condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); + statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); + showDisabled = 0; + priority = 2; + icon = QPATHTOF(UI\w_sniper_tripod_ca.paa); + }; }; }; }; @@ -46,7 +48,7 @@ class CfgVehicles { EGVAR(dragging,dragDirection) = 0; scope = 2; displayName = CSTRING(DisplayName); - model = PATHTOF(data\sniper_tripod.p3d); + model = QPATHTOF(data\sniper_tripod.p3d); class AnimationSources { class slide_down_tripod { @@ -76,7 +78,7 @@ class CfgVehicles { showDisabled = 0; exceptions[] = {}; priority = 5; - icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + icon = QPATHTOF(UI\w_sniper_tripod_ca.paa); }; class ACE_Adjust { @@ -85,11 +87,11 @@ class CfgVehicles { distance = 5; condition = "true"; //wait a frame to handle "Do When releasing action menu key" option: - statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [ARR_2(_player,_target)])] call EFUNC(common,execNextFrame)); + statement = QUOTE([ARR_2({_this call FUNC(adjust)}, [ARR_2(_player,_target)])] call CBA_fnc_execNextFrame); showDisabled = 0; exceptions[] = {}; priority = 5; - icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + icon = QPATHTOF(UI\w_sniper_tripod_ca.paa); }; }; }; diff --git a/addons/tripod/CfgWeapons.hpp b/addons/tripod/CfgWeapons.hpp index 6322ef1906..3c5ca6d2b1 100644 --- a/addons/tripod/CfgWeapons.hpp +++ b/addons/tripod/CfgWeapons.hpp @@ -7,8 +7,8 @@ class CfgWeapons { scope = 2; displayName = CSTRING(DisplayName); descriptionShort = ""; - model = PATHTOF(data\w_sniper_tripod.p3d); - picture = PATHTOF(UI\w_sniper_tripod_ca.paa); + model = QPATHTOF(data\w_sniper_tripod.p3d); + picture = QPATHTOF(UI\w_sniper_tripod_ca.paa); class ItemInfo: InventoryItem_Base_F { mass = 40; diff --git a/addons/tripod/XEH_postInit.sqf b/addons/tripod/XEH_postInit.sqf index 79aa7a69f2..86fda03b48 100644 --- a/addons/tripod/XEH_postInit.sqf +++ b/addons/tripod/XEH_postInit.sqf @@ -7,13 +7,13 @@ GVAR(adjustPFH) = -1; GVAR(height) = 0; // Cancel adjustment if interact menu opens -["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); +["ace_interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call CBA_fnc_addEventHandler; // Cancel adjusting on player change. -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler; +["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler; // handle falling unconscious -["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); +["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler; // @todo captivity? diff --git a/addons/tripod/config.cpp b/addons/tripod/config.cpp index 80379019c3..8251e0c469 100644 --- a/addons/tripod/config.cpp +++ b/addons/tripod/config.cpp @@ -2,15 +2,22 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_Tripod"}; weapons[] = {"ACE_Tripod"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; - author[] = {"Rocko", "Scubaman3D", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Rocko", "Scubaman3D", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgWeapons.hpp" + +class ACE_newEvents { + interactMenuOpened = "ace_interactMenuOpened"; +}; diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf index 2b8659b2a4..b12f713ace 100644 --- a/addons/tripod/functions/fnc_adjust.sqf +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: tripod * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/tripod/functions/fnc_pickup.sqf b/addons/tripod/functions/fnc_pickup.sqf index 886aa5087e..dc8b990515 100644 --- a/addons/tripod/functions/fnc_pickup.sqf +++ b/addons/tripod/functions/fnc_pickup.sqf @@ -6,7 +6,7 @@ * 0: unit * 1: tripod * - * Return value: + * Return Value: * None * * Example: @@ -30,4 +30,4 @@ if (stance _unit == "STAND") then { deleteVehicle _tripod; [_unit, "ACE_Tripod"] call EFUNC(common,addToInventory); -}, [_unit, _tripod], 1] call EFUNC(common,waitAndExecute); +}, [_unit, _tripod], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/tripod/functions/fnc_place.sqf b/addons/tripod/functions/fnc_place.sqf index 3168703f31..b4b6790ef6 100644 --- a/addons/tripod/functions/fnc_place.sqf +++ b/addons/tripod/functions/fnc_place.sqf @@ -6,7 +6,7 @@ * 0: unit * 1: tripod class * - * Return value: + * Return Value: * None * * Example: @@ -53,4 +53,4 @@ if (stance _unit == "STAND") then { }; }, 0, [_tripod, _direction, _position]] call CBA_fnc_addPerFrameHandler; -}, [_unit], 1] call EFUNC(common,waitAndExecute); +}, [_unit], 1] call CBA_fnc_waitAndExecute; diff --git a/addons/tripod/script_component.hpp b/addons/tripod/script_component.hpp index 95d11d3a65..28be9b780e 100644 --- a/addons/tripod/script_component.hpp +++ b/addons/tripod/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT tripod +#define COMPONENT_BEAUTIFIED Tripod #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/ui/ACE_Settings.hpp b/addons/ui/ACE_Settings.hpp index 89ddc8d35d..e6c3e5e496 100644 --- a/addons/ui/ACE_Settings.hpp +++ b/addons/ui/ACE_Settings.hpp @@ -45,7 +45,7 @@ class ACE_Settings { }; // ADVANCED - // Upper Weapon Info + // Soldier class GVAR(weaponName) { category = CSTRING(Category); displayName = CSTRING(WeaponName); @@ -70,8 +70,6 @@ class ACE_Settings { value = 1; isClientSettable = 1; }; - - // Lower Weapon Info class GVAR(ammoType) { category = CSTRING(Category); displayName = CSTRING(AmmoType); @@ -85,7 +83,7 @@ class ACE_Settings { displayName = CSTRING(AmmoCount); description = CSTRING(RequiresSoldierVehicleWeaponInfo); typeName = "BOOL"; - value = 0; + value = 1; isClientSettable = 1; }; class GVAR(magCount) { @@ -122,14 +120,12 @@ class ACE_Settings { }; class GVAR(weaponLowerInfoBackground) { category = CSTRING(Category); - displayName = CSTRING(WeaponLowerInfoBackground); //todo + displayName = CSTRING(WeaponLowerInfoBackground); description = CSTRING(RequiresSoldierVehicleWeaponInfo); typeName = "BOOL"; value = 1; isClientSettable = 1; }; - - // Stance class GVAR(stance) { category = CSTRING(Category); displayName = CSTRING(Stance); @@ -138,8 +134,6 @@ class ACE_Settings { value = 1; isClientSettable = 1; }; - - // Stamina Bar class GVAR(staminaBar) { category = CSTRING(Category); displayName = CSTRING(StaminaBar); @@ -149,6 +143,88 @@ class ACE_Settings { isClientSettable = 1; }; + // Gunner + class GVAR(gunnerWeaponName) { + category = CSTRING(Category); + displayName = CSTRING(GunnerWeaponName); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerWeaponNameBackground) { + category = CSTRING(Category); + displayName = CSTRING(GunnerWeaponNameBackground); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerFiringMode) { + category = CSTRING(Category); + displayName = CSTRING(GunnerFiringMode); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerAmmoType) { + category = CSTRING(Category); + displayName = CSTRING(GunnerAmmoType); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerAmmoCount) { + category = CSTRING(Category); + displayName = CSTRING(GunnerAmmoCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerMagCount) { + category = CSTRING(Category); + displayName = CSTRING(GunnerMagCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerLaunchableName) { + category = CSTRING(Category); + displayName = CSTRING(gunnerLaunchableName); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerLaunchableCount) { + category = CSTRING(Category); + displayName = CSTRING(gunnerLaunchableCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerZeroing) { + category = CSTRING(Category); + displayName = CSTRING(GunnerZeroing); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + class GVAR(gunnerWeaponLowerInfoBackground) { + category = CSTRING(Category); + displayName = CSTRING(GunnerWeaponLowerInfoBackground); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + value = 1; + isClientSettable = 1; + }; + // Vehicle class GVAR(vehicleName) { category = CSTRING(Category); @@ -206,12 +282,4 @@ class ACE_Settings { value = 1; isClientSettable = 1; }; - class GVAR(vehicleGunnerWeapon) { - category = CSTRING(Category); - displayName = CSTRING(VehicleGunnerWeapon); - description = CSTRING(RequiresSoldierVehicleWeaponInfo); - typeName = "BOOL"; - value = 1; - isClientSettable = 1; - }; }; diff --git a/addons/ui/ACE_UI.hpp b/addons/ui/ACE_UI.hpp new file mode 100644 index 0000000000..e59dd50385 --- /dev/null +++ b/addons/ui/ACE_UI.hpp @@ -0,0 +1,180 @@ +#define ANYWHERE 0 +#define GROUND_ONLY 1 +#define VEHICLE_ONLY 2 + +class ACE_UI { + class weaponName { + idd = 300; + elements[] = {118}; + location = GROUND_ONLY; + class conditions {}; + }; + class weaponNameBackground { + idd = 300; + elements[] = {1001, 1008}; + location = GROUND_ONLY; + class conditions {}; + }; + class firingMode { + idd = 300; + elements[] = {187, 1203}; + location = GROUND_ONLY; + class conditions {}; + }; + class ammoType { + idd = 300; + elements[] = {155}; + location = GROUND_ONLY; + class conditions {}; + }; + class ammoCount { + idd = 300; + elements[] = {184}; + location = GROUND_ONLY; + class conditions {}; + }; + class magCount { + idd = 300; + elements[] = {185}; + location = GROUND_ONLY; + class conditions {}; + }; + class throwableName { + idd = 300; + elements[] = {152}; + location = GROUND_ONLY; + class conditions {}; + }; + class throwableCount { + idd = 300; + elements[] = {151}; + location = GROUND_ONLY; + class conditions {}; + }; + class zeroing { + idd = 300; + elements[] = {168}; + location = GROUND_ONLY; + class conditions {}; + }; + class weaponLowerInfoBackground { + idd = 300; + elements[] = {1202}; + location = GROUND_ONLY; + class conditions {}; + }; + class staminaBar { + idd = 305; + elements[] = {193}; + location = GROUND_ONLY; + class conditions {}; + }; + class stance { + idd = 303; + elements[] = {188, 1201}; + location = GROUND_ONLY; + class conditions {}; + }; + class gunnerWeaponName { + idd = 300; + elements[] = {118}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerWeaponNameBackground { + idd = 300; + elements[] = {1001, 1008}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerFiringMode { + idd = 300; + elements[] = {187, 1203}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerAmmoType { + idd = 300; + elements[] = {155}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerAmmoCount { + idd = 300; + elements[] = {184}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerMagCount { + idd = 300; + elements[] = {185}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerLaunchableName { + idd = 300; + elements[] = {152}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerLaunchableCount { + idd = 300; + elements[] = {151}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerZeroing { + idd = 300; + elements[] = {168}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class gunnerWeaponLowerInfoBackground { + idd = 300; + elements[] = {1202}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleName { + idd = 300; + elements[] = {120}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleNameBackground { + idd = 300; + elements[] = {1000, 1013}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleFuelBar { + idd = 300; + elements[] = {113, 1202}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleSpeed { + idd = 300; + elements[] = {121, 1004, 1006}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleAltitude { + idd = 300; + elements[] = {122, 1005, 1014}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleDamage { + idd = 300; + elements[] = {111}; + location = VEHICLE_ONLY; + class conditions {}; + }; + class vehicleInfoBackground { + idd = 300; + elements[] = {1200}; + location = VEHICLE_ONLY; + class conditions {}; + }; +}; diff --git a/addons/ui/CfgEventHandlers.hpp b/addons/ui/CfgEventHandlers.hpp index 36c0fca8a3..89c91283ed 100644 --- a/addons/ui/CfgEventHandlers.hpp +++ b/addons/ui/CfgEventHandlers.hpp @@ -15,3 +15,10 @@ class Extended_PostInit_EventHandlers { clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; }; + +// Closing diary resets showHUD +class Extended_DisplayUnload_EventHandlers { + class RscDiary { + ADDON = QUOTE([{[false] call FUNC(setElements)}] call CBA_fnc_execNextFrame); + }; +}; diff --git a/addons/ui/CfgVehicles.hpp b/addons/ui/CfgVehicles.hpp index 391b3627eb..0b1cc9b2a9 100644 --- a/addons/ui/CfgVehicles.hpp +++ b/addons/ui/CfgVehicles.hpp @@ -44,7 +44,7 @@ class CfgVehicles { }; // ADVANCED - // Upper Weapon Info + // Soldier class weaponName { displayName = CSTRING(WeaponName); description = CSTRING(RequiresSoldierVehicleWeaponInfo); @@ -63,8 +63,6 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; - - // Lower Weapon Info class ammoType { displayName = CSTRING(AmmoType); description = CSTRING(RequiresSoldierVehicleWeaponInfo); @@ -75,7 +73,7 @@ class CfgVehicles { displayName = CSTRING(AmmoCount); description = CSTRING(RequiresSoldierVehicleWeaponInfo); typeName = "BOOL"; - defaultValue = 0; + defaultValue = 1; }; class magCount { displayName = CSTRING(MagCount); @@ -107,16 +105,12 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; - - // Stance class stance { displayName = CSTRING(Stance); description = CSTRING(RequiresSoldierVehicleWeaponInfo); typeName = "BOOL"; defaultValue = 1; }; - - // Stamina Bar class staminaBar { displayName = CSTRING(StaminaBar); description = CSTRING(RequiresSoldierVehicleWeaponInfo); @@ -124,6 +118,68 @@ class CfgVehicles { defaultValue = 1; }; + // Gunner + class gunnerWeaponName { + displayName = CSTRING(GunnerWeaponName); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerWeaponNameBackground { + displayName = CSTRING(GunnerWeaponNameBackground); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerFiringMode { + displayName = CSTRING(GunnerFiringMode); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerAmmoType { + displayName = CSTRING(GunnerAmmoType); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerAmmoCount { + displayName = CSTRING(GunnerAmmoCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerMagCount { + displayName = CSTRING(GunnerMagCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerLaunchableName { + displayName = CSTRING(gunnerLaunchableName); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerLaunchableCount { + displayName = CSTRING(gunnerLaunchableCount); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerZeroing { + displayName = CSTRING(GunnerZeroing); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + class gunnerWeaponLowerInfoBackground { + displayName = CSTRING(GunnerWeaponLowerInfoBackground); + description = CSTRING(RequiresSoldierVehicleWeaponInfo); + typeName = "BOOL"; + defaultValue = 1; + }; + // Vehicle class vehicleName { displayName = CSTRING(VehicleName); @@ -167,12 +223,6 @@ class CfgVehicles { typeName = "BOOL"; defaultValue = 1; }; - class vehicleGunnerWeapon { - displayName = CSTRING(VehicleGunnerWeapon); - description = CSTRING(RequiresSoldierVehicleWeaponInfo); - typeName = "BOOL"; - defaultValue = 1; - }; }; class ModuleDescription { description = CSTRING(ModuleDescription); diff --git a/addons/ui/XEH_PREP.hpp b/addons/ui/XEH_PREP.hpp index 8a6b4d2ce1..5c01ea1c3e 100644 --- a/addons/ui/XEH_PREP.hpp +++ b/addons/ui/XEH_PREP.hpp @@ -1,3 +1,4 @@ +PREP(findSetElement); PREP(moduleInit); PREP(setAdvancedElement); PREP(setElements); diff --git a/addons/ui/XEH_clientInit.sqf b/addons/ui/XEH_clientInit.sqf index d228696fc0..450ea0904f 100644 --- a/addons/ui/XEH_clientInit.sqf +++ b/addons/ui/XEH_clientInit.sqf @@ -3,38 +3,39 @@ // Exit on Headless if (!hasInterface) exitWith {}; -["SettingsInitialized", { +["ace_settingsInitialized", { // Initial settings - [true] call FUNC(setElements); + [false] call FUNC(setElements); // On load and entering/exiting a vehicle - ["infoDisplayChanged", { + ["ace_infoDisplayChanged", { // Selective UI Advanced // Defaults must be set in this EH to make sure controls are activated and advanced settings can be modified private _force = [true, false] select (GVAR(allowSelectiveUI)); { - [_x select 0, _x select 1, _x select 2, _force] call FUNC(setAdvancedElement); - } forEach ELEMENTS_ADVANCED; - }] call EFUNC(common,addEventHandler); + private _name = configName _x; + [_name, missionNamespace getVariable (format [QGVAR(%1), _name]), false, _force] call FUNC(setAdvancedElement); + } forEach ("true" configClasses (configFile >> "ACE_UI")); + + // Execute local event for when it's safe to modify UI through this API + // infoDisplayChanged can execute multiple times, make sure it only happens once + if (!GVAR(interfaceInitialized)) then { + [QGVAR(InterfaceInitialized), []] call CBA_fnc_localEvent; + GVAR(interfaceInitialized) = true; + }; + }] call CBA_fnc_addEventHandler; // On changing settings - ["SettingChanged", { + ["ace_settingChanged", { params ["_name"]; - // Selective UI Basic if (_name in ELEMENTS_BASIC) then { - [false] call FUNC(setElements); - }; - - // Selective UI Advanced - { - _x params ["_idd", "_elements", "_elementName"]; - - if (_name == _elementName) then { - [_idd, _elements, _elementName] call FUNC(setAdvancedElement); - TRACE_2("Setting Changed",_name,_elementName); + [true] call FUNC(setElements); + } else { + if (isClass (configFile >> "ACE_UI" >> _name select [7])) then { + [_name select [7], missionNamespace getVariable _name, true] call FUNC(setAdvancedElement); }; - } forEach ELEMENTS_ADVANCED; - }] call EFUNC(common,addEventHandler); + }; + }] call CBA_fnc_addEventHandler; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/ui/XEH_preInit.sqf b/addons/ui/XEH_preInit.sqf index 4a5638fc03..8646227653 100644 --- a/addons/ui/XEH_preInit.sqf +++ b/addons/ui/XEH_preInit.sqf @@ -5,5 +5,6 @@ ADDON = false; #include "XEH_PREP.hpp" GVAR(elementsSet) = []; +GVAR(interfaceInitialized) = false; ADDON = true; diff --git a/addons/ui/config.cpp b/addons/ui/config.cpp index d6fbed61ae..d480a5f33b 100644 --- a/addons/ui/config.cpp +++ b/addons/ui/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"VKing", "Jonpas"}; - authorUrl = "http://ace3mod.com/"; + author = ECSTRING(common,ACETeam); + authors[] = {"VKing", "Jonpas"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,6 +17,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" +#include "ACE_UI.hpp" #include "RscChat.hpp" #include "RscVignette.hpp" diff --git a/addons/ui/functions/fnc_findSetElement.sqf b/addons/ui/functions/fnc_findSetElement.sqf new file mode 100644 index 0000000000..939d371c04 --- /dev/null +++ b/addons/ui/functions/fnc_findSetElement.sqf @@ -0,0 +1,25 @@ +/* + * Author: Jonpas + * Finds set element by element name and returns index, source of the set element and state. + * + * Arguments: + * 0: Element Name + * + * Return Value: + * None + * + * Example: + * ["ace_ui_ammoCount"] call ace_ui_fnc_findSetElement + * + * Public: No + */ +#include "script_component.hpp" + +params ["_element"]; + +{ + if (_element in _x) exitWith { + [_forEachIndex, _x select 0, _x select 2] + }; + [-1, "", false] +} forEach GVAR(elementsSet); diff --git a/addons/ui/functions/fnc_moduleInit.sqf b/addons/ui/functions/fnc_moduleInit.sqf index 10f18f94f3..6bfe29392f 100644 --- a/addons/ui/functions/fnc_moduleInit.sqf +++ b/addons/ui/functions/fnc_moduleInit.sqf @@ -18,12 +18,13 @@ params ["_logic", "_units", "_activated"]; if (!_activated) exitWith {}; +[_logic, QGVAR(allowSelectiveUI), "allowSelectiveUI"] call EFUNC(common,readSettingFromModule); + // Basic if (isArray (missionConfigFile >> "showHUD")) then { // HUD visibility is hardcoded in mission config and showHUD command is overriden ACE_LOGINFO("User Interface Module Failed to Initialize Basic settings - showHUD overriden in mission config!"); } else { - [_logic, QGVAR(allowSelectiveUI), "allowSelectiveUI"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(soldierVehicleWeaponInfo), "soldierVehicleWeaponInfo"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleRadar), "vehicleRadar"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleCompass), "vehicleCompass"] call EFUNC(common,readSettingFromModule); @@ -44,6 +45,16 @@ if (isArray (missionConfigFile >> "showHUD")) then { [_logic, QGVAR(weaponLowerInfoBackground), "weaponLowerInfoBackground"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(stance), "stance"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(staminaBar), "staminaBar"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerWeaponName), "gunnerWeaponName"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerWeaponNameBackground), "gunnerWeaponNameBackground"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerFiringMode), "gunnerFiringMode"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerAmmoType), "gunnerAmmoType"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerAmmoCount), "gunnerAmmoCount"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerMagCount), "gunnerMagCount"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerLaunchableName), "gunnerLaunchableName"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerLaunchableCount), "gunnerLaunchableCount"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerZeroing), "gunnerZeroing"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(gunnerWeaponLowerInfoBackground), "gunnerWeaponLowerInfoBackground"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleName), "vehicleName"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleNameBackground), "vehicleNameBackground"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleFuelBar), "vehicleFuelBar"] call EFUNC(common,readSettingFromModule); @@ -51,6 +62,5 @@ if (isArray (missionConfigFile >> "showHUD")) then { [_logic, QGVAR(vehicleAltitude), "vehicleAltitude"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleDamage), "vehicleDamage"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(vehicleInfoBackground), "vehicleInfoBackground"] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(vehicleGunnerWeapon), "vehicleGunnerWeapon"] call EFUNC(common,readSettingFromModule); ACE_LOGINFO_1("User Interface Module Initialized. Allow client modifications: %1",GVAR(allowSelectiveUI)); diff --git a/addons/ui/functions/fnc_setAdvancedElement.sqf b/addons/ui/functions/fnc_setAdvancedElement.sqf index 2ef88d5868..f068c48ed0 100644 --- a/addons/ui/functions/fnc_setAdvancedElement.sqf +++ b/addons/ui/functions/fnc_setAdvancedElement.sqf @@ -3,33 +3,65 @@ * Sets advanced visible element of the UI using displays and controls. * * Arguments: - * 0: Element IDD - * 1: Element IDCs - * 2: Show/Hide Element OR Element ACE Settings Variable + * 0: Element Name + * 1: Show/Hide Element + * 2: Show Hint * 3: Force change even when disallowed (default: false) * * Return Value: * Successfully Set * * Example: - * [303, [188], true, false] call ace_ui_fnc_setAdvancedElement + * ["ace_ui_ammoCount", true, false] call ace_ui_fnc_setAdvancedElement * * Public: No */ #include "script_component.hpp" -params ["_idd", "_elements", "_show", ["_force", false, [true]] ]; - -if (_elementInfo in GVAR(elementsSet)) exitWith {}; +params ["_element", "_show", ["_showHint", false, [true]], ["_force", false, [true]] ]; if (!_force && {!GVAR(allowSelectiveUI)}) exitWith { - [LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured) + [LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured); + false }; -// Get show/hide boolean from mission namespace if it's a string -if (typeName _show == "STRING") then { - _show = missionNamespace getVariable _show; +private _config = configFile >> "ACE_UI" >> _element; + +// Exit if main vehicle type condition not fitting +private _location = getNumber (_config >> "location"); // (0-both, 1-ground, 2-vehicle) +private _canUseWeapon = ACE_player call CBA_fnc_canUseWeapon; +if ((_canUseWeapon && _location == 2) || (!_canUseWeapon && _location == 1)) exitWith {false}; + +private _idd = getNumber (_config >> "idd"); +private _elements = getArray (_config >> "elements"); + +// Get setting from config API +{ + private _condition = call compile (getText _x); + if !(_condition) exitWith { + // Display and print info which component forced the element except for default vehicle check + if (_showHint) then { + [LSTRING(Disabled), 2] call EFUNC(common,displayTextStructured); + ACE_LOGINFO_2("Attempted modification of a forced User Interface element '%1' by '%2'",_element,configName _x); + }; + _show = false; + }; +} forEach (configProperties [_config >> "conditions"]); + +// Get setting from scripted API +if (!_force) then { + private _setElement = [_element] call FUNC(findSetElement); + _setElement params ["_indexSet", "_sourceSet", "_showSet"]; + + if (_indexSet != -1) then { + if (_showHint) then { + [LSTRING(Disabled), 2] call EFUNC(common,displayTextStructured); + ACE_LOGINFO_2("Attempted modification of a forced User Interface element '%1' by '%2'",_element,_sourceSet); + }; + _show = _showSet; + }; }; + _show = [1, 0] select _show; // Disable/Enable elements @@ -40,7 +72,7 @@ private _success = false; // Loop through IGUI displays as they can be present several times for some reason { if (_idd == ctrlIDD _x) then { - TRACE_3("Setting Element Visibility",_show,_idd,_idc); + //TRACE_3("Setting Element Visibility",_show,_idd,_idc); (_x displayCtrl _idc) ctrlSetFade _show; (_x displayCtrl _idc) ctrlCommit 0; diff --git a/addons/ui/functions/fnc_setElementVisibility.sqf b/addons/ui/functions/fnc_setElementVisibility.sqf index b019c4c081..f8ed74c4ad 100644 --- a/addons/ui/functions/fnc_setElementVisibility.sqf +++ b/addons/ui/functions/fnc_setElementVisibility.sqf @@ -3,47 +3,64 @@ * Setter for toggling advanced element visibility. * * Arguments: - * 0: Set/Unset (default: true) - * 1: Element IDD (default: 0) - * 2: Element IDCs (default: []) - * 3: Show/Hide Element OR Element ACE Settings Variable (default: false) + * 0: Source + * 1: Set/Unset + * 2: Element Name + * 3: Show/Hide Element (default: false) * * Return Value: * None * * Example: - * [true, 300, [188], false] call ace_ui_fnc_setElementVisibility + * ["ace_reload", true, "ace_ui_ammoCount", false] call ace_ui_fnc_setElementVisibility * * Public: Yes */ #include "script_component.hpp" params [ + ["_source", "", [""]], ["_set", true, [true]], - ["_idd", 0, [0]], - ["_elements", [], [[]]], - ["_show", false, [true, ""]] + ["_element", "", [""]], + ["_show", false, [true]] ]; +// Verify element is bound +if (!isClass (configFile >> "ACE_UI" >> _element)) exitWith { + ACE_LOGWARNING_1("Element '%1' does not exist",_element); +}; + +if (_source == "" || {_element == ""}) exitWith { + ACE_LOGWARNING("Source or Element may not be empty strings!"); +}; + private _return = false; -if (_set) then { - if ([_idd, _elements] in GVAR(elementsSet)) exitWith { TRACE_3("Element already set",_idd,_elements,GVAR(elementsSet)); }; +private _setElement = [_element] call FUNC(findSetElement); +_setElement params ["_indexSet", "_sourceSet"]; - TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet)); - private _success = [_idd, _elements, _show] call FUNC(setAdvancedElement); +if (_set) then { + // Exit if element has been set from another component, print warning if after interface initialization + if (_indexSet != -1) exitWith { + if (GVAR(interfaceInitialized)) then { + ACE_LOGWARNING_2("Element '%1' already set by %2",_element,_sourceSet); + }; + }; + + TRACE_4("Setting element",_source,_element,_show,GVAR(elementsSet)); + private _success = [_element, _show, false, true] call FUNC(setAdvancedElement); if (_success) then { - GVAR(elementsSet) pushBack [_idd, _elements]; + GVAR(elementsSet) pushBack [_source, _element, _show]; _return = true; }; } else { - if ([_idd, _elements] in GVAR(elementsSet)) then { - TRACE_4("Setting element",_idd,_elements,_show,GVAR(elementsSet)); - [_idd, _elements, _show] call FUNC(setAdvancedElement); + if (_indexSet != -1) then { + TRACE_4("Unsetting element",_sourceSet,_element,_show,GVAR(elementsSet)); - private _index = GVAR(elementsSet) find [_idd, _elements]; - GVAR(elementsSet) deleteAt _index; + GVAR(elementsSet) deleteAt _indexSet; + + [_element, _show, false, true] call FUNC(setAdvancedElement); _return = true; }; }; diff --git a/addons/ui/functions/fnc_setElements.sqf b/addons/ui/functions/fnc_setElements.sqf index 64b716ee29..f029a9f5ae 100644 --- a/addons/ui/functions/fnc_setElements.sqf +++ b/addons/ui/functions/fnc_setElements.sqf @@ -3,7 +3,7 @@ * Sets basic visible elements of the UI using showHUD setter. * * Arguments: - * 0: Force change even when disallowed (default: false) + * 0: Show Hint (default: false) * * Return Value: * None @@ -15,12 +15,12 @@ */ #include "script_component.hpp" -if (isArray (missionConfigFile >> "showHUD")) exitWith {}; +params [["_showHint", false]]; -params [ ["_force", false, [true]] ]; - -if (!_force && {!GVAR(allowSelectiveUI)}) exitWith { - [LSTRING(Disallowed), 2] call EFUNC(common,displayTextStructured); +if (isArray (missionConfigFile >> "showHUD")) exitWith { + if (_showHint) then { + [LSTRING(Disabled)] call EFUNC(common,displayTextStructured); + }; }; ["ui", [ diff --git a/addons/ui/script_component.hpp b/addons/ui/script_component.hpp index a7410a49b8..44ca977563 100644 --- a/addons/ui/script_component.hpp +++ b/addons/ui/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT ui +#define COMPONENT_BEAUTIFIED UI #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -17,51 +18,26 @@ #include "\z\ace\addons\main\script_macros.hpp" -// Elements +// Basic Elements #define ELEMENTS_BASIC [QGVAR(soldierVehicleWeaponInfo), QGVAR(vehicleRadar), QGVAR(vehicleCompass), QGVAR(commandMenu), QGVAR(groupBar)] -// IDD, IDC, Element (must be string to compare to changed setting name) -#define ELEMENTS_ADVANCED [ \ - [300, [118], QGVAR(weaponName)], \ - [300, [1001, 1008], QGVAR(weaponNameBackground)], \ - [300, [187, 1203], QGVAR(firingMode)], \ - [300, [155], QGVAR(ammoType)], \ - [300, [184], QGVAR(ammoCount)], \ - [300, [185], QGVAR(magCount)], \ - [300, [152], QGVAR(throwableName)], \ - [300, [151], QGVAR(throwableCount)], \ - [300, [1202], QGVAR(weaponLowerInfoBackground)], \ - [300, [168], QGVAR(zeroing)], \ - [305, [193], QGVAR(staminaBar)], \ - [303, [188, 1201], QGVAR(stance)], \ - [300, [120], QGVAR(vehicleName)], \ - [300, [1000, 1013], QGVAR(vehicleNameBackground)], \ - [300, [113, 1202], QGVAR(vehicleFuelBar)], \ - [300, [121, 1004, 1006], QGVAR(vehicleSpeed)], \ - [300, [122, 1005, 1014], QGVAR(vehicleAltitude)], \ - [300, [111], QGVAR(vehicleDamage)], \ - [300, [1200], QGVAR(vehicleInfoBackground)], \ - [300, [150], QGVAR(vehicleGunnerWeapon)] \ -] - - /* RscUnitInfo = 300 -------------------- -118 (Weapon Name) -+ 1001 (Weapon Name Background 1/2) -+ 1008 (Weapon Name Background 2/2) +118 (Weapon Name / Gunner Weapon Name) ++ 1001 (Weapon Name Background 1/2 / Gunner Weapon Name Background 1/2) ++ 1008 (Weapon Name Background 2/2 / Gunner Weapon Name Background 2/2) -187 (Firing Mode) -+ 1203 (Firing Mode Background) +187 (Firing Mode / Gunner Firing Mode) ++ 1203 (Firing Mode Background / Gunner Firing Mode Background) -155 (Ammo Type) -184 (Ammo Count) - disabled in config by ace_reload -185 (Magazine Count) -152 (Grenade/Flare Type) -151 (Grenade/Flare Count) -1202 (Lower Weapon Info Background) -168 (Zeroing) +155 (Ammo Type / Gunner Ammo Type) +184 (Ammo Count / Gunner Ammo Count) +185 (Magazine Count / Gunner Magazine Count) +152 (Grenade/Flare Type / Launchable Type) +151 (Grenade/Flare Count / Launchable Count) +1202 (Lower Weapon Info Background / Gunner Lower Weapon Info Background) +168 (Zeroing / Gunner Zeroing) 120 (Vehicle Name) @@ -80,8 +56,6 @@ RscUnitInfo = 300 111 (Vehicle Damage) 1200 (Vehicle Info Background) -150 (Vehicle Gunner Weapon) - RscStanceInfo = 303 -------------------- diff --git a/addons/ui/stringtable.xml b/addons/ui/stringtable.xml index 74cd89e93b..77b9ad66a9 100644 --- a/addons/ui/stringtable.xml +++ b/addons/ui/stringtable.xml @@ -4,128 +4,241 @@ User Interface Uživatelské rozhraní + Interface do usuário + Interface utilisateur User Interface Uživatelské rozhraní + Interface do usuário + Interface utilisateur This module allows toggling visible user interface parts. + Este módulo permite ligar ou desligar partes da interface do usuário + Ce module permet le basculement de parties visibles de l'interface utlisateur Allow Selective UI Povolit selektivní UI + Permitir IU Selecionável + Permettre l'IU selective Allow client to modify their UI. Povolit klientovi měnit jeho UI + Permite o cliente modificar sua IU. + Permet aux clients de modifier leur IU Soldier/Vehicle/Weapon Information Informace o Vojákovi/Vozidlu/Zbrani + Informação de Soldado/Veículo/Armamento + Soldat/Véhicule/Arme/Informations Vehicle Radar Radar vozidla + Radar de Veículo + Radar de véhicule Vehicle Compass Kompas vozidla + Bússola de Veículo + Compas de véhicule Command Menu Menu rozkazů + Menu de Comando + Menu de commandement Group Bar Panel skupiny + Barra de Grupo + Barre de groupe Weapon Name Název zbraně + Nome do Armamento + Nom de l''arme Weapon Name Background Název zbraně v pozadí + Fundo do Nome do Armamento + Arrière-plan du nom de l'arme Firing Mode Režim palby + Modo de Disparo + Mode de tir Ammo Type Typ munice + Tipo de Munição + Type de munitions Ammo Count Počet munice + Quantidade de Munição + Nombre de munitions Magazine Count Počet zásobníků + Quantidade de Carregadores + Nombre de chargeurs Throwable Type Typ granátů apod. + Tipo de Arremessável + Type d'objets de lancer Throwable Count Počet granátů apod. + Quantidade de Arremessável + Nombre d'objets de lancer Zeroing Náměr + Zerar a mira + Mise à zéro Weapon Lower Info Background + Informações na parte de baixo do fundo do Armamento + Arrière-plan des informations inférieures de l'arme Stance Postoj + Postura + Posture Stamina Bar Panel výdrže + Barra de Energia + Barre d'endurance + + + Gunner Weapon Name + Nome da arma do fuzileiro + Nom de l'arme du tireur + + + Gunner Weapon Name Background + Fundo do nome da arma do fuzileiro + Arrière-plan du nom de l'arme (tireur) + + + Gunner Firing Mode + Modo de disparo do fuzileiro + Mode de tir (tireur) + + + Gunner Ammo Type + Tipo de Munição do fuzileiro + Type de munitions (tireur) + + + Gunner Ammo Count + Quantidade de Munição do fuzileiro + Nombre de munitions (tireur) + + + Gunner Magazine Count + Quantidade de Carregadores do fuzileiro + Nombre de chargeurs (tireur) + + + Gunner Launchable Type + Tipo de Arremessável do fuzileiro + Type d'objets jetable ( tireur) + + + Gunner Launchable Count + Quantidade de Arremessável do fuzileiro + Nombre d'objets jetable (tireur) + + + Gunner Zeroing + Zerar a mira do fuzileiro + Mise à zéro ( tireur) + + + Gunner Weapon Lower Info Background + Informações na parte de baixo do fundo do Armamento do fuzileiro + Arrière-plan des informations inférieures (tireur) Vehicle Name Název vozidla + Nome do Veículo + Nom du véhicule Vehicle Name Background Název vozidla v pozadí + Fundo do Nome do Veículo + Arrière-plan du nom du véhicule Vehicle Fuel Bar Ukazatel paliva + Barra de Combustível do Veículo + Barre d'éssence du véhicule Vehicle Speed Rychlost vozidla + Velocidade do Veículo + Vitesse du véhicule Vehicle Altitude Výška vozidla + Altitude do Veículo + Altitude du véhicule Vehicle Damage Poškození vozidla + Dano do Veículo + Dégats du véhicule Vehicle Info Background Info o vozidle v pozadí - - - Vehicle Gunner Weapon - Střelcova zbraň ve vozidle + Fundo das informações do veículo + Arrière-plan des informations du véhicule - Requires Soldier/Vehicle/Weapons Information. + Requires Soldier/Vehicle/Weapon Information. Vyžaduje informace o Vojákovi/Vozidlu/Zbrani + Requer informações de Soldado/Veículo/Armamento + Requiert les informations de soldat/Vehicule/Arme. Modifying User Interface is disabled. Změna uživatelského rozhraní je zakázána. + A modificação da interface do usuário está desabilitada. + Modifications de l'interface utilisateur désactivé. + + + Cannot modify a forced User Interface element. + Não é possível modificar um elemento forçado da interface do usuário. + Impossible de modifier un élément de l'interface utilisateur forcé \ No newline at end of file diff --git a/addons/vector/CfgWeapons.hpp b/addons/vector/CfgWeapons.hpp index a28321bdc8..cc2cf985f6 100644 --- a/addons/vector/CfgWeapons.hpp +++ b/addons/vector/CfgWeapons.hpp @@ -5,9 +5,9 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(VectorName); descriptionShort = CSTRING(VectorDescription); - model = PATHTOF(ace_vector.p3d); - modelOptics = PATHTOF(ace_vector_optics.p3d); - picture = PATHTOF(UI\ace_vector_x_ca.paa); + model = QPATHTOF(ace_vector.p3d); + modelOptics = QPATHTOF(ace_vector_optics.p3d); + picture = QPATHTOF(UI\ace_vector_x_ca.paa); visionMode[] = {"Normal","NVG"}; opticsZoomMax = 0.06621; opticsZoomMin = 0.06621; diff --git a/addons/vector/config.cpp b/addons/vector/config.cpp index e4cdf9a55b..2f2302d9af 100644 --- a/addons/vector/config.cpp +++ b/addons/vector/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_Vector"}; weapons[] = {"ACE_Vector", "ACE_VectorDay"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Ghost","Hamburger SV","commy2","bux578"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"Ghost","Hamburger SV","commy2","bux578"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -18,3 +20,7 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "RscInGameUI.hpp" + +class ACE_newEvents { + RangerfinderData = QGVAR(rangefinderData); +}; diff --git a/addons/vector/functions/fnc_convertToTexturesDegree.sqf b/addons/vector/functions/fnc_convertToTexturesDegree.sqf index a028012cec..b94c2edf64 100644 --- a/addons/vector/functions/fnc_convertToTexturesDegree.sqf +++ b/addons/vector/functions/fnc_convertToTexturesDegree.sqf @@ -32,25 +32,25 @@ if (GVAR(useMil)) then { _digit1 = floor (_number / 100); _digit2 = floor (_number / 10) - _digit1 * 10; _digit3 = _number mod 10; - _digit4 = QUOTE(PATHTOF(rsc\vector_degree.paa)); + _digit4 = QPATHTOF(rsc\vector_degree.paa); if (_isNegative) then { if (_digit1 == 0) then { if (_digit2 == 0) then { _digit1 = ""; - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; } else { - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; }; } else { - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; } else { @@ -59,16 +59,16 @@ if (GVAR(useMil)) then { if (_digit2 == 0) then { _digit1 = ""; _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; } else { _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; }; } else { - _digit1 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit1]; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; + _digit1 = format [QPATHTOF(rsc\vector_%1.paa), _digit1]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; }; }; diff --git a/addons/vector/functions/fnc_convertToTexturesDistance.sqf b/addons/vector/functions/fnc_convertToTexturesDistance.sqf index ea0d054e5e..eb39febfe8 100644 --- a/addons/vector/functions/fnc_convertToTexturesDistance.sqf +++ b/addons/vector/functions/fnc_convertToTexturesDistance.sqf @@ -15,7 +15,7 @@ _isNegative = _number < 0; _number = abs _number; if (_number >= 10000) exitWith { - [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return + [QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa)] // return }; private ["_digit1", "_digit2", "_digit3", "_digit4"]; @@ -32,25 +32,25 @@ if (_isNegative) then { if (_digit3 == 0) then { _digit1 = ""; _digit2 = ""; - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; } else { _digit1 = ""; - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; } else { @@ -61,24 +61,24 @@ if (_isNegative) then { _digit1 = ""; _digit2 = ""; _digit3 = ""; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; } else { _digit1 = ""; _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { - _digit1 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit1]; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit1 = format [QPATHTOF(rsc\vector_%1.paa), _digit1]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; }; diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index 6141e40fa8..7a77a3aab8 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -16,7 +16,7 @@ _isNegative = _number < 0; _number = abs _number; if (_number > 9999) exitWith { - [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return + [QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa)] // return }; private ["_digit0", "_digit1", "_digit2", "_digit3", "_digit4"]; @@ -35,31 +35,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_l.paa)); + _digit0 = QPATHTOF(rsc\vector_l.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit3 = ""; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_l.paa)); + _digit0 = QPATHTOF(rsc\vector_l.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_l.paa)); + _digit0 = QPATHTOF(rsc\vector_l.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; } else { @@ -67,31 +67,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_r.paa)); + _digit0 = QPATHTOF(rsc\vector_r.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit3 = ""; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_r.paa)); + _digit0 = QPATHTOF(rsc\vector_r.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_r.paa)); + _digit0 = QPATHTOF(rsc\vector_r.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; }; @@ -104,31 +104,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); + _digit0 = QPATHTOF(rsc\vector_d.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit3 = ""; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); + _digit0 = QPATHTOF(rsc\vector_d.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); + _digit0 = QPATHTOF(rsc\vector_d.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; } else { @@ -136,31 +136,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_a.paa)); + _digit0 = QPATHTOF(rsc\vector_a.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit3 = ""; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_a.paa)); + _digit0 = QPATHTOF(rsc\vector_a.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_a.paa)); + _digit0 = QPATHTOF(rsc\vector_a.paa); _digit1 = ""; - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; }; @@ -173,31 +173,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_u.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_p.paa)); + _digit0 = QPATHTOF(rsc\vector_u.paa); + _digit1 = QPATHTOF(rsc\vector_p.paa); _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_u.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_p.paa)); + _digit0 = QPATHTOF(rsc\vector_u.paa); + _digit1 = QPATHTOF(rsc\vector_p.paa); _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_u.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_p.paa)); - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit0 = QPATHTOF(rsc\vector_u.paa); + _digit1 = QPATHTOF(rsc\vector_p.paa); + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; } else { @@ -205,31 +205,31 @@ switch (_coordinate) do { if (_digit1 == 0) then { if (_digit2 == 0) then { if (_digit3 == 0) then { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_n.paa)); + _digit0 = QPATHTOF(rsc\vector_d.paa); + _digit1 = QPATHTOF(rsc\vector_n.paa); _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; _digit4 = ""; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_n.paa)); + _digit0 = QPATHTOF(rsc\vector_d.paa); + _digit1 = QPATHTOF(rsc\vector_n.paa); _digit2 = ""; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { - _digit0 = QUOTE(PATHTOF(rsc\vector_d.paa)); - _digit1 = QUOTE(PATHTOF(rsc\vector_n.paa)); - _digit2 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit2]; - _digit3 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit3]; - _digit4 = format [QUOTE(PATHTOF(rsc\vector_%1.paa)), _digit4]; + _digit0 = QPATHTOF(rsc\vector_d.paa); + _digit1 = QPATHTOF(rsc\vector_n.paa); + _digit2 = format [QPATHTOF(rsc\vector_%1.paa), _digit2]; + _digit3 = format [QPATHTOF(rsc\vector_%1.paa), _digit3]; + _digit4 = format [QPATHTOF(rsc\vector_%1.paa), _digit4]; }; } else { _digit0 = ""; - _digit1 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit2 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit3 = QUOTE(PATHTOF(rsc\vector_minus.paa)); - _digit4 = QUOTE(PATHTOF(rsc\vector_minus.paa)); + _digit1 = QPATHTOF(rsc\vector_minus.paa); + _digit2 = QPATHTOF(rsc\vector_minus.paa); + _digit3 = QPATHTOF(rsc\vector_minus.paa); + _digit4 = QPATHTOF(rsc\vector_minus.paa); }; }; @@ -238,7 +238,7 @@ switch (_coordinate) do { // trap errors if !([_digit0, _digit1, _digit2, _digit3, _digit4] isEqualTypeAll "") exitWith { - [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return + [QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa), QPATHTOF(rsc\vector_minus.paa)] // return }; [_digit0, _digit1, _digit2, _digit3, _digit4] diff --git a/addons/vector/functions/fnc_dataTransfer.sqf b/addons/vector/functions/fnc_dataTransfer.sqf index 25403b82ee..f99490f04c 100644 --- a/addons/vector/functions/fnc_dataTransfer.sqf +++ b/addons/vector/functions/fnc_dataTransfer.sqf @@ -22,4 +22,4 @@ _direction = call FUNC(getDirection); _azimuth = _direction select 0; _inclination = _direction select 1; //Send Data to connected GPS -["RangerfinderData", [_distance, _azimuth, _inclination]] call EFUNC(common,localEvent); \ No newline at end of file +[QGVAR(rangefinderData), [_distance, _azimuth, _inclination]] call CBA_fnc_localEvent; diff --git a/addons/vector/functions/fnc_onKeyDown.sqf b/addons/vector/functions/fnc_onKeyDown.sqf index 9fa51e9068..feb706bc02 100644 --- a/addons/vector/functions/fnc_onKeyDown.sqf +++ b/addons/vector/functions/fnc_onKeyDown.sqf @@ -40,19 +40,19 @@ switch (_this select 0) do { // handle input in option menu if (GVAR(currentMode) == "settings") exitWith { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 1) exitWith {}; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 1) exitWith {}; - if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) then { + if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) then { GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1; } else { GVAR(keyDownTabCountAzimuth) = 1; }; - GVAR(keyDownTimeAzimuth) = ACE_diagTime; + GVAR(keyDownTimeAzimuth) = diag_tickTime; }; if (GVAR(currentMode) == "config") exitWith { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; ["config"] call FUNC(nextMode); }; @@ -66,30 +66,30 @@ switch (_this select 0) do { [false] call FUNC(showP1); // handle 5 times clicking - if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) then { + if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) then { GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1; - GVAR(keyDownTimeAzimuth) = ACE_diagTime; + GVAR(keyDownTimeAzimuth) = diag_tickTime; } else { GVAR(keyDownTabCountAzimuth) = 1; }; // open settings menu if (GVAR(keyDownTabCountAzimuth) == 5) exitWith { - GVAR(keyDownTimeMenu) = ACE_diagTime; - GVAR(keyDownTimeAzimuth) = ACE_diagTime; + GVAR(keyDownTimeMenu) = diag_tickTime; + GVAR(keyDownTimeAzimuth) = diag_tickTime; GVAR(keyDownTabCountAzimuth) = 0; GVAR(configTemp) = [GVAR(useFeet), GVAR(useMil)]; ["settings"] call FUNC(showText); "settings" call _fnc_setPFH; }; - if (ACE_diagTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith { + if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith { "azimuth+inclination" call _fnc_setPFH; }; - GVAR(keyDownTimeAzimuth) = ACE_diagTime; + GVAR(keyDownTimeAzimuth) = diag_tickTime; - if (ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5) then { + if (diag_tickTime > GVAR(keyDownTimeDistance) + 0.5) then { if !(GETGVAR(isKeyDownDistance,false)) then { ["distance"] call FUNC(clearDisplay); "azimuth" call _fnc_setPFH; @@ -110,19 +110,19 @@ switch (_this select 0) do { // handle input in option menu if (GVAR(currentMode) == "config") exitWith { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; - if (ACE_diagTime < GVAR(keyDownTimeDistance) + 0.5) then { + if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) then { GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1; } else { GVAR(keyDownTabCountDistance) = 1; }; - GVAR(keyDownTimeDistance) = ACE_diagTime; + GVAR(keyDownTimeDistance) = diag_tickTime; }; if (GVAR(currentMode) == "settings") exitWith { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 0.5) exitWith {}; ["settings"] call FUNC(nextMode); }; @@ -141,30 +141,30 @@ switch (_this select 0) do { [false] call FUNC(showP1); // handle 5 times clicking - if (ACE_diagTime < GVAR(keyDownTimeDistance) + 0.5) then { + if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) then { GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1; - GVAR(keyDownTimeDistance) = ACE_diagTime; + GVAR(keyDownTimeDistance) = diag_tickTime; } else { GVAR(keyDownTabCountDistance) = 1; }; // open config menu if (GVAR(keyDownTabCountDistance) == 5) exitWith { - GVAR(keyDownTimeMenu) = ACE_diagTime; - GVAR(keyDownTimeDistance) = ACE_diagTime; + GVAR(keyDownTimeMenu) = diag_tickTime; + GVAR(keyDownTimeDistance) = diag_tickTime; GVAR(keyDownTabCountDistance) = 0; GVAR(configTemp) = GVAR(modeReticle); ["config"] call FUNC(showText); "config" call _fnc_setPFH; }; - if (ACE_diagTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { + if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { "height+distance" call _fnc_setPFH; }; - GVAR(keyDownTimeDistance) = ACE_diagTime; + GVAR(keyDownTimeDistance) = diag_tickTime; - if (ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.5) then { + if (diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5) then { if !(GETGVAR(isKeyDownAzimuth,false)) then { ["azimuth"] call FUNC(clearDisplay); "distance" call _fnc_setPFH; diff --git a/addons/vector/functions/fnc_onKeyHold.sqf b/addons/vector/functions/fnc_onKeyHold.sqf index 517cf3ea37..ee6d80e2de 100644 --- a/addons/vector/functions/fnc_onKeyHold.sqf +++ b/addons/vector/functions/fnc_onKeyHold.sqf @@ -21,7 +21,7 @@ switch (_this select 0) do { case ("azimuth"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.2; + _isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.2; [false] call FUNC(showCenter); @@ -42,7 +42,7 @@ switch (_this select 0) do { case ("distance"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; [_isReady] call FUNC(showCenter); @@ -66,7 +66,7 @@ switch (_this select 0) do { call FUNC(showAzimuth); private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; [_isReady] call FUNC(showCenter); @@ -89,7 +89,7 @@ switch (_this select 0) do { case ("azimuth+inclination"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.2; + _isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.2; [false] call FUNC(showCenter); @@ -110,7 +110,7 @@ switch (_this select 0) do { case ("height+distance"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; [_isReady] call FUNC(showCenter); @@ -132,7 +132,7 @@ switch (_this select 0) do { case ("relative_distance"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5; [_isReady] call FUNC(showCenter); @@ -155,7 +155,7 @@ switch (_this select 0) do { case ("relative_height+length"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5; [_isReady] call FUNC(showCenter); @@ -178,7 +178,7 @@ switch (_this select 0) do { case ("relative_azimuth+distance"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; [_isReady] call FUNC(showCenter); @@ -201,7 +201,7 @@ switch (_this select 0) do { case ("fall_of_shot"): { private "_isReady"; - _isReady = ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5; + _isReady = diag_tickTime > GVAR(keyDownTimeDistance) + 0.5; [_isReady] call FUNC(showCenter); @@ -223,8 +223,8 @@ switch (_this select 0) do { }; case ("settings"): { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 1) exitWith { - GVAR(keyDownTimeAzimuth) = ACE_diagTime; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 1) exitWith { + GVAR(keyDownTimeAzimuth) = diag_tickTime; }; [["meter", "feet"] select (GVAR(configTemp) select 0)] call FUNC(showText); @@ -247,7 +247,7 @@ switch (_this select 0) do { }; }; - if (GVAR(keyDownTabCountAzimuth) > 0 && {ACE_diagTime > GVAR(keyDownTimeAzimuth) + 0.5}) exitWith { + if (GVAR(keyDownTabCountAzimuth) > 0 && {diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.5}) exitWith { ["clear_left"] call FUNC(showText); ["clear_right"] call FUNC(showText); @@ -264,8 +264,8 @@ switch (_this select 0) do { }; case ("config"): { - if (ACE_diagTime < GVAR(keyDownTimeMenu) + 1) exitWith { - GVAR(keyDownTimeDistance) = ACE_diagTime; + if (diag_tickTime < GVAR(keyDownTimeMenu) + 1) exitWith { + GVAR(keyDownTimeDistance) = diag_tickTime; }; switch (GVAR(configTemp)) do { @@ -315,7 +315,7 @@ switch (_this select 0) do { }; }; - if (GVAR(keyDownTabCountDistance) > 0 && {ACE_diagTime > GVAR(keyDownTimeDistance) + 0.5}) exitWith { + if (GVAR(keyDownTabCountDistance) > 0 && {diag_tickTime > GVAR(keyDownTimeDistance) + 0.5}) exitWith { ["clear_left"] call FUNC(showText); ["clear_right"] call FUNC(showText); diff --git a/addons/vector/functions/fnc_showCenter.sqf b/addons/vector/functions/fnc_showCenter.sqf index 1293e1286d..4870b10a69 100644 --- a/addons/vector/functions/fnc_showCenter.sqf +++ b/addons/vector/functions/fnc_showCenter.sqf @@ -7,6 +7,6 @@ Shows or hides the vectors center square thingy. */ #include "script_component.hpp" -((GETUVAR(ACE_dlgVector,displayNull)) displayCtrl 1301) ctrlSetText (["", QUOTE(PATHTOF(rsc\vector_center.paa))] select (_this select 0)); +((GETUVAR(ACE_dlgVector,displayNull)) displayCtrl 1301) ctrlSetText (["", QPATHTOF(rsc\vector_center.paa)] select (_this select 0)); [GVAR(illuminate)] call FUNC(illuminate); diff --git a/addons/vector/functions/fnc_showP1.sqf b/addons/vector/functions/fnc_showP1.sqf index 73453961c1..27f9063794 100644 --- a/addons/vector/functions/fnc_showP1.sqf +++ b/addons/vector/functions/fnc_showP1.sqf @@ -13,9 +13,9 @@ disableSerialization; _dlgVector = GETUVAR(ACE_dlgVector,displayNull); if (_this select 0) then { - (_dlgVector displayCtrl 1321) ctrlSetText QUOTE(PATHTOF(rsc\vector_1.paa)); - (_dlgVector displayCtrl 1322) ctrlSetText QUOTE(PATHTOF(rsc\vector_minus.paa)); - (_dlgVector displayCtrl 1323) ctrlSetText QUOTE(PATHTOF(rsc\vector_p.paa)); + (_dlgVector displayCtrl 1321) ctrlSetText QPATHTOF(rsc\vector_1.paa); + (_dlgVector displayCtrl 1322) ctrlSetText QPATHTOF(rsc\vector_minus.paa); + (_dlgVector displayCtrl 1323) ctrlSetText QPATHTOF(rsc\vector_p.paa); (_dlgVector displayCtrl 1324) ctrlSetText ""; } else { (_dlgVector displayCtrl 1321) ctrlSetText ""; diff --git a/addons/vector/functions/fnc_showReticle.sqf b/addons/vector/functions/fnc_showReticle.sqf index d44adfb68d..bcd565774f 100644 --- a/addons/vector/functions/fnc_showReticle.sqf +++ b/addons/vector/functions/fnc_showReticle.sqf @@ -7,6 +7,6 @@ Shows or hides the electronic reticle. */ #include "script_component.hpp" -((GETUVAR(ACE_dlgVector,displayNull)) displayCtrl 1302) ctrlSetText (["", QUOTE(PATHTOF(rsc\vector_crosshair.paa))] select (_this select 0)); +((GETUVAR(ACE_dlgVector,displayNull)) displayCtrl 1302) ctrlSetText (["", QPATHTOF(rsc\vector_crosshair.paa)] select (_this select 0)); [GVAR(illuminate)] call FUNC(illuminate); diff --git a/addons/vector/functions/fnc_showText.sqf b/addons/vector/functions/fnc_showText.sqf index 68dbe9d642..f9d85d84e3 100644 --- a/addons/vector/functions/fnc_showText.sqf +++ b/addons/vector/functions/fnc_showText.sqf @@ -10,123 +10,123 @@ switch (_this select 0) do { case ("config"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; (_dlgVector displayCtrl 1316) ctrlSetText ""; - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_c.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_f.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_i.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_g.paa)); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_c.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_n.paa); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_f.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_i.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_g.paa); (_dlgVector displayCtrl 1313) ctrlSetText ""; (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("settings"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; - (_dlgVector displayCtrl 1316) ctrlSetText QUOTE(PATHTOF(rsc\vector_u.paa)); - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_i.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_5.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_e.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); - (_dlgVector displayCtrl 1313) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); + (_dlgVector displayCtrl 1316) ctrlSetText QPATHTOF(rsc\vector_u.paa); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_n.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_i.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_t.paa); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_5.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_e.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_t.paa); + (_dlgVector displayCtrl 1313) ctrlSetText QPATHTOF(rsc\vector_t.paa); (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("nigt"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; - (_dlgVector displayCtrl 1316) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_i.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_g.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); + (_dlgVector displayCtrl 1316) ctrlSetText QPATHTOF(rsc\vector_n.paa); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_i.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_g.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_t.paa); }; case ("eret"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; - (_dlgVector displayCtrl 1316) ctrlSetText QUOTE(PATHTOF(rsc\vector_e.paa)); - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_r.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_e.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); + (_dlgVector displayCtrl 1316) ctrlSetText QPATHTOF(rsc\vector_e.paa); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_r.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_e.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_t.paa); }; case ("on"): { - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_n.paa); (_dlgVector displayCtrl 1312) ctrlSetText ""; (_dlgVector displayCtrl 1313) ctrlSetText ""; (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("off"): { - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_f.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_f.paa)); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_f.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_f.paa); (_dlgVector displayCtrl 1313) ctrlSetText ""; (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("deg"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; - (_dlgVector displayCtrl 1316) ctrlSetText QUOTE(PATHTOF(rsc\vector_3.paa)); - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_6.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_0.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_degree.paa)); + (_dlgVector displayCtrl 1316) ctrlSetText QPATHTOF(rsc\vector_3.paa); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_6.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_0.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_degree.paa); }; case ("mil"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; - (_dlgVector displayCtrl 1316) ctrlSetText QUOTE(PATHTOF(rsc\vector_6.paa)); - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_4.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_0.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_0.paa)); + (_dlgVector displayCtrl 1316) ctrlSetText QPATHTOF(rsc\vector_6.paa); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_4.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_0.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_0.paa); }; case ("meter"): { - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_5.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_1.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_minus.paa)); - (_dlgVector displayCtrl 1313) ctrlSetText QUOTE(PATHTOF(rsc\vector_u.paa)); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_5.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_1.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_minus.paa); + (_dlgVector displayCtrl 1313) ctrlSetText QPATHTOF(rsc\vector_u.paa); (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("feet"): { - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_f.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_e.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_e.paa)); - (_dlgVector displayCtrl 1313) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_f.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_e.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_e.paa); + (_dlgVector displayCtrl 1313) ctrlSetText QPATHTOF(rsc\vector_t.paa); (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("stor"): { - (_dlgVector displayCtrl 1321) ctrlSetText QUOTE(PATHTOF(rsc\vector_5.paa)); - (_dlgVector displayCtrl 1322) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); - (_dlgVector displayCtrl 1323) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1324) ctrlSetText QUOTE(PATHTOF(rsc\vector_r.paa)); + (_dlgVector displayCtrl 1321) ctrlSetText QPATHTOF(rsc\vector_5.paa); + (_dlgVector displayCtrl 1322) ctrlSetText QPATHTOF(rsc\vector_t.paa); + (_dlgVector displayCtrl 1323) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1324) ctrlSetText QPATHTOF(rsc\vector_r.paa); }; case ("old_config"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; (_dlgVector displayCtrl 1316) ctrlSetText ""; - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_1.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_d.paa)); - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_c.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); - (_dlgVector displayCtrl 1313) ctrlSetText QUOTE(PATHTOF(rsc\vector_f.paa)); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_1.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_d.paa); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_c.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_n.paa); + (_dlgVector displayCtrl 1313) ctrlSetText QPATHTOF(rsc\vector_f.paa); (_dlgVector displayCtrl 1314) ctrlSetText ""; }; case ("old_settings"): { (_dlgVector displayCtrl 1315) ctrlSetText ""; (_dlgVector displayCtrl 1316) ctrlSetText ""; - (_dlgVector displayCtrl 1317) ctrlSetText QUOTE(PATHTOF(rsc\vector_o.paa)); - (_dlgVector displayCtrl 1318) ctrlSetText QUOTE(PATHTOF(rsc\vector_1.paa)); - (_dlgVector displayCtrl 1319) ctrlSetText QUOTE(PATHTOF(rsc\vector_d.paa)); - (_dlgVector displayCtrl 1310) ctrlSetText QUOTE(PATHTOF(rsc\vector_u.paa)); - (_dlgVector displayCtrl 1311) ctrlSetText QUOTE(PATHTOF(rsc\vector_n.paa)); - (_dlgVector displayCtrl 1312) ctrlSetText QUOTE(PATHTOF(rsc\vector_i.paa)); - (_dlgVector displayCtrl 1313) ctrlSetText QUOTE(PATHTOF(rsc\vector_t.paa)); + (_dlgVector displayCtrl 1317) ctrlSetText QPATHTOF(rsc\vector_o.paa); + (_dlgVector displayCtrl 1318) ctrlSetText QPATHTOF(rsc\vector_1.paa); + (_dlgVector displayCtrl 1319) ctrlSetText QPATHTOF(rsc\vector_d.paa); + (_dlgVector displayCtrl 1310) ctrlSetText QPATHTOF(rsc\vector_u.paa); + (_dlgVector displayCtrl 1311) ctrlSetText QPATHTOF(rsc\vector_n.paa); + (_dlgVector displayCtrl 1312) ctrlSetText QPATHTOF(rsc\vector_i.paa); + (_dlgVector displayCtrl 1313) ctrlSetText QPATHTOF(rsc\vector_t.paa); (_dlgVector displayCtrl 1314) ctrlSetText ""; }; diff --git a/addons/vector/script_component.hpp b/addons/vector/script_component.hpp index 3a84d60fc4..091481fbcd 100644 --- a/addons/vector/script_component.hpp +++ b/addons/vector/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT vector +#define COMPONENT_BEAUTIFIED Vector #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_VECTOR #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/vehiclelock/CfgMagazines.hpp b/addons/vehiclelock/CfgMagazines.hpp index 62c6fdcec2..28cb00717a 100644 --- a/addons/vehiclelock/CfgMagazines.hpp +++ b/addons/vehiclelock/CfgMagazines.hpp @@ -1,7 +1,7 @@ class CfgMagazines { class CA_Magazine; class ACE_key_customKeyMagazine: CA_Magazine { - picture = QUOTE(PATHTOF(ui\keyBlack.paa)); + picture = QPATHTOF(ui\keyBlack.paa); displayName = "ACE Vehicle Key"; //!!!CANNOT be localized!!!: because it is used as part of the magazineDetail string descriptionShort = CSTRING(Item_Custom_Description); count = 1; diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 182bee611b..fdf51fb106 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -3,16 +3,16 @@ class ACE_unlockVehicle { \ displayName = CSTRING(Action_UnLock); \ condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ - statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ + statement = QUOTE([ARR_3(QUOTE(QGVAR(setVehicleLock)), [ARR_2(_target,false)], [_target])] call CBA_fnc_targetEvent); \ priority = 0.3; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + icon = QPATHTOF(ui\key_menuIcon_ca.paa); \ }; \ class ACE_lockVehicle { \ displayName = CSTRING(Action_Lock); \ condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ - statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ + statement = QUOTE([ARR_3(QUOTE(QGVAR(setVehicleLock)), [ARR_2(_target,true)], [_target])] call CBA_fnc_targetEvent); \ priority = 0.2; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + icon = QPATHTOF(ui\key_menuIcon_ca.paa); \ }; \ class ACE_lockpickVehicle { \ displayName = CSTRING(Action_Lockpick); \ @@ -27,17 +27,17 @@ displayName = CSTRING(Action_UnLock); \ distance = 4; \ condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ - statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ + statement = QUOTE([ARR_3(QUOTE(QGVAR(setVehicleLock)), [ARR_2(_target,false)], [_target])] call CBA_fnc_targetEvent); \ priority = 0.3; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + icon = QPATHTOF(ui\key_menuIcon_ca.paa); \ }; \ class ACE_lockVehicle { \ displayName = CSTRING(Action_Lock); \ distance = 4; \ condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ - statement = QUOTE([ARR_3('VehicleLock_SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ + statement = QUOTE([ARR_3(QUOTE(QGVAR(setVehicleLock)), [ARR_2(_target,true)], [_target])] call CBA_fnc_targetEvent); \ priority = 0.2; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + icon = QPATHTOF(ui\key_menuIcon_ca.paa); \ }; \ class ACE_lockpickVehicle { \ displayName = CSTRING(Action_Lockpick); \ @@ -75,7 +75,7 @@ class CfgVehicles { scope = 2; isGlobal = 0; isSingular = 1; - icon = QUOTE(PATHTOF(ui\Icon_Module_VehicleLock_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_VehicleLock_ca.paa); functionPriority = 0; class Arguments { class LockVehicleInventory { @@ -113,7 +113,7 @@ class CfgVehicles { function = QFUNC(moduleSync); scope = 2; isGlobal = 0; - icon = QUOTE(PATHTOF(ui\Icon_Module_VehicleKey_ca.paa)); + icon = QPATHTOF(ui\Icon_Module_VehicleKey_ca.paa); functionPriority = 0; class Arguments {}; class ModuleDescription: ModuleDescription { diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp index 0895988737..1d72a5538d 100644 --- a/addons/vehiclelock/CfgWeapons.hpp +++ b/addons/vehiclelock/CfgWeapons.hpp @@ -8,7 +8,7 @@ class CfgWeapons { displayName = "Vehicle Key: Master"; descriptionShort = CSTRING(Item_Master_Description); model = "\A3\weapons_F\ammo\mag_univ.p3d"; - picture = QUOTE(PATHTOF(ui\keyBlack.paa)); + picture = QPATHTOF(ui\keyBlack.paa); scope = 2; class ItemInfo: InventoryItem_Base_F { mass = 0; @@ -17,26 +17,26 @@ class CfgWeapons { class ACE_key_lockpick: ACE_key_master { displayName = "Lockpick"; descriptionShort = CSTRING(Item_Lockpick_Description); - picture = QUOTE(PATHTOF(ui\lockpick.paa)); + picture = QPATHTOF(ui\lockpick.paa); }; class ACE_key_west: ACE_key_master { displayName = "Vehicle Key: West"; descriptionShort = CSTRING(Item_West_Description); - picture = QUOTE(PATHTOF(ui\keyBlue.paa)); + picture = QPATHTOF(ui\keyBlue.paa); }; class ACE_key_east: ACE_key_master { displayName = "Vehicle Key: East"; descriptionShort = CSTRING(Item_East_Description); - picture = QUOTE(PATHTOF(ui\keyRed.paa)); + picture = QPATHTOF(ui\keyRed.paa); }; class ACE_key_indp: ACE_key_master { displayName = "Vehicle Key: Independent"; descriptionShort = CSTRING(Item_Indp_Description); - picture = QUOTE(PATHTOF(ui\keyPurple.paa)); + picture = QPATHTOF(ui\keyPurple.paa); }; class ACE_key_civ: ACE_key_master { displayName = "Vehicle Key: Civilian"; descriptionShort = CSTRING(Item_Civ_Description); - picture = QUOTE(PATHTOF(ui\keyGreen.paa)); + picture = QPATHTOF(ui\keyGreen.paa); }; }; diff --git a/addons/vehiclelock/XEH_postInit.sqf b/addons/vehiclelock/XEH_postInit.sqf index 93d8bd6426..3888a6e87a 100644 --- a/addons/vehiclelock/XEH_postInit.sqf +++ b/addons/vehiclelock/XEH_postInit.sqf @@ -1,15 +1,15 @@ #include "script_component.hpp" //Add Event Handlers -["VehicleLock_SetupCustomKey", {_this call FUNC(serverSetupCustomKeyEH)}] call EFUNC(common,addEventHandler); -["VehicleLock_SetVehicleLock", {_this call FUNC(setVehicleLockEH)}] call EFUNC(common,addEventHandler); +[QGVAR(setupCustomKey), {_this call FUNC(serverSetupCustomKeyEH)}] call CBA_fnc_addEventHandler; +[QGVAR(setVehicleLock), {_this call FUNC(setVehicleLockEH)}] call CBA_fnc_addEventHandler; if (!hasInterface) exitwith {}; -["SettingsInitialized", { +["ace_settingsInitialized", { TRACE_1("SettingsInitialized eh",GVAR(LockVehicleInventory)); if (GVAR(LockVehicleInventory)) then { ["CAManBase", "InventoryOpened", {_this call FUNC(onOpenInventory);}] call CBA_fnc_addClassEventHandler; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/vehiclelock/config.cpp b/addons/vehiclelock/config.cpp index 9ee1343bc8..52299ca512 100644 --- a/addons/vehiclelock/config.cpp +++ b/addons/vehiclelock/config.cpp @@ -1,15 +1,18 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_interaction"}; - author[] = {"PabstMirror"}; - authorUrl = "https://github.com/acemod/ACE3"; - VERSION_CONFIG; - }; + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author = ECSTRING(common,ACETeam); + url = ECSTRING(main,URL); + authors[] = {"PabstMirror"}; + authorUrl = "https://github.com/acemod/ACE3"; + VERSION_CONFIG; + }; }; #include "ACE_Settings.hpp" @@ -17,3 +20,8 @@ class CfgPatches { #include "CfgMagazines.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" + +class ACE_newEvents { + VehicleLock_SetVehicleLock = QGVAR(setVehicleLock); + VehicleLock_SetupCustomKey = QGVAR(setupCustomKey); +}; diff --git a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf index 073054648e..b45bf150f3 100644 --- a/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf +++ b/addons/vehiclelock/functions/fnc_addKeyForVehicle.sqf @@ -36,7 +36,7 @@ if (_useCustom) then { _keyMagazine = _newMags select 0; TRACE_2("setting up key on server",_veh,_keyMagazine); //Have the server run add the key to the vehicle's key array: - ["VehicleLock_SetupCustomKey", [_veh, _keyMagazine]] call EFUNC(common,serverEvent); + [QGVAR(setupCustomKey), [_veh, _keyMagazine]] call CBA_fnc_serverEvent; } else { _keyName = [_veh] call FUNC(getVehicleSideKey); _unit addItem _keyName; //addItem has global effects diff --git a/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf b/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf index be23dc8dd9..b0835a6272 100644 --- a/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf +++ b/addons/vehiclelock/functions/fnc_handleVehicleInitPost.sqf @@ -38,8 +38,8 @@ TRACE_1("params",_vehicle); }; if ((_lock && {(locked _vehicle) != 2}) || {!_lock && {(locked _vehicle) != 0}}) then { TRACE_3("Setting Lock State",_lock,(typeOf _vehicle),_vehicle); - ["VehicleLock_SetVehicleLock", [_vehicle], [_vehicle, _lock]] call EFUNC(common,targetEvent); + [QGVAR(SetVehicleLock), [_vehicle, _lock], [_vehicle]] call CBA_fnc_targetEvent; }; }; //Delay call until mission start (so everyone has the eventHandler's installed) -}, [_vehicle], 0.25] call EFUNC(common,waitAndExecute); +}, [_vehicle], 0.25] call CBA_fnc_waitAndExecute; diff --git a/addons/vehiclelock/functions/fnc_lockpick.sqf b/addons/vehiclelock/functions/fnc_lockpick.sqf index 3435af24bf..bf15a6eadd 100644 --- a/addons/vehiclelock/functions/fnc_lockpick.sqf +++ b/addons/vehiclelock/functions/fnc_lockpick.sqf @@ -55,7 +55,7 @@ switch (_funcType) do { [_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], {(_this select 0) call FUNC(lockpick)}, {}, (localize LSTRING(Action_LockpickInUse)), _condition] call EFUNC(common,progressBar); }; case "finishLockpick": { - ["VehicleLock_SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent); + [QGVAR(setVehicleLock), [_veh, false], [_veh]] call CBA_fnc_targetEvent; }; default { ERROR("bad function type"); diff --git a/addons/vehiclelock/functions/fnc_moduleSync.sqf b/addons/vehiclelock/functions/fnc_moduleSync.sqf index 27577e4dbe..99e822d53d 100644 --- a/addons/vehiclelock/functions/fnc_moduleSync.sqf +++ b/addons/vehiclelock/functions/fnc_moduleSync.sqf @@ -51,4 +51,4 @@ if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not ac } forEach _syncedObjects; //Wait to add keys until various gear assigns have finished (~5 seconds) -}, [_syncedObjects], 5, 1] call EFUNC(common,waitAndExecute); +}, [_syncedObjects], 5, 1] call CBA_fnc_waitAndExecute; diff --git a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf index 5ac9ee427e..fb8972ef1d 100644 --- a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf +++ b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf @@ -42,7 +42,7 @@ if (GVAR(LockVehicleInventory) && //if setting not enabled [{ TRACE_1("Opening Player Inventory", _this); ACE_player action ["Gear", objNull] - }, []] call EFUNC(common,execNextFrame); + }, []] call CBA_fnc_execNextFrame; }, - []] call EFUNC(common,waitUntilAndExecute); + []] call CBA_fnc_waitUntilAndExecute; }; diff --git a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf index d2290ef732..9382de408e 100644 --- a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf +++ b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Sets a vehicle lock state because of a "VehicleLock_SetVehicleLock" event + * Sets a vehicle lock state because of a "ace_vehiclelock_setVehicleLock" event * * Arguments: * 0: Vehicle diff --git a/addons/vehiclelock/script_component.hpp b/addons/vehiclelock/script_component.hpp index 23b0ea9795..8846951780 100644 --- a/addons/vehiclelock/script_component.hpp +++ b/addons/vehiclelock/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT vehiclelock +#define COMPONENT_BEAUTIFIED Vehicle Lock #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/vehicles/config.cpp b/addons/vehicles/config.cpp index a3641a7b5b..9b0d595fc8 100644 --- a/addons/vehicles/config.cpp +++ b/addons/vehicles/config.cpp @@ -2,13 +2,18 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2","KoffeinFlummi"}; - authorUrl = "https://github.com/KoffeinFlummi/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","KoffeinFlummi"}; + url = ECSTRING(main,URL); VERSION_CONFIG; + + // this prevents any patched class from requiring this addon + addonRootClass = "A3_Characters_F"; }; }; diff --git a/addons/vehicles/functions/fnc_startEngine.sqf b/addons/vehicles/functions/fnc_startEngine.sqf index e2c171e018..8b0d0f17bb 100644 --- a/addons/vehicles/functions/fnc_startEngine.sqf +++ b/addons/vehicles/functions/fnc_startEngine.sqf @@ -24,9 +24,9 @@ if (!_isEngineOn || {floor abs speed _vehicle > 0}) exitWith {}; params ["_args", "_idPFH"]; _args params ["_vehicle", "_time", "_direction"]; - if (ACE_time > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; + if (CBA_missionTime > _time) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; }; _vehicle setVelocity [0, 0, 0]; _vehicle setVectorDirAndUp _direction; -} , 0, [_vehicle, ACE_time + STARTUP_DELAY, [vectorDir _vehicle, vectorUp _vehicle]]] call CBA_fnc_addPerFrameHandler; +} , 0, [_vehicle, CBA_missionTime + STARTUP_DELAY, [vectorDir _vehicle, vectorUp _vehicle]]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/vehicles/script_component.hpp b/addons/vehicles/script_component.hpp index 1f1b678acf..d8143e3fdc 100644 --- a/addons/vehicles/script_component.hpp +++ b/addons/vehicles/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT vehicles +#define COMPONENT_BEAUTIFIED Vehicles #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/viewdistance/XEH_clientInit.sqf b/addons/viewdistance/XEH_clientInit.sqf index dfcfd7e405..1fed0bd818 100644 --- a/addons/viewdistance/XEH_clientInit.sqf +++ b/addons/viewdistance/XEH_clientInit.sqf @@ -2,7 +2,7 @@ if (!hasInterface) exitWith {}; -["SettingsInitialized", { +["ace_settingsInitialized", { // if not enabled, then bugger off. if !(GVAR(enabled)) exitWith {}; @@ -10,7 +10,7 @@ if (!hasInterface) exitWith {}; [false] call FUNC(adaptViewDistance); // Set the EH which waits for any of the view distance settings to be changed, so that the effect is show immediately - ["SettingChanged",{ + ["ace_settingChanged",{ params ["_name"]; if ((_name == QGVAR(viewDistanceOnFoot)) || (_name == QGVAR(viewDistanceLandVehicle)) || @@ -19,11 +19,11 @@ if (!hasInterface) exitWith {}; [true] call FUNC(adaptViewDistance); }; - }] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addEventHandler; // Set the EH which waits for a vehicle change to automatically swap between On Foot/In Land Vehicle/In Air Vehicle // Also run when SettingsInitialized runs (not guaranteed) - ["playerVehicleChanged",{ + ["vehicle",{ [false] call FUNC(adaptViewDistance); - }] call EFUNC(common,addEventHandler); -}] call EFUNC(common,addEventHandler); + }] call CBA_fnc_addPlayerEventHandler; +}] call CBA_fnc_addEventHandler; diff --git a/addons/viewdistance/config.cpp b/addons/viewdistance/config.cpp index 2de8b2c954..cf986569e0 100644 --- a/addons/viewdistance/config.cpp +++ b/addons/viewdistance/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Winter", "Jonpas", "Arkhir"}; - authorUrl = "https://github.com/Winter259"; + author = ECSTRING(common,ACETeam); + authors[] = {"Winter", "Jonpas", "Arkhir"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/viewdistance/script_component.hpp b/addons/viewdistance/script_component.hpp index f5cd31f8ce..f78bfcbc1c 100644 --- a/addons/viewdistance/script_component.hpp +++ b/addons/viewdistance/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT viewdistance +#define COMPONENT_BEAUTIFIED View Distance #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index 2e03982fec..f9d1cf1d78 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -198,4 +198,4 @@ if (!hasInterface) exitWith {}; // Register fire event handler -["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["ace_firedPlayer", DFUNC(throwGrenade)] call CBA_fnc_addEventHandler; diff --git a/addons/weaponselect/config.cpp b/addons/weaponselect/config.cpp index 231d167cd0..cf8e08a3ba 100644 --- a/addons/weaponselect/config.cpp +++ b/addons/weaponselect/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2","KoffeinFlummi","esteldunedain"}; - authorUrl = "https://github.com/commy2/"; + author = ECSTRING(common,ACETeam); + authors[] = {"commy2","KoffeinFlummi","esteldunedain"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index ef9397ba57..288531df2c 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -26,4 +26,4 @@ private _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNa private _text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); -["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent); +[_text, _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/weaponselect/script_component.hpp b/addons/weaponselect/script_component.hpp index 7ab95f9887..743d471a2a 100644 --- a/addons/weaponselect/script_component.hpp +++ b/addons/weaponselect/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT weaponselect +#define COMPONENT_BEAUTIFIED Weapon Select #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_WEAPONSELECT #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/weather/CfgEventhandlers.hpp b/addons/weather/CfgEventhandlers.hpp index 74dfaab913..f913c4c22b 100644 --- a/addons/weather/CfgEventhandlers.hpp +++ b/addons/weather/CfgEventhandlers.hpp @@ -17,3 +17,9 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; + +class Extended_DisplayLoad_EventHandlers { + class Display3DEN { + ADDON = QUOTE(call COMPILE_FILE(init3DEN)); + }; +}; diff --git a/addons/weather/CfgVehicles.hpp b/addons/weather/CfgVehicles.hpp index f98a1e50f5..ab3d408fdc 100644 --- a/addons/weather/CfgVehicles.hpp +++ b/addons/weather/CfgVehicles.hpp @@ -3,7 +3,7 @@ class CfgVehicles { class GVAR(ModuleSettings): ACE_Module { scope = 2; displayName = CSTRING(Module_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Wind_ca.paa); category = "ACE"; function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; diff --git a/addons/weather/CfgWorlds.hpp b/addons/weather/CfgWorlds.hpp index dd0a616272..d417f104ad 100644 --- a/addons/weather/CfgWorlds.hpp +++ b/addons/weather/CfgWorlds.hpp @@ -11,6 +11,7 @@ class CfgWorlds { ACE_WindSpeedMax[] = {{8.8, 5.5}, {8.8, 5}, {8.6, 4.8}, {7.6, 3.4}, {7.0, 3.0}, {7.1, 3.0}, {7.5, 3.1}, {8.0, 3.2}, {7.6, 3.5}, {7.8, 4.6}, {7.9, 5.0}, {8.2, 5.5}}; ACE_WindSpeedMean[] = {4.8, 4.9, 4.6, 4.1, 3.5, 3.5, 4.3, 4.4, 4.1, 4.5, 4.5, 5.0}; ACE_WindSpeedMin[] = {{0.2, 5.0}, {0.1, 5.0}, {0.2, 4.3}, {0.0, 3.0}, {0.0, 2.1}, {0.0, 2.0}, {0.1, 3.1}, {0.3, 3.1}, {0.0, 3.6}, {0.0, 4.2}, {0.1, 5.0}, {0.2, 5.5}}; + // using the "Fraction of Time Spent with Various Wind Directions in (month)" graph ACE_WindDirectionProbabilities[] = {{0.06, 0.32, 0.05, 0.04, 0.15, 0.06, 0.02, 0.02}, // January {0.08, 0.32, 0.04, 0.04, 0.18, 0.06, 0.02, 0.02}, // February {0.09, 0.30, 0.04, 0.04, 0.20, 0.06, 0.02, 0.03}, // March @@ -23,6 +24,7 @@ class CfgWorlds { {0.10, 0.39, 0.04, 0.02, 0.15, 0.02, 0.01, 0.03}, // October {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December + // N , NE , E , SE , S , SW , W , NW }; class Altis: CAWorld { @@ -35,6 +37,7 @@ class CfgWorlds { ACE_WindSpeedMax[] = {{8.8, 5.5}, {8.8, 5}, {8.6, 4.8}, {7.6, 3.4}, {7.0, 3.0}, {7.1, 3.0}, {7.5, 3.1}, {8.0, 3.2}, {7.6, 3.5}, {7.8, 4.6}, {7.9, 5.0}, {8.2, 5.5}}; ACE_WindSpeedMean[] = {4.8, 4.9, 4.6, 4.1, 3.5, 3.5, 4.3, 4.4, 4.1, 4.5, 4.5, 5.0}; ACE_WindSpeedMin[] = {{0.2, 5.0}, {0.1, 5.0}, {0.2, 4.3}, {0.0, 3.0}, {0.0, 2.1}, {0.0, 2.0}, {0.1, 3.1}, {0.3, 3.1}, {0.0, 3.6}, {0.0, 4.2}, {0.1, 5.0}, {0.2, 5.5}}; + // using the "Fraction of Time Spent with Various Wind Directions in (month)" graph ACE_WindDirectionProbabilities[] = {{0.06, 0.32, 0.05, 0.04, 0.15, 0.06, 0.02, 0.02}, // January {0.08, 0.32, 0.04, 0.04, 0.18, 0.06, 0.02, 0.02}, // February {0.09, 0.30, 0.04, 0.04, 0.20, 0.06, 0.02, 0.03}, // March @@ -47,5 +50,32 @@ class CfgWorlds { {0.10, 0.39, 0.04, 0.02, 0.15, 0.02, 0.01, 0.03}, // October {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December + // N , NE , E , SE , S , SW , W , NW }; + + class Tanoa: CAWorld { + // Source: http://www.iten-online.ch/klima/australien/fidschi/suva.htm + ACE_TempDay[] = {31, 31, 31, 30, 28, 28, 27, 27, 28, 20, 29, 30}; + ACE_TempNight[] = {24, 24, 24, 23, 22, 21, 20, 21, 21, 22, 23, 23}; + // Source: https://weather-and-climate.com/average-monthly-Humidity-perc,suva,Fiji + ACE_Humidity[] = {81, 83, 85, 84, 80, 80, 78, 76, 77, 78, 79, 80}; + // https://weatherspark.com/averages/32711/Suva-Central-Division-Fiji + ACE_WindSpeedMax[] = {{6.9, 4.9}, {6.5, 4.8}, {6.4, 4.5}, {6.5, 4.3}, {6.4, 4.2}, {6.6, 4.5}, {6.5, 4.8}, {7.0, 4.9}, {7.3, 5.1}, {7.3, 5.1}, {7.2, 5.2}, {6.8, 5.1}}; + ACE_WindSpeedMean[] = {2.2, 2, 1.9, 1.6, 1.9, 2, 2.1, 2.3, 2.7, 3, 2.7, 2.4}; + ACE_WindSpeedMin[] = {{0.0, 0.1}, {0.1, 0.1}, {0.0, 0.0}, {0.0, 0.4}, {0.0, 0.4}, {0.0, 0.2}, {0.0, 0.5}, {0.0, 0.5}, {0.1, 1.0}, {0.2, 1.3}, {0.0, 0.5}, {0.0, 0.5}}; + // using the "Fraction of Time Spent with Various Wind Directions in (month)" graph + ACE_WindDirectionProbabilities[] = {{0.05, 0.08, 0.18, 0.13, 0.05, 0.01, 0.02, 0.05}, // January + {0.06, 0.08, 0.14, 0.11, 0.05, 0.01, 0.02, 0.06}, // February + {0.06, 0.08, 0.12, 0.09, 0.04, 0.01, 0.03, 0.06}, // March + {0.05, 0.08, 0.13, 0.13, 0.05, 0.01, 0.02, 0.06}, // April + {0.02, 0.06, 0.15, 0.16, 0.06, 0.01, 0.01, 0.03}, // May + {0.02, 0.07, 0.17, 0.17, 0.06, 0.01, 0.01, 0.03}, // June + {0.02, 0.07, 0.14, 0.18, 0.08, 0.02, 0.01, 0.02}, // July + {0.02, 0.05, 0.18, 0.18, 0.09, 0.03, 0.01, 0.02}, // August + {0.01, 0.04, 0.21, 0.22, 0.08, 0.01, 0.01, 0.01}, // September + {0.01, 0.06, 0.24, 0.24, 0.07, 0.01, 0.01, 0.02}, // October + {0.02, 0.07, 0.25, 0.20, 0.04, 0.01, 0.01, 0.02}, // November + {0.03, 0.08, 0.22, 0.16, 0.05, 0.01, 0.01, 0.03}};// December + // N , NE , E , SE , S , SW , W , NW + }; }; diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 9c32634060..569dd87dc4 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -5,13 +5,13 @@ GVAR(temperatureShift) = 3 - random 6; GVAR(badWeatherShift) = (random 1) ^ 2 * 10; GVAR(humidityShift) = (5 - random 10) / 100; -GVAR(wind_period_start_time) = ACE_time; -GVAR(rain_period_start_time) = ACE_time; +GVAR(wind_period_start_time) = CBA_missionTime; +GVAR(rain_period_start_time) = CBA_missionTime; GVAR(ACE_rain) = rain; -"ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = ACE_time; }; -"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = ACE_time; }; +"ACE_WIND_PARAMS" addPublicVariableEventHandler { GVAR(wind_period_start_time) = CBA_missionTime; }; +"ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = CBA_missionTime; }; "ACE_MISC_PARAMS" addPublicVariableEventHandler { if (!isServer) then { TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS); @@ -29,7 +29,7 @@ GVAR(ACE_rain) = rain; }; GVAR(WindInfo) = false; -["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKey), +["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKeyToggle), { // Conditions: canInteract if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -39,7 +39,8 @@ GVAR(WindInfo) = false; }, {false}, [37, [true, false, false]], false, 0] call CBA_fnc_addKeybind; // (SHIFT + K) -["ACE3 Common", QGVAR(WindInfoKey_hold), localize LSTRING(WindInfoKey_hold), + +["ACE3 Common", QGVAR(WindInfoKey_hold), localize LSTRING(WindInfoKeyHold), { // Conditions: canInteract if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; @@ -58,8 +59,8 @@ simulWeatherSync; -["SettingsInitialized",{ - TRACE_1("SettingsInitialized",GVAR(syncRain)); +["ace_settingsInitialized",{ + TRACE_1("ace_settingsInitialized eh",GVAR(syncRain)); //Create a 0 sec delay PFEH to update rain every frame: if (GVAR(syncRain)) then { @@ -78,17 +79,17 @@ simulWeatherSync; [] call FUNC(updateWind); //Every 1 second - if (ACE_time >= GVAR(nextUpdateRain)) then { + if (CBA_missionTime >= GVAR(nextUpdateRain)) then { [] call FUNC(updateRain); //Every 2 seconds - GVAR(nextUpdateRain) = 2 + ACE_time; + GVAR(nextUpdateRain) = 2 + CBA_missionTime; }; - if (ACE_time >= GVAR(nextUpdateTempAndHumidity)) then { + if (CBA_missionTime >= GVAR(nextUpdateTempAndHumidity)) then { [] call FUNC(updateTemperature); //Every 20 seconds [] call FUNC(updateHumidity); //Every 20 seconds - GVAR(nextUpdateTempAndHumidity) = 20 + ACE_time; + GVAR(nextUpdateTempAndHumidity) = 20 + CBA_missionTime; }; END_COUNTER(weatherPFEH); }, 1, []] call CBA_fnc_addPerFrameHandler; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/weather/XEH_postServerInit.sqf b/addons/weather/XEH_postServerInit.sqf index f7b830b11d..cd1fca2c4c 100644 --- a/addons/weather/XEH_postServerInit.sqf +++ b/addons/weather/XEH_postServerInit.sqf @@ -9,10 +9,10 @@ GVAR(rain_current_range) = -1+(random 2); // Wind call FUNC(initWind); -["SettingsInitialized", { - TRACE_2("SettingsInitialized",GVAR(enableServerController),GVAR(serverUpdateInterval)); +["ace_settingsInitialized", { + TRACE_2("ace_settingsInitialized eh",GVAR(enableServerController),GVAR(serverUpdateInterval)); if (GVAR(enableServerController)) then { [FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler; }; -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/weather/config.cpp b/addons/weather/config.cpp index 50e2f8ace0..f8b8130d37 100644 --- a/addons/weather/config.cpp +++ b/addons/weather/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"q1184", "Rocko", "esteldunedain", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"q1184", "Rocko", "esteldunedain", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; @@ -15,4 +18,4 @@ class CfgPatches { #include "CfgWorlds.hpp" #include "RscTitles.hpp" #include "CfgVehicles.hpp" -#include "ACE_Settings.hpp" \ No newline at end of file +#include "ACE_Settings.hpp" diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index f81384c1b0..10a1e45861 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -2,10 +2,10 @@ * Author: Ruthberg * Displays a wind info (colored arrow) in the top left corner of the screen * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -78,10 +78,10 @@ TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo)); TRACE_3("update display",_beaufortNumber,_windDir,_windSpeed); __ctrl ctrlSetTextColor _windColor; if (_beaufortNumber > 0) then { - __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_arrow_ca.paa)); + __ctrl ctrlSetText QPATHTOF(UI\wind_arrow_ca.paa); __ctrl ctrlSetAngle [_windDir, 0.5, 0.5]; } else { - __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_noneCircle_ca.paa)); + __ctrl ctrlSetText QPATHTOF(UI\wind_noneCircle_ca.paa); }; __ctrl ctrlCommit 0; @@ -94,7 +94,7 @@ TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo)); for "_index" from 0 to (_beaufortNumber - 1) do { private _ball = __dsp ctrlCreate ["RscPicture", _index]; - _ball ctrlSetText QUOTE(PATHTOF(UI\wind_dot_ca.paa)); + _ball ctrlSetText QPATHTOF(UI\wind_dot_ca.paa); _ball ctrlSetTextColor [1,1,1,1]; private _ballCenterX = _centerX - (_ballWidth / 2) + ((sin _windDir) * 0.013333) * (_index - 4.9) + ((cos _windDir) * 0.0125); private _ballCenterY = _centerY - (_ballHeight / 2) - ((1 * cos _windDir) * 4/3*0.013333) * (_index - 4.9) + ((sin _windDir) * 0.0125); diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index e1b56f2ed2..08a6f38568 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -2,10 +2,10 @@ * Author: Ruthberg, esteldunedain * Get the weather data for the current map * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index c9ccd43ff9..2d29335026 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team, Ruthberg * Calculate current wind locally from the data broadcasted by the server * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * Wind * * Example: @@ -20,7 +20,7 @@ if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] }; ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"]; //Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];] -private _periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; +private _periodPosition = (CBA_missionTime - GVAR(wind_period_start_time)) min _period; private _periodPercent = _periodPosition / _period; _spd = _spd + _spdChange * _periodPercent; diff --git a/addons/weather/functions/fnc_initWind.sqf b/addons/weather/functions/fnc_initWind.sqf index ddd314c0c6..634542c1e4 100644 --- a/addons/weather/functions/fnc_initWind.sqf +++ b/addons/weather/functions/fnc_initWind.sqf @@ -2,10 +2,10 @@ * Author: Ruthberg * Inits the wind variables on mission start * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 9791049914..79d2aab93e 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -2,10 +2,10 @@ * Author: Ruthberg * Gather weather parameters and broadcast them to the clients * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: diff --git a/addons/weather/functions/fnc_updateAceWeather.sqf b/addons/weather/functions/fnc_updateAceWeather.sqf index 2eb264d91b..db8783cd83 100644 --- a/addons/weather/functions/fnc_updateAceWeather.sqf +++ b/addons/weather/functions/fnc_updateAceWeather.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team, esteldunedain, ruthberg * Updates the wind and rain evolution on the server. Broadcasts the current and next values to the clients * - * Argument: + * Arguments: * None * - * Return value: + * Return Value: * None * * Example: @@ -48,7 +48,7 @@ if (GVAR(syncRain) && {GVAR(rain_period_count) > GVAR(rain_next_period)}) then { ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; TRACE_4("",_lastRain,_rainOverCast,_transitionTime,overcast); - GVAR(rain_period_start_time) = ACE_time; + GVAR(rain_period_start_time) = CBA_missionTime; publicVariable "ACE_RAIN_PARAMS"; }; @@ -94,7 +94,7 @@ if (GVAR(syncWind) && {GVAR(wind_period_count) > GVAR(wind_next_period)}) then { GVAR(current_wind_direction) = _windDirection; GVAR(current_wind_speed) = _windSpeed; - GVAR(wind_period_start_time) = ACE_time; + GVAR(wind_period_start_time) = CBA_missionTime; publicVariable "ACE_WIND_PARAMS"; }; diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf index 66a351096c..acd103615b 100644 --- a/addons/weather/functions/fnc_updateHumidity.sqf +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team * Updates GVAR(currentHumidity) * - * Argument: + * Arguments: * Nothing * - * Return value: + * Return Value: * Nothing * * Example: diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf index 9146b266b3..b073a6a24c 100644 --- a/addons/weather/functions/fnc_updateRain.sqf +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team, Ruthberg * Updates rain based on ACE_RAIN_PARAMS * - * Argument: + * Arguments: * Nothing * - * Return value: + * Return Value: * Nothing * * Example: @@ -18,10 +18,10 @@ if (!isNil "ACE_RAIN_PARAMS") then { ACE_RAIN_PARAMS params ["_oldRain", "_newRain", "_period"]; - private _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period; + private _periodPosition = (CBA_missionTime - GVAR(rain_period_start_time)) min _period; private _periodPercent = (_periodPosition / _period) min 1; - GVAR(ACE_Rain) = linearConversion [GVAR(rain_period_start_time), (GVAR(rain_period_start_time) + _period), ACE_time, _oldRain, _newRain]; + GVAR(ACE_Rain) = linearConversion [GVAR(rain_period_start_time), (GVAR(rain_period_start_time) + _period), CBA_missionTime, _oldRain, _newRain]; TRACE_3("Update Rain",rain,ACE_RAIN_PARAMS,GVAR(ACE_Rain)); }; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 9ff11859f4..6f2d911c15 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team * Updates GVAR(currentTemperature) based on the map data * - * Argument: + * Arguments: * Nothing * - * Return value: + * Return Value: * Nothing * * Example: diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf index 75724e3674..72ae0470ba 100644 --- a/addons/weather/functions/fnc_updateWind.sqf +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -2,10 +2,10 @@ * Author: ACE2 Team, Ruthberg * Updates wind, gusts and waves based on ACE_wind * - * Argument: + * Arguments: * Nothing * - * Return value: + * Return Value: * Nothing * * Example: diff --git a/addons/weather/init3DEN.sqf b/addons/weather/init3DEN.sqf new file mode 100644 index 0000000000..1bae6c4d95 --- /dev/null +++ b/addons/weather/init3DEN.sqf @@ -0,0 +1,15 @@ +// point of this file is to disable "auto-weather" by default +// we want this, because it breaks weather commands we use in this component +#include "script_component.hpp" + +// cannot create checkboxes which have the default value "true" +// 3den uses inverted checkboxes instead, but those only change in appearence +// we have to auto set these settings manually - on mission creation +add3DENEventHandler ["onMissionNew", { + set3DENMissionAttributes [ + ["Intel", "IntelRainIsForced", true], + ["Intel", "IntelLightningIsForced", true], + ["Intel", "IntelWavesIsForced", true], + ["Intel", "IntelWindIsForced", true] + ]; +}]; diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index 84d7e9987b..7148fa4bb1 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT weather +#define COMPONENT_BEAUTIFIED Weather #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL diff --git a/addons/weather/stringtable.xml b/addons/weather/stringtable.xml index 571fa9c25a..908e73ea3d 100644 --- a/addons/weather/stringtable.xml +++ b/addons/weather/stringtable.xml @@ -1,7 +1,7 @@  - + Show Wind Info Pokaż inf. o wietrze Показать информацию о ветре @@ -13,7 +13,7 @@ Zobrazit údaje o větru Mostrar informação do vento - + Show Wind Info (Toggle) Pokaż inf. o wietrze (przełącz) Показать информацию о ветре (перекл.) @@ -194,4 +194,4 @@ Definisce l'intervallo (in secondi) tra aggiornamenti del meteo - \ No newline at end of file + diff --git a/addons/winddeflection/CfgVehicles.hpp b/addons/winddeflection/CfgVehicles.hpp index c52949e1fc..866a00d9c1 100644 --- a/addons/winddeflection/CfgVehicles.hpp +++ b/addons/winddeflection/CfgVehicles.hpp @@ -3,7 +3,7 @@ class CfgVehicles { class GVAR(ModuleSettings): ACE_Module { scope = 2; displayName = CSTRING(windDeflection_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Wind_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Wind_ca.paa); category = "ACE"; function = QUOTE(DFUNC(initModuleSettings)); functionPriority = 1; diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf index 14b4db1def..fe454cb00d 100644 --- a/addons/winddeflection/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_postInit.sqf @@ -4,19 +4,19 @@ if (!hasInterface) exitWith {}; GVAR(trackedBullets) = []; -["SettingsInitialized", { +["ace_settingsInitialized", { //If not enabled, dont't add PFEH if (!GVAR(enabled)) exitWith {}; // Register fire event handler - ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); - ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["ace_firedPlayer", DFUNC(handleFired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerNonLocal", DFUNC(handleFired)] call CBA_fnc_addEventHandler; if (GVAR(vehicleEnabled)) then { - ["firedPlayerVehicle", DFUNC(handleFired)] call EFUNC(common,addEventHandler); - ["firedPlayerVehicleNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["ace_firedPlayerVehicle", DFUNC(handleFired)] call CBA_fnc_addEventHandler; + ["ace_firedPlayerVehicleNonLocal", DFUNC(handleFired)] call CBA_fnc_addEventHandler; }; [] call FUNC(updateTrajectoryPFH); -}] call EFUNC(common,addEventHandler); +}] call CBA_fnc_addEventHandler; diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index a7bedbb9ef..0e193dace5 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -2,12 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_weather"}; - author[] = {ECSTRING(common,ACETeam), "Glowbal", "Ruthberg"}; - authorUrl = "http://ace3mod.com/"; + author = ECSTRING(common,ACETeam); + authors[] = {ECSTRING(common,ACETeam), "Glowbal", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf index 393a5cd757..5ec512c903 100644 --- a/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf +++ b/addons/winddeflection/functions/fnc_updateTrajectoryPFH.sqf @@ -22,8 +22,8 @@ params ["_args"]; _args params ["_lastTime"]; - _deltaT = ACE_time - _lastTime; - _args set [0, ACE_time]; + _deltaT = CBA_missionTime - _lastTime; + _args set [0, CBA_missionTime]; _deleted = 0; _isWind = (vectorMagnitude ACE_wind > 0); @@ -53,4 +53,4 @@ nil } count +GVAR(trackedBullets); // END_COUNTER(pfeh); -}, GVAR(simulationInterval), [ACE_time]] call CBA_fnc_addPerFrameHandler; +}, GVAR(simulationInterval), [CBA_missionTime]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/winddeflection/script_component.hpp b/addons/winddeflection/script_component.hpp index e4cc1df840..10deceddd8 100644 --- a/addons/winddeflection/script_component.hpp +++ b/addons/winddeflection/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT winddeflection +#define COMPONENT_BEAUTIFIED Wind Deflection #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_WINDDEFLECTION #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/yardage450/CfgWeapons.hpp b/addons/yardage450/CfgWeapons.hpp index 54e15401a6..382a6d09fc 100644 --- a/addons/yardage450/CfgWeapons.hpp +++ b/addons/yardage450/CfgWeapons.hpp @@ -5,9 +5,9 @@ class CfgWeapons { author = ECSTRING(common,ACETeam); displayName = CSTRING(DisplayName); descriptionShort = CSTRING(Description); - model = PATHTOF(data\ace_yardage_pro_450.p3d); - modelOptics = PATHTOF(data\bushnell_optic.p3d); - picture = PATHTOF(UI\w_bushnell_ca.paa); + model = QPATHTOF(data\ace_yardage_pro_450.p3d); + modelOptics = QPATHTOF(data\bushnell_optic.p3d); + picture = QPATHTOF(UI\w_bushnell_ca.paa); opticsZoomMin = 0.33333/4; opticsZoomMax = 0.33333/4; opticsZoomInit = 0.33333/4; diff --git a/addons/yardage450/config.cpp b/addons/yardage450/config.cpp index 4d0f820aed..4af07b18fb 100644 --- a/addons/yardage450/config.cpp +++ b/addons/yardage450/config.cpp @@ -2,11 +2,14 @@ class CfgPatches { class ADDON { + name = COMPONENT_NAME; units[] = {"ACE_Item_Yardage450"}; weapons[] = {"ACE_Yardage450"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_apl", "ace_laser"}; - author[] = {"Spooner", "tcp", "Ruthberg"}; + author = ECSTRING(common,ACETeam); + authors[] = {"Spooner", "tcp", "Ruthberg"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; }; diff --git a/addons/yardage450/functions/fnc_turnOn.sqf b/addons/yardage450/functions/fnc_turnOn.sqf index 1cb20e71b6..a56bddb016 100644 --- a/addons/yardage450/functions/fnc_turnOn.sqf +++ b/addons/yardage450/functions/fnc_turnOn.sqf @@ -23,14 +23,14 @@ if (currentWeapon ACE_player != "ACE_Yardage450" || cameraView != "GUNNER") exitWith {}; -GVAR(powerOnTime) = ACE_time; +GVAR(powerOnTime) = CBA_missionTime; if (GVAR(active)) exitWith {}; GVAR(active) = true; [{ - if (ACE_time - GVAR(powerOnTime) > 30) exitWith { + if (CBA_missionTime - GVAR(powerOnTime) > 30) exitWith { GVAR(active) = false; 74210 cutText ["", "PLAIN"]; [_this select 1] call CBA_fnc_removePerFrameHandler; diff --git a/addons/yardage450/script_component.hpp b/addons/yardage450/script_component.hpp index d49c301359..bb901a9b50 100644 --- a/addons/yardage450/script_component.hpp +++ b/addons/yardage450/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT yardage450 +#define COMPONENT_BEAUTIFIED Yardage 450 #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -14,4 +15,4 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_YARDAGE450 #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/zeus/CfgEventHandlers.hpp b/addons/zeus/CfgEventHandlers.hpp index 89ab0bc900..becf395052 100644 --- a/addons/zeus/CfgEventHandlers.hpp +++ b/addons/zeus/CfgEventHandlers.hpp @@ -11,10 +11,8 @@ class Extended_PreInit_EventHandlers { }; }; -class Extended_InitPost_EventHandlers { - class AllVehicles { - class ADDON { - serverInit = QUOTE(call FUNC(addObjectToCurator)); - }; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index fbf63930c4..4ab9ad871c 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -18,14 +18,14 @@ class CfgVehicles { class GVAR(moduleSettings): ACE_Module { scope = 2; displayName = CSTRING(Settings_DisplayName); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Settings_ca.paa)); + icon = QPATHTOF(UI\Icon_Module_Zeus_Settings_ca.paa); category = "ACE"; function = QFUNC(moduleZeusSettings); functionPriority = 1; isGlobal = 1; isSingular = 1; isTriggerActivated = 0; - author = "SilentSpike"; + author = ECSTRING(common,ACETeam); class Arguments { class zeusAscension { displayName = CSTRING(ascension_DisplayName); @@ -84,7 +84,7 @@ class CfgVehicles { }; }; class GVAR(moduleBase): Module_F { - author = "SilentSpike"; + author = ECSTRING(common,ACETeam); category = "ACE"; functionPriority = 1; isGlobal = 1; @@ -92,104 +92,86 @@ class CfgVehicles { scope = 1; scopeCurator = 2; }; - class GVAR(moduleCaptive): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleCaptive_DisplayName); - function = QFUNC(moduleCaptive); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Captive_ca.paa)); - class ModuleDescription { - description = "Flips the capture state of the specified unit."; - sync[] = {}; - }; - }; - class GVAR(moduleSurrender): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSurrender_DisplayName); - function = QFUNC(moduleSurrender); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Surrender_ca.paa)); - class ModuleDescription { - description = "Flips the surrender state of the specified unit."; - sync[] = {}; - }; - }; - class GVAR(moduleUnconscious): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleUnconscious_DisplayName); - function = QFUNC(moduleUnconscious); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa)); - class ModuleDescription { - description = "Flips the unconscious state of the specified unit."; - sync[] = {}; - }; - }; - class GVAR(moduleSetMedic): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedic_DisplayName); - function = QFUNC(moduleSetMedic); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); - function = QFUNC(moduleSetMedicalVehicle); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { - curatorCanAttach = 1; - displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); - function = QFUNC(moduleSetMedicalFacility); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa)); - class ModuleDescription { - description = ""; - sync[] = {}; - }; - }; - class GVAR(moduleAddSpareTrack): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleAddSpareTrack_DisplayName); function = QFUNC(moduleAddSpareTrack); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo - class ModuleDescription { - description = CSTRING(ModuleAddSpareTrack_Description); - sync[] = {}; - }; + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo }; class GVAR(moduleAddSpareWheel): GVAR(moduleBase) { curatorCanAttach = 1; displayName = CSTRING(ModuleAddSpareWheel_DisplayName); function = QFUNC(moduleAddSpareWheel); - icon = QUOTE(PATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa));//@todo - class ModuleDescription { - description = CSTRING(ModuleAddSpareWheel_Description); - sync[] = {}; - }; + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa);//@todo + }; + class GVAR(moduleCaptive): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleCaptive_DisplayName); + function = QFUNC(moduleCaptive); + icon = QPATHTOF(UI\Icon_Module_Zeus_Captive_ca.paa); + }; + class GVAR(moduleDefendArea): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleDefendArea_DisplayName); + curatorInfoType = QGVAR(RscDefendArea); + }; + class GVAR(moduleGlobalSetSkill): GVAR(moduleBase) { + displayName = CSTRING(ModuleGlobalSetSkill_DisplayName); + curatorInfoType = QGVAR(RscGlobalSetSkill); + }; + class GVAR(moduleGroupSide): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleGroupSide_DisplayName); + curatorInfoType = QGVAR(RscGroupSide); + }; + class GVAR(modulePatrolArea): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModulePatrolArea_DisplayName); + curatorInfoType = QGVAR(RscPatrolArea); + }; + class GVAR(moduleSearchArea): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSearchArea_DisplayName); + curatorInfoType = QGVAR(RscSearchArea); + }; + class GVAR(moduleSearchNearby): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSearchNearby_DisplayName); + function = QFUNC(moduleSearchNearby); + }; + class GVAR(moduleSetMedic): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedic_DisplayName); + function = QFUNC(moduleSetMedic); + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa); + }; + class GVAR(moduleSetMedicalFacility): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalFacility_DisplayName); + function = QFUNC(moduleSetMedicalFacility); + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa); + }; + class GVAR(moduleSetMedicalVehicle): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetMedicalVehicle_DisplayName); + function = QFUNC(moduleSetMedicalVehicle); + icon = QPATHTOF(UI\Icon_Module_Zeus_Medic_ca.paa); + }; + class GVAR(moduleSurrender): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSurrender_DisplayName); + function = QFUNC(moduleSurrender); + icon = QPATHTOF(UI\Icon_Module_Zeus_Surrender_ca.paa); + }; + class GVAR(moduleTeleportPlayers): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleTeleportPlayers_DisplayName); + curatorInfoType = QGVAR(RscTeleportPlayers); + }; + class GVAR(moduleUnconscious): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleUnconscious_DisplayName); + function = QFUNC(moduleUnconscious); + icon = QPATHTOF(UI\Icon_Module_Zeus_Unconscious_ca.paa); }; - - // class GVAR(moduleSetSuppression): GVAR(moduleBase) { - // curatorCanAttach = 1; - // displayName = CSTRING(ModuleSetSupp_DisplayName); - // function = QFUNC(moduleSetSuppression); - // class ModuleDescription { - // description = "Set group of units to supressed."; - // sync[] = {}; - // }; - // }; - // class GVAR(moduleDisableSuppression): GVAR(moduleBase) { - // curatorCanAttach = 1; - // displayName = CSTRING(ModuleDisableSupp_DisplayName); - // function = QFUNC(moduleDisableSuppression); - // class ModuleDescription { - // description = "Remove suppression for units in group"; - // sync[] = {}; - // }; - // }; }; diff --git a/addons/zeus/XEH_PREP.hpp b/addons/zeus/XEH_PREP.hpp index 423b7f2f27..eb70a8529d 100644 --- a/addons/zeus/XEH_PREP.hpp +++ b/addons/zeus/XEH_PREP.hpp @@ -8,9 +8,23 @@ PREP(handleZeusUnitAssigned); PREP(moduleAddSpareTrack); PREP(moduleAddSpareWheel); PREP(moduleCaptive); +PREP(moduleGlobalSetSkill); +PREP(moduleGroupSide); +PREP(moduleSearchNearby); PREP(moduleSetMedic); PREP(moduleSetMedicalVehicle); PREP(moduleSetMedicalFacility); PREP(moduleSurrender); +PREP(moduleTeleportPlayers); PREP(moduleUnconscious); PREP(moduleZeusSettings); +PREP(ui_attributeCargo); +//PREP(ui_attributePosition); +PREP(ui_attributeRadius); +PREP(ui_defendArea); +PREP(ui_globalSetSkill); +PREP(ui_groupSide); +PREP(ui_patrolArea); +PREP(ui_searchArea); +PREP(ui_teleportPlayers); +PREP(zeusAttributes); diff --git a/addons/zeus/XEH_postInit.sqf b/addons/zeus/XEH_postInit.sqf new file mode 100644 index 0000000000..9062ae5e9a --- /dev/null +++ b/addons/zeus/XEH_postInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +["ace_settingsInitialized",{ + // Only add an InitPost EH if setting is enabled (and apply retroactively) + if (isServer && GVAR(autoAddObjects)) then { + ["AllVehicles", "InitPost", FUNC(addObjectToCurator), true, [], true] call CBA_fnc_addClassEventHandler; + }; +}] call CBA_fnc_addEventHandler; + +// Global skill module PVs values for persistence, just listen for the PV +QGVAR(GlobalSkillAI) addPublicVariableEventHandler FUNC(moduleGlobalSetSkill); + +[QGVAR(moduleDefendArea), CBA_fnc_taskDefend] call CBA_fnc_addEventHandler; +[QGVAR(modulePatrolArea), CBA_fnc_taskPatrol] call CBA_fnc_addEventHandler; +[QGVAR(moduleSearchNearby), CBA_fnc_searchNearby] call CBA_fnc_addEventHandler; +[QGVAR(moduleSearchArea), CBA_fnc_taskSearchArea] call CBA_fnc_addEventHandler; diff --git a/addons/zeus/XEH_preInit.sqf b/addons/zeus/XEH_preInit.sqf index 0d03673e46..47a1adefa3 100644 --- a/addons/zeus/XEH_preInit.sqf +++ b/addons/zeus/XEH_preInit.sqf @@ -5,7 +5,9 @@ ADDON = false; #include "XEH_PREP.hpp" if (isServer) then { - ["zeusUnitAssigned", FUNC(handleZeusUnitAssigned)] call EFUNC(common,addEventHandler); + [QGVAR(zeusUnitAssigned), FUNC(handleZeusUnitAssigned)] call CBA_fnc_addEventHandler; }; +GVAR(GlobalSkillAI) = [0.5,0.5,0.5,0.5,true,true]; + ADDON = true; diff --git a/addons/zeus/config.cpp b/addons/zeus/config.cpp index f41769e727..3ec87b637c 100644 --- a/addons/zeus/config.cpp +++ b/addons/zeus/config.cpp @@ -2,12 +2,22 @@ class CfgPatches { class ADDON { - units[] = {}; + name = COMPONENT_NAME; + units[] = { + QGVAR(moduleDefendArea), + QGVAR(moduleGlobalSetSkill), + QGVAR(moduleGroupSide), + QGVAR(modulePatrolArea), + QGVAR(moduleSearchArea), + QGVAR(moduleSearchNearby), + QGVAR(moduleTeleportPlayers) + }; weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"SilentSpike"}; - authorUrl = "https://github.com/SilentSpike"; + author = ECSTRING(common,ACETeam); + authors[] = {"SilentSpike"}; + url = ECSTRING(main,URL); VERSION_CONFIG; }; // Use additional cfgPatches to contextually remove modules from zeus @@ -42,3 +52,11 @@ class ACE_Curator { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "ACE_Settings.hpp" +#include "ui\RscAttributes.hpp" + +class ACE_newEvents { + zeusUnitAssigned = QGVAR(zeusUnitAssigned); + SetSurrendered = QEGVAR(captives,setSurrendered); + SetHandcuffed = QEGVAR(captives,setHandcuffed); + AddCargoByClass = "ace_addCargoByClass"; +}; diff --git a/addons/zeus/functions/fnc_addObjectToCurator.sqf b/addons/zeus/functions/fnc_addObjectToCurator.sqf index 176b55dfdc..cab5b3da6f 100644 --- a/addons/zeus/functions/fnc_addObjectToCurator.sqf +++ b/addons/zeus/functions/fnc_addObjectToCurator.sqf @@ -15,11 +15,6 @@ params ["_object"]; -if !(EGVAR(common,settingsInitFinished)) exitWith { - TRACE_1("pushing to runAtSettingsInitialized", _this); - EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addObjectToCurator), _this]; -}; - if (!(_object getVariable [QGVAR(addObject), GVAR(autoAddObjects)])) exitWith {}; [{ @@ -27,4 +22,4 @@ if (!(_object getVariable [QGVAR(addObject), GVAR(autoAddObjects)])) exitWith {} { _x addCuratorEditableObjects [[_this], true]; } forEach allCurators; -}, _object] call EFUNC(common,execNextFrame); +}, _object] call CBA_fnc_execNextFrame; diff --git a/addons/zeus/functions/fnc_bi_moduleCurator.sqf b/addons/zeus/functions/fnc_bi_moduleCurator.sqf index d10d36b839..8e939369be 100644 --- a/addons/zeus/functions/fnc_bi_moduleCurator.sqf +++ b/addons/zeus/functions/fnc_bi_moduleCurator.sqf @@ -24,13 +24,13 @@ _activated = _this select 2; if (_activated) then { //--- Terminate when not created on the server - if (!isserver && local _logic && isnull (getassignedcuratorunit _logic)) exitWith { + if (!isserver && local _logic && isnull (getassignedcuratorunit _logic)) exitwith { [format ["%1 is trying to create curator logic ModuleCurator_F",profilename],"bis_fnc_error",false] call bis_fnc_mp; deletevehicle _logic; }; //--- Get curator owner - _ownerVar = _logic getVariable ["owner",""]; + _ownerVar = _logic getvariable ["owner",""]; _ownerUID = parsenumber _ownerVar; if (cheatsenabled) then { _ownerVarArray = toarray _ownerVar; @@ -47,7 +47,7 @@ if (_activated) then { _isAdmin = _ownerVar == "#adminLogged" || _ownerVar == "#adminVoted"; //--- Wipe out the variable so clients can't access it - _logic setVariable ["owner",nil]; + _logic setvariable ["owner",nil]; //--- Server if (isserver) then { @@ -62,13 +62,13 @@ if (_activated) then { }; //--- Get allowed addons - _addonsType = _logic getVariable ["Addons",0]; + _addonsType = _logic getvariable ["Addons",2]; _addons = []; switch _addonsType do { //--- All (including unofficial ones) case 3: { - _cfgPatches = configFile >> "Cfgpatches"; + _cfgPatches = configfile >> "cfgpatches"; for "_i" from 0 to (count _cfgPatches - 1) do { _class = _cfgPatches select _i; if (isclass _class) then {_addons set [count _addons,configname _class];}; @@ -85,8 +85,8 @@ if (_activated) then { case 1: { _addonsList = []; { - _addonsList = _addonsList + (unitaddons typeOf _x); - } forEach (entities "all"); + _addonsList = _addonsList + (unitaddons typeof _x); + } foreach (entities "all"); removeallcuratoraddons _logic; _logic addcuratoraddons _addonsList; }; @@ -108,12 +108,12 @@ if (_activated) then { if (_adminVar != "") then {_ownerVar = _adminVar;}; - _forced = _logic getVariable ["forced",0] > 0; - _name = _logic getVariable ["name",""]; + _forced = _logic getvariable ["forced",0] > 0; + _name = _logic getvariable ["name",""]; if (_name == "") then {_name = localize "STR_A3_curator";}; //--- Wait until mission starts - waitUntil {time > 0}; // NOTE: DO NOT CHANGE TO ACE_TIME, IT BREAKS THE MODULE + waitUntil {time > 0}; // NOTE: DO NOT CHANGE TO CBA_missionTime, IT BREAKS THE MODULE //--- Refresh addon list, so it's broadcasted to clients _addons = curatoraddons _logic; @@ -124,43 +124,42 @@ if (_activated) then { //--- Wait for player to become Zeus switch true do { case (_ownerUID > 0): { - waitUntil { + waituntil { sleep 0.01; {getplayeruid _x == _ownerVar} count playableunits > 0 || isnull _logic }; }; default { - waitUntil {isplayer (missionnamespace getVariable [_ownerVar,objnull]) || isnull _logic}; + waituntil {isplayer (missionnamespace getvariable [_ownerVar,objnull]) || isnull _logic}; }; }; - if (isnull _logic) exitWith {}; + if (isnull _logic) exitwith {}; //--- Assign _player = objnull; switch true do { case (_ownerUID > 0): { { - if (getplayeruid _x == _ownerVar) exitWith {_player = _x;}; - } forEach playableunits; + if (getplayeruid _x == _ownerVar) exitwith {_player = _x;}; + } foreach playableunits; }; default { - _player = missionnamespace getVariable [_ownerVar,objnull]; + _player = missionnamespace getvariable [_ownerVar,objnull]; }; }; - waitUntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; - waitUntil {_player assignCurator _logic; getassignedcuratorunit _logic == _player || isnull _logic}; - if (isnull _logic) exitWith {}; + waituntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; + waituntil {_player assignCurator _logic; getassignedcuratorunit _logic == _player || isnull _logic}; + if (isnull _logic) exitwith {}; //--- Add radio channels { _x radiochanneladd [_player]; - } forEach (_logic getVariable ["channels",[]]); + } foreach (_logic getvariable ["channels",[]]); - // Added by ace_zeus to delay ascension message at mission start - [{ - _logic = _this select 0; - _player = _this select 1; + // Added by ace_zeus to delay ascension message code + private _msgCode = { + params ["_logic","_player"]; //--- Sent notification to all assigned players if ((_logic getVariable ["showNotification",true]) && GVAR(zeusAscension)) then { @@ -170,61 +169,48 @@ if (_activated) then { }; } forEach (curatoreditableobjects _logic); }; - },[_logic,_player]] call EFUNC(common,execNextFrame); + }; + + // Added by ace_zeus to hide ascension messages + if !(EGVAR(common,settingsInitFinished)) then { + EGVAR(common,runAtSettingsInitialized) pushBack [_msgCode, [_logic,_player]]; + } else { + [_logic,_player] call _msgCode; + }; [_logic,"curatorUnitAssigned",[_logic,_player]] call bis_fnc_callscriptedeventhandler; // Added by ace_zeus - ["zeusUnitAssigned", [_logic,_player]] call EFUNC(common,globalEvent); - - //--- Forced interface - //if (_forced) then { - // [[true,true],"bis_fnc_forceCuratorInterface",_player] call bis_fnc_mp; - //}; + [QGVAR(zeusUnitAssigned), [_logic,_player]] call CBA_fnc_globalEvent; //--- Wait for player to stop being Zeus switch true do { case (_ownerUID > 0): { - waitUntil { + waituntil { sleep 0.01; {getplayeruid _x == _ownerVar} count playableunits == 0 || isnull _logic }; }; default { - waitUntil {_player != missionnamespace getVariable [_ownerVar,objnull] || isnull _logic}; + waituntil {_player != missionnamespace getvariable [_ownerVar,objnull] || isnull _logic}; }; }; - if (isnull _logic) exitWith {}; + if (isnull _logic) exitwith {}; //--- Add radio channels { _x radiochannelremove [_player]; - } forEach (_logic getVariable ["channels",[]]); + } foreach (_logic getvariable ["channels",[]]); //--- Unassign - waitUntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; - if (isnull _logic) exitWith {}; + waituntil {unassigncurator _logic; isnull (getassignedcuratorunit _logic) || isnull _logic}; + if (isnull _logic) exitwith {}; }; }; - //--- Activated all future addons - _addons = []; - { - if (typeOf _x == "ModuleCuratorAddAddons_F") then { - _paramAddons = call compile ("[" + (_x getVariable ["addons",""]) + "]"); - { - if !(_x in _addons) then {_addons set [count _addons,_x];}; - { - if !(_x in _addons) then {_addons set [count _addons,_x];}; - } forEach (unitaddons _x); - } forEach _paramAddons; - }; - } forEach (synchronizedobjects _logic); - _addons call bis_fnc_activateaddons; - // Added by ace_zeus to delay bird code - [{ - _logic = _this select 0; + private _birdCode = { + params ["_logic"]; if (GVAR(zeusBird)) then { //--- Create bird @@ -244,16 +230,38 @@ if (_activated) then { } ]; }; - },[_logic]] call EFUNC(common,execNextFrame); + }; + + // Added by ace_zeus to hide camera bird + if !(EGVAR(common,settingsInitFinished)) then { + EGVAR(common,runAtSettingsInitialized) pushBack [_birdCode, [_logic]]; + } else { + [_logic] call _birdCode; + }; + + //--- Activated all future addons + _addons = []; + { + if (typeof _x == "ModuleCuratorAddAddons_F") then { + _paramAddons = call compile ("[" + (_x getvariable ["addons",""]) + "]"); + { + if !(_x in _addons) then {_addons set [count _addons,_x];}; + { + if !(_x in _addons) then {_addons set [count _addons,_x];}; + } foreach (unitaddons _x); + } foreach _paramAddons; + }; + } foreach (synchronizedobjects _logic); + _addons call bis_fnc_activateaddons; }; //--- Player if (hasinterface) then { - waitUntil {local player}; + waituntil {local player}; _serverCommand = if (_ownerVar == "#adminLogged") then {"#shutdown"} else {"#kick"}; //--- Black effect until the interface is open - _forced = _logic getVariable ["forced",0] > 0; + _forced = _logic getvariable ["forced",0] > 0; if (_forced) then { _isCurator = switch true do { case (_ownerUID > 0): { @@ -263,7 +271,7 @@ if (_activated) then { isserver || servercommandavailable _serverCommand }; default { - player == missionnamespace getVariable [_ownerVar,objnull] + player == missionnamespace getvariable [_ownerVar,objnull] }; }; if (_isCurator) then { @@ -274,11 +282,11 @@ if (_activated) then { //--- Check if player is server admin if (_isAdmin) then { - _adminVar = _logic getVariable ["adminVar",""]; - _logic setVariable ["adminVar",nil]; + _adminVar = _logic getvariable ["adminVar",""]; + _logic setvariable ["adminVar",nil]; if (isserver) then { //--- Host - missionnamespace setVariable [_adminVar,player]; + missionnamespace setvariable [_adminVar,player]; } else { //--- Client [_logic,_adminVar,_serverCommand] spawn { @@ -288,13 +296,13 @@ if (_activated) then { _adminVar = _this select 1; _serverCommand = _this select 2; while {true} do { - waitUntil {sleep 0.1; servercommandavailable _serverCommand}; - missionnamespace setVariable [_adminVar,player]; + waituntil {sleep 0.1; servercommandavailable _serverCommand}; + missionnamespace setvariable [_adminVar,player]; publicvariable _adminVar; _respawn = player addeventhandler ["respawn",format ["%1 = _this select 0; publicvariable '%1';",_adminVar]]; - waitUntil {sleep 0.1; !servercommandavailable _serverCommand}; - missionnamespace setVariable [_adminVar,objnull]; + waituntil {sleep 0.1; !servercommandavailable _serverCommand}; + missionnamespace setvariable [_adminVar,objnull]; publicvariable _adminVar; player removeeventhandler ["respawn",_respawn]; }; @@ -305,7 +313,7 @@ if (_activated) then { [_logic] spawn { _logic = _this select 0; sleep 1; - waitUntil {alive player}; + waituntil {alive player}; //--- Show warning when Zeus key is not assigned if (count (actionkeys "curatorInterface") == 0) then { @@ -319,7 +327,7 @@ if (_activated) then { //--- Show hint about pinging for players if ( - isNil {profilenamespace getVariable "bis_fnc_curatorPinged_done"} + isnil {profilenamespace getvariable "bis_fnc_curatorPinged_done"} && {isTutHintsEnabled} && diff --git a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf index 1143c30443..68e6e30242 100644 --- a/addons/zeus/functions/fnc_bi_moduleProjectile.sqf +++ b/addons/zeus/functions/fnc_bi_moduleProjectile.sqf @@ -42,7 +42,6 @@ if (_activated) then { _ammo = _logic getVariable ["type",gettext (configFile >> "CfgVehicles" >> typeOf _logic >> "ammo")]; if (_ammo != "") then { _CfgAmmo = configFile >> "CfgAmmo" >> _ammo; - //if !(isclass _CfgAmmo) exitWith {["CfgAmmo class '%1' not found.",_ammo] call bis_fnc_error;}; _dirVar = _fnc_scriptname + typeOf _logic; _logic setdir (missionnamespace getVariable [_dirVar,direction _logic]); //--- Restore custom direction _pos = getposatl _logic; @@ -104,16 +103,16 @@ if (_activated) then { _side = side group _x; if (_side in [east,west,resistance,civilian]) then { //--- Play radio (only if it wasn't played recently) - if (ACE_time > _x getVariable ["BIS_fnc_moduleProjectile_radio",-_delay]) then { + if (CBA_missionTime > _x getVariable ["BIS_fnc_moduleProjectile_radio",-_delay]) then { [[_side,_radio,"side"],"bis_fnc_sayMessage",_x] call bis_fnc_mp; - _x setVariable ["BIS_fnc_moduleProjectile_radio",ACE_time + _delay]; + _x setVariable ["BIS_fnc_moduleProjectile_radio",CBA_missionTime + _delay]; }; }; }; } forEach _entities; }; }; - if (count _hint > 0) then { + if (count _hint > 0 && {count objectCurators _logic > 0}) then { [[_hint,nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",objectcurators _logic] call bis_fnc_mp; }; if (count _velocity == 3) then { diff --git a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf index 7eec86bb7d..f32afef130 100644 --- a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf +++ b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf @@ -23,11 +23,11 @@ _activated = _this select 2; if (_activated && local _logic && !isnull curatorcamera) then { //--- Terminate when remote control is already in progress - if !(isnull (missionnamespace getVariable ["bis_fnc_moduleRemoteControl_unit",objnull])) exitWith {}; + if !(isnull (missionnamespace getvariable ["bis_fnc_moduleRemoteControl_unit",objnull])) exitwith {}; //--- Get unit under cursor _unit = objnull; - _mouseOver = missionnamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; + _mouseOver = missionnamespace getvariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;}; _unit = effectivecommander _unit; @@ -37,7 +37,8 @@ if (_activated && local _logic && !isnull curatorcamera) then { if (isplayer _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer";}; if !(alive _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorDestroyed";}; if (isnull _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorNull";}; - if !(isnull (_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull])) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";}; + if !(isnull (_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull])) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";}; + if (isuavconnected vehicle _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";}; if (_error == "") then { _unit spawn { @@ -47,7 +48,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { _vehicleRole = str assignedvehiclerole _unit; bis_fnc_moduleRemoteControl_unit = _unit; - _unit setVariable ["bis_fnc_moduleRemoteControl_owner",player,true]; + _unit setvariable ["bis_fnc_moduleRemoteControl_owner",player,true]; // Added by ace_zeus to toggle remote control wind sound if (GVAR(remoteWind)) then { @@ -76,7 +77,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { //--- Wait for interface to close (finddisplay 312) closedisplay 2; - waitUntil {isnull curatorcamera}; + waituntil {isnull curatorcamera}; //--- Switch player remotecontrol _unit; @@ -106,7 +107,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { _vehicle = vehicle _unit; _vehicleRole = str assignedvehiclerole _unit; _rating = rating player; - waitUntil { + waituntil { //--- Refresh when vehicle or vehicle role changes if ((vehicle _unit != _vehicle || str assignedvehiclerole _unit != _vehicleRole) && {alive _unit}) then { player remotecontrol _unit; @@ -123,43 +124,49 @@ if (_activated && local _logic && !isnull curatorcamera) then { || {!alive _unit} //--- Also isnull check, objNull is not alive || + {!alive player} + || {isnull getassignedcuratorlogic player} - //|| - //{_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull] != player} //--- Another curator stole the unit }; player addrating (-rating player + _rating); objnull remotecontrol _unit; - _unit setVariable ["bis_fnc_moduleRemoteControl_owner",nil,true]; + _unit setvariable ["bis_fnc_moduleRemoteControl_owner",nil,true]; - //--- Death screen - if ( - isnull curatorcamera - && - {cameraon != vehicle player} - && - {!isnull _unit} - && - {!isnull getassignedcuratorlogic player} - //&& - //{(_unit getVariable ["bis_fnc_moduleRemoteControl_owner",objnull] == player)} - ) then { - sleep 2; - ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black out",1]; - sleep 1; + if (alive player) then { + //--- Death screen + if ( + isnull curatorcamera + && + {cameraon != vehicle player} + && + {!isnull _unit} + && + {!isnull getassignedcuratorlogic player} + //&& + //{(_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull] == player)} + ) then { + sleep 2; + ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black out",1]; + sleep 1; + }; + if !(isnull _unit) then { + _unitPos = getposatl _unit; + _camPos = [_unitPos,10,direction _unit + 180] call bis_fnc_relpos; + _camPos set [2,(_unitPos select 2) + (getterrainheightasl _unitPos) - (getterrainheightasl _camPos) + 10]; + //[_camPos,_unit] call bis_fnc_setcuratorcamera; + (getassignedcuratorlogic player) setvariable ["bis_fnc_modulecuratorsetcamera_params",[_camPos,_unit]]; + }; + + sleep 0.1; //--- Engine needs a delay in case controlled unit was deleted + ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black in",1e10]; + opencuratorinterface; + ppeffectdestroy _color; + + waituntil {!isnull curatorcamera}; + } else { + ppeffectdestroy _color; }; - _unitPos = getposatl _unit; - _camPos = [_unitPos,10,direction _unit + 180] call bis_fnc_relpos; - _camPos set [2,(_unitPos select 2) + (getterrainheightasl _unitPos) - (getterrainheightasl _camPos) + 10]; - //[_camPos,_unit] call bis_fnc_setcuratorcamera; - (getassignedcuratorlogic player) setVariable ["bis_fnc_modulecuratorsetcamera_params",[_camPos,_unit]]; - - sleep 0.1; //--- Engine needs a delay in case controlled unit was deleted - ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black in",1e10]; - opencuratorinterface; - ppeffectdestroy _color; - - waitUntil {!isnull curatorcamera}; player switchcamera cameraview; bis_fnc_moduleRemoteControl_unit = nil; ("bis_fnc_moduleRemoteCurator" call bis_fnc_rscLayer) cuttext ["","black in",1]; diff --git a/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf index 3acb024476..492914eb1c 100644 --- a/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf +++ b/addons/zeus/functions/fnc_moduleAddSpareTrack.sqf @@ -32,7 +32,7 @@ if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(c if (getNumber (configFile >> "CfgVehicles" >> "ACE_Track" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); } else { - ["AddCargoByClass", ["ACE_Track", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + ["ace_addCargoByClass", ["ACE_Track", _mouseOverUnit, 1, true]] call CBA_fnc_localEvent; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf index c353af189b..105acb2b83 100644 --- a/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf +++ b/addons/zeus/functions/fnc_moduleAddSpareWheel.sqf @@ -32,7 +32,7 @@ if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(c if (getNumber (configFile >> "CfgVehicles" >> "ACE_Wheel" >> QEGVAR(cargo,size)) > [_mouseOverUnit] call EFUNC(cargo,getCargoSpaceLeft)) then { [LSTRING(OnlyEnoughCargoSpace)] call EFUNC(common,displayTextStructured); } else { - ["AddCargoByClass", ["ACE_Wheel", _mouseOverUnit, 1, true]] call EFUNC(common,localEvent); + ["ace_addCargoByClass", ["ACE_Wheel", _mouseOverUnit, 1, true]] call CBA_fnc_localEvent; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleCaptive.sqf b/addons/zeus/functions/fnc_moduleCaptive.sqf index 8273c8ba6f..7d1c46f873 100644 --- a/addons/zeus/functions/fnc_moduleCaptive.sqf +++ b/addons/zeus/functions/fnc_moduleCaptive.sqf @@ -38,7 +38,7 @@ if (isNil QEFUNC(captives,setHandcuffed)) then { } else { _captive = GETVAR(_unit,EGVAR(captives,isHandcuffed),false); // Event initalized by ACE_Captives - ["SetHandcuffed", _unit, [_unit, !_captive]] call EFUNC(common,targetEvent); + [QEGVAR(captives,setHandcuffed), [_unit, !_captive], _unit] call CBA_fnc_targetEvent; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf b/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf new file mode 100644 index 0000000000..290f2d5e5f --- /dev/null +++ b/addons/zeus/functions/fnc_moduleGlobalSetSkill.sqf @@ -0,0 +1,49 @@ +/* + * Author: SilentSpike + * PV event handler to update the AI skill on all machines when set by zeus module + * + * Arguments: + * 0: Variable name + * 1: Variable new value + * + * Return Value: + * None + * + * Example: + * "ace_zeus_GlobalSkillAI" addPublicVariableEventHandler ace_zeus_fnc_moduleGlobalSetSkill + * + * Public: No + */ + +#include "script_component.hpp" + +_this params ["_varName","_varValue"]; +_varValue params ["_general","_accuracy","_handling","_spotting","_cover","_combat"]; +TRACE_1("Params",_this); + +TRACE_6("AI settings updated",GVAR(GlobalSkillAI)); +{ + if (local _x) then { + _unit setSkill ["general", _general]; + _unit setSkill ["commanding", _general]; + _unit setSkill ["courage", _general]; + _unit setSkill ["aimingAccuracy", _accuracy]; + _unit setSkill ["aimingShake", _handling]; + _unit setSkill ["aimingSpeed", _handling]; + _unit setSkill ["reloadSpeed", _handling]; + _unit setSkill ["spotDistance", _spotting]; + _unit setSkill ["spotTime", _spotting]; + + if (_cover) then { + _unit enableAI "COVER"; + } else { + _unit disableAI "COVER"; + }; + + if (_combat) then { + _unit enableAI "AUTOCOMBAT"; + } else { + _unit disableAI "AUTOCOMBAT"; + }; + }; +} forEach allUnits; diff --git a/addons/zeus/functions/fnc_moduleGroupSide.sqf b/addons/zeus/functions/fnc_moduleGroupSide.sqf new file mode 100644 index 0000000000..fa37ca3463 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleGroupSide.sqf @@ -0,0 +1,45 @@ +/* + * Author: SilentSpike + * Zeus module function to change side of a group on dialog confirmation + * + * Arguments: + * 0: Unit to target + * 1: Chosen side + * + * Return Value: + * None + * + * Example: + * [this, west] call ace_zeus_fnc_moduleGroupSide + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_unit","_newSide"]; +private _side = side _unit; + +// Nothing to do here +if (_side == _newSide) exitWith {}; + +private _oldGroup = group _unit; +private _newGroup = createGroup _newSide; + +// Pretty hacky, will replace units return group with this new group if unconcious +if (GETVAR(_unit,ACE_isUnconscious,false) && {GETMVAR(EGVAR(medical,moveUnitsFromGroupOnUnconscious),false)}) then { + private _previousGroupsList = _unit getVariable [QEGVAR(common,previousGroupSwitchTo), []]; + + { + if ("ACE_isUnconscious" == (_x select 2)) exitWith { + _x set [0,_newGroup]; + _x set [1,_newSide]; + _previousGroupsList set [_forEachIndex, _x]; + }; + } forEach _previousGroupsList; + + _unit setVariable [QEGVAR(common,previousGroupSwitchTo), _previousGroupsList, true]; +} else { + (units _unit) joinSilent _newGroup; + deleteGroup _oldGroup; +}; diff --git a/addons/zeus/functions/fnc_moduleSearchNearby.sqf b/addons/zeus/functions/fnc_moduleSearchNearby.sqf new file mode 100644 index 0000000000..48f35bbfee --- /dev/null +++ b/addons/zeus/functions/fnc_moduleSearchNearby.sqf @@ -0,0 +1,51 @@ +/* + * Author: SilentSpike + * Commands the group the module is placed on to search the nearest building + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic","_units","_activated"]; + +if !(_activated && local _logic) exitWith {}; + +//Validate the module target: +private _unit = effectiveCommander (attachedTo _logic); +private _building = nearestBuilding (getPosASL _unit); + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call _fnc_errorAndClose; + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call _fnc_errorAndClose; + }; + case (alive _unit): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; + case (_unit distance _building < 500): { + [LSTRING(BuildingTooFar)] call _fnc_errorAndClose; + }; +}; + +//Perform the module function: +[QGVAR(moduleSearchNearby), [_unit], _unit] call CBA_fnc_targetEvent; +deleteVehicle _logic; diff --git a/addons/zeus/functions/fnc_moduleSurrender.sqf b/addons/zeus/functions/fnc_moduleSurrender.sqf index 95f35593a5..e14501feb0 100644 --- a/addons/zeus/functions/fnc_moduleSurrender.sqf +++ b/addons/zeus/functions/fnc_moduleSurrender.sqf @@ -41,7 +41,7 @@ if (isNil QEFUNC(captives,setSurrendered)) then { } else { _surrendering = GETVAR(_unit,EGVAR(captives,isSurrendering),false); // Event initalized by ACE_Captives - ["SetSurrendered", _unit, [_unit, !_surrendering]] call EFUNC(common,targetEvent); + [QEGVAR(captives,setSurrendered), [_unit, !_surrendering], _unit] call CBA_fnc_targetEvent; }; }; }; diff --git a/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf b/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf new file mode 100644 index 0000000000..decdb21999 --- /dev/null +++ b/addons/zeus/functions/fnc_moduleTeleportPlayers.sqf @@ -0,0 +1,43 @@ +/* + * Author: SilentSpike + * Zeus module function to teleport players on dialog confirmation + * + * Arguments: + * 0: Teleport to + * 1: Player UID + * 2: Teleport group + * + * Return Value: + * None + * + * Example: + * [player, "5854854754", false] call ace_zeus_fnc_moduleTeleportPlayers + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_logic","_uid","_group"]; + +// Get the chosen unit +private _player = [_uid] call BIS_fnc_getUnitByUID; + +// Handle if group mode was selected +if (_group) then { + _player = units _player; +} else { + _player = [_player]; +}; + +// Handle teleportation +{ + moveOut _x; + + private _attached = attachedTo _logic; + if (isNull _attached) then { + [_x, _logic] call BIS_fnc_moveToRespawnPosition; + } else { + [_x, _attached] call BIS_fnc_moveToRespawnPosition; + }; +} forEach _player; diff --git a/addons/zeus/functions/fnc_ui_attributeCargo.sqf b/addons/zeus/functions/fnc_ui_attributeCargo.sqf new file mode 100644 index 0000000000..444fa5e7e2 --- /dev/null +++ b/addons/zeus/functions/fnc_ui_attributeCargo.sqf @@ -0,0 +1,33 @@ +/* + * Author: PabstMirror + * Initalises the ace_cargo attribute of the zeus vehicle attributes display + * (the display shown on double click) + * + * Arguments: + * 0: ace_cargo controls group + * + * Return Value: + * None + * + * Example: + * onSetFocus = "_this call ace_zeus_fnc_ui_vehCargo" + * + * Public: No + */ + +#include "script_component.hpp" + +params ["_control"]; +TRACE_1("params",_control); + +private _veh = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); +TRACE_1("",_veh); + +private _loaded = _veh getVariable [QEGVAR(cargo,loaded), []]; +TRACE_1("",_loaded); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +{ + (_control controlsGroupCtrl 80086) lbAdd (str _x); +} forEach _loaded; diff --git a/addons/zeus/functions/fnc_ui_attributePosition.sqf b/addons/zeus/functions/fnc_ui_attributePosition.sqf new file mode 100644 index 0000000000..95557a891b --- /dev/null +++ b/addons/zeus/functions/fnc_ui_attributePosition.sqf @@ -0,0 +1,60 @@ +/* + * Author: SilentSpike + * Initalises the `position` zeus module attribute + * + * Arguments: + * 0: position controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _map = _control controlsGroupCtrl 26469; + +// Centre map on the logic initially +_map ctrlMapAnimAdd [0, ctrlMapScale _map, _logic]; +ctrlMapAnimCommit _map; + +private _fnc_onDraw = { + params ["_map"]; + + private _display = ctrlParent _map; + private _pos = GETVAR(_display,GVAR(position),[]); + private _radius = GETVAR(_display,GVAR(radius),0); + + if !(_pos isEqualTo []) then { + // Works alongside radius attribute + if (_radius == 0) then { + _map drawIcon ["\A3\ui_f\data\map\markers\military\dot_CA.paa", [0,0,0,1], _pos, 19, 19, 0, "", 0, 0]; + } else { + _map drawEllipse [_pos, _radius, _radius, 0, [0,0,0,1], ""]; + }; + }; +}; + +private _fnc_onMapClick = { + params ["_map","_button","_x","_y","_shift","_ctrl","_alt"]; + + if (_button == 0) then { + private _display = ctrlParent _map; + SETVAR(_display,GVAR(position),_pos); + }; +}; + +SETVAR(_display,GVAR(position),getPos _logic); +_map ctrlAddEventHandler ["draw",_fnc_onDraw]; +_map ctrlAddEventHandler ["mouseButtonDown",_fnc_onMapClick]; diff --git a/addons/zeus/functions/fnc_ui_attributeRadius.sqf b/addons/zeus/functions/fnc_ui_attributeRadius.sqf new file mode 100644 index 0000000000..c26f8ac97d --- /dev/null +++ b/addons/zeus/functions/fnc_ui_attributeRadius.sqf @@ -0,0 +1,47 @@ +/* + * Author: SilentSpike + * Initalises the `radius` zeus module attribute + * + * Arguments: + * 0: radius controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _edit = _control controlsGroupCtrl 26467; + +_edit ctrlSetText "100"; + +private _fnc_onKeyUp = { + params ["_display"]; + + private _edit = _display displayCtrl 26467; + private _radius = parseNumber (ctrlText _edit); + + // Handle invalid radius (non-numerical input) + if (_radius == 0) then { + _edit ctrlSetTooltip (localize LSTRING(AttributeRadiusInvalid)); + _edit ctrlSetTextColor [1,0,0,1]; + } else { + _edit ctrlSetTooltip ""; + _edit ctrlSetTextColor [1,1,1,1]; + SETVAR(_display,GVAR(radius),_radius); + }; +}; + +[_display] call _fnc_onKeyUp; +_display displayAddEventHandler ["keyUp", _fnc_onKeyUp]; diff --git a/addons/zeus/functions/fnc_ui_defendArea.sqf b/addons/zeus/functions/fnc_ui_defendArea.sqf new file mode 100644 index 0000000000..6fcb4a17d5 --- /dev/null +++ b/addons/zeus/functions/fnc_ui_defendArea.sqf @@ -0,0 +1,76 @@ +/* + * Author: SilentSpike + * Initalises the `defend area` zeus module display + * + * Arguments: + * 0: dummy controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Validate the module target: +private _unit = effectiveCommander (attachedTo _logic); + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call _fnc_errorAndClose; + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call _fnc_errorAndClose; + }; + case (alive _unit): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; +}; + +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + if (_this select 1 == 2) then { + deleteVehicle _logic; + }; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + private _unit = effectiveCommander (attachedTo _logic); + private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); + + [QGVAR(moduleDefendArea), [_unit,_position,_radius], _unit] call CBA_fnc_targetEvent; + deleteVehicle _logic; +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_control ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_globalSetSkill.sqf b/addons/zeus/functions/fnc_ui_globalSetSkill.sqf new file mode 100644 index 0000000000..8dcac19bce --- /dev/null +++ b/addons/zeus/functions/fnc_ui_globalSetSkill.sqf @@ -0,0 +1,81 @@ +/* + * Author: PabstMirror + * Initalises the `global skill` zeus module display + * + * Arguments: + * 0: globalSetSkill controls group + * + * Return Value: + * None + * + * Example: + * onSetFocus = "_this call ace_zeus_fnc_ui_globalSetSkill" + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +params ["_control"]; +TRACE_1("params",_control); + +//Generic Init: +private _display = ctrlparent _control; +private _ctrlButtonOK = _display displayctrl 1; //IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); +TRACE_1("logicObject",_logic); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _fnc_sliderMove = { + params ["_slider"]; + private _idc = ctrlIDC _slider; // IDCs ∈ [16184,16187] + private _curVal = GVAR(GlobalSkillAI) select (_idc - 16184); // [0,3] + _slider ctrlSetTooltip format ["%1%3 (was %2%3)", round(sliderPosition _slider * 100), round(_curVal * 100), "%"]; +}; + +{ + private _slider = _display displayCtrl _x; + _slider sliderSetRange [0, 1]; + _slider sliderSetSpeed [0.01,0.1]; + _slider sliderSetPosition (GVAR(GlobalSkillAI) select _forEachIndex); + _slider ctrlAddEventHandler ["SliderPosChanged", _fnc_sliderMove]; + _slider call _fnc_sliderMove; +} forEach [16184,16185,16186,16187]; + +(_display displayCtrl 16188) cbSetChecked (GVAR(GlobalSkillAI) select 4); +(_display displayCtrl 16189) cbSetChecked (GVAR(GlobalSkillAI) select 5); + +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + deleteVehicle _logic; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + TRACE_1("_fnc_onConfirm params",_this); + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + GVAR(GlobalSkillAI) = [ + sliderPosition (_display displayCtrl 16184), // General + sliderPosition (_display displayCtrl 16185), // Accuracy + sliderPosition (_display displayCtrl 16186), // Handling + sliderPosition (_display displayCtrl 16187), // Spotting + cbChecked (_display displayCtrl 16188), // Seek cover + cbChecked (_display displayCtrl 16189) // Autocombat + ]; + publicVariable QGVAR(GlobalSkillAI); // Values should persist for future use + + // PV EH won't run on local machine + [QGVAR(GlobalSkillAI),GVAR(GlobalSkillAI)] call FUNC(moduleGlobalSetSkill); +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_groupSide.sqf b/addons/zeus/functions/fnc_ui_groupSide.sqf new file mode 100644 index 0000000000..be3298c8da --- /dev/null +++ b/addons/zeus/functions/fnc_ui_groupSide.sqf @@ -0,0 +1,136 @@ +/* + * Author: SilentSpike + * Initalises the `group side` zeus module display + * + * Arguments: + * 0: groupSide controls group + * + * Return Value: + * NONE + * + * Example: + * onSetFocus = "_this call ace_zeus_fnc_ui_groupSide" + * + * Public: No + */ + +#include "script_component.hpp" +#define IDCs [31201,31200,31202,31203] + +disableSerialization; + +params ["_control"]; + +//Generic Init: +private _display = ctrlparent _control; +private _ctrlButtonOK = _display displayctrl 1; //IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); +TRACE_1("logicObject",_logic); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Validate the module target: +private _unit = effectiveCommander (attachedTo _logic); +private _side = side _unit; + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call _fnc_errorAndClose; + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call _fnc_errorAndClose; + }; + case (alive _unit): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; + case (_side in [west,east,independent,civilian]): { + [LSTRING(OnlySpecificSide)] call _fnc_errorAndClose; + }; +}; + +//Specific on-load stuff: +private _idcActive = 31200 + ([west,east,independent,civilian] find _side); +SETVAR(_display,oldSide,_idcActive - 31200); +SETVAR(_display,newSide,_idcActive - 31200); + +private _fnc_onSelection = { + params [["_activeCtrl", controlNull, [controlNull]]]; + + private _display = ctrlParent _activeCtrl; + if (isNull _display) exitWith {}; + + // Update the button scales and colours on selection + { + private _ctrl = _display displayCtrl _x; + private _color = _ctrl getVariable "color"; + private _scale = 1; + + if (ctrlIDC _activeCtrl == _x) then { + _color set [3,1]; + _scale = 1.2 + } else { + _color set [3,0.5]; + }; + + _ctrl ctrlSetTextColor _color; + [_ctrl,_scale,0.1] call BIS_fnc_ctrlSetScale; + } forEach IDCs; + + // Store selected button index for confirmation + SETVAR(_display,newSide,(ctrlIDC _activeCtrl) - 31200); +}; + +// Initalize buttons with colour and scale +{ + private _ctrl = _display displayCtrl _x; + private _color = [_forEachIndex] call BIS_fnc_sideColor; + _ctrl setVariable ["color", _color]; + _ctrl ctrlSetActiveColor _color; + _color set [3,0.5]; + + if (ctrlIDC _ctrl == _idcActive) then { + [_ctrl,1.2,0] call BIS_fnc_ctrlSetScale; + _color set [3,1]; + }; + + _ctrl ctrlSetTextColor _color; + + _ctrl ctrlAddEventHandler ["buttonclick", _fnc_onSelection]; +} forEach IDCs; + +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + if (_this select 1 == 2) then { + deleteVehicle _logic; + }; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + private _unit = effectiveCommander (attachedTo _logic); + private _side = [west,east,independent,civilian] select (GETVAR(_display,newSide,GETVAR(_display,oldSide,0))); + + [_unit, _side] call FUNC(moduleGroupSide); + deleteVehicle _logic; +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_patrolArea.sqf b/addons/zeus/functions/fnc_ui_patrolArea.sqf new file mode 100644 index 0000000000..d4fbc092a0 --- /dev/null +++ b/addons/zeus/functions/fnc_ui_patrolArea.sqf @@ -0,0 +1,76 @@ +/* + * Author: SilentSpike + * Initalises the `patrol area` zeus module display + * + * Arguments: + * 0: dummy controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Validate the module target: +private _unit = effectiveCommander (attachedTo _logic); + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call _fnc_errorAndClose; + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call _fnc_errorAndClose; + }; + case (alive _unit): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; +}; + +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + if (_this select 1 == 2) then { + deleteVehicle _logic; + }; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + private _unit = effectiveCommander (attachedTo _logic); + private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); + + [QGVAR(modulePatrolArea), [_unit,_position,_radius,5], _unit] call CBA_fnc_targetEvent; + deleteVehicle _logic; +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_control ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_searchArea.sqf b/addons/zeus/functions/fnc_ui_searchArea.sqf new file mode 100644 index 0000000000..3da147b963 --- /dev/null +++ b/addons/zeus/functions/fnc_ui_searchArea.sqf @@ -0,0 +1,82 @@ +/* + * Author: SilentSpike + * Initalises the `search area` zeus module display + * + * Arguments: + * 0: dummy controls group + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +//Generic Init: +params ["_control"]; +private _display = ctrlParent _control; +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Validate the module target: +private _unit = effectiveCommander (attachedTo _logic); + +scopeName "Main"; +private _fnc_errorAndClose = { + params ["_msg"]; + _display closeDisplay 0; + deleteVehicle _logic; + [_msg] call EFUNC(common,displayTextStructured); + breakOut "Main"; +}; + +switch (false) do { + case !(isNull _unit): { + [LSTRING(NothingSelected)] call _fnc_errorAndClose; + }; + case (_unit isKindOf "CAManBase"): { + [LSTRING(OnlyInfantry)] call _fnc_errorAndClose; + }; + case (alive _unit): { + [LSTRING(OnlyAlive)] call _fnc_errorAndClose; + }; +}; + +private _fnc_onUnload = { + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + if (_this select 1 == 2) then { + deleteVehicle _logic; + }; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + private _unit = effectiveCommander (attachedTo _logic); + private _radius = GETVAR(_display,GVAR(radius),50); + private _position = GETVAR(_display,GVAR(position),getPos _logic); + private _marker = QGVAR(ModuleSearchArea) + str(_unit); + + createMarker [_marker, _position]; + _marker setMarkerAlpha 0; + _marker setMarkerShape "ELLIPSE"; + _marker setMarkerSize [_radius,_radius]; + + [QGVAR(moduleSearchArea), [_unit,_marker], _unit] call CBA_fnc_targetEvent; + deleteVehicle _logic; +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_control ctrlAddEventHandler ["buttonClick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_ui_teleportPlayers.sqf b/addons/zeus/functions/fnc_ui_teleportPlayers.sqf new file mode 100644 index 0000000000..bdcd8ae93f --- /dev/null +++ b/addons/zeus/functions/fnc_ui_teleportPlayers.sqf @@ -0,0 +1,70 @@ +/* + * Author: SilentSpike + * Initalises the `teleport players` zeus module display + * + * Arguments: + * 0: teleportPlayers controls group + * + * Return Value: + * NONE + * + * Example: + * onSetFocus = "_this call ace_zeus_fnc_ui_teleportPlayers" + * + * Public: No + */ + +#include "script_component.hpp" + +disableSerialization; + +params ["_control"]; + +//Generic Init: +private _display = ctrlparent _control; +private _ctrlButtonOK = _display displayctrl 1; //IDC_OK +private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); +TRACE_1("logicObject",_logic); + +_control ctrlRemoveAllEventHandlers "setFocus"; + +//Specific on-load stuff: +private _listbox = _display displayCtrl 16189; +{ + if (alive _x) then { + _listbox lbSetData [_listbox lbAdd (name _x), getPlayerUID _x]; + }; +} forEach allPlayers; + +_listbox lbSetCurSel 0; +(_display displayCtrl 16188) cbSetChecked (_logic getVariable ["tpGroup",false]); + +private _fnc_onUnload = { + params ["_display"]; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + // Store checkbox value for reopening + _logic setVariable ["tpGroup", cbChecked (_display displayCtrl 16188)]; +}; + +private _fnc_onConfirm = { + params [["_ctrlButtonOK", controlNull, [controlNull]]]; + + private _display = ctrlparent _ctrlButtonOK; + if (isNull _display) exitWith {}; + + private _logic = GETMVAR(BIS_fnc_initCuratorAttributes_target,objnull); + if (isNull _logic) exitWith {}; + + private _lb = _display displayCtrl 16189; + + private _uid = _lb lbData (lbCurSel _lb); + private _group = cbChecked (_display displayCtrl 16188); + + [_logic, _uid, _group] call FUNC(moduleTeleportPlayers); +}; + +_display displayAddEventHandler ["unload", _fnc_onUnload]; +_ctrlButtonOK ctrlAddEventHandler ["buttonclick", _fnc_onConfirm]; diff --git a/addons/zeus/functions/fnc_zeusAttributes.sqf b/addons/zeus/functions/fnc_zeusAttributes.sqf new file mode 100644 index 0000000000..dcbef69510 --- /dev/null +++ b/addons/zeus/functions/fnc_zeusAttributes.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Dummy function to include BIS script file. + * Used in initalisation of zeus attribute displays. + * + * Arguments: + * 0: UI event string + * 1: UI event parameters + * 2: Display class name + * + * Return Value: + * None + * + * Example: + * onLoad = "['onLoad',_this,'RscDisplayExample'] call ace_zeus_fnc_zeusAttributes" + * + * Public: No + */ + +#include "script_component.hpp" + +TRACE_1("params",_this); + +#include "\a3\ui_f_curator\UI\Displays\RscDisplayAttributes.sqf" diff --git a/addons/zeus/script_component.hpp b/addons/zeus/script_component.hpp index cb0fa29be3..ba32164b87 100644 --- a/addons/zeus/script_component.hpp +++ b/addons/zeus/script_component.hpp @@ -1,4 +1,5 @@ #define COMPONENT zeus +#define COMPONENT_BEAUTIFIED Zeus #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL @@ -15,3 +16,11 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +// UI grid +#define SIZEX ((safezoneW / safezoneH) min 1.2) +#define SIZEY (SIZEX / 1.2) +#define W_PART(num) (num * (SIZEX / 40)) +#define H_PART(num) (num * (SIZEY / 25)) +#define X_PART(num) (W_PART(num) + (safezoneX + (safezoneW - SIZEX)/2)) +#define Y_PART(num) (H_PART(num) + (safezoneY + (safezoneH - SIZEY)/2)) diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index c07d4f7f84..cc37293a25 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -8,7 +8,7 @@ Nastavení Zeuse Zeus-Einstellungen Ajustes do Zeus - Paramètres du Zeus + Paramètres de Zeus Zeus beállítások Настройки Зевса Impostazioni Zeus @@ -32,7 +32,7 @@ Zpráva o novém Zeusovi Aufstiegsnachrichten Mensagens de ascensão - Message ascension + Message d'ascension Felemelkedési üzenetek Сообщения о вознесении Messaggi di Ascesa @@ -44,7 +44,7 @@ Zobrazit globální zprávu když je hráč přiřazen jako Zeus. Zeige globale Popup-Nachrichten wenn ein Spieler zu Zeus wird. Mostra uma mensagem popup quando um jogador é atribuido ao Zeus. - Affiche un message en global quand un joueur est assigner comme Zeus + Affiche un message global quand un joueur est assigné en tant que Zeus Globális üzeneteket jelez ki, ha egy játékos Zeus-nak lesz beosztva. Отображает глобальное всплывающее сообщение, когда один из игроков становится Зевсом. Mostra messaggi popup globali quando un giocatore viene assegnato come Zeus. @@ -181,6 +181,70 @@ Пленный (вкл./выкл.) Apri Catturato + + Defend Area + Défendre la zone + + + Global AI Skill + Compétence global de l'IA + + + General Skill + Compétence générale + + + Changes: general, commanding, courage + Change: general, commanding, courage + + + Accuracy + Précision + + + Changes: aimingAccuracy + Change: aimingAccuracy + + + Weapon Handling + Maniement d'armes + + + Changes: aimingShake, aimingSpeed, reloadSpeed + Change: aimingShake, aimingSpeed, reloadSpeed + + + Spotting + repérage + + + Changes: spotDistance, spotTime + Change: spotDistance, spotTime + + + Seek Cover + Chercher couverture + + + Should AI seek cover + L'IA devrait elle chercher couverture + + + Auto Combat + Combat automatique + + + Should AI automatically switch to combat mode + L'IA devrait elle passer automatiquement en mode combat + + + Group Side + Côté du groupe + + + Patrol Area + Zone de patrouille + Toggle Surrender Przełącz kapitulację @@ -193,6 +257,26 @@ Сдавшийся (вкл./выкл.) Apri Resa + + Teleport Players + Téléporter joueurs + + + Player + Joueur + + + Teleport selected player to module position + Téléporter le joueur sélectionné à la position du module + + + Teleport Group + Téléporter le groupe + + + Teleports all units in group + Téléporte toutes les unités du groupe + Toggle Unconscious Przełącz nieprzytomność @@ -205,6 +289,14 @@ Без сознания (вкл./выкл.) Apri Incosciente + + Search Area + Chercher la zone + + + Search Nearby Building + Chercher le bâtiment proche + Assign Medic Sanitäter zuweisen. @@ -249,17 +341,6 @@ Agregar rueda de auxilio Ajouter pièce de rechange - - Adds a Spare Wheel to the vehicle - Adiciona uma roda sobressalente ao veículo - Dodaje koło zapasowe do pojazdu - Добавляет запасное колесо в транспорт - Přidá rezervní kolo do vozidla - Aggiungi una ruota di scorta al veicolo - Fügt dem Fahrzeug ein Ersatzrad hinzu - Agrega una rueda de auxilio al vehículo - Ajoute une roue de secours au véhicule - Add Spare Track Adicionar esteira sobressalente @@ -271,17 +352,6 @@ Agregar oruga de repuesto Ajouter une chenille de secours - - Adds a Spare Track to the vehicle - Adiciona uma esteira sobressalente ao veículo - Dodaje zapasową gąsienicę do pojazdu - Добавляет запасную гусеницу в транспорт - Přidá náhradní pás do vozidla - Aggiungi un cingolo di scorta al veicolo - Fügt dem Fahrzeug eine Ersatzkette hinzu - Agrega una oruga de repuesto al vehículo - Ajoute une chenille de reserve - Unit must be alive Utiliser uniquement sur une unité vivante @@ -362,9 +432,17 @@ Юнит не должен быть пленным L'unità non dev'essere un prigioniero + + Unit must belong to an appropriate side + L'unité doit appartenir à un côté approprié + + + Nearest building is too far away + Le bâtiment le plus proche est trop loin + Place on a unit - Rien sous le curseur + Placez sur une unité Es wurde nichts ausgewählt Nada bajo el ratón Coloque em uma unidade @@ -408,5 +486,29 @@ Ajoute n'importe quel objet spawné à tous les curateurs de la mission Fügt jedes gespawnte Objekt allen Kuratoren der Mission hinzu + + Cargo: + Cargo: + + + Task Position + Position de la tâche + + + Select a position to perform the task at + Sélectionne une position où accomplir la tâche + + + Task Radius + Rayon de la tâche + + + Radius to perform the task within + Rayon dans lequel la tâche prend place + + + Invalid radius entered + rayon invalide entré + - + \ No newline at end of file diff --git a/addons/zeus/ui/RscAttributes.hpp b/addons/zeus/ui/RscAttributes.hpp new file mode 100644 index 0000000000..1efcde2c66 --- /dev/null +++ b/addons/zeus/ui/RscAttributes.hpp @@ -0,0 +1,422 @@ +class RscControlsGroup; +class RscControlsGroupNoScrollbars; +class RscText; +class RscListbox; +class RscCombo; +class RscEdit; +class RscXSliderH; +class RscCheckBox; +class RscActivePicture; +class RscMapControl; + +class RscDisplayAttributes { + class Controls { + class Background; + class Title; + class Content: RscControlsGroup { + class controls; + }; + class ButtonOK; + class ButtonCancel; + }; +}; + +class GVAR(AttributeRadius): RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_attributeRadius)); + idc = 26466; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(1.2); + class controls { + class Title1: RscText { + idc = -1; + text = CSTRING(AttributeRadius); + toolTip = CSTRING(AttributeRadius_desc); + x = 0; + y = H_PART(0.1); + w = W_PART(10); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Radius: RscEdit { + idc = 26467; + x = W_PART(10.1); + y = H_PART(0.1); + w = W_PART(15.8); + h = H_PART(1); + autocomplete = ""; + }; + }; +}; + +class GVAR(AttributePosition): RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_attributePosition)); + idc = 26468; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(26); + class controls { + class Title1: RscText { + idc = -1; + text = CSTRING(AttributePosition); + toolTip = CSTRING(AttributePosition_desc); + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Position: RscMapControl { + idc = 26469; + x = W_PART(0.5); + y = H_PART(1.1); + w = W_PART(25); + h = H_PART(24.8); + }; + }; +}; + +class GVAR(RscDefendArea): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscDefendArea)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; + }; + }; + class ButtonOK: ButtonOK { + onSetFocus = QUOTE(_this call FUNC(ui_defendArea)); + }; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(RscGlobalSetSkill): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscGlobalSetSkill)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscGlobalSetSkill)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class globalSetSkill: RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_globalSetSkill)); + idc = 26422; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(6.5); + class controls { + class Title1: RscText { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_general); + toolTip = CSTRING(ModuleGlobalSetSkill_general_desc); + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class General: RscXSliderH { + idc = 16184; + x = W_PART(10.1); + y = 0; + w = W_PART(15.9); + h = H_PART(1); + }; + class Title2: Title1 { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_accuracy); + toolTip = CSTRING(ModuleGlobalSetSkill_accuracy_desc); + y = H_PART(1.1); + }; + class Accuracy: General { + idc = 16185; + y = H_PART(1.1); + }; + class Title3: Title1 { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_handling); + toolTip = CSTRING(ModuleGlobalSetSkill_handling_desc); + y = H_PART(2.2); + }; + class Handling: General { + idc = 16186; + y = H_PART(2.2); + }; + class Title4: Title1 { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_spotting); + toolTip = CSTRING(ModuleGlobalSetSkill_spotting_desc); + y = H_PART(3.3); + }; + class Spotting: General { + idc = 16187; + y = H_PART(3.3); + }; + class Title5: Title1 { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_cover); + toolTip = CSTRING(ModuleGlobalSetSkill_cover_desc); + y = H_PART(4.4); + }; + class Cover: RscCheckBox { + idc = 16188; + x = W_PART(10.1); + y = H_PART(4.4); + w = W_PART(1); + h = H_PART(1); + }; + class Title6: Title5 { + idc = -1; + text = CSTRING(ModuleGlobalSetSkill_combat); + toolTip = CSTRING(ModuleGlobalSetSkill_combat_desc); + y = H_PART(5.5); + }; + class Combat: Cover { + idc = 16189; + y = H_PART(5.5); + }; + }; + }; + }; + }; + class ButtonOK: ButtonOK {}; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(RscGroupSide): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscGroupSide)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscGroupSide)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class groupSide: RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_groupSide)); + idc = 26422; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(2.5); + class controls { + class Title: RscText { + idc = 31002; + text = "$STR_disp_arcunit_side"; + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(2.5); + colorBackground[] = {0,0,0,0.5}; + }; + class Background: RscText { + idc = 31000; + x = W_PART(10); + y = 0; + w = W_PART(16); + h = H_PART(2.5); + colorBackground[] = {1,1,1,0.1}; + }; + class BLUFOR: RscActivePicture { + idc = 31200; + text = "\a3\Ui_f\data\Map\Markers\NATO\b_unknown.paa"; + x = W_PART(12.5); + y = H_PART(0.25); + w = W_PART(2); + h = H_PART(2); + tooltip = "$STR_WEST"; + }; + class OPFOR: BLUFOR { + idc = 31201; + text = "\a3\Ui_f\data\Map\Markers\NATO\o_unknown.paa"; + x = W_PART(15.5); + y = H_PART(0.25); + w = W_PART(2); + h = H_PART(2); + tooltip = "$STR_EAST"; + }; + class Independent: BLUFOR { + idc = 31202; + text = "\a3\Ui_f\data\Map\Markers\NATO\n_unknown.paa"; + x = W_PART(18.5); + y = H_PART(0.25); + w = W_PART(2); + h = H_PART(2); + tooltip = "$STR_guerrila"; + }; + class Civilian: BLUFOR { + idc = 31203; + text = "\a3\Ui_f\data\Map\Markers\NATO\n_unknown.paa"; + x = W_PART(21.5); + y = H_PART(0.25); + w = W_PART(2); + h = H_PART(2); + tooltip = "$STR_Civilian"; + }; + }; + }; + }; + }; + class ButtonOK: ButtonOK {}; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(RscPatrolArea): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscPatrolArea)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscPatrolArea)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; + }; + }; + class ButtonOK: ButtonOK { + onSetFocus = QUOTE(_this call FUNC(ui_patrolArea)); + }; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(RscSearchArea): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscSearchArea)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscSearchArea)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class radius: GVAR(AttributeRadius) {}; + //class position: GVAR(AttributePosition) {}; + }; + }; + class ButtonOK: ButtonOK { + onSetFocus = QUOTE(_this call FUNC(ui_searchArea)); + }; + class ButtonCancel: ButtonCancel {}; + }; +}; + +class GVAR(RscTeleportPlayers): RscDisplayAttributes { + onLoad = QUOTE([ARR_3('onLoad', _this, QUOTE(QGVAR(RscTeleportPlayers)))] call FUNC(zeusAttributes)); + onUnload = QUOTE([ARR_3('onUnload', _this, QUOTE(QGVAR(RscTeleportPlayers)))] call FUNC(zeusAttributes)); + class Controls: Controls { + class Background: Background {}; + class Title: Title {}; + class Content: Content { + class Controls { + class teleportPlayers: RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_teleportPlayers)); + idc = 26422; + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(8.5); + class controls { + class Title: RscText { + idc = -1; + text = CSTRING(ModuleTeleportPlayers_player); + toolTip = CSTRING(ModuleTeleportPlayers_player_desc); + x = 0; + y = 0; + w = W_PART(26); + h = H_PART(1); + colorBackground[] = {0,0,0,0.5}; + }; + class Unit: RscListbox { + idc = 16189; + x = 0; + y = H_PART(1.1); + w = W_PART(26); + h = H_PART(5.9); + }; + class Label: Title { + idc = -1; + text = CSTRING(ModuleTeleportPlayers_group); + toolTip = CSTRING(ModuleTeleportPlayers_group_desc); + y = H_PART(7.1); + w = W_PART(10); + }; + class UseGroup: RscCheckBox { + idc = 16188; + x = W_PART(10.1); + y = H_PART(7.1); + w = W_PART(1); + h = H_PART(1); + }; + }; + }; + }; + }; + class ButtonOK: ButtonOK {}; + class ButtonCancel: ButtonCancel {}; + }; +}; + + +class GVAR(AttributeCargo): RscControlsGroupNoScrollbars { + onSetFocus = QUOTE(_this call FUNC(ui_attributeCargo)); + idc = -1; + x = X_PART(7); + y = Y_PART(10); + w = W_PART(26); + h = H_PART(3); + class controls { + class Title: RscText { + idc = -1; + text = CSTRING(AttributeCargo); + x = 0; + y = 0; + w = W_PART(10); + h = H_PART(3); + colorBackground[] = {0,0,0,0.5}; + }; + class Background: RscText { + idc = -1; + x = W_PART(10); + y = 0; + w = W_PART(16); + h = H_PART(3); + colorBackground[] = {1,1,1,0.1}; + }; + class Cargo: RscListBox { + idc = 80086; + x = W_PART(10); + y = 0; + w = W_PART(16); + h = H_PART(3); + }; + + }; +}; + +class RscDisplayAttributesVehicle: RscDisplayAttributes { + class Controls: Controls { + class Content: Content { + class Controls: controls { + class ace_cargo: GVAR(AttributeCargo) { }; + }; + }; + }; +}; + +class RscDisplayAttributesVehicleEmpty: RscDisplayAttributes { + class Controls: Controls { + class Content: Content { + class Controls: controls { + class ace_cargo: GVAR(AttributeCargo) { }; + }; + }; + }; +}; diff --git a/docs/README_DE.md b/docs/README_DE.md index 95a7b3c406..f7985229ae 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -4,7 +4,7 @@

- ACE3 Version + ACE3 Version ACE3 Fehlermeldungen diff --git a/docs/README_PL.md b/docs/README_PL.md index 87884e3a68..0122aa9c78 100644 --- a/docs/README_PL.md +++ b/docs/README_PL.md @@ -3,7 +3,7 @@

- ACE3 Wersja + ACE3 Wersja ACE3 Zagadnienia diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index db4c94242b..7ed8386dba 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -1,142 +1,142 @@ -cmake_minimum_required (VERSION 3.0) -project (ACE) - -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -if(WIN32) -add_definitions(/DWINVER=0x0600 /D_WIN32_WINNT=0x0600) -endif() - -if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX) - message(STATUS "No build type selected, default to Debug") - set(CMAKE_BUILD_TYPE "Debug") -endif() - -option(DEVEL "DEVEL" OFF) -option(USE_BULLET "USE_BULLET" OFF) -option(USE_DIRECTX "USE_DIRECTX" OFF) -option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) -option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON) - - -if(CMAKE_COMPILER_IS_GNUCXX) - SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive") - set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") - set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message(ERROR "SUPPORT NOT COMPLETE") -elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /arch:SSE2 /Qpar-report:2") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1") - set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2 /Ob2 /D NDEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} /MT /Zi /O2 /Ob1 /D NDEBUG") -endif() - -include_directories("common") - -if(USE_BULLET) - # Dependencies - # - set(BACKUP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) - set(BACKUP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - set(BACKUP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - - add_definitions(-DUSE_DIRECTX) - add_subdirectory(lib/bullet3) - - set_target_properties(App_BasicExample PROPERTIES FOLDER Bullet3) - set_target_properties(App_HelloWorld PROPERTIES FOLDER Bullet3) - set_target_properties(App_ExampleBrowser PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet2FileLoader PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Collision PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Dynamics PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Geometry PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3Common PROPERTIES FOLDER Bullet3) - set_target_properties(Bullet3OpenCL_clew PROPERTIES FOLDER Bullet3) - set_target_properties(BulletCollision PROPERTIES FOLDER Bullet3) - set_target_properties(BulletDynamics PROPERTIES FOLDER Bullet3) - set_target_properties(BulletFileLoader PROPERTIES FOLDER Bullet3) - set_target_properties(BulletSoftBody PROPERTIES FOLDER Bullet3) - - set_target_properties(BulletWorldImporter PROPERTIES FOLDER Bullet3) - set_target_properties(BulletXmlWorldImporter PROPERTIES FOLDER Bullet3) - set_target_properties(ConvexDecomposition PROPERTIES FOLDER Bullet3) - set_target_properties(GIMPACTUtils PROPERTIES FOLDER Bullet3) - set_target_properties(gtest PROPERTIES FOLDER Bullet3) - set_target_properties(gwen PROPERTIES FOLDER Bullet3) - set_target_properties(HACD PROPERTIES FOLDER Bullet3) - set_target_properties(OpenGLWindow PROPERTIES FOLDER Bullet3) - set_target_properties(LinearMath PROPERTIES FOLDER Bullet3) - - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BACKUP_ARCHIVE_OUTPUT_DIRECTORY}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BACKUP_LIBRARY_OUTPUT_DIRECTORY}) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BACKUP_RUNTIME_OUTPUT_DIRECTORY}) - - include_directories(BEFORE "lib/bullet3/src") -endif() -if(USE_DIRECTX) - add_definitions(-DUSE_DIRECTX) - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) - find_package (DirectX) - link_directories (BEFORE ${DirectX_D3DX11_LIBRARY}) - include_directories (BEFORE ${DirectX_D3DX11_INCLUDE_DIR} ) -endif() -if(DEVEL) - add_definitions(-DDEVEL) -endif() - - -string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ") -set(ACE_VERSION_MAJOR 3) -set(ACE_VERSION_MINOR 5) -set(ACE_VERSION_REVISION 0) -EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD - OUTPUT_VARIABLE T_ACE_VERSION_BUILD - OUTPUT_STRIP_TRAILING_WHITESPACE -) -string(SUBSTRING ${T_ACE_VERSION_BUILD} 0 7 ACE_VERSION_BUILD ) - -message("Building for: " ${ACE_VERSION_MAJOR}.${ACE_VERSION_MINOR}.${ACE_VERSION_REVISION}-${ACE_VERSION_BUILD}) - -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version.hpp.in" - "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version.hpp" - @ONLY) - -if(MSVC) - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version_win32.rc.in" - "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc" - @ONLY) - set(GLOBAL_RC ${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc) -endif() - -include_directories(${CMAKE_CURRENT_BINARY_DIR}/common) -set(GLOBAL_SOURCES ${GLOBAL_RC}) - - -# Add extensions to build here -add_subdirectory(common) - -# Extensions - -add_subdirectory(fcs) -add_subdirectory(break_line) -add_subdirectory(clipboard) -add_subdirectory(advanced_ballistics) -add_subdirectory(medical) -add_subdirectory(parse_imagepath) - -# Test Extension for dynamically loading/unloading built extensions; does not build in release -if (DEVEL) - add_subdirectory(dynload) - add_subdirectory(tests) - if(USE_DIRECTX) - add_subdirectory(lib/directxtk) - endif() -endif() - - - -message("Build Type: ${CMAKE_BUILD_TYPE}") \ No newline at end of file +cmake_minimum_required (VERSION 3.0) +project (ACE) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +if(WIN32) +add_definitions(/DWINVER=0x0600 /D_WIN32_WINNT=0x0600) +endif() + +if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX) + message(STATUS "No build type selected, default to Debug") + set(CMAKE_BUILD_TYPE "Debug") +endif() + +option(DEVEL "DEVEL" OFF) +option(USE_BULLET "USE_BULLET" OFF) +option(USE_DIRECTX "USE_DIRECTX" OFF) +option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF) +option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON) + + +if(CMAKE_COMPILER_IS_GNUCXX) + SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive") + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++") +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message(ERROR "SUPPORT NOT COMPLETE") +elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall /arch:SSE2 /Qpar-report:2") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2 /Ob2 /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} /MT /Zi /O2 /Ob1 /D NDEBUG") +endif() + +include_directories("common") + +if(USE_BULLET) + # Dependencies + # + set(BACKUP_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) + set(BACKUP_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + set(BACKUP_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + + add_definitions(-DUSE_DIRECTX) + add_subdirectory(lib/bullet3) + + set_target_properties(App_BasicExample PROPERTIES FOLDER Bullet3) + set_target_properties(App_HelloWorld PROPERTIES FOLDER Bullet3) + set_target_properties(App_ExampleBrowser PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet2FileLoader PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet3Collision PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet3Dynamics PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet3Geometry PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet3Common PROPERTIES FOLDER Bullet3) + set_target_properties(Bullet3OpenCL_clew PROPERTIES FOLDER Bullet3) + set_target_properties(BulletCollision PROPERTIES FOLDER Bullet3) + set_target_properties(BulletDynamics PROPERTIES FOLDER Bullet3) + set_target_properties(BulletFileLoader PROPERTIES FOLDER Bullet3) + set_target_properties(BulletSoftBody PROPERTIES FOLDER Bullet3) + + set_target_properties(BulletWorldImporter PROPERTIES FOLDER Bullet3) + set_target_properties(BulletXmlWorldImporter PROPERTIES FOLDER Bullet3) + set_target_properties(ConvexDecomposition PROPERTIES FOLDER Bullet3) + set_target_properties(GIMPACTUtils PROPERTIES FOLDER Bullet3) + set_target_properties(gtest PROPERTIES FOLDER Bullet3) + set_target_properties(gwen PROPERTIES FOLDER Bullet3) + set_target_properties(HACD PROPERTIES FOLDER Bullet3) + set_target_properties(OpenGLWindow PROPERTIES FOLDER Bullet3) + set_target_properties(LinearMath PROPERTIES FOLDER Bullet3) + + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${BACKUP_ARCHIVE_OUTPUT_DIRECTORY}) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${BACKUP_LIBRARY_OUTPUT_DIRECTORY}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BACKUP_RUNTIME_OUTPUT_DIRECTORY}) + + include_directories(BEFORE "lib/bullet3/src") +endif() +if(USE_DIRECTX) + add_definitions(-DUSE_DIRECTX) + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) + find_package (DirectX) + link_directories (BEFORE ${DirectX_D3DX11_LIBRARY}) + include_directories (BEFORE ${DirectX_D3DX11_INCLUDE_DIR} ) +endif() +if(DEVEL) + add_definitions(-DDEVEL) +endif() + + +string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ") +set(ACE_VERSION_MAJOR 3) +set(ACE_VERSION_MINOR 6) +set(ACE_VERSION_REVISION 0) +EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD + OUTPUT_VARIABLE T_ACE_VERSION_BUILD + OUTPUT_STRIP_TRAILING_WHITESPACE +) +string(SUBSTRING ${T_ACE_VERSION_BUILD} 0 7 ACE_VERSION_BUILD ) + +message("Building for: " ${ACE_VERSION_MAJOR}.${ACE_VERSION_MINOR}.${ACE_VERSION_REVISION}-${ACE_VERSION_BUILD}) + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version.hpp.in" + "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version.hpp" + @ONLY) + +if(MSVC) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/common/ace_version_win32.rc.in" + "${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc" + @ONLY) + set(GLOBAL_RC ${CMAKE_CURRENT_BINARY_DIR}/common/ace_version_win32.rc) +endif() + +include_directories(${CMAKE_CURRENT_BINARY_DIR}/common) +set(GLOBAL_SOURCES ${GLOBAL_RC}) + + +# Add extensions to build here +add_subdirectory(common) + +# Extensions + +add_subdirectory(fcs) +add_subdirectory(break_line) +add_subdirectory(clipboard) +add_subdirectory(advanced_ballistics) +add_subdirectory(medical) +add_subdirectory(parse_imagepath) + +# Test Extension for dynamically loading/unloading built extensions; does not build in release +if (DEVEL) + add_subdirectory(dynload) + add_subdirectory(tests) + if(USE_DIRECTX) + add_subdirectory(lib/directxtk) + endif() +endif() + + + +message("Build Type: ${CMAKE_BUILD_TYPE}") diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 8286e054d2..e9082ad2d1 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -1,5 +1,6 @@ #include "shared.hpp" +#include #include #include #include @@ -238,7 +239,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) ZERO_OUTPUT(); std::stringstream outputStr; if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize); + strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE); EXTENSION_RETURN(); } @@ -261,8 +262,8 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) // int n = sprintf(output, "%f", retard); outputStr << retard; - strncpy(output, outputStr.str().c_str(), outputSize); - + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); + EXTENSION_RETURN(); } else if (!strcmp(mode, "atmosphericCorrection")) { double ballisticCoefficient = 1.0; @@ -280,7 +281,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel); //int n = sprintf(output, "%f", ballisticCoefficient); outputStr << ballisticCoefficient; - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } else if (!strcmp(mode, "new")) { unsigned int index = 0; @@ -375,7 +376,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) bulletDatabase[index].frames = 0.0; bulletDatabase[index].randSeed = 0; - strncpy(output, "", outputSize); + strncpy_s(output, outputSize, "", _TRUNCATE); EXTENSION_RETURN(); } else if (!strcmp(mode, "simulate")) { // simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16 @@ -592,9 +593,9 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) velocityOffset[1] += (distribution(bulletDatabase[index].randGenerator) * 0.8 - 0.4) * coef; velocityOffset[2] += (distribution(bulletDatabase[index].randGenerator) * 0.8 - 0.4) * coef; }; - + outputStr << "_bullet setVelocity (_bulletVelocity vectorAdd [" << velocityOffset[0] << "," << velocityOffset[1] << "," << velocityOffset[2] << "]); _bullet setPosASL (_bulletPosition vectorAdd [" << positionOffset[0] << "," << positionOffset[1] << "," << positionOffset[2] << "]);"; - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } else if (!strcmp(mode, "set")) { int height = 0; @@ -609,7 +610,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) map->gridBuildingNums.push_back(numObjects); map->gridSurfaceIsWater.push_back(surfaceIsWater); - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } else if (!strcmp(mode, "init")) { int mapSize = 0; @@ -625,7 +626,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) map = &mapDatabase[worldName]; if (map->gridHeights.size() == gridCells) { outputStr << "Terrain already initialized"; - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } @@ -638,9 +639,9 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) map->gridBuildingNums.reserve(gridCells); map->gridSurfaceIsWater.reserve(gridCells); - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } - strncpy(output, outputStr.str().c_str(), outputSize); + strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE); EXTENSION_RETURN(); } diff --git a/extensions/advanced_ballistics/CMakeLists.txt b/extensions/advanced_ballistics/CMakeLists.txt index 51e709f6d2..55d84810d1 100644 --- a/extensions/advanced_ballistics/CMakeLists.txt +++ b/extensions/advanced_ballistics/CMakeLists.txt @@ -1,12 +1,12 @@ -set(ACE_EXTENSION_NAME "ace_advanced_ballistics") - -file(GLOB SOURCES *.h *.hpp *.c *.cpp) -add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) -target_link_libraries(${ACE_EXTENSION_NAME} ace_common) -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") -set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) - -if(CMAKE_COMPILER_IS_GNUCXX) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) +set(ACE_EXTENSION_NAME "ace_advanced_ballistics") + +file(GLOB SOURCES *.h *.hpp *.c *.cpp) +add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES}) +target_link_libraries(${ACE_EXTENSION_NAME} ace_common) +set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "") +set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions) + +if(CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1) endif() \ No newline at end of file diff --git a/extensions/break_line/ace_break_line.cpp b/extensions/break_line/ace_break_line.cpp index 7644748378..c408ceab5c 100644 --- a/extensions/break_line/ace_break_line.cpp +++ b/extensions/break_line/ace_break_line.cpp @@ -13,6 +13,7 @@ #include "shared.hpp" +#include #include #include #include @@ -56,23 +57,16 @@ std::string addLineBreaks(const std::vector &words) { } } } - + return sstream.str(); } -// i like to live dangerously. jk, fix strncpy sometime pls. -#pragma warning( push ) -#pragma warning( disable : 4996 ) - void __stdcall RVExtension(char *output, int outputSize, const char *function) { ZERO_OUTPUT(); if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize); + strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE); } else { - strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize); - output[outputSize - 1] = '\0'; + strncpy_s(output, outputSize, addLineBreaks(splitString(function)).c_str(), _TRUNCATE); } EXTENSION_RETURN(); } - -#pragma warning( pop ) diff --git a/extensions/build/.gitignore b/extensions/build/.gitignore index 44c5ea8fa7..86d0cb2726 100644 --- a/extensions/build/.gitignore +++ b/extensions/build/.gitignore @@ -1,4 +1,4 @@ -# Ignore everything in this directory -* -# Except this file +# Ignore everything in this directory +* +# Except this file !.gitignore \ No newline at end of file diff --git a/extensions/clipboard/ace_clipboard.cpp b/extensions/clipboard/ace_clipboard.cpp index cdd5f7c423..0b3d965ad5 100644 --- a/extensions/clipboard/ace_clipboard.cpp +++ b/extensions/clipboard/ace_clipboard.cpp @@ -1,90 +1,81 @@ -/* - * ace_clipboard.cpp - * - * Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit. - * - * Takes: - * Localized string as string - * - * Returns: - * None - */ -#include "shared.hpp" -#include -#include - -extern "C" { - EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); -} - -std::string gClipboardData; - -void __stdcall RVExtension(char *output, int outputSize, const char *function) { - std::string cur_input(function); - std::string result; - - ZERO_OUTPUT(); - - if (cur_input.length() < 1) { - EXTENSION_RETURN(); - } - - if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize); - EXTENSION_RETURN(); - } - -#ifdef _WIN32 - - if (!strcmp(function, "--COMPLETE--")) { - HGLOBAL hClipboardData = GlobalAlloc(GMEM_FIXED, gClipboardData.length() + 1); - if (!hClipboardData) { - result = "GlobalAlloc() failed, GetLastError=" + GetLastError(); - gClipboardData = ""; - EXTENSION_RETURN(); - } - - char *pClipboardData = (char *)GlobalLock(hClipboardData); - if (!pClipboardData) { - result = "GlobalLock() failed, GetLastError=" + GetLastError(); - gClipboardData = ""; - EXTENSION_RETURN(); - } - memcpy(pClipboardData, gClipboardData.c_str(), gClipboardData.length()); - pClipboardData[gClipboardData.length() + 1] = 0x00; - - GlobalUnlock(hClipboardData); - - if (!OpenClipboard(NULL)) { - result = "OpenClipboard() failed, GetLastError=" + GetLastError(); - } - else { - if (!EmptyClipboard()) { - result = "OpenClipboard() failed, GetLastError=" + GetLastError(); - } - else { - if (!SetClipboardData(CF_TEXT, hClipboardData)) { - result = "SetClipboardData() failed, GetLastError=" + GetLastError(); - } - else { - if (!CloseClipboard()) { - result = "CloseClipboard() failed, GetLastError=" + GetLastError(); - } - } - } - } - - gClipboardData = ""; - } else { - gClipboardData = gClipboardData + cur_input; - } - - end: - if(result.length() > 1) - memcpy(output, result.c_str(), result.length()+1); - - #endif - - EXTENSION_RETURN(); -} - +/* + * ace_clipboard.cpp + * + * Takes a string and copies it to the clipboard; bypasses arma 8k clippy limit. Windows only. + * + * Takes: + * Localized string as string + * + * Returns: + * None + */ + +#include "shared.hpp" + +#include +#include +#include + +extern "C" { + EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); +} + +std::string gClipboardData; + +void __stdcall RVExtension(char *output, int outputSize, const char *function) { + std::string cur_input(function); + std::string result; + + ZERO_OUTPUT(); + + if (cur_input.length() < 1) { + EXTENSION_RETURN(); + } + + if (!strcmp(function, "version")) { + strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE); + EXTENSION_RETURN(); + } + + #ifdef _WIN32 + + if (!strcmp(function, "--COMPLETE--")) { + if (OpenClipboard(NULL) == 0) { + result = "OpenClipboard() failed, GetLastError=" + GetLastError(); + } else { + if (EmptyClipboard() == 0) { + result = "EmptyClipboard() failed, GetLastError=" + GetLastError(); + } else { + // GPTR = GMEM_FIXED + GMEM_ZEROINIT, returns a ptr, no need for GlobalLock/GlobalUnlock + char *pClipboardData = (char *)GlobalAlloc(GPTR, gClipboardData.length()); + + if (pClipboardData == NULL) { + result = "GlobalAlloc() failed, GetLastError=" + GetLastError(); + EXTENSION_RETURN(); + } + strncpy_s(pClipboardData, gClipboardData.length(), gClipboardData.c_str(), _TRUNCATE); + + // if success, system owns the memory, if fail, free it from the heap + if (SetClipboardData(CF_TEXT, pClipboardData) == NULL) { + result = "SetClipboardData() failed, GetLastError=" + GetLastError(); + GlobalFree(pClipboardData); + } else { + if (CloseClipboard() == 0) { + result = "CloseClipboard() failed, GetLastError=" + GetLastError(); + } + } + } + } + gClipboardData = ""; + } else { + gClipboardData = gClipboardData + cur_input; + } + + if (result.length() > 1) { + strncpy_s(output, outputSize, result.c_str(), _TRUNCATE); + } + + #endif + + EXTENSION_RETURN(); +} diff --git a/extensions/cmake/FindDirectX.cmake b/extensions/cmake/FindDirectX.cmake index 69bf1d62e8..b413b0b294 100644 --- a/extensions/cmake/FindDirectX.cmake +++ b/extensions/cmake/FindDirectX.cmake @@ -1,215 +1,215 @@ -# - try to find DirectX include directories and libraries -# -# Once done this will define: -# -# DirectX_XYZ_FOUND - system has the XYZ API -# DirectX_XYZ_INCLUDE_FOUND - system has the include for the XYZ API -# DirectX_XYZ_INCLUDE_DIR - include directory for the XYZ API -# DirectX_XYZ_LIBRARY - path/name for the XYZ library -# -# Where XYZ can be any of: -# -# DDRAW -# D3D -# D3DX -# D3D8 -# D3DX8 -# D3D9 -# D3DX9 -# D3D10 -# D3D10_1 -# D3DX10 -# D3D11 -# D3D11_1 -# D3D11_2 -# D3DX11 -# D2D1 -# - - -include (CheckIncludeFileCXX) -include (FindPackageMessage) - - -if (WIN32) - - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (DirectX_ARCHITECTURE x64) - else () - set (DirectX_ARCHITECTURE x86) - endif () - - # Can't use "$ENV{ProgramFiles(x86)}" to avoid violating CMP0053. See - # http://public.kitware.com/pipermail/cmake-developers/2014-October/023190.html - set (ProgramFiles_x86 "ProgramFiles(x86)") - if ("$ENV{${ProgramFiles_x86}}") - set (ProgramFiles "$ENV{${ProgramFiles_x86}}") - else () - set (ProgramFiles "$ENV{ProgramFiles}") - endif () - - find_path (DirectX_ROOT_DIR - Include/d3d9.h - PATHS - "$ENV{DXSDK_DIR}" - "${ProgramFiles}/Microsoft DirectX SDK (June 2010)" - "${ProgramFiles}/Microsoft DirectX SDK (February 2010)" - "${ProgramFiles}/Microsoft DirectX SDK (March 2009)" - "${ProgramFiles}/Microsoft DirectX SDK (August 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (June 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (March 2008)" - "${ProgramFiles}/Microsoft DirectX SDK (November 2007)" - "${ProgramFiles}/Microsoft DirectX SDK (August 2007)" - "${ProgramFiles}/Microsoft DirectX SDK" - DOC "DirectX SDK root directory" - ) - if (DirectX_ROOT_DIR) - set (DirectX_INC_SEARCH_PATH "${DirectX_ROOT_DIR}/Include") - set (DirectX_LIB_SEARCH_PATH "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}") - set (DirectX_BIN_SEARCH_PATH "${DirectX_ROOT_DIR}/Utilities/bin/x86") - endif () - - # With VS 2011 and Windows 8 SDK, the DirectX SDK is included as part of - # the Windows SDK. - # - # See also: - # - http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx - if (DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) - set (USE_WINSDK_HEADERS TRUE) - endif () - - # Find a header in the DirectX SDK - macro (find_dxsdk_header var_name header) - set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") - set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") - find_path (${include_dir_var} ${header} - HINTS ${DirectX_INC_SEARCH_PATH} - DOC "The directory where ${header} resides" - CMAKE_FIND_ROOT_PATH_BOTH - ) - if (${include_dir_var}) - set (${include_found_var} TRUE) - find_package_message (${var_name}_INC "Found ${header} header: ${${include_dir_var}}/${header}" "[${${include_dir_var}}]") - endif () - mark_as_advanced (${include_found_var}) - endmacro () - - # Find a library in the DirectX SDK - macro (find_dxsdk_library var_name library) - # DirectX SDK - set (library_var "DirectX_${var_name}_LIBRARY") - find_library (${library_var} ${library} - HINTS ${DirectX_LIB_SEARCH_PATH} - DOC "The directory where ${library} resides" - CMAKE_FIND_ROOT_PATH_BOTH - ) - if (${library_var}) - find_package_message (${var_name}_LIB "Found ${library} library: ${${library_var}}" "[${${library_var}}]") - endif () - mark_as_advanced (${library_var}) - endmacro () - - # Find a header in the Windows SDK - macro (find_winsdk_header var_name header) - if (USE_WINSDK_HEADERS) - # Windows SDK - set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") - set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") - check_include_file_cxx (${header} ${include_found_var}) - set (${include_dir_var}) - mark_as_advanced (${include_found_var}) - else () - find_dxsdk_header (${var_name} ${header}) - endif () - endmacro () - - # Find a library in the Windows SDK - macro (find_winsdk_library var_name library) - if (USE_WINSDK_HEADERS) - # XXX: We currently just assume the library exists - set (library_var "DirectX_${var_name}_LIBRARY") - set (${library_var} ${library}) - mark_as_advanced (${library_var}) - else () - find_dxsdk_library (${var_name} ${library}) - endif () - endmacro () - - # Combine header and library variables into an API found variable - macro (find_combined var_name inc_var_name lib_var_name) - if (DirectX_${inc_var_name}_INCLUDE_FOUND AND DirectX_${lib_var_name}_LIBRARY) - set (DirectX_${var_name}_FOUND 1) - find_package_message (${var_name} "Found ${var_name} API" "[${DirectX_${lib_var_name}_LIBRARY}][${DirectX_${inc_var_name}_INCLUDE_DIR}]") - endif () - endmacro () - - find_winsdk_header (DDRAW ddraw.h) - find_winsdk_library (DDRAW ddraw) - find_combined (DDRAW DDRAW DDRAW) - - if (CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") - # Windows 7 SDKs, used by XP toolset, do not include d3d.h - find_dxsdk_header (D3D d3d.h) - else () - find_winsdk_header (D3D d3d.h) - endif () - find_combined (D3D D3D DDRAW) - - find_dxsdk_header (D3DX d3dx.h) - find_combined (D3DX D3DX D3DX) - - find_dxsdk_header (D3D8 d3d8.h) - find_dxsdk_library (D3D8 d3d8) - find_combined (D3D8 D3D8 D3D8) - - find_dxsdk_header (D3DX8 d3dx8.h) - find_dxsdk_library (D3DX8 d3dx8) - find_combined (D3DX8 D3DX8 D3DX8) - - find_winsdk_header (D3D9 d3d9.h) - find_winsdk_library (D3D9 d3d9) - find_combined (D3D9 D3D9 D3D9) - - find_dxsdk_header (D3DX9 d3dx9.h) - find_dxsdk_library (D3DX9 d3dx9) - find_combined (D3DX9 D3DX9 D3DX9) - - find_winsdk_header (DXGI dxgi.h) - find_winsdk_header (DXGI1_2 dxgi1_2.h) - find_winsdk_header (DXGI1_3 dxgi1_3.h) - find_winsdk_library (DXGI dxgi) - - find_winsdk_header (D3D10 d3d10.h) - find_winsdk_library (D3D10 d3d10) - find_combined (D3D10 D3D10 D3D10) - - find_winsdk_header (D3D10_1 d3d10_1.h) - find_winsdk_library (D3D10_1 d3d10_1) - find_combined (D3D10_1 D3D10_1 D3D10_1) - - find_dxsdk_header (D3DX10 d3dx10.h) - find_dxsdk_library (D3DX10 d3dx10) - find_combined (D3DX10 D3DX10 D3DX10) - - find_winsdk_header (D3D11 d3d11.h) - find_winsdk_library (D3D11 d3d11) - find_combined (D3D11 D3D11 D3D11) - find_winsdk_header (D3D11_1 d3d11_1.h) - find_combined (D3D11_1 D3D11_1 D3D11) - find_winsdk_header (D3D11_2 d3d11_2.h) - find_combined (D3D11_2 D3D11_2 D3D11) - - find_dxsdk_header (D3DX11 d3dx11.h) - find_dxsdk_library (D3DX11 d3dx11) - find_combined (D3DX11 D3DX11 D3DX11) - - find_winsdk_header (D2D1 d2d1.h) - find_winsdk_library (D2D1 d2d1) - find_combined (D2D1 D2D1 D2D1) - - find_program (DirectX_FXC_EXECUTABLE fxc - HINTS ${DirectX_BIN_SEARCH_PATH} - DOC "Path to fxc.exe executable." - ) - +# - try to find DirectX include directories and libraries +# +# Once done this will define: +# +# DirectX_XYZ_FOUND - system has the XYZ API +# DirectX_XYZ_INCLUDE_FOUND - system has the include for the XYZ API +# DirectX_XYZ_INCLUDE_DIR - include directory for the XYZ API +# DirectX_XYZ_LIBRARY - path/name for the XYZ library +# +# Where XYZ can be any of: +# +# DDRAW +# D3D +# D3DX +# D3D8 +# D3DX8 +# D3D9 +# D3DX9 +# D3D10 +# D3D10_1 +# D3DX10 +# D3D11 +# D3D11_1 +# D3D11_2 +# D3DX11 +# D2D1 +# + + +include (CheckIncludeFileCXX) +include (FindPackageMessage) + + +if (WIN32) + + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set (DirectX_ARCHITECTURE x64) + else () + set (DirectX_ARCHITECTURE x86) + endif () + + # Can't use "$ENV{ProgramFiles(x86)}" to avoid violating CMP0053. See + # http://public.kitware.com/pipermail/cmake-developers/2014-October/023190.html + set (ProgramFiles_x86 "ProgramFiles(x86)") + if ("$ENV{${ProgramFiles_x86}}") + set (ProgramFiles "$ENV{${ProgramFiles_x86}}") + else () + set (ProgramFiles "$ENV{ProgramFiles}") + endif () + + find_path (DirectX_ROOT_DIR + Include/d3d9.h + PATHS + "$ENV{DXSDK_DIR}" + "${ProgramFiles}/Microsoft DirectX SDK (June 2010)" + "${ProgramFiles}/Microsoft DirectX SDK (February 2010)" + "${ProgramFiles}/Microsoft DirectX SDK (March 2009)" + "${ProgramFiles}/Microsoft DirectX SDK (August 2008)" + "${ProgramFiles}/Microsoft DirectX SDK (June 2008)" + "${ProgramFiles}/Microsoft DirectX SDK (March 2008)" + "${ProgramFiles}/Microsoft DirectX SDK (November 2007)" + "${ProgramFiles}/Microsoft DirectX SDK (August 2007)" + "${ProgramFiles}/Microsoft DirectX SDK" + DOC "DirectX SDK root directory" + ) + if (DirectX_ROOT_DIR) + set (DirectX_INC_SEARCH_PATH "${DirectX_ROOT_DIR}/Include") + set (DirectX_LIB_SEARCH_PATH "${DirectX_ROOT_DIR}/Lib/${DirectX_ARCHITECTURE}") + set (DirectX_BIN_SEARCH_PATH "${DirectX_ROOT_DIR}/Utilities/bin/x86") + endif () + + # With VS 2011 and Windows 8 SDK, the DirectX SDK is included as part of + # the Windows SDK. + # + # See also: + # - http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx + if (DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) + set (USE_WINSDK_HEADERS TRUE) + endif () + + # Find a header in the DirectX SDK + macro (find_dxsdk_header var_name header) + set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") + set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") + find_path (${include_dir_var} ${header} + HINTS ${DirectX_INC_SEARCH_PATH} + DOC "The directory where ${header} resides" + CMAKE_FIND_ROOT_PATH_BOTH + ) + if (${include_dir_var}) + set (${include_found_var} TRUE) + find_package_message (${var_name}_INC "Found ${header} header: ${${include_dir_var}}/${header}" "[${${include_dir_var}}]") + endif () + mark_as_advanced (${include_found_var}) + endmacro () + + # Find a library in the DirectX SDK + macro (find_dxsdk_library var_name library) + # DirectX SDK + set (library_var "DirectX_${var_name}_LIBRARY") + find_library (${library_var} ${library} + HINTS ${DirectX_LIB_SEARCH_PATH} + DOC "The directory where ${library} resides" + CMAKE_FIND_ROOT_PATH_BOTH + ) + if (${library_var}) + find_package_message (${var_name}_LIB "Found ${library} library: ${${library_var}}" "[${${library_var}}]") + endif () + mark_as_advanced (${library_var}) + endmacro () + + # Find a header in the Windows SDK + macro (find_winsdk_header var_name header) + if (USE_WINSDK_HEADERS) + # Windows SDK + set (include_dir_var "DirectX_${var_name}_INCLUDE_DIR") + set (include_found_var "DirectX_${var_name}_INCLUDE_FOUND") + check_include_file_cxx (${header} ${include_found_var}) + set (${include_dir_var}) + mark_as_advanced (${include_found_var}) + else () + find_dxsdk_header (${var_name} ${header}) + endif () + endmacro () + + # Find a library in the Windows SDK + macro (find_winsdk_library var_name library) + if (USE_WINSDK_HEADERS) + # XXX: We currently just assume the library exists + set (library_var "DirectX_${var_name}_LIBRARY") + set (${library_var} ${library}) + mark_as_advanced (${library_var}) + else () + find_dxsdk_library (${var_name} ${library}) + endif () + endmacro () + + # Combine header and library variables into an API found variable + macro (find_combined var_name inc_var_name lib_var_name) + if (DirectX_${inc_var_name}_INCLUDE_FOUND AND DirectX_${lib_var_name}_LIBRARY) + set (DirectX_${var_name}_FOUND 1) + find_package_message (${var_name} "Found ${var_name} API" "[${DirectX_${lib_var_name}_LIBRARY}][${DirectX_${inc_var_name}_INCLUDE_DIR}]") + endif () + endmacro () + + find_winsdk_header (DDRAW ddraw.h) + find_winsdk_library (DDRAW ddraw) + find_combined (DDRAW DDRAW DDRAW) + + if (CMAKE_GENERATOR_TOOLSET MATCHES "_xp$") + # Windows 7 SDKs, used by XP toolset, do not include d3d.h + find_dxsdk_header (D3D d3d.h) + else () + find_winsdk_header (D3D d3d.h) + endif () + find_combined (D3D D3D DDRAW) + + find_dxsdk_header (D3DX d3dx.h) + find_combined (D3DX D3DX D3DX) + + find_dxsdk_header (D3D8 d3d8.h) + find_dxsdk_library (D3D8 d3d8) + find_combined (D3D8 D3D8 D3D8) + + find_dxsdk_header (D3DX8 d3dx8.h) + find_dxsdk_library (D3DX8 d3dx8) + find_combined (D3DX8 D3DX8 D3DX8) + + find_winsdk_header (D3D9 d3d9.h) + find_winsdk_library (D3D9 d3d9) + find_combined (D3D9 D3D9 D3D9) + + find_dxsdk_header (D3DX9 d3dx9.h) + find_dxsdk_library (D3DX9 d3dx9) + find_combined (D3DX9 D3DX9 D3DX9) + + find_winsdk_header (DXGI dxgi.h) + find_winsdk_header (DXGI1_2 dxgi1_2.h) + find_winsdk_header (DXGI1_3 dxgi1_3.h) + find_winsdk_library (DXGI dxgi) + + find_winsdk_header (D3D10 d3d10.h) + find_winsdk_library (D3D10 d3d10) + find_combined (D3D10 D3D10 D3D10) + + find_winsdk_header (D3D10_1 d3d10_1.h) + find_winsdk_library (D3D10_1 d3d10_1) + find_combined (D3D10_1 D3D10_1 D3D10_1) + + find_dxsdk_header (D3DX10 d3dx10.h) + find_dxsdk_library (D3DX10 d3dx10) + find_combined (D3DX10 D3DX10 D3DX10) + + find_winsdk_header (D3D11 d3d11.h) + find_winsdk_library (D3D11 d3d11) + find_combined (D3D11 D3D11 D3D11) + find_winsdk_header (D3D11_1 d3d11_1.h) + find_combined (D3D11_1 D3D11_1 D3D11) + find_winsdk_header (D3D11_2 d3d11_2.h) + find_combined (D3D11_2 D3D11_2 D3D11) + + find_dxsdk_header (D3DX11 d3dx11.h) + find_dxsdk_library (D3DX11 d3dx11) + find_combined (D3DX11 D3DX11 D3DX11) + + find_winsdk_header (D2D1 d2d1.h) + find_winsdk_library (D2D1 d2d1) + find_combined (D2D1 D2D1 D2D1) + + find_program (DirectX_FXC_EXECUTABLE fxc + HINTS ${DirectX_BIN_SEARCH_PATH} + DOC "Path to fxc.exe executable." + ) + endif () \ No newline at end of file diff --git a/extensions/common/CMakeLists.txt b/extensions/common/CMakeLists.txt index 620023ceb1..b9291e3dc4 100644 --- a/extensions/common/CMakeLists.txt +++ b/extensions/common/CMakeLists.txt @@ -1,18 +1,18 @@ -file(GLOB_RECURSE ACE_COMMON_SOURCES *.h *.hpp *.c *.cpp) - - -file(GLOB ACE_BASE_COMMON_SOURCES *.h *.hpp *.c *.cpp) -file(GLOB ACE_P3D_SOURCES p3d/*.h p3d/*.hpp p3d/*.c p3d/*.cpp) -file(GLOB ACE_PBO_SOURCES pbo/*.h pbo/*.hpp pbo/*.c pbo/*.cpp) -file(GLOB ACE_SIMULATION_SOURCES simulation/*.h simulation/*.hpp simulation/*.c simulation/*.cpp) -file(GLOB ACE_DIRECTX_SOURCES directx/*.h directx/*.hpp directx/*.c directx/*.cpp) -file(GLOB ACE_GLM_SOURCES glm/*.h glm/*.hpp glm/*.c glm/*.cpp) - -SOURCE_GROUP("common" FILES ${ACE_BASE_COMMON_SOURCES}) -SOURCE_GROUP("p3d" FILES ${ACE_P3D_SOURCES}) -SOURCE_GROUP("pbo" FILES ${ACE_PBO_SOURCES}) -SOURCE_GROUP("simulation" FILES ${ACE_SIMULATION_SOURCES}) -SOURCE_GROUP("directx" FILES ${ACE_DIRECTX_SOURCES}) -SOURCE_GROUP("glm" FILES ${ACE_GLM_SOURCES}) - -add_library(ace_common STATIC ${ACE_GLM_SOURCES} ${ACE_BASE_COMMON_SOURCES} ${ACE_P3D_SOURCES} ${ACE_PBO_SOURCES} ${ACE_SIMULATION_SOURCES} ${ACE_DIRECTX_SOURCES}) +file(GLOB_RECURSE ACE_COMMON_SOURCES *.h *.hpp *.c *.cpp) + + +file(GLOB ACE_BASE_COMMON_SOURCES *.h *.hpp *.c *.cpp) +file(GLOB ACE_P3D_SOURCES p3d/*.h p3d/*.hpp p3d/*.c p3d/*.cpp) +file(GLOB ACE_PBO_SOURCES pbo/*.h pbo/*.hpp pbo/*.c pbo/*.cpp) +file(GLOB ACE_SIMULATION_SOURCES simulation/*.h simulation/*.hpp simulation/*.c simulation/*.cpp) +file(GLOB ACE_DIRECTX_SOURCES directx/*.h directx/*.hpp directx/*.c directx/*.cpp) +file(GLOB ACE_GLM_SOURCES glm/*.h glm/*.hpp glm/*.c glm/*.cpp) + +SOURCE_GROUP("common" FILES ${ACE_BASE_COMMON_SOURCES}) +SOURCE_GROUP("p3d" FILES ${ACE_P3D_SOURCES}) +SOURCE_GROUP("pbo" FILES ${ACE_PBO_SOURCES}) +SOURCE_GROUP("simulation" FILES ${ACE_SIMULATION_SOURCES}) +SOURCE_GROUP("directx" FILES ${ACE_DIRECTX_SOURCES}) +SOURCE_GROUP("glm" FILES ${ACE_GLM_SOURCES}) + +add_library(ace_common STATIC ${ACE_GLM_SOURCES} ${ACE_BASE_COMMON_SOURCES} ${ACE_P3D_SOURCES} ${ACE_PBO_SOURCES} ${ACE_SIMULATION_SOURCES} ${ACE_DIRECTX_SOURCES}) diff --git a/extensions/common/ace_common.cpp b/extensions/common/ace_common.cpp index 6ccd690c3a..2f887450f2 100644 --- a/extensions/common/ace_common.cpp +++ b/extensions/common/ace_common.cpp @@ -1,4 +1,4 @@ - -int test(int var) { - return var; + +int test(int var) { + return var; } \ No newline at end of file diff --git a/extensions/common/ace_common.h b/extensions/common/ace_common.h index 93f7b9af8a..8da16d779a 100644 --- a/extensions/common/ace_common.h +++ b/extensions/common/ace_common.h @@ -1,4 +1,4 @@ -#pragma once - -#include "targetver.h" -#include "ace_version.hpp" +#pragma once + +#include "targetver.h" +#include "ace_version.hpp" diff --git a/extensions/common/ace_version.hpp.in b/extensions/common/ace_version.hpp.in index 853648497d..48ff6e75c1 100644 --- a/extensions/common/ace_version.hpp.in +++ b/extensions/common/ace_version.hpp.in @@ -1,4 +1,4 @@ -#pragma once - -#define ACE_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@" +#pragma once + +#define ACE_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@" #define ACE_FULL_VERSION_STR "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" \ No newline at end of file diff --git a/extensions/common/ace_version_win32.rc.in b/extensions/common/ace_version_win32.rc.in index 112f404649..5bba006f9a 100644 --- a/extensions/common/ace_version_win32.rc.in +++ b/extensions/common/ace_version_win32.rc.in @@ -1,47 +1,47 @@ -#ifdef _WIN32 - - #include - - #ifndef DEBUG - #define VER_DEBUG 0 - #else - #define VER_DEBUG VS_FF_DEBUG - #endif - - VS_VERSION_INFO VERSIONINFO - FILEVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ - PRODUCTVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG) - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN - BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - BEGIN - VALUE "CompanyName", "ACE3 Team" - VALUE "FileDescription", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "FileVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "ProductName", "ACE3" - VALUE "ProductVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" - VALUE "Build Date", "@ACE_BUILDSTAMP@" - END - END - - BLOCK "VarFileInfo" - BEGIN - /* The following line should only be modified for localized versions. */ - /* It consists of any number of WORD,WORD pairs, with each pair */ - /* describing a language,codepage combination supported by the file. */ - /* */ - /* For example, a file might have values "0x409,1252" indicating that it */ - /* supports English language (0x409) in the Windows ANSI codepage (1252). */ - - VALUE "Translation", 0x409, 1252 - - END - END - +#ifdef _WIN32 + + #include + + #ifndef DEBUG + #define VER_DEBUG 0 + #else + #define VER_DEBUG VS_FF_DEBUG + #endif + + VS_VERSION_INFO VERSIONINFO + FILEVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ + PRODUCTVERSION @ACE_VERSION_MAJOR@, @ACE_VERSION_MINOR@, @ACE_VERSION_REVISION@ + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS (VS_FF_PRIVATEBUILD|VS_FF_PRERELEASE|VER_DEBUG) + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "ACE3 Team" + VALUE "FileDescription", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "FileVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "ProductName", "ACE3" + VALUE "ProductVersion", "@ACE_VERSION_MAJOR@.@ACE_VERSION_MINOR@.@ACE_VERSION_REVISION@-@ACE_VERSION_BUILD@" + VALUE "Build Date", "@ACE_BUILDSTAMP@" + END + END + + BLOCK "VarFileInfo" + BEGIN + /* The following line should only be modified for localized versions. */ + /* It consists of any number of WORD,WORD pairs, with each pair */ + /* describing a language,codepage combination supported by the file. */ + /* */ + /* For example, a file might have values "0x409,1252" indicating that it */ + /* supports English language (0x409) in the Windows ANSI codepage (1252). */ + + VALUE "Translation", 0x409, 1252 + + END + END + #endif \ No newline at end of file diff --git a/extensions/common/arguments.hpp b/extensions/common/arguments.hpp index 70e942a241..7869cc2998 100644 --- a/extensions/common/arguments.hpp +++ b/extensions/common/arguments.hpp @@ -1,90 +1,90 @@ -#pragma once - -#include "shared.hpp" -#include "vector.hpp" - -#include -#include - -namespace ace { - class argument_accessor { - public: - argument_accessor(const uint32_t index, const std::vector & ar) : _index(index), _args(ar) { } - - const std::string & as_string() const { return _args[_index]; } - operator const std::string &() const { return as_string(); } - - float as_float() const { return atof(_args[_index].c_str()); } - operator float() const { return as_float(); } - - int as_int() const { return atoi(_args[_index].c_str()); } - operator int() const { return as_int(); } - - int as_uint32() const { return (uint32_t)atoi(_args[_index].c_str()); } - operator uint32_t() const { return as_uint32(); } - - ace::vector3 as_vector() const { - std::vector t = ace::split(_args[_index], ';'); - return ace::vector3(atof(t[0].c_str()), - atof(t[1].c_str()), - atof(t[2].c_str())); - } - operator ace::vector3() const { return as_vector(); } - - protected: - const uint32_t _index; - const std::vector & _args; - }; - - class arguments { - public: - arguments(const std::string & str) : _original(str) { - _args = ace::split(str, ','); - for (int i = 0; i < _args.size(); i++) { - _args[i] = trim(_args[i]); - } - } - - size_t size() const { return _args.size(); } - - const argument_accessor operator[] (int index) const { return argument_accessor(index, _args); } - - const std::string & as_string(uint32_t _index) const { return _args[_index]; } - float as_float(uint32_t _index) const { return atof(_args[_index].c_str()); } - int as_int(uint32_t _index) const { return atoi(_args[_index].c_str()); } - int as_uint32(uint32_t _index) const { return (uint32_t)atoi(_args[_index].c_str()); } - ace::vector3 as_vector(uint32_t _index) const { - std::vector t = ace::split(_args[_index], ';'); - return ace::vector3(atof(t[0].c_str()), - atof(t[1].c_str()), - atof(t[2].c_str())); - } - - const std::string & get() const { - return _original; - } - - std::string create(const std::string & command) const { - std::stringstream ss; - ss << command << ":"; - - for (auto & v : _args) { - ss << v << ","; - } - - // Remove the trailing , - std::string result = ss.str(); - result.erase(result.length()); - - return result; - } - static std::string create(const std::string & command, const arguments & args) { - return args.create(command); - } - - - protected: - std::vector _args; - const std::string _original; - }; +#pragma once + +#include "shared.hpp" +#include "vector.hpp" + +#include +#include + +namespace ace { + class argument_accessor { + public: + argument_accessor(const uint32_t index, const std::vector & ar) : _index(index), _args(ar) { } + + const std::string & as_string() const { return _args[_index]; } + operator const std::string &() const { return as_string(); } + + float as_float() const { return atof(_args[_index].c_str()); } + operator float() const { return as_float(); } + + int as_int() const { return atoi(_args[_index].c_str()); } + operator int() const { return as_int(); } + + int as_uint32() const { return (uint32_t)atoi(_args[_index].c_str()); } + operator uint32_t() const { return as_uint32(); } + + ace::vector3 as_vector() const { + std::vector t = ace::split(_args[_index], ';'); + return ace::vector3(atof(t[0].c_str()), + atof(t[1].c_str()), + atof(t[2].c_str())); + } + operator ace::vector3() const { return as_vector(); } + + protected: + const uint32_t _index; + const std::vector & _args; + }; + + class arguments { + public: + arguments(const std::string & str) : _original(str) { + _args = ace::split(str, ','); + for (int i = 0; i < _args.size(); i++) { + _args[i] = trim(_args[i]); + } + } + + size_t size() const { return _args.size(); } + + const argument_accessor operator[] (int index) const { return argument_accessor(index, _args); } + + const std::string & as_string(uint32_t _index) const { return _args[_index]; } + float as_float(uint32_t _index) const { return atof(_args[_index].c_str()); } + int as_int(uint32_t _index) const { return atoi(_args[_index].c_str()); } + int as_uint32(uint32_t _index) const { return (uint32_t)atoi(_args[_index].c_str()); } + ace::vector3 as_vector(uint32_t _index) const { + std::vector t = ace::split(_args[_index], ';'); + return ace::vector3(atof(t[0].c_str()), + atof(t[1].c_str()), + atof(t[2].c_str())); + } + + const std::string & get() const { + return _original; + } + + std::string create(const std::string & command) const { + std::stringstream ss; + ss << command << ":"; + + for (auto & v : _args) { + ss << v << ","; + } + + // Remove the trailing , + std::string result = ss.str(); + result.erase(result.length()); + + return result; + } + static std::string create(const std::string & command, const arguments & args) { + return args.create(command); + } + + + protected: + std::vector _args; + const std::string _original; + }; } \ No newline at end of file diff --git a/extensions/common/directx/d3d_display.cpp b/extensions/common/directx/d3d_display.cpp index bfc7a0e013..3b175fd7e4 100644 --- a/extensions/common/directx/d3d_display.cpp +++ b/extensions/common/directx/d3d_display.cpp @@ -1,439 +1,439 @@ -#ifdef USE_DIRECTX - -#include "shared.hpp" -#include "d3d_display.hpp" - -#include - -#include - -using namespace DirectX; - -namespace ace { - namespace debug { - - DWORD GetMainThreadId() { - const std::shared_ptr hThreadSnapshot( - CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0), CloseHandle); - if (hThreadSnapshot.get() == INVALID_HANDLE_VALUE) { - throw std::runtime_error("GetMainThreadId failed"); - } - THREADENTRY32 tEntry; - tEntry.dwSize = sizeof(THREADENTRY32); - DWORD result = 0; - DWORD currentPID = GetCurrentProcessId(); - for (BOOL success = Thread32First(hThreadSnapshot.get(), &tEntry); - !result && success && GetLastError() != ERROR_NO_MORE_FILES; - success = Thread32Next(hThreadSnapshot.get(), &tEntry)) - { - if (tEntry.th32OwnerProcessID == currentPID) { - result = tEntry.th32ThreadID; - } - } - return result; - } - - d3d_display::d3d_display() : _fullscreen(false) {} - d3d_display::~d3d_display() {} - - bool d3d_display::render_thread(uint32_t w, uint32_t h, bool f) { - _render_thread = std::make_unique(this, d3d_display_worker_args(w, h, f) ); - return true; - } - - void d3d_display::render_worker(d3d_display_worker_args args) { - { - create(args.width, args.height, args.fullscreen); - init(); - } - run(); - } - - bool d3d_display::run() { - MSG msg = { 0 }; - - while (WM_QUIT != msg.message) { - if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } else { - render(); - } - } - - return true; - } - - bool d3d_display::init() { - - std::lock_guard _lock(_render_lock); - - HRESULT hr = S_OK; - RECT rc; - - GetClientRect(_hWnd, &rc); - UINT width = rc.right - rc.left; - UINT height = rc.bottom - rc.top; - UINT createDeviceFlags = 0; -#ifdef _DEBUG - createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; -#endif - - D3D_DRIVER_TYPE driverTypes[] = - { - D3D_DRIVER_TYPE_HARDWARE, - D3D_DRIVER_TYPE_WARP, - D3D_DRIVER_TYPE_REFERENCE, - }; - UINT numDriverTypes = ARRAYSIZE(driverTypes); - - D3D_FEATURE_LEVEL featureLevels[] = - { - D3D_FEATURE_LEVEL_11_0, - D3D_FEATURE_LEVEL_10_1, - D3D_FEATURE_LEVEL_10_0, - }; - UINT numFeatureLevels = ARRAYSIZE(featureLevels); - - DXGI_SWAP_CHAIN_DESC sd; - ZeroMemory(&sd, sizeof(sd)); - sd.BufferCount = 1; - sd.BufferDesc.Width = width; - sd.BufferDesc.Height = height; - sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - sd.BufferDesc.RefreshRate.Numerator = 60; - sd.BufferDesc.RefreshRate.Denominator = 1; - sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - sd.OutputWindow = _hWnd; - sd.SampleDesc.Count = 1; - sd.SampleDesc.Quality = 0; - sd.Windowed = _fullscreen ? FALSE : TRUE; - - for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++) - { - _driverType = driverTypes[driverTypeIndex]; - hr = D3D11CreateDeviceAndSwapChain(nullptr, _driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, - D3D11_SDK_VERSION, &sd, &_pSwapChain, &_pd3dDevice, &_featureLevel, &_pImmediateContext); - if (SUCCEEDED(hr)) - break; - } - if (FAILED(hr)) - return false; - - // Create a render target view - ID3D11Texture2D* pBackBuffer = nullptr; - hr = _pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); - if (FAILED(hr)) - return false; - - hr = _pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, &_pRenderTargetView); - pBackBuffer->Release(); - if (FAILED(hr)) - return false; - - // Create depth stencil texture - D3D11_TEXTURE2D_DESC descDepth; - ZeroMemory(&descDepth, sizeof(descDepth)); - descDepth.Width = width; - descDepth.Height = height; - descDepth.MipLevels = 1; - descDepth.ArraySize = 1; - descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; - descDepth.SampleDesc.Count = 1; - descDepth.SampleDesc.Quality = 0; - descDepth.Usage = D3D11_USAGE_DEFAULT; - descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; - descDepth.CPUAccessFlags = 0; - descDepth.MiscFlags = 0; - hr = _pd3dDevice->CreateTexture2D(&descDepth, nullptr, &_pDepthStencil); - if (FAILED(hr)) - return false; - - // Create the depth stencil view - D3D11_DEPTH_STENCIL_VIEW_DESC descDSV; - ZeroMemory(&descDSV, sizeof(descDSV)); - descDSV.Format = descDepth.Format; - descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; - descDSV.Texture2D.MipSlice = 0; - hr = _pd3dDevice->CreateDepthStencilView(_pDepthStencil, &descDSV, &_pDepthStencilView); - if (FAILED(hr)) - return false; - - _pImmediateContext->OMSetRenderTargets(1, &_pRenderTargetView, _pDepthStencilView); - - // Setup the viewport - D3D11_VIEWPORT vp; - vp.Width = (FLOAT)width; - vp.Height = (FLOAT)height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; - vp.TopLeftX = 0; - vp.TopLeftY = 0; - _pImmediateContext->RSSetViewports(1, &vp); - - XMStoreFloat4x4(&_World, XMMatrixIdentity()); - XMStoreFloat4x4(&_View, XMMatrixLookAtLH(XMLoadFloat4(&_camera.camPosition), XMLoadFloat4(&_camera.camTarget), XMLoadFloat4(&_camera.camUp))); - XMStoreFloat4x4(&_Projection, XMMatrixPerspectiveFovLH(XM_PIDIV4, width / (FLOAT)height, 0.01f, 100.0f)); - - init_input(); - - return true; - } - - bool d3d_display::init_input() { - RAWINPUTDEVICE Rid[2]; - - Rid[0].usUsagePage = 0x01; // magic numbers - Rid[0].usUsage = 0x02; // magically means mouse - Rid[0].dwFlags = 0; // (use this if you DO NOT WANT to capture mouse) - //Rid[0].dwFlags = RIDEV_CAPTUREMOUSE | RIDEV_NOLEGACY ; // (use this to CAPTURE MOUSE) - Rid[0].hwndTarget = _hWnd; - - Rid[1].usUsagePage = 0x01; // magic numbers - Rid[1].usUsage = 0x06; // magically means keyboard - Rid[1].dwFlags = 0; // use RIDEV_NOHOTKEYS for no winkey - Rid[1].hwndTarget = _hWnd; - - if (!RegisterRawInputDevices(Rid, 2, sizeof(Rid[0]))) { - LOG(ERROR) << "Could not register raw input devices. "; - exit(1); - } - } - - bool d3d_display::create(uint32_t width = 1024, uint32_t height = 768, bool fullscreen = false) { - std::lock_guard _lock(_render_lock); - - _fullscreen = fullscreen; - - WNDCLASSEXW wcex; - wcex.cbSize = sizeof(WNDCLASSEXW); - wcex.style = CS_HREDRAW | CS_VREDRAW; - wcex.lpfnWndProc = (WNDPROC)&ace::debug::d3d_display::wndproc; - wcex.cbClsExtra = 0; - wcex.cbWndExtra = 0; - wcex.hInstance = (HINSTANCE)GetCurrentProcess(); - //wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SAMPLE1); - //wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); - wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wcex.lpszMenuName = nullptr; - wcex.lpszClassName = L"ACE3BaseDisplayClass"; - //wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SAMPLE1); - if (!RegisterClassExW(&wcex)) { - return false; - } - - // Create window - _hInst = (HINSTANCE)GetCurrentProcess(); - RECT rc = { 0, 0, width, height }; - AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE); - _hWnd = CreateWindowW(L"ACE3BaseDisplayClass", L"ACE3 D3D Render", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, _hInst, - nullptr); - - if (!_hWnd) { - return false; - } - - // Attach our input to the master input - //AttachThreadInput(GetCurrentThreadId(), GetMainThraedId()); - - SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this); - - ShowWindow(_hWnd, 5); - - return true; - } - - bool d3d_display::destroy() { - if (_pImmediateContext) _pImmediateContext->ClearState(); - - if (_pBatchInputLayout) _pBatchInputLayout->Release(); - - if (_pTextureRV1) _pTextureRV1->Release(); - if (_pTextureRV2) _pTextureRV2->Release(); - - if (_pDepthStencilView) _pDepthStencilView->Release(); - if (_pDepthStencil) _pDepthStencil->Release(); - if (_pRenderTargetView) _pRenderTargetView->Release(); - if (_pSwapChain) _pSwapChain->Release(); - if (_pImmediateContext) _pImmediateContext->Release(); - if (_pd3dDevice) _pd3dDevice->Release(); - - return true; - } - - bool d3d_display::render() { - // Update our time - static float t = 0.0f; - static float dt = 0.f; - if (_driverType == D3D_DRIVER_TYPE_REFERENCE) { - t += (float)XM_PI * 0.0125f; - } else { - static uint64_t dwTimeStart = 0; - static uint64_t dwTimeLast = 0; - uint64_t dwTimeCur = GetTickCount64(); - if (dwTimeStart == 0) - dwTimeStart = dwTimeCur; - t = (dwTimeCur - dwTimeStart) / 1000.0f; - dt = (dwTimeCur - dwTimeLast) / 1000.0f; - dwTimeLast = dwTimeCur; - } - - { - std::lock_guard _lock(_render_lock); - - _pImmediateContext->ClearRenderTargetView(_pRenderTargetView, Colors::MidnightBlue); - _pImmediateContext->ClearDepthStencilView(_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); - - update_camera(); - step(); - - _pSwapChain->Present(0, 0); - } - - return true; - } - - bool d3d_display::step() { - return true; - } - - void d3d_display::_move_camera(ace::vector3 direction) { - - } - void d3d_display::_rotate_camera(ace::vector3 direction) { - - } - void d3d_display::update_camera() { - XMVECTOR DefaultForward, DefaultRight, camPosition; - - DefaultForward = XMLoadFloat4(&_camera.DefaultForward); - DefaultRight = XMLoadFloat4(&_camera.DefaultRight); - camPosition = XMLoadFloat4(&_camera.camPosition); - - XMMATRIX camRotationMatrix = XMMatrixRotationRollPitchYaw(_camera.camPitch, _camera.camYaw, 0); - XMVECTOR camTarget = XMVector3TransformCoord(DefaultForward, camRotationMatrix); - camTarget = XMVector3Normalize(camTarget); - - XMVECTOR camRight = XMVector3TransformCoord(DefaultRight, camRotationMatrix); - XMVECTOR camForward = XMVector3TransformCoord(DefaultForward, camRotationMatrix); - XMVECTOR camUp = XMVector3Cross(camForward, camRight); - - camPosition += _camera.moveLeftRight * camRight; - camPosition += _camera.moveBackForward * camForward; - XMStoreFloat4(&_camera.camPosition, camPosition); - - _camera.moveLeftRight = 0.0f; - _camera.moveBackForward = 0.0f; - - camTarget = camPosition + camTarget; - - XMStoreFloat4x4(&_View, XMMatrixLookAtLH(camPosition, camTarget, camUp)); - } - - LRESULT CALLBACK d3d_display::_wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - PAINTSTRUCT ps; - HDC hdc; - - switch (message) { - case WM_INPUT: { - UINT dwSize; - if (GetActiveWindow() != _hWnd) { - return DefWindowProc(hWnd, message, wParam, lParam); - } - GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, - sizeof(RAWINPUTHEADER)); - LPBYTE lpb = new BYTE[dwSize]; - if (lpb == NULL) { - return 0; - } - - int readSize = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)); - - if (readSize != dwSize) - break; - - RAWINPUT* raw = (RAWINPUT*)lpb; - - float speed = 0.5f; - - if (raw->header.dwType == RIM_TYPEKEYBOARD) { - switch (raw->data.keyboard.VKey) { - case VK_SPACE: { - XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); - break; - } - // Camera Movement - case 0x57: case VK_NUMPAD8: - case VK_UP: { - _camera.moveBackForward += speed; - break; - } - case 0x53: case VK_NUMPAD2: - case VK_DOWN: { - _camera.moveBackForward -= speed; - break; - } - case 0x41: case VK_NUMPAD4: - case VK_LEFT: { - _camera.moveLeftRight -= speed; - break; - } - case 0x44: case VK_NUMPAD6: - case VK_RIGHT: { - _camera.moveLeftRight += speed; - break; - } - // Numpad Movement - case VK_NUMPAD5: { - XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); - break; - } - } - } - else if (raw->header.dwType == RIM_TYPEMOUSE) { - RAWMOUSE mouseCurrState = raw->data.mouse; - - if ((mouseCurrState.lLastX != _last_mouse_state.lLastY) || (mouseCurrState.lLastX != _last_mouse_state.lLastY)) - { - _camera.camYaw += mouseCurrState.lLastX * 0.005f; - _camera.camPitch += mouseCurrState.lLastY * 0.005f; - _last_mouse_state = mouseCurrState; - } - - } - - delete[] lpb; - return 0; - } - - case WM_PAINT: - hdc = BeginPaint(hWnd, &ps); - EndPaint(hWnd, &ps); - break; - - case WM_DESTROY: - PostQuitMessage(0); - - break; - default: - return DefWindowProc(hWnd, message, wParam, lParam); - } - - return 0; - } - LRESULT CALLBACK d3d_display::wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - LONG data; - data = GetWindowLongPtr(hWnd, GWLP_USERDATA); - if (data) { - return ((d3d_display*)data)->_wndproc(hWnd, message, wParam, lParam); - } else { - return DefWindowProc(hWnd, message, wParam, lParam); - } - } - }; - - -}; - +#ifdef USE_DIRECTX + +#include "shared.hpp" +#include "d3d_display.hpp" + +#include + +#include + +using namespace DirectX; + +namespace ace { + namespace debug { + + DWORD GetMainThreadId() { + const std::shared_ptr hThreadSnapshot( + CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0), CloseHandle); + if (hThreadSnapshot.get() == INVALID_HANDLE_VALUE) { + throw std::runtime_error("GetMainThreadId failed"); + } + THREADENTRY32 tEntry; + tEntry.dwSize = sizeof(THREADENTRY32); + DWORD result = 0; + DWORD currentPID = GetCurrentProcessId(); + for (BOOL success = Thread32First(hThreadSnapshot.get(), &tEntry); + !result && success && GetLastError() != ERROR_NO_MORE_FILES; + success = Thread32Next(hThreadSnapshot.get(), &tEntry)) + { + if (tEntry.th32OwnerProcessID == currentPID) { + result = tEntry.th32ThreadID; + } + } + return result; + } + + d3d_display::d3d_display() : _fullscreen(false) {} + d3d_display::~d3d_display() {} + + bool d3d_display::render_thread(uint32_t w, uint32_t h, bool f) { + _render_thread = std::make_unique(this, d3d_display_worker_args(w, h, f) ); + return true; + } + + void d3d_display::render_worker(d3d_display_worker_args args) { + { + create(args.width, args.height, args.fullscreen); + init(); + } + run(); + } + + bool d3d_display::run() { + MSG msg = { 0 }; + + while (WM_QUIT != msg.message) { + if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } else { + render(); + } + } + + return true; + } + + bool d3d_display::init() { + + std::lock_guard _lock(_render_lock); + + HRESULT hr = S_OK; + RECT rc; + + GetClientRect(_hWnd, &rc); + UINT width = rc.right - rc.left; + UINT height = rc.bottom - rc.top; + UINT createDeviceFlags = 0; +#ifdef _DEBUG + createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; +#endif + + D3D_DRIVER_TYPE driverTypes[] = + { + D3D_DRIVER_TYPE_HARDWARE, + D3D_DRIVER_TYPE_WARP, + D3D_DRIVER_TYPE_REFERENCE, + }; + UINT numDriverTypes = ARRAYSIZE(driverTypes); + + D3D_FEATURE_LEVEL featureLevels[] = + { + D3D_FEATURE_LEVEL_11_0, + D3D_FEATURE_LEVEL_10_1, + D3D_FEATURE_LEVEL_10_0, + }; + UINT numFeatureLevels = ARRAYSIZE(featureLevels); + + DXGI_SWAP_CHAIN_DESC sd; + ZeroMemory(&sd, sizeof(sd)); + sd.BufferCount = 1; + sd.BufferDesc.Width = width; + sd.BufferDesc.Height = height; + sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + sd.BufferDesc.RefreshRate.Numerator = 60; + sd.BufferDesc.RefreshRate.Denominator = 1; + sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; + sd.OutputWindow = _hWnd; + sd.SampleDesc.Count = 1; + sd.SampleDesc.Quality = 0; + sd.Windowed = _fullscreen ? FALSE : TRUE; + + for (UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++) + { + _driverType = driverTypes[driverTypeIndex]; + hr = D3D11CreateDeviceAndSwapChain(nullptr, _driverType, nullptr, createDeviceFlags, featureLevels, numFeatureLevels, + D3D11_SDK_VERSION, &sd, &_pSwapChain, &_pd3dDevice, &_featureLevel, &_pImmediateContext); + if (SUCCEEDED(hr)) + break; + } + if (FAILED(hr)) + return false; + + // Create a render target view + ID3D11Texture2D* pBackBuffer = nullptr; + hr = _pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); + if (FAILED(hr)) + return false; + + hr = _pd3dDevice->CreateRenderTargetView(pBackBuffer, nullptr, &_pRenderTargetView); + pBackBuffer->Release(); + if (FAILED(hr)) + return false; + + // Create depth stencil texture + D3D11_TEXTURE2D_DESC descDepth; + ZeroMemory(&descDepth, sizeof(descDepth)); + descDepth.Width = width; + descDepth.Height = height; + descDepth.MipLevels = 1; + descDepth.ArraySize = 1; + descDepth.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + descDepth.SampleDesc.Count = 1; + descDepth.SampleDesc.Quality = 0; + descDepth.Usage = D3D11_USAGE_DEFAULT; + descDepth.BindFlags = D3D11_BIND_DEPTH_STENCIL; + descDepth.CPUAccessFlags = 0; + descDepth.MiscFlags = 0; + hr = _pd3dDevice->CreateTexture2D(&descDepth, nullptr, &_pDepthStencil); + if (FAILED(hr)) + return false; + + // Create the depth stencil view + D3D11_DEPTH_STENCIL_VIEW_DESC descDSV; + ZeroMemory(&descDSV, sizeof(descDSV)); + descDSV.Format = descDepth.Format; + descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D; + descDSV.Texture2D.MipSlice = 0; + hr = _pd3dDevice->CreateDepthStencilView(_pDepthStencil, &descDSV, &_pDepthStencilView); + if (FAILED(hr)) + return false; + + _pImmediateContext->OMSetRenderTargets(1, &_pRenderTargetView, _pDepthStencilView); + + // Setup the viewport + D3D11_VIEWPORT vp; + vp.Width = (FLOAT)width; + vp.Height = (FLOAT)height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + vp.TopLeftX = 0; + vp.TopLeftY = 0; + _pImmediateContext->RSSetViewports(1, &vp); + + XMStoreFloat4x4(&_World, XMMatrixIdentity()); + XMStoreFloat4x4(&_View, XMMatrixLookAtLH(XMLoadFloat4(&_camera.camPosition), XMLoadFloat4(&_camera.camTarget), XMLoadFloat4(&_camera.camUp))); + XMStoreFloat4x4(&_Projection, XMMatrixPerspectiveFovLH(XM_PIDIV4, width / (FLOAT)height, 0.01f, 100.0f)); + + init_input(); + + return true; + } + + bool d3d_display::init_input() { + RAWINPUTDEVICE Rid[2]; + + Rid[0].usUsagePage = 0x01; // magic numbers + Rid[0].usUsage = 0x02; // magically means mouse + Rid[0].dwFlags = 0; // (use this if you DO NOT WANT to capture mouse) + //Rid[0].dwFlags = RIDEV_CAPTUREMOUSE | RIDEV_NOLEGACY ; // (use this to CAPTURE MOUSE) + Rid[0].hwndTarget = _hWnd; + + Rid[1].usUsagePage = 0x01; // magic numbers + Rid[1].usUsage = 0x06; // magically means keyboard + Rid[1].dwFlags = 0; // use RIDEV_NOHOTKEYS for no winkey + Rid[1].hwndTarget = _hWnd; + + if (!RegisterRawInputDevices(Rid, 2, sizeof(Rid[0]))) { + LOG(ERROR) << "Could not register raw input devices. "; + exit(1); + } + } + + bool d3d_display::create(uint32_t width = 1024, uint32_t height = 768, bool fullscreen = false) { + std::lock_guard _lock(_render_lock); + + _fullscreen = fullscreen; + + WNDCLASSEXW wcex; + wcex.cbSize = sizeof(WNDCLASSEXW); + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = (WNDPROC)&ace::debug::d3d_display::wndproc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = (HINSTANCE)GetCurrentProcess(); + //wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SAMPLE1); + //wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); + wcex.lpszMenuName = nullptr; + wcex.lpszClassName = L"ACE3BaseDisplayClass"; + //wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SAMPLE1); + if (!RegisterClassExW(&wcex)) { + return false; + } + + // Create window + _hInst = (HINSTANCE)GetCurrentProcess(); + RECT rc = { 0, 0, width, height }; + AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, FALSE); + _hWnd = CreateWindowW(L"ACE3BaseDisplayClass", L"ACE3 D3D Render", WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, nullptr, nullptr, _hInst, + nullptr); + + if (!_hWnd) { + return false; + } + + // Attach our input to the master input + //AttachThreadInput(GetCurrentThreadId(), GetMainThraedId()); + + SetWindowLongPtr(_hWnd, GWLP_USERDATA, (LONG)this); + + ShowWindow(_hWnd, 5); + + return true; + } + + bool d3d_display::destroy() { + if (_pImmediateContext) _pImmediateContext->ClearState(); + + if (_pBatchInputLayout) _pBatchInputLayout->Release(); + + if (_pTextureRV1) _pTextureRV1->Release(); + if (_pTextureRV2) _pTextureRV2->Release(); + + if (_pDepthStencilView) _pDepthStencilView->Release(); + if (_pDepthStencil) _pDepthStencil->Release(); + if (_pRenderTargetView) _pRenderTargetView->Release(); + if (_pSwapChain) _pSwapChain->Release(); + if (_pImmediateContext) _pImmediateContext->Release(); + if (_pd3dDevice) _pd3dDevice->Release(); + + return true; + } + + bool d3d_display::render() { + // Update our time + static float t = 0.0f; + static float dt = 0.f; + if (_driverType == D3D_DRIVER_TYPE_REFERENCE) { + t += (float)XM_PI * 0.0125f; + } else { + static uint64_t dwTimeStart = 0; + static uint64_t dwTimeLast = 0; + uint64_t dwTimeCur = GetTickCount64(); + if (dwTimeStart == 0) + dwTimeStart = dwTimeCur; + t = (dwTimeCur - dwTimeStart) / 1000.0f; + dt = (dwTimeCur - dwTimeLast) / 1000.0f; + dwTimeLast = dwTimeCur; + } + + { + std::lock_guard _lock(_render_lock); + + _pImmediateContext->ClearRenderTargetView(_pRenderTargetView, Colors::MidnightBlue); + _pImmediateContext->ClearDepthStencilView(_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); + + update_camera(); + step(); + + _pSwapChain->Present(0, 0); + } + + return true; + } + + bool d3d_display::step() { + return true; + } + + void d3d_display::_move_camera(ace::vector3 direction) { + + } + void d3d_display::_rotate_camera(ace::vector3 direction) { + + } + void d3d_display::update_camera() { + XMVECTOR DefaultForward, DefaultRight, camPosition; + + DefaultForward = XMLoadFloat4(&_camera.DefaultForward); + DefaultRight = XMLoadFloat4(&_camera.DefaultRight); + camPosition = XMLoadFloat4(&_camera.camPosition); + + XMMATRIX camRotationMatrix = XMMatrixRotationRollPitchYaw(_camera.camPitch, _camera.camYaw, 0); + XMVECTOR camTarget = XMVector3TransformCoord(DefaultForward, camRotationMatrix); + camTarget = XMVector3Normalize(camTarget); + + XMVECTOR camRight = XMVector3TransformCoord(DefaultRight, camRotationMatrix); + XMVECTOR camForward = XMVector3TransformCoord(DefaultForward, camRotationMatrix); + XMVECTOR camUp = XMVector3Cross(camForward, camRight); + + camPosition += _camera.moveLeftRight * camRight; + camPosition += _camera.moveBackForward * camForward; + XMStoreFloat4(&_camera.camPosition, camPosition); + + _camera.moveLeftRight = 0.0f; + _camera.moveBackForward = 0.0f; + + camTarget = camPosition + camTarget; + + XMStoreFloat4x4(&_View, XMMatrixLookAtLH(camPosition, camTarget, camUp)); + } + + LRESULT CALLBACK d3d_display::_wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + PAINTSTRUCT ps; + HDC hdc; + + switch (message) { + case WM_INPUT: { + UINT dwSize; + if (GetActiveWindow() != _hWnd) { + return DefWindowProc(hWnd, message, wParam, lParam); + } + GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, + sizeof(RAWINPUTHEADER)); + LPBYTE lpb = new BYTE[dwSize]; + if (lpb == NULL) { + return 0; + } + + int readSize = GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)); + + if (readSize != dwSize) + break; + + RAWINPUT* raw = (RAWINPUT*)lpb; + + float speed = 0.5f; + + if (raw->header.dwType == RIM_TYPEKEYBOARD) { + switch (raw->data.keyboard.VKey) { + case VK_SPACE: { + XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); + break; + } + // Camera Movement + case 0x57: case VK_NUMPAD8: + case VK_UP: { + _camera.moveBackForward += speed; + break; + } + case 0x53: case VK_NUMPAD2: + case VK_DOWN: { + _camera.moveBackForward -= speed; + break; + } + case 0x41: case VK_NUMPAD4: + case VK_LEFT: { + _camera.moveLeftRight -= speed; + break; + } + case 0x44: case VK_NUMPAD6: + case VK_RIGHT: { + _camera.moveLeftRight += speed; + break; + } + // Numpad Movement + case VK_NUMPAD5: { + XMStoreFloat4(&_camera.camPosition, XMVectorSet(0, 0, 0, 0)); + break; + } + } + } + else if (raw->header.dwType == RIM_TYPEMOUSE) { + RAWMOUSE mouseCurrState = raw->data.mouse; + + if ((mouseCurrState.lLastX != _last_mouse_state.lLastY) || (mouseCurrState.lLastX != _last_mouse_state.lLastY)) + { + _camera.camYaw += mouseCurrState.lLastX * 0.005f; + _camera.camPitch += mouseCurrState.lLastY * 0.005f; + _last_mouse_state = mouseCurrState; + } + + } + + delete[] lpb; + return 0; + } + + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + break; + + case WM_DESTROY: + PostQuitMessage(0); + + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; + } + LRESULT CALLBACK d3d_display::wndproc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + LONG data; + data = GetWindowLongPtr(hWnd, GWLP_USERDATA); + if (data) { + return ((d3d_display*)data)->_wndproc(hWnd, message, wParam, lParam); + } else { + return DefWindowProc(hWnd, message, wParam, lParam); + } + } + }; + + +}; + #endif \ No newline at end of file diff --git a/extensions/common/directx/d3d_display.hpp b/extensions/common/directx/d3d_display.hpp index b10e8ef070..c17eedf8cc 100644 --- a/extensions/common/directx/d3d_display.hpp +++ b/extensions/common/directx/d3d_display.hpp @@ -1,130 +1,130 @@ -#pragma once - -#ifdef USE_DIRECTX - -#include -#include -#include -#include - -#include -#include -#include - -#include "singleton.hpp" -#include "vector.hpp" - -#define IDI_ACE_DEBUG 666 - -namespace ace { - namespace debug { - - __declspec(align(16)) - struct camera_movement { - camera_movement() { - XMStoreFloat4(&DefaultForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); - XMStoreFloat4(&DefaultRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); - XMStoreFloat4(&camForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); - XMStoreFloat4(&camRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); - - camYaw = 0.0f; - camPitch = 0.0f; - - moveLeftRight = 0.0f; - moveBackForward = 0.0f; - - XMStoreFloat4(&camPosition, DirectX::XMVectorSet(0.0f, 12.0f, 6.0f, 0.0f)); - XMStoreFloat4(&camTarget, DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f)); - XMStoreFloat4(&camUp, DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f)); - } - - DirectX::XMFLOAT4 DefaultForward; - DirectX::XMFLOAT4 DefaultRight; - DirectX::XMFLOAT4 camForward; - DirectX::XMFLOAT4 camRight; - - DirectX::XMFLOAT4X4 camRotationMatrix; - DirectX::XMFLOAT4X4 groundWorld; - - float moveLeftRight; - float moveBackForward; - - float camYaw; - float camPitch; - - DirectX::XMFLOAT4 camPosition; - DirectX::XMFLOAT4 camTarget; - DirectX::XMFLOAT4 camUp; - }; - - struct d3d_display_worker; - struct d3d_display_worker_args; - __declspec(align(16)) - class d3d_display { - public: - d3d_display(); - ~d3d_display(); - - virtual bool run(); - virtual bool render(); - virtual bool render_thread(uint32_t, uint32_t, bool); - - virtual void update_camera(); - virtual bool step(); - - virtual bool create(uint32_t, uint32_t, bool); - virtual bool init(); - virtual bool init_input(); - - virtual bool destroy(); - - void render_worker(d3d_display_worker_args); - - static LRESULT CALLBACK wndproc(HWND, UINT, WPARAM, LPARAM); - LRESULT CALLBACK _wndproc(HWND, UINT, WPARAM, LPARAM); - protected: - void _move_camera(ace::vector3); - void _rotate_camera(ace::vector3); - - std::unique_ptr _render_thread; - std::mutex _render_lock; - - bool _fullscreen; - HINSTANCE _hInst = nullptr; - HWND _hWnd = nullptr; - D3D_DRIVER_TYPE _driverType = D3D_DRIVER_TYPE_NULL; - D3D_FEATURE_LEVEL _featureLevel = D3D_FEATURE_LEVEL_11_0; - ID3D11Device* _pd3dDevice = nullptr; - ID3D11DeviceContext* _pImmediateContext = nullptr; - IDXGISwapChain* _pSwapChain = nullptr; - ID3D11RenderTargetView* _pRenderTargetView = nullptr; - ID3D11Texture2D* _pDepthStencil = nullptr; - ID3D11DepthStencilView* _pDepthStencilView = nullptr; - - ID3D11ShaderResourceView* _pTextureRV1 = nullptr; - ID3D11ShaderResourceView* _pTextureRV2 = nullptr; - ID3D11InputLayout* _pBatchInputLayout = nullptr; - - DirectX::XMFLOAT4X4 _World; - DirectX::XMFLOAT4X4 _View; - DirectX::XMFLOAT4X4 _Projection; - - RAWMOUSE _last_mouse_state; - camera_movement _camera; - - }; - struct d3d_display_worker_args { - d3d_display_worker_args(uint32_t w, uint32_t h, bool f) : width(w), height(h), fullscreen(f) {} - uint32_t width; - uint32_t height; - bool fullscreen; - }; - struct d3d_display_worker { - d3d_display_worker(d3d_display * obj, d3d_display_worker_args args) : thread(&ace::debug::d3d_display::render_worker, obj, args) {} - ~d3d_display_worker() { thread.join(); } - std::thread thread; - }; - }; -}; - +#pragma once + +#ifdef USE_DIRECTX + +#include +#include +#include +#include + +#include +#include +#include + +#include "singleton.hpp" +#include "vector.hpp" + +#define IDI_ACE_DEBUG 666 + +namespace ace { + namespace debug { + + __declspec(align(16)) + struct camera_movement { + camera_movement() { + XMStoreFloat4(&DefaultForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); + XMStoreFloat4(&DefaultRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); + XMStoreFloat4(&camForward, DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f)); + XMStoreFloat4(&camRight, DirectX::XMVectorSet(1.0f, 0.0f, 0.0f, 0.0f)); + + camYaw = 0.0f; + camPitch = 0.0f; + + moveLeftRight = 0.0f; + moveBackForward = 0.0f; + + XMStoreFloat4(&camPosition, DirectX::XMVectorSet(0.0f, 12.0f, 6.0f, 0.0f)); + XMStoreFloat4(&camTarget, DirectX::XMVectorSet(0.0f, 0.0f, 0.0f, 0.0f)); + XMStoreFloat4(&camUp, DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f)); + } + + DirectX::XMFLOAT4 DefaultForward; + DirectX::XMFLOAT4 DefaultRight; + DirectX::XMFLOAT4 camForward; + DirectX::XMFLOAT4 camRight; + + DirectX::XMFLOAT4X4 camRotationMatrix; + DirectX::XMFLOAT4X4 groundWorld; + + float moveLeftRight; + float moveBackForward; + + float camYaw; + float camPitch; + + DirectX::XMFLOAT4 camPosition; + DirectX::XMFLOAT4 camTarget; + DirectX::XMFLOAT4 camUp; + }; + + struct d3d_display_worker; + struct d3d_display_worker_args; + __declspec(align(16)) + class d3d_display { + public: + d3d_display(); + ~d3d_display(); + + virtual bool run(); + virtual bool render(); + virtual bool render_thread(uint32_t, uint32_t, bool); + + virtual void update_camera(); + virtual bool step(); + + virtual bool create(uint32_t, uint32_t, bool); + virtual bool init(); + virtual bool init_input(); + + virtual bool destroy(); + + void render_worker(d3d_display_worker_args); + + static LRESULT CALLBACK wndproc(HWND, UINT, WPARAM, LPARAM); + LRESULT CALLBACK _wndproc(HWND, UINT, WPARAM, LPARAM); + protected: + void _move_camera(ace::vector3); + void _rotate_camera(ace::vector3); + + std::unique_ptr _render_thread; + std::mutex _render_lock; + + bool _fullscreen; + HINSTANCE _hInst = nullptr; + HWND _hWnd = nullptr; + D3D_DRIVER_TYPE _driverType = D3D_DRIVER_TYPE_NULL; + D3D_FEATURE_LEVEL _featureLevel = D3D_FEATURE_LEVEL_11_0; + ID3D11Device* _pd3dDevice = nullptr; + ID3D11DeviceContext* _pImmediateContext = nullptr; + IDXGISwapChain* _pSwapChain = nullptr; + ID3D11RenderTargetView* _pRenderTargetView = nullptr; + ID3D11Texture2D* _pDepthStencil = nullptr; + ID3D11DepthStencilView* _pDepthStencilView = nullptr; + + ID3D11ShaderResourceView* _pTextureRV1 = nullptr; + ID3D11ShaderResourceView* _pTextureRV2 = nullptr; + ID3D11InputLayout* _pBatchInputLayout = nullptr; + + DirectX::XMFLOAT4X4 _World; + DirectX::XMFLOAT4X4 _View; + DirectX::XMFLOAT4X4 _Projection; + + RAWMOUSE _last_mouse_state; + camera_movement _camera; + + }; + struct d3d_display_worker_args { + d3d_display_worker_args(uint32_t w, uint32_t h, bool f) : width(w), height(h), fullscreen(f) {} + uint32_t width; + uint32_t height; + bool fullscreen; + }; + struct d3d_display_worker { + d3d_display_worker(d3d_display * obj, d3d_display_worker_args args) : thread(&ace::debug::d3d_display::render_worker, obj, args) {} + ~d3d_display_worker() { thread.join(); } + std::thread thread; + }; + }; +}; + #endif \ No newline at end of file diff --git a/extensions/common/dispatch.hpp b/extensions/common/dispatch.hpp index 0a37824b83..5292336b85 100644 --- a/extensions/common/dispatch.hpp +++ b/extensions/common/dispatch.hpp @@ -1,153 +1,153 @@ -#pragma once - -#include -#include -#include -#include - -#include "shared.hpp" -#include "arguments.hpp" -#include "singleton.hpp" - -namespace ace { - class dispatcher { - public: - dispatcher() : _ready(true) {} - - virtual bool call(const std::string & name_, const arguments & args_, std::string & result_) { - if (_methods.find(name_) == _methods.end()) { - // @TODO: Exceptions - return false; - } - return _methods[name_](args_, result_); - } - - bool add(const std::string & name_, std::function func_) { - if (_methods.find(name_) != _methods.end()) { - // @TODO: Exceptions - return false; - } - _methods[name_] = func_; - - return true; - } - - bool ready() const { return _ready; } - void ready(bool r) { _ready.exchange(r); } - protected: - std::unordered_map < std::string, std::function > _methods; - std::atomic_bool _ready; - }; - class dispatch : public dispatcher, public singleton { }; - - struct dispatch_message { - dispatch_message(const std::string & command_, const arguments & args_, const uint64_t id_) : command(command_), args(args_), id(id_) {} - std::string command; - arguments args; - uint64_t id; - }; - struct dispatch_result { - dispatch_result() {} - dispatch_result(const std::string &res, const uint64_t id_) : message(res), id(id_) {} - std::string message; - uint64_t id; - }; - - class threaded_dispatcher : public dispatcher { - public: - threaded_dispatcher() : _stop(false), _worker(&ace::threaded_dispatcher::monitor, this) { - - } - ~threaded_dispatcher() {} - - bool call(const std::string & name_, const arguments & args_, std::string & result_, bool threaded) { - if (_methods.find(name_) == _methods.end()) { - // @TODO: Exceptions - return false; - } - if (threaded) { - std::lock_guard lock(_messages_lock); - _messages.push(dispatch_message(name_, args_, _message_id)); - - // @TODO: We should provide an interface for this serialization. - std::stringstream ss; - ss << "[\"result_id\", \"" << _message_id << "\" ]"; - result_ = ss.str(); - - _message_id = _message_id + 1; - } else { -#ifdef _DEBUG - if (name_ != "fetch_result") { - LOG(TRACE) << "dispatch[immediate]:\t[" << name_ << "] { " << args_.get() << " }"; - } -#endif - return dispatcher::call(name_, args_, result_); - } - - return true; - } - bool call(const std::string & name_, const arguments & args_, std::string & result_) override { - return call(name_, args_, result_, false); - } - - void push_result(const dispatch_result & result) { - { - std::lock_guard lock(_results_lock); - _results.push(result); - } - } - void push_result(const std::string & result) { - push_result(dispatch_result(result, -1)); - } - void stop() { - std::lock_guard lock(_messages_lock); - _stop = true; - } - protected: - void monitor() { - _ready = false; - while (!_stop) { - { - std::lock_guard lock(_messages_lock); - while (!_messages.empty()) { - if (_ready) { - dispatch_result result; - dispatch_message _message = std::move(_messages.front()); - _messages.pop(); - - result.id = _message.id; - result.message.resize(4096); -#ifdef _DEBUG - if (_message.command != "fetch_result") { - LOG(TRACE) << "dispatch[threaded]:\t[" << _message.command << "]"; - if (_message.args.size() > 0) { - // LOG(TRACE) << "\t{ " << _messages.front().args.get() << " }"; - } - } -#endif - dispatcher::call(_message.command, _message.args, result.message); - { - std::lock_guard lock(_results_lock); - _results.push(result); - } - - - } - } - } - sleep(5); - } - } - std::atomic_bool _stop; - std::queue _results; - std::mutex _results_lock; - - std::queue _messages; - std::mutex _messages_lock; - - std::thread _worker; - - uint64_t _message_id; - }; - class threaded_dispatch : public threaded_dispatcher, public singleton { }; +#pragma once + +#include +#include +#include +#include + +#include "shared.hpp" +#include "arguments.hpp" +#include "singleton.hpp" + +namespace ace { + class dispatcher { + public: + dispatcher() : _ready(true) {} + + virtual bool call(const std::string & name_, const arguments & args_, std::string & result_) { + if (_methods.find(name_) == _methods.end()) { + // @TODO: Exceptions + return false; + } + return _methods[name_](args_, result_); + } + + bool add(const std::string & name_, std::function func_) { + if (_methods.find(name_) != _methods.end()) { + // @TODO: Exceptions + return false; + } + _methods[name_] = func_; + + return true; + } + + bool ready() const { return _ready; } + void ready(bool r) { _ready.exchange(r); } + protected: + std::unordered_map < std::string, std::function > _methods; + std::atomic_bool _ready; + }; + class dispatch : public dispatcher, public singleton { }; + + struct dispatch_message { + dispatch_message(const std::string & command_, const arguments & args_, const uint64_t id_) : command(command_), args(args_), id(id_) {} + std::string command; + arguments args; + uint64_t id; + }; + struct dispatch_result { + dispatch_result() {} + dispatch_result(const std::string &res, const uint64_t id_) : message(res), id(id_) {} + std::string message; + uint64_t id; + }; + + class threaded_dispatcher : public dispatcher { + public: + threaded_dispatcher() : _stop(false), _worker(&ace::threaded_dispatcher::monitor, this) { + + } + ~threaded_dispatcher() {} + + bool call(const std::string & name_, const arguments & args_, std::string & result_, bool threaded) { + if (_methods.find(name_) == _methods.end()) { + // @TODO: Exceptions + return false; + } + if (threaded) { + std::lock_guard lock(_messages_lock); + _messages.push(dispatch_message(name_, args_, _message_id)); + + // @TODO: We should provide an interface for this serialization. + std::stringstream ss; + ss << "[\"result_id\", \"" << _message_id << "\" ]"; + result_ = ss.str(); + + _message_id = _message_id + 1; + } else { +#ifdef _DEBUG + if (name_ != "fetch_result") { + LOG(TRACE) << "dispatch[immediate]:\t[" << name_ << "] { " << args_.get() << " }"; + } +#endif + return dispatcher::call(name_, args_, result_); + } + + return true; + } + bool call(const std::string & name_, const arguments & args_, std::string & result_) override { + return call(name_, args_, result_, false); + } + + void push_result(const dispatch_result & result) { + { + std::lock_guard lock(_results_lock); + _results.push(result); + } + } + void push_result(const std::string & result) { + push_result(dispatch_result(result, -1)); + } + void stop() { + std::lock_guard lock(_messages_lock); + _stop = true; + } + protected: + void monitor() { + _ready = false; + while (!_stop) { + { + std::lock_guard lock(_messages_lock); + while (!_messages.empty()) { + if (_ready) { + dispatch_result result; + dispatch_message _message = std::move(_messages.front()); + _messages.pop(); + + result.id = _message.id; + result.message.resize(4096); +#ifdef _DEBUG + if (_message.command != "fetch_result") { + LOG(TRACE) << "dispatch[threaded]:\t[" << _message.command << "]"; + if (_message.args.size() > 0) { + // LOG(TRACE) << "\t{ " << _messages.front().args.get() << " }"; + } + } +#endif + dispatcher::call(_message.command, _message.args, result.message); + { + std::lock_guard lock(_results_lock); + _results.push(result); + } + + + } + } + } + sleep(5); + } + } + std::atomic_bool _stop; + std::queue _results; + std::mutex _results_lock; + + std::queue _messages; + std::mutex _messages_lock; + + std::thread _worker; + + uint64_t _message_id; + }; + class threaded_dispatch : public threaded_dispatcher, public singleton { }; }; \ No newline at end of file diff --git a/extensions/common/easyloggingc++.hpp b/extensions/common/easyloggingc++.hpp index 3a5455c4d0..962c61be84 100644 --- a/extensions/common/easyloggingc++.hpp +++ b/extensions/common/easyloggingc++.hpp @@ -1,6718 +1,6718 @@ -// -// Easylogging++ v9.80 -// Single-header only, cross-platform logging library for C++ applications -// -// Copyright (c) 2015 muflihun.com -// -// This library is released under the MIT Licence. -// http://easylogging.muflihun.com/licence.php -// -// easylogging@muflihun.com -// -// https://github.com/easylogging/easyloggingpp -// http://easylogging.muflihun.com -// http://muflihun.com -// -#ifndef EASYLOGGINGPP_H -#define EASYLOGGINGPP_H -// Compilers and C++0x/C++11 Evaluation -#if defined(__GNUC__) -# define ELPP_COMPILER_GCC 1 -# define ELPP_GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -# if defined(__GXX_EXPERIMENTAL_CXX0X__) -# define ELPP_CXX0X 1 -# elif(ELPP_GCC_VERSION >= 40801) -# define ELPP_CXX11 1 -# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) -#endif // defined(__GNUC__) -// Visual C++ -#if defined(_MSC_VER) -# define ELPP_COMPILER_MSVC 1 -# define ELPP_CRT_DBG_WARNINGS 1 -# if (_MSC_VER == 1600) -# define ELPP_CXX0X 1 -# elif(_MSC_VER >= 1700) -# define ELPP_CXX11 1 -# endif // (_MSC_VER == 1600) -#endif // defined(_MSC_VER) -// Clang++ -#if defined(__clang__) && (__clang__ == 1) -# define ELPP_COMPILER_CLANG 1 -# define ELPP_CLANG_VERSION (__clang_major__ * 10000 \ - + __clang_minor__ * 100 \ - + __clang_patchlevel__) -# if (ELPP_CLANG_VERSION >= 30300) -# define ELPP_CXX11 1 -# endif // (ELPP_CLANG_VERSION >= 30300) -#endif // defined(__clang__) && (__clang__ == 1) -// MinGW -#if defined(__MINGW32__) || defined(__MINGW64__) -# define ELPP_MINGW 1 -#endif // defined(__MINGW32__) || defined(__MINGW64__) -// Cygwin -#if defined(__CYGWIN__) && (__CYGWIN__ == 1) -# define ELPP_CYGWIN 1 -#endif // defined(__CYGWIN__) && (__CYGWIN__ == 1) -// Intel C++ -#if defined(__INTEL_COMPILER) -# define ELPP_COMPILER_INTEL 1 -#endif -// Operating System Evaluation -// Windows -#if defined(_WIN32) || defined(_WIN64) -# define ELPP_OS_WINDOWS 1 -#endif // defined(_WIN32) || defined(_WIN64) -// Linux -#if (defined(__linux) || defined(__linux__)) -# define ELPP_OS_LINUX 1 -#endif // (defined(__linux) || defined(__linux__)) -// Mac -#if defined(__APPLE__) -# define ELPP_OS_MAC 1 -#endif // defined(__APPLE__) -// FreeBSD -#if defined(__FreeBSD__) -# define ELPP_OS_FREEBSD 1 -#endif -// Solaris -#if defined(__sun) -# define ELPP_OS_SOLARIS 1 -#endif -// Unix -#if ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_SOLARIS) && (!ELPP_OS_WINDOWS)) -# define ELPP_OS_UNIX 1 -#endif // ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_SOLARIS) && (!ELPP_OS_WINDOWS)) -// Android -#if defined(__ANDROID__) -# define ELPP_OS_ANDROID 1 -#endif // defined(__ANDROID__) -// Evaluating Cygwin as *nix OS -#if !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN -# undef ELPP_OS_UNIX -# undef ELPP_OS_LINUX -# define ELPP_OS_UNIX 1 -# define ELPP_OS_LINUX 1 -#endif // !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN -#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_INFO) -# define ELPP_INTERNAL_DEBUGGING_OUT_INFO std::cout -#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) -#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_ERROR) -# define ELPP_INTERNAL_DEBUGGING_OUT_ERROR std::cerr -#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) -#if !defined(ELPP_INTERNAL_DEBUGGING_ENDL) -# define ELPP_INTERNAL_DEBUGGING_ENDL std::endl -#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) -#if !defined(ELPP_INTERNAL_DEBUGGING_MSG) -# define ELPP_INTERNAL_DEBUGGING_MSG(msg) msg -#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) -// Internal Assertions and errors -#if !defined(ELPP_DISABLE_ASSERT) -# if (defined(ELPP_DEBUG_ASSERT_FAILURE)) -# define ELPP_ASSERT(expr, msg) if (!(expr)) { \ - std::stringstream internalInfoStream; internalInfoStream << msg; \ - ELPP_INTERNAL_DEBUGGING_OUT_ERROR \ - << "EASYLOGGING++ ASSERTION FAILED (LINE: " << __LINE__ << ") [" #expr << "] WITH MESSAGE \"" \ - << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" << ELPP_INTERNAL_DEBUGGING_ENDL; base::utils::abort(1, \ - "ELPP Assertion failure, please define ELPP_DEBUG_ASSERT_FAILURE"); } -# else -# define ELPP_ASSERT(expr, msg) if (!(expr)) { \ - std::stringstream internalInfoStream; internalInfoStream << msg; \ - ELPP_INTERNAL_DEBUGGING_OUT_ERROR\ - << "ASSERTION FAILURE FROM EASYLOGGING++ (LINE: " \ - << __LINE__ << ") [" #expr << "] WITH MESSAGE \"" << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" \ - << ELPP_INTERNAL_DEBUGGING_ENDL; } -# endif // (defined(ELPP_DEBUG_ASSERT_FAILURE)) -#else -# define ELPP_ASSERT(x, y) -#endif //(!defined(ELPP_DISABLE_ASSERT) -#if ELPP_COMPILER_MSVC -# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ - { char buff[256]; strerror_s(buff, 256, errno); \ - ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << buff << " [" << errno << "]";} (void)0 -#else -# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ - ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << strerror(errno) << " [" << errno << "]"; (void)0 -#endif // ELPP_COMPILER_MSVC -#if defined(ELPP_DEBUG_ERRORS) -# if !defined(ELPP_INTERNAL_ERROR) -# define ELPP_INTERNAL_ERROR(msg, pe) { \ - std::stringstream internalInfoStream; internalInfoStream << " " << msg; \ - ELPP_INTERNAL_DEBUGGING_OUT_ERROR \ - << "ERROR FROM EASYLOGGING++ (LINE: " << __LINE__ << ") " \ - << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << ELPP_INTERNAL_DEBUGGING_ENDL; \ - if (pe) { ELPP_INTERNAL_DEBUGGING_OUT_ERROR << " "; ELPP_INTERNAL_DEBUGGING_WRITE_PERROR; }} (void)0 -# endif -#else -# undef ELPP_INTERNAL_INFO -# define ELPP_INTERNAL_ERROR(msg, pe) -#endif // defined(ELPP_DEBUG_ERRORS) -#if (defined(ELPP_DEBUG_INFO)) -# if !(defined(ELPP_INTERNAL_INFO_LEVEL)) -# define ELPP_INTERNAL_INFO_LEVEL 9 -# endif // !(defined(ELPP_INTERNAL_INFO_LEVEL)) -# if !defined(ELPP_INTERNAL_INFO) -# define ELPP_INTERNAL_INFO(lvl, msg) { if (lvl <= ELPP_INTERNAL_INFO_LEVEL) { \ - std::stringstream internalInfoStream; internalInfoStream << " " << msg; \ - ELPP_INTERNAL_DEBUGGING_OUT_INFO << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) \ - << ELPP_INTERNAL_DEBUGGING_ENDL; }} -# endif -#else -# undef ELPP_INTERNAL_INFO -# define ELPP_INTERNAL_INFO(lvl, msg) -#endif // (defined(ELPP_DEBUG_INFO)) -#if defined(ELPP_STACKTRACE_ON_CRASH) -# if (ELPP_COMPILER_GCC && !ELPP_MINGW) -# define ELPP_STACKTRACE 1 -# else -# if ELPP_COMPILER_MSVC -# pragma message("Stack trace not available for this compiler") -# else -# warning "Stack trace not available for this compiler"; -# endif // ELPP_COMPILER_MSVC -# endif // ELPP_COMPILER_GCC -#endif // (defined(ELPP_STACKTRACE_ON_CRASH)) -// Miscellaneous macros -#define ELPP_UNUSED(x) (void)x -#if ELPP_OS_UNIX -// Log file permissions for unix-based systems -# define ELPP_LOG_PERMS S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IRGRP | S_IXGRP | S_IWOTH | S_IXOTH -#endif // ELPP_OS_UNIX -#if defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC -# if defined(ELPP_EXPORT_SYMBOLS) -# define ELPP_EXPORT __declspec(dllexport) -# else -# define ELPP_EXPORT __declspec(dllimport) -# endif // defined(ELPP_EXPORT_SYMBOLS) -#else -# define ELPP_EXPORT -#endif // defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC -// Some special functions that are VC++ specific -#undef STRTOK -#undef STRERROR -#undef STRCAT -#undef STRCPY -#if ELPP_CRT_DBG_WARNINGS -# define STRTOK(a, b, c) strtok_s(a, b, c) -# define STRERROR(a, b, c) strerror_s(a, b, c) -# define STRCAT(a, b, len) strcat_s(a, len, b) -# define STRCPY(a, b, len) strcpy_s(a, len, b) -#else -# define STRTOK(a, b, c) strtok(a, b) -# define STRERROR(a, b, c) strerror(c) -# define STRCAT(a, b, len) strcat(a, b) -# define STRCPY(a, b, len) strcpy(a, b) -#endif -// Compiler specific support evaluations -#if (!ELPP_MINGW && !ELPP_COMPILER_CLANG) || defined(ELPP_FORCE_USE_STD_THREAD) -# define ELPP_USE_STD_THREADING 1 -#endif // (!ELPP_MINGW && !ELPP_COMPILER_CLANG) || defined(ELPP_FORCE_USE_STD_THREAD) -#undef ELPP_FINAL -#if ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702) -# define ELPP_FINAL -#else -# define ELPP_FINAL final -#endif // ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702) -#if defined(ELPP_EXPERIMENTAL_ASYNC) -# define ELPP_ASYNC_LOGGING 1 -#else -# define ELPP_ASYNC_LOGGING 0 -#endif // defined(ELPP_EXPERIMENTAL_ASYNC) -#if defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING -# define ELPP_THREADING_ENABLED 1 -#endif // defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING -// Function macro ELPP_FUNC -#undef ELPP_FUNC -#if ELPP_COMPILER_MSVC // Visual C++ -# define ELPP_FUNC __FUNCSIG__ -#elif ELPP_COMPILER_GCC // GCC -# define ELPP_FUNC __PRETTY_FUNCTION__ -#elif ELPP_COMPILER_INTEL // Intel C++ -# define ELPP_FUNC __PRETTY_FUNCTION__ -#elif ELPP_COMPILER_CLANG // Clang++ -# define ELPP_FUNC __PRETTY_FUNCTION__ -#else -# if defined(__func__) -# define ELPP_FUNC __func__ -# else -# define ELPP_FUNC "" -# endif // defined(__func__) -#endif // defined(_MSC_VER) -#undef ELPP_VARIADIC_TEMPLATES_SUPPORTED -// Keep following line commented until features are fixed -#if ELPP_COMPILER_GCC || ELPP_COMPILER_CLANG || ELPP_COMPILER_INTEL || (ELPP_COMPILER_MSVC && _MSC_VER >= 1800) -# define ELPP_VARIADIC_TEMPLATES_SUPPORTED 1 -#endif // ELPP_COMPILER_GCC || ELPP_COMPILER_CLANG || ELPP_COMPILER_INTEL || (ELPP_COMPILER_MSVC && _MSC_VER >= 1800) -// Logging Enable/Disable macros -#if (!defined(ELPP_DISABLE_LOGS)) -# define ELPP_LOGGING_ENABLED 1 -#endif // (!defined(ELPP_DISABLE_LOGS)) -#if (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED) && ((defined(_DEBUG)) || (!defined(NDEBUG)))) -# define ELPP_DEBUG_LOG 1 -#else -# define ELPP_DEBUG_LOG 0 -#endif // (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED) && ((defined(_DEBUG)) || (!defined(NDEBUG)))) -#if (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_INFO_LOG 1 -#else -# define ELPP_INFO_LOG 0 -#endif // (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_WARNING_LOG 1 -#else -# define ELPP_WARNING_LOG 0 -#endif // (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_ERROR_LOG 1 -#else -# define ELPP_ERROR_LOG 0 -#endif // (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_FATAL_LOG 1 -#else -# define ELPP_FATAL_LOG 0 -#endif // (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_TRACE_LOG 1 -#else -# define ELPP_TRACE_LOG 0 -#endif // (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) -# define ELPP_VERBOSE_LOG 1 -#else -# define ELPP_VERBOSE_LOG 0 -#endif // (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) -#if (!(ELPP_CXX0X || ELPP_CXX11)) -# error "Easylogging++ 9.0+ is only compatible with C++0x (or higher) compliant compiler" -#endif // (!(ELPP_CXX0X || ELPP_CXX11)) -// Headers -#if defined(ELPP_SYSLOG) -# include -#endif // defined(ELPP_SYSLOG) -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(ELPP_UNICODE) -# include -# if ELPP_OS_WINDOWS -# include -# endif // ELPP_OS_WINDOWS -#endif // defined(ELPP_UNICODE) -#if ELPP_STACKTRACE -# include -# include -#endif // ELPP_STACKTRACE -#if ELPP_OS_ANDROID -# include -#endif // ELPP_OS_ANDROID -#if ELPP_OS_UNIX -# include -# include -#elif ELPP_OS_WINDOWS -# include -# include -# if defined(WIN32_LEAN_AND_MEAN) -# if defined(ELPP_WINSOCK2) -# include -# else -# include -# endif // defined(ELPP_WINSOCK2) -# endif // defined(WIN32_LEAN_AND_MEAN) -#endif // ELPP_OS_UNIX -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if ELPP_THREADING_ENABLED -# if ELPP_USE_STD_THREADING -# include -# include -# else -# if ELPP_OS_UNIX -# include -# endif // ELPP_OS_UNIX -# endif // ELPP_USE_STD_THREADING -#endif // ELPP_THREADING_ENABLED -#if ELPP_ASYNC_LOGGING -# include -# include -# include -#endif // ELPP_ASYNC_LOGGING -#if defined(ELPP_STL_LOGGING) -// For logging STL based templates -# include -# include -# include -# include -# include -# include -# if defined(ELPP_LOG_STD_ARRAY) -# include -# endif // defined(ELPP_LOG_STD_ARRAY) -# if defined(ELPP_LOG_UNORDERED_MAP) -# include -# endif // defined(ELPP_LOG_UNORDERED_MAP) -# if defined(ELPP_LOG_UNORDERED_SET) -# include -# endif // defined(ELPP_UNORDERED_SET) -#endif // defined(ELPP_STL_LOGGING) -#if defined(ELPP_QT_LOGGING) -// For logging Qt based classes & templates -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif // defined(ELPP_QT_LOGGING) -#if defined(ELPP_BOOST_LOGGING) -// For logging boost based classes & templates -# include -# include -# include -# include -# include -# include -# include -# include -#endif // defined(ELPP_BOOST_LOGGING) -#if defined(ELPP_WXWIDGETS_LOGGING) -// For logging wxWidgets based classes & templates -# include -#endif // defined(ELPP_WXWIDGETS_LOGGING) -// Forward declarations -namespace el { - class Logger; - class LogMessage; - class PerformanceTrackingData; - class Loggers; - class Helpers; - template class Callback; - class LogDispatchCallback; - class PerformanceTrackingCallback; - class LogDispatchData; - namespace base { - class Storage; - class RegisteredLoggers; - class PerformanceTracker; - class MessageBuilder; - class Writer; - class PErrorWriter; - class LogDispatcher; - class DefaultLogBuilder; - class DefaultLogDispatchCallback; -#if ELPP_ASYNC_LOGGING - class AsyncLogDispatchCallback; - class AsyncDispatchWorker; -#endif // ELPP_ASYNC_LOGGING - class DefaultPerformanceTrackingCallback; - } // namespace base -} // namespace el - /// @brief Easylogging++ entry namespace -namespace el { - /// @brief Namespace containing base/internal functionality used by Easylogging++ - namespace base { - /// @brief Data types used by Easylogging++ - namespace type { -#undef ELPP_LITERAL -#undef ELPP_STRLEN -#undef ELPP_COUT -#if defined(ELPP_UNICODE) -# define ELPP_LITERAL(txt) L##txt -# define ELPP_STRLEN wcslen -# if defined ELPP_CUSTOM_COUT -# define ELPP_COUT ELPP_CUSTOM_COUT -# else -# define ELPP_COUT std::wcout -# endif // defined ELPP_CUSTOM_COUT - typedef wchar_t char_t; - typedef std::wstring string_t; - typedef std::wstringstream stringstream_t; - typedef std::wfstream fstream_t; - typedef std::wostream ostream_t; -#else -# define ELPP_LITERAL(txt) txt -# define ELPP_STRLEN strlen -# if defined ELPP_CUSTOM_COUT -# define ELPP_COUT ELPP_CUSTOM_COUT -# else -# define ELPP_COUT std::cout -# endif // defined ELPP_CUSTOM_COUT - typedef char char_t; - typedef std::string string_t; - typedef std::stringstream stringstream_t; - typedef std::fstream fstream_t; - typedef std::ostream ostream_t; -#endif // defined(ELPP_UNICODE) -#if defined(ELPP_CUSTOM_COUT_LINE) -# define ELPP_COUT_LINE(logLine) ELPP_CUSTOM_COUT_LINE(logLine) -#else -# define ELPP_COUT_LINE(logLine) logLine << std::flush -#endif // defined(ELPP_CUSTOM_COUT_LINE) - typedef unsigned short EnumType; - typedef std::shared_ptr StoragePointer; - typedef int VerboseLevel; - typedef std::shared_ptr LogDispatchCallbackPtr; - typedef std::shared_ptr PerformanceTrackingCallbackPtr; - } // namespace type - /// @brief Internal helper class that prevent copy constructor for class - /// - /// @detail When using this class simply inherit it privately - class NoCopy { - protected: - NoCopy(void) {} - private: - NoCopy(const NoCopy&); - NoCopy& operator=(const NoCopy&); - }; - /// @brief Internal helper class that makes all default constructors private. - /// - /// @detail This prevents initializing class making it static unless an explicit constructor is declared. - /// When using this class simply inherit it privately - class StaticClass { - private: - StaticClass(void); - StaticClass(const StaticClass&); - StaticClass& operator=(const StaticClass&); - }; - } // namespace base - /// @brief Represents enumeration for severity level used to determine level of logging - /// - /// @detail With Easylogging++, developers may disable or enable any level regardless of - /// what the severity is. Or they can choose to log using hierarchical logging flag - enum class Level : base::type::EnumType { - /// @brief Generic level that represents all the levels. Useful when setting global configuration for all levels - Global = 1, - /// @brief Information that can be useful to back-trace certain events - mostly useful than debug logs. - Trace = 2, - /// @brief Informational events most useful for developers to debug application - Debug = 4, - /// @brief Severe error information that will presumably abort application - Fatal = 8, - /// @brief Information representing errors in application but application will keep running - Error = 16, - /// @brief Useful when application has potentially harmful situtaions - Warning = 32, - /// @brief Information that can be highly useful and vary with verbose logging level. - Verbose = 64, - /// @brief Mainly useful to represent current progress of application - Info = 128, - /// @brief Represents unknown level - Unknown = 1010 - }; - /// @brief Static class that contains helper functions for el::Level - class LevelHelper : base::StaticClass { - public: - /// @brief Represents minimum valid level. Useful when iterating through enum. - static const base::type::EnumType kMinValid = static_cast(Level::Trace); - /// @brief Represents maximum valid level. This is used internally and you should not need it. - static const base::type::EnumType kMaxValid = static_cast(Level::Info); - /// @brief Casts level to int, useful for iterating through enum. - static base::type::EnumType castToInt(Level level) { - return static_cast(level); - } - /// @brief Casts int(ushort) to level, useful for iterating through enum. - static Level castFromInt(base::type::EnumType l) { - return static_cast(l); - } - /// @brief Converts level to associated const char* - /// @return Upper case string based level. - static const char* convertToString(Level level) { - // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. - if (level == Level::Global) return "GLOBAL"; - if (level == Level::Debug) return "DEBUG"; - if (level == Level::Info) return "INFO"; - if (level == Level::Warning) return "WARNING"; - if (level == Level::Error) return "ERROR"; - if (level == Level::Fatal) return "FATAL"; - if (level == Level::Verbose) return "VERBOSE"; - if (level == Level::Trace) return "TRACE"; - return "UNKNOWN"; - } - /// @brief Converts from levelStr to Level - /// @param levelStr Upper case string based level. - /// Lower case is also valid but providing upper case is recommended. - static Level convertFromString(const char* levelStr) { - if ((strcmp(levelStr, "GLOBAL") == 0) || (strcmp(levelStr, "global") == 0)) - return Level::Global; - if ((strcmp(levelStr, "DEBUG") == 0) || (strcmp(levelStr, "debug") == 0)) - return Level::Debug; - if ((strcmp(levelStr, "INFO") == 0) || (strcmp(levelStr, "info") == 0)) - return Level::Info; - if ((strcmp(levelStr, "WARNING") == 0) || (strcmp(levelStr, "warning") == 0)) - return Level::Warning; - if ((strcmp(levelStr, "ERROR") == 0) || (strcmp(levelStr, "error") == 0)) - return Level::Error; - if ((strcmp(levelStr, "FATAL") == 0) || (strcmp(levelStr, "fatal") == 0)) - return Level::Fatal; - if ((strcmp(levelStr, "VERBOSE") == 0) || (strcmp(levelStr, "verbose") == 0)) - return Level::Verbose; - if ((strcmp(levelStr, "TRACE") == 0) || (strcmp(levelStr, "trace") == 0)) - return Level::Trace; - return Level::Unknown; - } - /// @brief Applies specified function to each level starting from startIndex - /// @param startIndex initial value to start the iteration from. This is passed as pointer and - /// is left-shifted so this can be used inside function (fn) to represent current level. - /// @param fn function to apply with each level. This bool represent whether or not to stop iterating through levels. - static inline void forEachLevel(base::type::EnumType* startIndex, const std::function& fn) { - base::type::EnumType lIndexMax = LevelHelper::kMaxValid; - do { - if (fn()) { - break; - } - *startIndex = static_cast(*startIndex << 1); - } while (*startIndex <= lIndexMax); - } - }; - /// @brief Represents enumeration of ConfigurationType used to configure or access certain aspect - /// of logging - enum class ConfigurationType : base::type::EnumType { - /// @brief Determines whether or not corresponding level and logger of logging is enabled - /// You may disable all logs by using el::Level::Global - Enabled = 1, - /// @brief Whether or not to write corresponding log to log file - ToFile = 2, - /// @brief Whether or not to write corresponding level and logger log to standard output. - /// By standard output meaning termnal, command prompt etc - ToStandardOutput = 4, - /// @brief Determines format of logging corresponding level and logger. - Format = 8, - /// @brief Determines log file (full path) to write logs to for correponding level and logger - Filename = 16, - /// @brief Specifies milliseconds width. Width can be within range (1-6) - MillisecondsWidth = 32, - /// @brief Determines whether or not performance tracking is enabled. - /// - /// @detail This does not depend on logger or level. Performance tracking always uses 'performance' logger - PerformanceTracking = 64, - /// @brief Specifies log file max size. - /// - /// @detail If file size of corresponding log file (for corresponding level) is >= specified size, log file will - /// be truncated and re-initiated. - MaxLogFileSize = 128, - /// @brief Specifies number of log entries to hold until we flush pending log data - LogFlushThreshold = 256, - /// @brief Represents unknown configuration - Unknown = 1010 - }; - /// @brief Static class that contains helper functions for el::ConfigurationType - class ConfigurationTypeHelper : base::StaticClass { - public: - /// @brief Represents minimum valid configuration type. Useful when iterating through enum. - static const base::type::EnumType kMinValid = static_cast(ConfigurationType::Enabled); - /// @brief Represents maximum valid configuration type. This is used internally and you should not need it. - static const base::type::EnumType kMaxValid = static_cast(ConfigurationType::MaxLogFileSize); - /// @brief Casts configuration type to int, useful for iterating through enum. - static base::type::EnumType castToInt(ConfigurationType configurationType) { - return static_cast(configurationType); - } - /// @brief Casts int(ushort) to configurationt type, useful for iterating through enum. - static ConfigurationType castFromInt(base::type::EnumType c) { - return static_cast(c); - } - /// @brief Converts configuration type to associated const char* - /// @returns Upper case string based configuration type. - static const char* convertToString(ConfigurationType configurationType) { - // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. - if (configurationType == ConfigurationType::Enabled) return "ENABLED"; - if (configurationType == ConfigurationType::Filename) return "FILENAME"; - if (configurationType == ConfigurationType::Format) return "FORMAT"; - if (configurationType == ConfigurationType::ToFile) return "TO_FILE"; - if (configurationType == ConfigurationType::ToStandardOutput) return "TO_STANDARD_OUTPUT"; - if (configurationType == ConfigurationType::MillisecondsWidth) return "MILLISECONDS_WIDTH"; - if (configurationType == ConfigurationType::PerformanceTracking) return "PERFORMANCE_TRACKING"; - if (configurationType == ConfigurationType::MaxLogFileSize) return "MAX_LOG_FILE_SIZE"; - if (configurationType == ConfigurationType::LogFlushThreshold) return "LOG_FLUSH_THRESHOLD"; - return "UNKNOWN"; - } - /// @brief Converts from configStr to ConfigurationType - /// @param configStr Upper case string based configuration type. - /// Lower case is also valid but providing upper case is recommended. - static ConfigurationType convertFromString(const char* configStr) { - if ((strcmp(configStr, "ENABLED") == 0) || (strcmp(configStr, "enabled") == 0)) - return ConfigurationType::Enabled; - if ((strcmp(configStr, "TO_FILE") == 0) || (strcmp(configStr, "to_file") == 0)) - return ConfigurationType::ToFile; - if ((strcmp(configStr, "TO_STANDARD_OUTPUT") == 0) || (strcmp(configStr, "to_standard_output") == 0)) - return ConfigurationType::ToStandardOutput; - if ((strcmp(configStr, "FORMAT") == 0) || (strcmp(configStr, "format") == 0)) - return ConfigurationType::Format; - if ((strcmp(configStr, "FILENAME") == 0) || (strcmp(configStr, "filename") == 0)) - return ConfigurationType::Filename; - if ((strcmp(configStr, "MILLISECONDS_WIDTH") == 0) || (strcmp(configStr, "milliseconds_width") == 0)) - return ConfigurationType::MillisecondsWidth; - if ((strcmp(configStr, "PERFORMANCE_TRACKING") == 0) || (strcmp(configStr, "performance_tracking") == 0)) - return ConfigurationType::PerformanceTracking; - if ((strcmp(configStr, "MAX_LOG_FILE_SIZE") == 0) || (strcmp(configStr, "max_log_file_size") == 0)) - return ConfigurationType::MaxLogFileSize; - if ((strcmp(configStr, "LOG_FLUSH_THRESHOLD") == 0) || (strcmp(configStr, "log_flush_threshold") == 0)) - return ConfigurationType::LogFlushThreshold; - return ConfigurationType::Unknown; - } - /// @brief Applies specified function to each configuration type starting from startIndex - /// @param startIndex initial value to start the iteration from. This is passed by pointer and is left-shifted - /// so this can be used inside function (fn) to represent current configuration type. - /// @param fn function to apply with each configuration type. - /// This bool represent whether or not to stop iterating through configurations. - static inline void forEachConfigType(base::type::EnumType* startIndex, const std::function& fn) { - base::type::EnumType cIndexMax = ConfigurationTypeHelper::kMaxValid; - do { - if (fn()) { - break; - } - *startIndex = static_cast(*startIndex << 1); - } while (*startIndex <= cIndexMax); - } - }; - /// @brief Flags used while writing logs. This flags are set by user - enum class LoggingFlag : base::type::EnumType { - /// @brief Makes sure we have new line for each container log entry - NewLineForContainer = 1, - /// @brief Makes sure if -vmodule is used and does not specifies a module, then verbose - /// logging is allowed via that module. - AllowVerboseIfModuleNotSpecified = 2, - /// @brief When handling crashes by default, detailed crash reason will be logged as well - LogDetailedCrashReason = 4, - /// @brief Allows to disable application abortion when logged using FATAL level - DisableApplicationAbortOnFatalLog = 8, - /// @brief Flushes log with every log-entry (performance sensative) - Disabled by default - ImmediateFlush = 16, - /// @brief Enables strict file rolling - StrictLogFileSizeCheck = 32, - /// @brief Make terminal output colorful for supported terminals - ColoredTerminalOutput = 64, - /// @brief Supports use of multiple logging in same macro, e.g, CLOG(INFO, "default", "network") - MultiLoggerSupport = 128, - /// @brief Disables comparing performance tracker's checkpoints - DisablePerformanceTrackingCheckpointComparison = 256, - /// @brief Disable VModules - DisableVModules = 512, - /// @brief Disable VModules extensions - DisableVModulesExtensions = 1024, - /// @brief Enables hierarchical logging - HierarchicalLogging = 2048, - /// @brief Creates logger automatically when not available - CreateLoggerAutomatically = 4096, - /// @brief Adds spaces b/w logs that separated by left-shift operator - AutoSpacing = 8192, - /// @brief Preserves time format and does not convert it to sec, hour etc (performance tracking only) - FixedTimeFormat = 16384 - }; - namespace base { - /// @brief Namespace containing constants used internally. - namespace consts { - // Level log values - These are values that are replaced in place of %level format specifier - static const base::type::char_t* kInfoLevelLogValue = ELPP_LITERAL("INFO "); - static const base::type::char_t* kDebugLevelLogValue = ELPP_LITERAL("DEBUG"); - static const base::type::char_t* kWarningLevelLogValue = ELPP_LITERAL("WARN "); - static const base::type::char_t* kErrorLevelLogValue = ELPP_LITERAL("ERROR"); - static const base::type::char_t* kFatalLevelLogValue = ELPP_LITERAL("FATAL"); - static const base::type::char_t* kVerboseLevelLogValue = ELPP_LITERAL("VER"); - static const base::type::char_t* kTraceLevelLogValue = ELPP_LITERAL("TRACE"); - static const base::type::char_t* kInfoLevelShortLogValue = ELPP_LITERAL("I"); - static const base::type::char_t* kDebugLevelShortLogValue = ELPP_LITERAL("D"); - static const base::type::char_t* kWarningLevelShortLogValue = ELPP_LITERAL("W"); - static const base::type::char_t* kErrorLevelShortLogValue = ELPP_LITERAL("E"); - static const base::type::char_t* kFatalLevelShortLogValue = ELPP_LITERAL("F"); - static const base::type::char_t* kVerboseLevelShortLogValue = ELPP_LITERAL("V"); - static const base::type::char_t* kTraceLevelShortLogValue = ELPP_LITERAL("T"); - // Format specifiers - These are used to define log format - static const base::type::char_t* kAppNameFormatSpecifier = ELPP_LITERAL("%app"); - static const base::type::char_t* kLoggerIdFormatSpecifier = ELPP_LITERAL("%logger"); - static const base::type::char_t* kThreadIdFormatSpecifier = ELPP_LITERAL("%thread"); - static const base::type::char_t* kSeverityLevelFormatSpecifier = ELPP_LITERAL("%level"); - static const base::type::char_t* kSeverityLevelShortFormatSpecifier = ELPP_LITERAL("%levshort"); - static const base::type::char_t* kDateTimeFormatSpecifier = ELPP_LITERAL("%datetime"); - static const base::type::char_t* kLogFileFormatSpecifier = ELPP_LITERAL("%file"); - static const base::type::char_t* kLogFileBaseFormatSpecifier = ELPP_LITERAL("%fbase"); - static const base::type::char_t* kLogLineFormatSpecifier = ELPP_LITERAL("%line"); - static const base::type::char_t* kLogLocationFormatSpecifier = ELPP_LITERAL("%loc"); - static const base::type::char_t* kLogFunctionFormatSpecifier = ELPP_LITERAL("%func"); - static const base::type::char_t* kCurrentUserFormatSpecifier = ELPP_LITERAL("%user"); - static const base::type::char_t* kCurrentHostFormatSpecifier = ELPP_LITERAL("%host"); - static const base::type::char_t* kMessageFormatSpecifier = ELPP_LITERAL("%msg"); - static const base::type::char_t* kVerboseLevelFormatSpecifier = ELPP_LITERAL("%vlevel"); - static const char* kDateTimeFormatSpecifierForFilename = "%datetime"; - // Date/time - static const char* kDays[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; - static const char* kDaysAbbrev[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static const char* kMonths[12] = { "January", "February", "March", "Apri", "May", "June", "July", "August", - "September", "October", "November", "December" }; - static const char* kMonthsAbbrev[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - static const char* kDefaultDateTimeFormat = "%Y-%M-%d %H:%m:%s,%g"; - static const char* kDefaultDateTimeFormatInFilename = "%Y-%M-%d_%H-%m"; - static const int kYearBase = 1900; - static const char* kAm = "AM"; - static const char* kPm = "PM"; - // Miscellaneous constants - static const char* kDefaultLoggerId = "default"; - static const char* kPerformanceLoggerId = "performance"; - static const char* kSysLogLoggerId = "syslog"; - static const char* kNullPointer = "nullptr"; - static const char kFormatSpecifierChar = '%'; -#if ELPP_VARIADIC_TEMPLATES_SUPPORTED - static const char kFormatSpecifierCharValue = 'v'; -#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED - static const unsigned int kMaxLogPerContainer = 100; - static const unsigned int kMaxLogPerCounter = 100000; - static const unsigned int kDefaultMillisecondsWidth = 3; - static const base::type::VerboseLevel kMaxVerboseLevel = 9; - static const char* kUnknownUser = "user"; - static const char* kUnknownHost = "unknown-host"; -#if defined(ELPP_DEFAULT_LOG_FILE) - static const char* kDefaultLogFile = ELPP_DEFAULT_LOG_FILE; -#else -# if ELPP_OS_UNIX -# if ELPP_OS_ANDROID - static const char* kDefaultLogFile = "logs/ace.log"; -# else - static const char* kDefaultLogFile = "logs/ace.log"; -# endif // ELPP_OS_ANDROID -# elif ELPP_OS_WINDOWS - static const char* kDefaultLogFile = "logs\\ace.log"; -# endif // ELPP_OS_UNIX -#endif // defined(ELPP_DEFAULT_LOG_FILE) -#if !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) - static const char* kDefaultLogFileParam = "--default-log-file"; -#endif // !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) -#if defined(ELPP_LOGGING_FLAGS_FROM_ARG) - static const char* kLoggingFlagsParam = "--logging-flags"; -#endif // defined(ELPP_LOGGING_FLAGS_FROM_ARG) -#if ELPP_OS_WINDOWS - static const char* kFilePathSeperator = "\\"; -#else - static const char* kFilePathSeperator = "/"; -#endif // ELPP_OS_WINDOWS - static const char* kValidLoggerIdSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._"; - static const char* kConfigurationComment = "##"; - static const char* kConfigurationLevel = "*"; - static const char* kConfigurationLoggerId = "--"; - static const std::size_t kSourceFilenameMaxLength = 100; - static const std::size_t kSourceLineMaxLength = 10; - static const Level kPerformanceTrackerDefaultLevel = Level::Info; - const struct { - double value; - const base::type::char_t* unit; - } kTimeFormats[] = { - { 1000.0f, ELPP_LITERAL("mis") }, - { 1000.0f, ELPP_LITERAL("ms") }, - { 60.0f, ELPP_LITERAL("seconds") }, - { 60.0f, ELPP_LITERAL("minutes") }, - { 24.0f, ELPP_LITERAL("hours") }, - { 7.0f, ELPP_LITERAL("days") } - }; - static const int kTimeFormatsCount = sizeof(kTimeFormats) / sizeof(kTimeFormats[0]); - const struct { - int numb; - const char* name; - const char* brief; - const char* detail; - } kCrashSignals[] = { - // NOTE: Do not re-order, if you do please check CrashHandler(bool) constructor and CrashHandler::setHandler(..) - { SIGABRT, "SIGABRT", "Abnormal termination", - "Program was abnormally terminated." }, - { SIGFPE, "SIGFPE", "Erroneous arithmetic operation", - "Arithemetic operation issue such as division by zero or operation resulting in overflow." }, - { SIGILL, "SIGILL", "Illegal instruction", - "Generally due to a corruption in the code or to an attempt to execute data." }, - { SIGSEGV, "SIGSEGV", "Invalid access to memory", - "Program is trying to read an invalid (unallocated, deleted or corrupted) or inaccessible memory." }, - { SIGINT, "SIGINT", "Interactive attention signal", - "Interruption generated (generally) by user or operating system." }, - }; - static const int kCrashSignalsCount = sizeof(kCrashSignals) / sizeof(kCrashSignals[0]); - } // namespace consts - } // namespace base - typedef std::function PreRollOutCallback; - namespace base { - static inline void defaultPreRollOutCallback(const char*, std::size_t) {} - /// @brief Enum to represent timestamp unit - enum class TimestampUnit : base::type::EnumType { - Microsecond = 0, Millisecond = 1, Second = 2, Minute = 3, Hour = 4, Day = 5 - }; - /// @brief Format flags used to determine specifiers that are active for performance improvements. - enum class FormatFlags : base::type::EnumType { - DateTime = 1 << 1, LoggerId = 1 << 2, File = 1 << 3, Line = 1 << 4, Location = 1 << 5, Function = 1 << 6, - User = 1 << 7, Host = 1 << 8, LogMessage = 1 << 9, VerboseLevel = 1 << 10, AppName = 1 << 11, ThreadId = 1 << 12, - Level = 1 << 13, FileBase = 1 << 14, LevelShort = 1 << 15 - }; - /// @brief A milliseconds width class containing actual width and offset for date/time - class MillisecondsWidth { - public: - MillisecondsWidth(void) { init(base::consts::kDefaultMillisecondsWidth); } - explicit MillisecondsWidth(int width) { init(width); } - bool operator==(const MillisecondsWidth& msWidth) { return m_width == msWidth.m_width && m_offset == msWidth.m_offset; } - int m_width; unsigned int m_offset; - private: - void init(int width) { - if (width < 1 || width > 6) { - width = base::consts::kDefaultMillisecondsWidth; - } - m_width = width; - switch (m_width) { - case 3: m_offset = 1000; break; - case 4: m_offset = 100; break; - case 5: m_offset = 10; break; - case 6: m_offset = 1; break; - default: m_offset = 1000; break; - } - } - }; - /// @brief Namespace containing utility functions/static classes used internally - namespace utils { - /// @brief Deletes memory safely and points to null - template - static inline - typename std::enable_if::value, void>::type - safeDelete(T*& pointer) { - if (pointer == nullptr) - return; - delete pointer; - pointer = nullptr; - } - /// @brief Gets value of const char* but if it is nullptr, a string nullptr is returned - static inline const char* charPtrVal(const char* pointer) { - return pointer == nullptr ? base::consts::kNullPointer : pointer; - } - /// @brief Aborts application due with user-defined status - static inline void abort(int status, const std::string& reason = std::string()) { - // Both status and reason params are there for debugging with tools like gdb etc - ELPP_UNUSED(status); - ELPP_UNUSED(reason); -#if defined(ELPP_COMPILER_MSVC) && defined(_M_IX86) && defined(_DEBUG) - // Ignore msvc critical error dialog - break instead (on debug mode) - _asm int 3 -#else - ::abort(); -#endif // defined(ELPP_COMPILER_MSVC) && defined(_M_IX86) && defined(_DEBUG) - } - /// @brief Bitwise operations for C++11 strong enum class. This casts e into Flag_T and returns value after bitwise operation - /// Use these function as

flag = bitwise::Or(MyEnum::val1, flag);
- namespace bitwise { - template - static inline base::type::EnumType And(Enum e, base::type::EnumType flag) { - return static_cast(flag) & static_cast(e); - } - template - static inline base::type::EnumType Not(Enum e, base::type::EnumType flag) { - return static_cast(flag) & ~(static_cast(e)); - } - template - static inline base::type::EnumType Or(Enum e, base::type::EnumType flag) { - return static_cast(flag) | static_cast(e); - } - } // namespace bitwise - template - static inline void addFlag(Enum e, base::type::EnumType* flag) { - *flag = base::utils::bitwise::Or(e, *flag); - } - template - static inline void removeFlag(Enum e, base::type::EnumType* flag) { - *flag = base::utils::bitwise::Not(e, *flag); - } - template - static inline bool hasFlag(Enum e, base::type::EnumType flag) { - return base::utils::bitwise::And(e, flag) > 0x0; - } - } // namespace utils - namespace threading { -#if ELPP_THREADING_ENABLED -# if !ELPP_USE_STD_THREADING - namespace internal { - /// @brief A mutex wrapper for compiler that dont yet support std::mutex - class Mutex : base::NoCopy { - public: - Mutex(void) { -# if ELPP_OS_UNIX - pthread_mutex_init(&m_underlyingMutex, nullptr); -# elif ELPP_OS_WINDOWS - InitializeCriticalSection(&m_underlyingMutex); -# endif // ELPP_OS_UNIX - } - - virtual ~Mutex(void) { -# if ELPP_OS_UNIX - pthread_mutex_destroy(&m_underlyingMutex); -# elif ELPP_OS_WINDOWS - DeleteCriticalSection(&m_underlyingMutex); -# endif // ELPP_OS_UNIX - } - - inline void lock(void) { -# if ELPP_OS_UNIX - pthread_mutex_lock(&m_underlyingMutex); -# elif ELPP_OS_WINDOWS - EnterCriticalSection(&m_underlyingMutex); -# endif // ELPP_OS_UNIX - } - - inline bool try_lock(void) { -# if ELPP_OS_UNIX - return (pthread_mutex_trylock(&m_underlyingMutex) == 0); -# elif ELPP_OS_WINDOWS - return TryEnterCriticalSection(&m_underlyingMutex); -# endif // ELPP_OS_UNIX - } - - inline void unlock(void) { -# if ELPP_OS_UNIX - pthread_mutex_unlock(&m_underlyingMutex); -# elif ELPP_OS_WINDOWS - LeaveCriticalSection(&m_underlyingMutex); -# endif // ELPP_OS_UNIX - } - - private: -# if ELPP_OS_UNIX - pthread_mutex_t m_underlyingMutex; -# elif ELPP_OS_WINDOWS - CRITICAL_SECTION m_underlyingMutex; -# endif // ELPP_OS_UNIX - }; - /// @brief Scoped lock for compiler that dont yet support std::lock_guard - template - class ScopedLock : base::NoCopy { - public: - explicit ScopedLock(M& mutex) { - m_mutex = &mutex; - m_mutex->lock(); - } - - virtual ~ScopedLock(void) { - m_mutex->unlock(); - } - private: - M* m_mutex; - ScopedLock(void); - }; - } // namespace internal - /// @brief Gets ID of currently running threading in windows systems. On unix, nothing is returned. - static inline std::string getCurrentThreadId(void) { - std::stringstream ss; -# if (ELPP_OS_WINDOWS) - ss << GetCurrentThreadId(); -# endif // (ELPP_OS_WINDOWS) - return ss.str(); - } - static inline void msleep(int) { - // No implementation for non std::thread version - } - typedef base::threading::internal::Mutex Mutex; - typedef base::threading::internal::ScopedLock ScopedLock; -# else - /// @brief Gets ID of currently running threading using std::this_thread::get_id() - static inline std::string getCurrentThreadId(void) { - std::stringstream ss; - ss << std::this_thread::get_id(); - return ss.str(); - } - static inline void msleep(int ms) { - // Only when async logging enabled - this is because async is strict on compiler -#if ELPP_ASYNC_LOGGING - std::this_thread::sleep_for(std::chrono::milliseconds(ms)); -#endif // ELPP_ASYNC_LOGGING - } - typedef std::mutex Mutex; - typedef std::lock_guard ScopedLock; -# endif // !ELPP_USE_STD_THREADING -#else - namespace internal { - /// @brief Mutex wrapper used when multi-threading is disabled. - class NoMutex : base::NoCopy { - public: - NoMutex(void) {} - inline void lock(void) {} - inline bool try_lock(void) { return true; } - inline void unlock(void) {} - }; - /// @brief Lock guard wrapper used when multi-threading is disabled. - template - class NoScopedLock : base::NoCopy { - public: - explicit NoScopedLock(Mutex&) { - } - virtual ~NoScopedLock(void) { - } - private: - NoScopedLock(void); - }; - } // namespace internal - static inline std::string getCurrentThreadId(void) { - return std::string(); - } - static inline void msleep(int) { - // No custom implementation - } - typedef base::threading::internal::NoMutex Mutex; - typedef base::threading::internal::NoScopedLock ScopedLock; -#endif // ELPP_THREADING_ENABLED - /// @brief Base of thread safe class, this class is inheritable-only - class ThreadSafe { - public: - virtual inline void acquireLock(void) ELPP_FINAL { m_mutex.lock(); } - virtual inline void releaseLock(void) ELPP_FINAL { m_mutex.unlock(); } - virtual inline base::threading::Mutex& lock(void) ELPP_FINAL { return m_mutex; } - protected: - ThreadSafe(void) {} - virtual ~ThreadSafe(void) {} - private: - base::threading::Mutex m_mutex; - }; - } // namespace threading - namespace utils { - class File : base::StaticClass { - public: - /// @brief Creates new out file stream for specified filename. - /// @return Pointer to newly created fstream or nullptr - static base::type::fstream_t* newFileStream(const std::string& filename) { - base::type::fstream_t *fs = new base::type::fstream_t(filename.c_str(), - base::type::fstream_t::out | base::type::fstream_t::app); -#if defined(ELPP_UNICODE) - std::locale elppUnicodeLocale(""); -#if ELPP_OS_WINDOWS - std::locale elppUnicodeLocaleWindows(elppUnicodeLocale, new std::codecvt_utf8_utf16); - elppUnicodeLocale = elppUnicodeLocaleWindows; -#endif - fs->imbue(elppUnicodeLocale); -#endif // defined(ELPP_UNICODE) - if (fs->is_open()) { - fs->flush(); - } - else { - base::utils::safeDelete(fs); - ELPP_INTERNAL_ERROR("Bad file [" << filename << "]", true); - } - return fs; - } - - /// @brief Gets size of file provided in stream - static std::size_t getSizeOfFile(base::type::fstream_t* fs) { - if (fs == nullptr) { - return 0; - } - std::streampos currPos = fs->tellg(); - fs->seekg(0, fs->end); - std::size_t size = static_cast(fs->tellg()); - fs->seekg(currPos); - return size; - } - - /// @brief Determines whether or not provided path exist in current file system - static inline bool pathExists(const char* path, bool considerFile = false) { - if (path == nullptr) { - return false; - } -#if ELPP_OS_UNIX - ELPP_UNUSED(considerFile); - struct stat st; - return (stat(path, &st) == 0); -#elif ELPP_OS_WINDOWS - DWORD fileType = GetFileAttributesA(path); - if (fileType == INVALID_FILE_ATTRIBUTES) { - return false; - } - return considerFile ? true : ((fileType & FILE_ATTRIBUTE_DIRECTORY) == 0 ? false : true); -#endif // ELPP_OS_UNIX - } - - /// @brief Creates specified path on file system - /// @param path Path to create. - static bool createPath(const std::string& path) { - if (path.empty()) { - return false; - } - if (base::utils::File::pathExists(path.c_str())) { - return true; - } - int status = -1; - - char* currPath = const_cast(path.c_str()); - std::string builtPath = std::string(); -#if ELPP_OS_UNIX - if (path[0] == '/') { - builtPath = "/"; - } - currPath = STRTOK(currPath, base::consts::kFilePathSeperator, 0); -#elif ELPP_OS_WINDOWS - // Use secure functions API - char* nextTok_ = nullptr; - currPath = STRTOK(currPath, base::consts::kFilePathSeperator, &nextTok_); - ELPP_UNUSED(nextTok_); -#endif // ELPP_OS_UNIX - while (currPath != nullptr) { - builtPath.append(currPath); - builtPath.append(base::consts::kFilePathSeperator); -#if ELPP_OS_UNIX - status = mkdir(builtPath.c_str(), ELPP_LOG_PERMS); - currPath = STRTOK(nullptr, base::consts::kFilePathSeperator, 0); -#elif ELPP_OS_WINDOWS - status = _mkdir(builtPath.c_str()); - currPath = STRTOK(nullptr, base::consts::kFilePathSeperator, &nextTok_); -#endif // ELPP_OS_UNIX - } - if (status == -1) { - ELPP_INTERNAL_ERROR("Error while creating path [" << path << "]", true); - return false; - } - return true; - } - /// @brief Extracts path of filename with leading slash - static std::string extractPathFromFilename(const std::string& fullPath, - const char* seperator = base::consts::kFilePathSeperator) { - if ((fullPath == "") || (fullPath.find(seperator) == std::string::npos)) { - return fullPath; - } - std::size_t lastSlashAt = fullPath.find_last_of(seperator); - if (lastSlashAt == 0) { - return std::string(seperator); - } - return fullPath.substr(0, lastSlashAt + 1); - } - /// @brief builds stripped filename and puts it in buff - static void buildStrippedFilename(const char* filename, char buff[], - std::size_t limit = base::consts::kSourceFilenameMaxLength) { - std::size_t sizeOfFilename = strlen(filename); - if (sizeOfFilename >= limit) { - filename += (sizeOfFilename - limit); - if (filename[0] != '.' && filename[1] != '.') { // prepend if not already - filename += 3; // 3 = '..' - STRCAT(buff, "..", limit); - } - } - STRCAT(buff, filename, limit); - } - /// @brief builds base filename and puts it in buff - static void buildBaseFilename(const std::string& fullPath, char buff[], - std::size_t limit = base::consts::kSourceFilenameMaxLength, - const char* seperator = base::consts::kFilePathSeperator) { - const char *filename = fullPath.c_str(); - std::size_t lastSlashAt = fullPath.find_last_of(seperator); - filename += lastSlashAt ? lastSlashAt + 1 : 0; - std::size_t sizeOfFilename = strlen(filename); - if (sizeOfFilename >= limit) { - filename += (sizeOfFilename - limit); - if (filename[0] != '.' && filename[1] != '.') { // prepend if not already - filename += 3; // 3 = '..' - STRCAT(buff, "..", limit); - } - } - STRCAT(buff, filename, limit); - } - }; - /// @brief String utilities helper class used internally. You should not use it. - class Str : base::StaticClass { - public: - /// @brief Checks if character is digit. Dont use libc implementation of it to prevent locale issues. - static inline bool isDigit(char c) { - return c >= '0' && c <= '9'; - } - - /// @brief Matches wildcards, '*' and '?' only supported. - static bool wildCardMatch(const char* str, const char* pattern) { - while (*pattern) { - switch (*pattern) { - case '?': - if (!*str) - return false; - ++str; - ++pattern; - break; - case '*': - if (wildCardMatch(str, pattern + 1)) - return true; - if (*str && wildCardMatch(str + 1, pattern)) - return true; - return false; - break; - default: - if (*str++ != *pattern++) - return false; - break; - } - } - return !*str && !*pattern; - } - - /// @brief Trims string from start - /// @param [in,out] str String to trim - static inline std::string& ltrim(std::string& str) { - str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(&std::isspace)))); - return str; - } - - /// @brief Trim string from end - /// @param [in,out] str String to trim - static inline std::string& rtrim(std::string& str) { - str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun(&std::isspace))).base(), str.end()); - return str; - } - - /// @brief Trims string from left and right - /// @param [in,out] str String to trim - static inline std::string& trim(std::string& str) { - return ltrim(rtrim(str)); - } - - /// @brief Determines whether or not str starts with specified string - /// @param str String to check - /// @param start String to check against - /// @return Returns true if starts with specified string, false otherwise - static inline bool startsWith(const std::string& str, const std::string& start) { - return (str.length() >= start.length()) && (str.compare(0, start.length(), start) == 0); - } - - /// @brief Determines whether or not str ends with specified string - /// @param str String to check - /// @param end String to check against - /// @return Returns true if ends with specified string, false otherwise - static inline bool endsWith(const std::string& str, const std::string& end) { - return (str.length() >= end.length()) && (str.compare(str.length() - end.length(), end.length(), end) == 0); - } - - /// @brief Replaces all instances of replaceWhat with 'replaceWith'. Original variable is changed for performance. - /// @param [in,out] str String to replace from - /// @param replaceWhat Character to replace - /// @param replaceWith Character to replace with - /// @return Modified version of str - static inline std::string& replaceAll(std::string& str, char replaceWhat, char replaceWith) { - std::replace(str.begin(), str.end(), replaceWhat, replaceWith); - return str; - } - - /// @brief Replaces all instances of 'replaceWhat' with 'replaceWith'. (String version) Replaces in place - /// @param str String to replace from - /// @param replaceWhat Character to replace - /// @param replaceWith Character to replace with - /// @return Modified (original) str - static inline std::string& replaceAll(std::string& str, const std::string& replaceWhat, // NOLINT - const std::string& replaceWith) { - if (replaceWhat == replaceWith) - return str; - std::size_t foundAt = std::string::npos; - while ((foundAt = str.find(replaceWhat, foundAt + 1)) != std::string::npos) { - str.replace(foundAt, replaceWhat.length(), replaceWith); - } - return str; - } - - static void replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat, // NOLINT - const base::type::string_t& replaceWith) { - std::size_t foundAt = base::type::string_t::npos; - while ((foundAt = str.find(replaceWhat, foundAt + 1)) != base::type::string_t::npos) { - if (foundAt > 0 && str[foundAt - 1] == base::consts::kFormatSpecifierChar) { - str.erase(foundAt > 0 ? foundAt - 1 : 0, 1); - ++foundAt; - } - else { - str.replace(foundAt, replaceWhat.length(), replaceWith); - return; - } - } - } -#if defined(ELPP_UNICODE) - static void replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat, // NOLINT - const std::string& replaceWith) { - replaceFirstWithEscape(str, replaceWhat, base::type::string_t(replaceWith.begin(), replaceWith.end())); - } -#endif // defined(ELPP_UNICODE) - /// @brief Converts string to uppercase - /// @param str String to convert - /// @return Uppercase string - static inline std::string& toUpper(std::string& str) { - std::transform(str.begin(), str.end(), str.begin(), ::toupper); - return str; - } - - /// @brief Compares cstring equality - uses strcmp - static inline bool cStringEq(const char* s1, const char* s2) { - if (s1 == nullptr && s2 == nullptr) return true; - if (s1 == nullptr || s2 == nullptr) return false; - return strcmp(s1, s2) == 0; - } - - /// @brief Compares cstring equality (case-insensitive) - uses toupper(char) - /// Dont use strcasecmp because of CRT (VC++) - static bool cStringCaseEq(const char* s1, const char* s2) { - if (s1 == nullptr && s2 == nullptr) return true; - if (s1 == nullptr || s2 == nullptr) return false; - if (strlen(s1) != strlen(s2)) return false; - while (*s1 != '\0' && *s2 != '\0') { - if (::toupper(*s1) != ::toupper(*s2)) return false; - ++s1; - ++s2; - } - return true; - } - - /// @brief Returns true if c exist in str - static inline bool contains(const char* str, char c) { - for (; *str; ++str) { - if (*str == c) - return true; - } - return false; - } - - static inline char* convertAndAddToBuff(std::size_t n, int len, char* buf, const char* bufLim, bool zeroPadded = true) { - char localBuff[10] = ""; - char* p = localBuff + sizeof(localBuff) - 2; - if (n > 0) { - for (; n > 0 && p > localBuff && len > 0; n /= 10, --len) - *--p = static_cast(n % 10 + '0'); - } - else { - *--p = '0'; - --len; - } - if (zeroPadded) - while (p > localBuff && len-- > 0) *--p = static_cast('0'); - return addToBuff(p, buf, bufLim); - } - - static inline char* addToBuff(const char* str, char* buf, const char* bufLim) { - while ((buf < bufLim) && ((*buf = *str++) != '\0')) - ++buf; - return buf; - } - - static inline char* clearBuff(char buff[], std::size_t lim) { - STRCPY(buff, "", lim); - ELPP_UNUSED(lim); // For *nix we dont have anything using lim in above STRCPY macro - return buff; - } - - /// @brief Converst wchar* to char* - /// NOTE: Need to free return value after use! - static char* wcharPtrToCharPtr(const wchar_t* line) { - std::size_t len_ = wcslen(line) + 1; - char* buff_ = static_cast(malloc(len_ + 1)); -# if ELPP_OS_UNIX || (ELPP_OS_WINDOWS && !ELPP_CRT_DBG_WARNINGS) - std::wcstombs(buff_, line, len_); -# elif ELPP_OS_WINDOWS - std::size_t convCount_ = 0; - mbstate_t mbState_; - ::memset(static_cast(&mbState_), 0, sizeof(mbState_)); - wcsrtombs_s(&convCount_, buff_, len_, &line, len_, &mbState_); -# endif // ELPP_OS_UNIX || (ELPP_OS_WINDOWS && !ELPP_CRT_DBG_WARNINGS) - return buff_; - } - }; - /// @brief Operating System helper static class used internally. You should not use it. - class OS : base::StaticClass { - public: -#if ELPP_OS_WINDOWS - /// @brief Gets environment variables for Windows based OS. - /// We are not using getenv(const char*) because of CRT deprecation - /// @param varname Variable name to get environment variable value for - /// @return If variable exist the value of it otherwise nullptr - static const char* getWindowsEnvironmentVariable(const char* varname) { - const DWORD bufferLen = 50; - static char buffer[bufferLen]; - if (GetEnvironmentVariableA(varname, buffer, bufferLen)) { - return buffer; - } - return nullptr; - } -#endif // ELPP_OS_WINDOWS -#if ELPP_OS_ANDROID - /// @brief Reads android property value - static inline std::string getProperty(const char* prop) { - char propVal[PROP_VALUE_MAX + 1]; - int ret = __system_property_get(prop, propVal); - return ret == 0 ? std::string() : std::string(propVal); - } - - /// @brief Reads android device name - static std::string getDeviceName(void) { - std::stringstream ss; - std::string manufacturer = getProperty("ro.product.manufacturer"); - std::string model = getProperty("ro.product.model"); - if (manufacturer.empty() || model.empty()) { - return std::string(); - } - ss << manufacturer << "-" << model; - return ss.str(); - } -#endif // ELPP_OS_ANDROID - - /// @brief Runs command on terminal and returns the output. - /// - /// @detail This is applicable only on unix based systems, for all other OS, an empty string is returned. - /// @param command Bash command - /// @return Result of bash output or empty string if no result found. - static const std::string getBashOutput(const char* command) { -#if (ELPP_OS_UNIX && !ELPP_OS_ANDROID && !ELPP_CYGWIN) - if (command == nullptr) { - return std::string(); - } - FILE* proc = nullptr; - if ((proc = popen(command, "r")) == nullptr) { - ELPP_INTERNAL_ERROR("\nUnable to run command [" << command << "]", true); - return std::string(); - } - char hBuff[4096]; - if (fgets(hBuff, sizeof(hBuff), proc) != nullptr) { - pclose(proc); - if (hBuff[strlen(hBuff) - 1] == '\n') { - hBuff[strlen(hBuff) - 1] = '\0'; - } - return std::string(hBuff); - } - return std::string(); -#else - ELPP_UNUSED(command); - return std::string(); -#endif // (ELPP_OS_UNIX && !ELPP_OS_ANDROID && !ELPP_CYGWIN) - } - - /// @brief Gets environment variable. This is cross-platform and CRT safe (for VC++) - /// @param variableName Environment variable name - /// @param defaultVal If no environment variable or value found the value to return by default - /// @param alternativeBashCommand If environment variable not found what would be alternative bash command - /// in order to look for value user is looking for. E.g, for 'user' alternative command will 'whoami' - static std::string getEnvironmentVariable(const char* variableName, const char* defaultVal, const char* alternativeBashCommand = nullptr) { -#if ELPP_OS_UNIX - const char* val = getenv(variableName); -#elif ELPP_OS_WINDOWS - const char* val = getWindowsEnvironmentVariable(variableName); -#endif // ELPP_OS_UNIX - if ((val == nullptr) || ((strcmp(val, "") == 0))) { -#if ELPP_OS_UNIX && defined(ELPP_FORCE_ENV_VAR_FROM_BASH) - // Try harder on unix-based systems - std::string valBash = base::utils::OS::getBashOutput(alternativeBashCommand); - if (valBash.empty()) { - return std::string(defaultVal); - } - else { - return valBash; - } -#elif ELPP_OS_WINDOWS || ELPP_OS_UNIX - ELPP_UNUSED(alternativeBashCommand); - return std::string(defaultVal); -#endif // ELPP_OS_UNIX && defined(ELPP_FORCE_ENV_VAR_FROM_BASH) - } - return std::string(val); - } - /// @brief Gets current username. - static inline std::string currentUser(void) { -#if ELPP_OS_UNIX && !ELPP_OS_ANDROID - return getEnvironmentVariable("USER", base::consts::kUnknownUser, "whoami"); -#elif ELPP_OS_WINDOWS - return getEnvironmentVariable("USERNAME", base::consts::kUnknownUser); -#elif ELPP_OS_ANDROID - ELPP_UNUSED(base::consts::kUnknownUser); - return std::string("android"); -#else - return std::string(); -#endif // ELPP_OS_UNIX && !ELPP_OS_ANDROID - } - - /// @brief Gets current host name or computer name. - /// - /// @detail For android systems this is device name with its manufacturer and model seperated by hyphen - static inline std::string currentHost(void) { -#if ELPP_OS_UNIX && !ELPP_OS_ANDROID - return getEnvironmentVariable("HOSTNAME", base::consts::kUnknownHost, "hostname"); -#elif ELPP_OS_WINDOWS - return getEnvironmentVariable("COMPUTERNAME", base::consts::kUnknownHost); -#elif ELPP_OS_ANDROID - ELPP_UNUSED(base::consts::kUnknownHost); - return getDeviceName(); -#else - return std::string(); -#endif // ELPP_OS_UNIX && !ELPP_OS_ANDROID - } - /// @brief Whether or not terminal supports colors - static inline bool termSupportsColor(void) { - std::string term = getEnvironmentVariable("TERM", ""); - return term == "xterm" || term == "xterm-color" || term == "xterm-256color" || - term == "screen" || term == "linux" || term == "cygwin"; - } - }; - extern std::string s_currentUser; - extern std::string s_currentHost; - extern bool s_termSupportsColor; -#define ELPP_INITI_BASIC_DECLR \ - namespace el {\ - namespace base {\ - namespace utils {\ - std::string s_currentUser = el::base::utils::OS::currentUser(); \ - std::string s_currentHost = el::base::utils::OS::currentHost(); \ - bool s_termSupportsColor = el::base::utils::OS::termSupportsColor(); \ - }\ - }\ - } - /// @brief Contains utilities for cross-platform date/time. This class make use of el::base::utils::Str - class DateTime : base::StaticClass { - public: - /// @brief Cross platform gettimeofday for Windows and unix platform. This can be used to determine current millisecond. - /// - /// @detail For unix system it uses gettimeofday(timeval*, timezone*) and for Windows, a seperate implementation is provided - /// @param [in,out] tv Pointer that gets updated - static void gettimeofday(struct timeval* tv) { -#if ELPP_OS_WINDOWS - if (tv != nullptr) { -# if ELPP_COMPILER_MSVC || defined(_MSC_EXTENSIONS) - const unsigned __int64 delta_ = 11644473600000000Ui64; -# else - const unsigned __int64 delta_ = 11644473600000000ULL; -# endif // ELPP_COMPILER_MSVC || defined(_MSC_EXTENSIONS) - const double secOffSet = 0.000001; - const unsigned long usecOffSet = 1000000; - FILETIME fileTime; - GetSystemTimeAsFileTime(&fileTime); - unsigned __int64 present = 0; - present |= fileTime.dwHighDateTime; - present = present << 32; - present |= fileTime.dwLowDateTime; - present /= 10; // mic-sec - // Subtract the difference - present -= delta_; - tv->tv_sec = static_cast(present * secOffSet); - tv->tv_usec = static_cast(present % usecOffSet); - } -#else - ::gettimeofday(tv, nullptr); -#endif // ELPP_OS_WINDOWS - } - - /// @brief Gets current date and time with milliseconds. - /// @param format User provided date/time format - /// @param msWidth A pointer to base::MillisecondsWidth from configuration (non-null) - /// @returns string based date time in specified format. - static inline std::string getDateTime(const char* format, const base::MillisecondsWidth* msWidth) { - struct timeval currTime; - gettimeofday(&currTime); - struct ::tm timeInfo; - buildTimeInfo(&currTime, &timeInfo); - const int kBuffSize = 30; - char buff_[kBuffSize] = ""; - parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(currTime.tv_usec / msWidth->m_offset), msWidth); - return std::string(buff_); - } - - /// @brief Formats time to get unit accordingly, units like second if > 1000 or minutes if > 60000 etc - static base::type::string_t formatTime(unsigned long long time, base::TimestampUnit timestampUnit) { - double result = static_cast(time); - base::type::EnumType start = static_cast(timestampUnit); - const base::type::char_t* unit = base::consts::kTimeFormats[start].unit; - for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) { - if (result <= base::consts::kTimeFormats[i].value) { - break; - } - result /= base::consts::kTimeFormats[i].value; - unit = base::consts::kTimeFormats[i + 1].unit; - } - base::type::stringstream_t ss; - ss << result << " " << unit; - return ss.str(); - } - - /// @brief Gets time difference in milli/micro second depending on timestampUnit - static inline unsigned long long getTimeDifference(const struct timeval& endTime, const struct timeval& startTime, base::TimestampUnit timestampUnit) { - if (timestampUnit == base::TimestampUnit::Microsecond) { - return static_cast(static_cast(1000000 * endTime.tv_sec + endTime.tv_usec) - - static_cast(1000000 * startTime.tv_sec + startTime.tv_usec)); - } - else { - return static_cast((((endTime.tv_sec - startTime.tv_sec) * 1000000) + (endTime.tv_usec - startTime.tv_usec)) / 1000); - } - } - - private: - static inline struct ::tm* buildTimeInfo(struct timeval* currTime, struct ::tm* timeInfo) { -#if ELPP_OS_UNIX - time_t rawTime = currTime->tv_sec; - ::localtime_r(&rawTime, timeInfo); - return timeInfo; -#else -# if ELPP_COMPILER_MSVC - ELPP_UNUSED(currTime); - time_t t; - _time64(&t); - localtime_s(timeInfo, &t); - return timeInfo; -# else - // For any other compilers that don't have CRT warnings issue e.g, MinGW or TDM GCC- we use different method - time_t rawTime = currTime->tv_sec; - struct tm* tmInf = localtime(&rawTime); - *timeInfo = *tmInf; - return timeInfo; -# endif // ELPP_COMPILER_MSVC -#endif // ELPP_OS_UNIX - } - static char* parseFormat(char* buf, std::size_t bufSz, const char* format, const struct tm* tInfo, - std::size_t msec, const base::MillisecondsWidth* msWidth) { - const char* bufLim = buf + bufSz; - for (; *format; ++format) { - if (*format == base::consts::kFormatSpecifierChar) { - switch (*++format) { - case base::consts::kFormatSpecifierChar: // Escape - break; - case '\0': // End - --format; - break; - case 'd': // Day - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mday, 2, buf, bufLim); - continue; - case 'a': // Day of week (short) - buf = base::utils::Str::addToBuff(base::consts::kDaysAbbrev[tInfo->tm_wday], buf, bufLim); - continue; - case 'A': // Day of week (long) - buf = base::utils::Str::addToBuff(base::consts::kDays[tInfo->tm_wday], buf, bufLim); - continue; - case 'M': // month - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mon + 1, 2, buf, bufLim); - continue; - case 'b': // month (short) - buf = base::utils::Str::addToBuff(base::consts::kMonthsAbbrev[tInfo->tm_mon], buf, bufLim); - continue; - case 'B': // month (long) - buf = base::utils::Str::addToBuff(base::consts::kMonths[tInfo->tm_mon], buf, bufLim); - continue; - case 'y': // year (two digits) - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 2, buf, bufLim); - continue; - case 'Y': // year (four digits) - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 4, buf, bufLim); - continue; - case 'h': // hour (12-hour) - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour % 12, 2, buf, bufLim); - continue; - case 'H': // hour (24-hour) - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour, 2, buf, bufLim); - continue; - case 'm': // minute - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_min, 2, buf, bufLim); - continue; - case 's': // second - buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_sec, 2, buf, bufLim); - continue; - case 'z': // milliseconds - case 'g': - buf = base::utils::Str::convertAndAddToBuff(msec, msWidth->m_width, buf, bufLim); - continue; - case 'F': // AM/PM - buf = base::utils::Str::addToBuff((tInfo->tm_hour >= 12) ? base::consts::kPm : base::consts::kAm, buf, bufLim); - continue; - default: - continue; - } - } - if (buf == bufLim) break; - *buf++ = *format; - } - return buf; - } - }; - /// @brief Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGINGPP(..) - class CommandLineArgs { - public: - CommandLineArgs(void) { - setArgs(0, static_cast(nullptr)); - } - CommandLineArgs(int argc, const char** argv) { - setArgs(argc, argv); - } - CommandLineArgs(int argc, char** argv) { - setArgs(argc, argv); - } - virtual ~CommandLineArgs(void) {} - /// @brief Sets arguments and parses them - inline void setArgs(int argc, const char** argv) { - setArgs(argc, const_cast(argv)); - } - /// @brief Sets arguments and parses them - inline void setArgs(int argc, char** argv) { - m_params.clear(); - m_paramsWithValue.clear(); - if (argc == 0 || argv == nullptr) { - return; - } - m_argc = argc; - m_argv = argv; - for (int i = 1; i < m_argc; ++i) { - const char* v = (strstr(m_argv[i], "=")); - if (v != nullptr && strlen(v) > 0) { - std::string key = std::string(m_argv[i]); - key = key.substr(0, key.find_first_of('=')); - if (hasParamWithValue(key.c_str())) { - ELPP_INTERNAL_INFO(1, "Skipping [" << key << "] arg since it already has value [" - << getParamValue(key.c_str()) << "]"); - } - else { - m_paramsWithValue.insert(std::make_pair(key, std::string(v + 1))); - } - } - if (v == nullptr) { - if (hasParam(m_argv[i])) { - ELPP_INTERNAL_INFO(1, "Skipping [" << m_argv[i] << "] arg since it already exists"); - } - else { - m_params.push_back(std::string(m_argv[i])); - } - } - } - } - /// @brief Returns true if arguments contain paramKey with a value (seperated by '=') - inline bool hasParamWithValue(const char* paramKey) const { - return m_paramsWithValue.find(std::string(paramKey)) != m_paramsWithValue.end(); - } - /// @brief Returns value of arguments - /// @see hasParamWithValue(const char*) - inline const char* getParamValue(const char* paramKey) const { - return m_paramsWithValue.find(std::string(paramKey))->second.c_str(); - } - /// @brief Return true if arguments has a param (not having a value) i,e without '=' - inline bool hasParam(const char* paramKey) const { - return std::find(m_params.begin(), m_params.end(), std::string(paramKey)) != m_params.end(); - } - /// @brief Returns true if no params available. This exclude argv[0] - inline bool empty(void) const { - return m_params.empty() && m_paramsWithValue.empty(); - } - /// @brief Returns total number of arguments. This exclude argv[0] - inline std::size_t size(void) const { - return m_params.size() + m_paramsWithValue.size(); - } - inline friend base::type::ostream_t& operator<<(base::type::ostream_t& os, const CommandLineArgs& c) { - for (int i = 1; i < c.m_argc; ++i) { - os << ELPP_LITERAL("[") << c.m_argv[i] << ELPP_LITERAL("]"); - if (i < c.m_argc - 1) { - os << ELPP_LITERAL(" "); - } - } - return os; - } - - private: - int m_argc; - char** m_argv; - std::map m_paramsWithValue; - std::vector m_params; - }; - /// @brief Abstract registry (aka repository) that provides basic interface for pointer repository specified by T_Ptr type. - /// - /// @detail Most of the functions are virtual final methods but anything implementing this abstract class should implement - /// unregisterAll() and deepCopy(const AbstractRegistry&) and write registerNew() method according to container - /// and few more methods; get() to find element, unregister() to unregister single entry. - /// Please note that this is thread-unsafe and should also implement thread-safety mechanisms in implementation. - template - class AbstractRegistry : public base::threading::ThreadSafe { - public: - typedef typename Container::iterator iterator; - typedef typename Container::const_iterator const_iterator; - - /// @brief Default constructor - AbstractRegistry(void) {} - - /// @brief Move constructor that is useful for base classes - AbstractRegistry(AbstractRegistry&& sr) { - if (this == &sr) { - return; - } - unregisterAll(); - m_list = std::move(sr.m_list); - } - - bool operator==(const AbstractRegistry& other) { - if (size() != other.size()) { - return false; - } - for (std::size_t i = 0; i < m_list.size(); ++i) { - if (m_list.at(i) != other.m_list.at(i)) { - return false; - } - } - return true; - } - - bool operator!=(const AbstractRegistry& other) { - if (size() != other.size()) { - return true; - } - for (std::size_t i = 0; i < m_list.size(); ++i) { - if (m_list.at(i) != other.m_list.at(i)) { - return true; - } - } - return false; - } - - /// @brief Assignment move operator - AbstractRegistry& operator=(AbstractRegistry&& sr) { - if (this == &sr) { - return *this; - } - unregisterAll(); - m_list = std::move(sr.m_list); - return *this; - } - - virtual ~AbstractRegistry(void) { - } - - /// @return Iterator pointer from start of repository - virtual inline iterator begin(void) ELPP_FINAL { - return m_list.begin(); - } - - /// @return Iterator pointer from end of repository - virtual inline iterator end(void) ELPP_FINAL { - return m_list.end(); - } - - - /// @return Constant iterator pointer from start of repository - virtual inline const_iterator cbegin(void) const ELPP_FINAL { - return m_list.cbegin(); - } - - /// @return End of repository - virtual inline const_iterator cend(void) const ELPP_FINAL { - return m_list.cend(); - } - - /// @return Whether or not repository is empty - virtual inline bool empty(void) const ELPP_FINAL { - return m_list.empty(); - } - - /// @return Size of repository - virtual inline std::size_t size(void) const ELPP_FINAL { - return m_list.size(); - } - - /// @brief Returns underlying container by reference - virtual inline Container& list(void) ELPP_FINAL { - return m_list; - } - - /// @brief Returns underlying container by constant reference. - virtual inline const Container& list(void) const ELPP_FINAL { - return m_list; - } - - /// @brief Unregisters all the pointers from current repository. - virtual void unregisterAll(void) = 0; - - protected: - virtual void deepCopy(const AbstractRegistry&) = 0; - void reinitDeepCopy(const AbstractRegistry& sr) { - unregisterAll(); - deepCopy(sr); - } - - private: - Container m_list; - }; - - /// @brief A pointer registry mechanism to manage memory and provide search functionalities. (non-predicate version) - /// - /// @detail NOTE: This is thread-unsafe implementation (although it contains lock function, it does not use these functions) - /// of AbstractRegistry. Any implementation of this class should be - /// explicitly (by using lock functions) - template - class Registry : public AbstractRegistry> { - public: - typedef typename Registry::iterator iterator; - typedef typename Registry::const_iterator const_iterator; - - Registry(void) {} - - /// @brief Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor. - Registry(const Registry& sr) : AbstractRegistry>() { - if (this == &sr) { - return; - } - this->reinitDeepCopy(sr); - } - - /// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element - /// @see unregisterAll() - /// @see deepCopy(const AbstractRegistry&) - Registry& operator=(const Registry& sr) { - if (this == &sr) { - return *this; - } - this->reinitDeepCopy(sr); - return *this; - } - - virtual ~Registry(void) { - unregisterAll(); - } - - protected: - virtual inline void unregisterAll(void) ELPP_FINAL { - if (!this->empty()) { - for (auto&& curr : this->list()) { - base::utils::safeDelete(curr.second); - } - this->list().clear(); - } - } - - /// @brief Registers new registry to repository. - virtual inline void registerNew(const T_Key& uniqKey, T_Ptr* ptr) ELPP_FINAL { - unregister(uniqKey); - this->list().insert(std::make_pair(uniqKey, ptr)); - } - - /// @brief Unregisters single entry mapped to specified unique key - inline void unregister(const T_Key& uniqKey) { - T_Ptr* existing = get(uniqKey); - if (existing != nullptr) { - base::utils::safeDelete(existing); - this->list().erase(uniqKey); - } - } - - /// @brief Gets pointer from repository. If none found, nullptr is returned. - inline T_Ptr* get(const T_Key& uniqKey) { - iterator it = this->list().find(uniqKey); - return it == this->list().end() - ? nullptr - : it->second; - } - - private: - virtual inline void deepCopy(const AbstractRegistry>& sr) ELPP_FINAL { - for (const_iterator it = sr.cbegin(); it != sr.cend(); ++it) { - registerNew(it->first, new T_Ptr(*it->second)); - } - } - }; - - /// @brief A pointer registry mechanism to manage memory and provide search functionalities. (predicate version) - /// - /// @detail NOTE: This is thread-unsafe implementation of AbstractRegistry. Any implementation of this class - /// should be made thread-safe explicitly - template - class RegistryWithPred : public AbstractRegistry> { - public: - typedef typename RegistryWithPred::iterator iterator; - typedef typename RegistryWithPred::const_iterator const_iterator; - - RegistryWithPred(void) { - } - - virtual ~RegistryWithPred(void) { - unregisterAll(); - } - - /// @brief Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor. - RegistryWithPred(const RegistryWithPred& sr) : AbstractRegistry>() { - if (this == &sr) { - return; - } - this->reinitDeepCopy(sr); - } - - /// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element - /// @see unregisterAll() - /// @see deepCopy(const AbstractRegistry&) - RegistryWithPred& operator=(const RegistryWithPred& sr) { - if (this == &sr) { - return *this; - } - this->reinitDeepCopy(sr); - return *this; - } - - friend inline base::type::ostream_t& operator<<(base::type::ostream_t& os, const RegistryWithPred& sr) { - for (const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) { - os << ELPP_LITERAL(" ") << **it << ELPP_LITERAL("\n"); - } - return os; - } - - protected: - virtual inline void unregisterAll(void) ELPP_FINAL { - if (!this->empty()) { - for (auto&& curr : this->list()) { - base::utils::safeDelete(curr); - } - this->list().clear(); - } - } - - virtual void unregister(T_Ptr*& ptr) ELPP_FINAL { - if (ptr) { - iterator iter = this->begin(); - for (; iter != this->end(); ++iter) { - if (ptr == *iter) { - break; - } - } - if (iter != this->end() && *iter != nullptr) { - this->list().erase(iter); - base::utils::safeDelete(*iter); - } - } - } - - virtual inline void registerNew(T_Ptr* ptr) ELPP_FINAL { - this->list().push_back(ptr); - } - - /// @brief Gets pointer from repository with speicifed arguments. Arguments are passed to predicate - /// in order to validate pointer. - template - inline T_Ptr* get(const T& arg1, const T2 arg2) { - iterator iter = std::find_if(this->list().begin(), this->list().end(), Pred(arg1, arg2)); - if (iter != this->list().end() && *iter != nullptr) { - return *iter; - } - return nullptr; - } - - private: - virtual inline void deepCopy(const AbstractRegistry>& sr) { - for (const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) { - registerNew(new T_Ptr(**it)); - } - } - }; - - } // namespace utils - } // namespace base - /// @brief Base of Easylogging++ friendly class - /// - /// @detail After inheriting this class publicly, implement pure-virtual function `void log(std::ostream&) const` - class Loggable { - public: - virtual ~Loggable(void) {} - virtual void log(el::base::type::ostream_t&) const = 0; - private: - friend inline el::base::type::ostream_t& operator<<(el::base::type::ostream_t& os, const Loggable& loggable) { - loggable.log(os); - return os; - } - }; - namespace base { - /// @brief Represents log format containing flags and date format. This is used internally to start initial log - class LogFormat : public Loggable { - public: - LogFormat(void) : - m_level(Level::Unknown), - m_userFormat(base::type::string_t()), - m_format(base::type::string_t()), - m_dateTimeFormat(std::string()), - m_flags(0x0) { - } - - LogFormat(Level level, const base::type::string_t& format) - : m_level(level), m_userFormat(format) { - parseFromFormat(m_userFormat); - } - - LogFormat(const LogFormat& logFormat) { - m_level = logFormat.m_level; - m_userFormat = logFormat.m_userFormat; - m_format = logFormat.m_format; - m_dateTimeFormat = logFormat.m_dateTimeFormat; - m_flags = logFormat.m_flags; - } - - LogFormat(LogFormat&& logFormat) { - m_level = std::move(logFormat.m_level); - m_userFormat = std::move(logFormat.m_userFormat); - m_format = std::move(logFormat.m_format); - m_dateTimeFormat = std::move(logFormat.m_dateTimeFormat); - m_flags = std::move(logFormat.m_flags); - } - - LogFormat& operator=(const LogFormat& logFormat) { - m_level = logFormat.m_level; - m_userFormat = logFormat.m_userFormat; - m_dateTimeFormat = logFormat.m_dateTimeFormat; - m_flags = logFormat.m_flags; - return *this; - } - - virtual ~LogFormat(void) { - } - - inline bool operator==(const LogFormat& other) { - return m_level == other.m_level && m_userFormat == other.m_userFormat && m_format == other.m_format && - m_dateTimeFormat == other.m_dateTimeFormat && m_flags == other.m_flags; - } - - /// @brief Updates format to be used while logging. - /// @param userFormat User provided format - void parseFromFormat(const base::type::string_t& userFormat) { - // We make copy because we will be changing the format - // i.e, removing user provided date format from original format - // and then storing it. - base::type::string_t formatCopy = userFormat; - m_flags = 0x0; - auto conditionalAddFlag = [&](const base::type::char_t* specifier, base::FormatFlags flag) { - std::size_t foundAt = base::type::string_t::npos; - while ((foundAt = formatCopy.find(specifier, foundAt + 1)) != base::type::string_t::npos) { - if (foundAt > 0 && formatCopy[foundAt - 1] == base::consts::kFormatSpecifierChar) { - if (hasFlag(flag)) { - // If we already have flag we remove the escape chars so that '%%' is turned to '%' - // even after specifier resolution - this is because we only replaceFirst specifier - formatCopy.erase(foundAt > 0 ? foundAt - 1 : 0, 1); - ++foundAt; - } - } - else { - if (!hasFlag(flag)) addFlag(flag); - } - } - }; - conditionalAddFlag(base::consts::kAppNameFormatSpecifier, base::FormatFlags::AppName); - conditionalAddFlag(base::consts::kSeverityLevelFormatSpecifier, base::FormatFlags::Level); - conditionalAddFlag(base::consts::kSeverityLevelShortFormatSpecifier, base::FormatFlags::LevelShort); - conditionalAddFlag(base::consts::kLoggerIdFormatSpecifier, base::FormatFlags::LoggerId); - conditionalAddFlag(base::consts::kThreadIdFormatSpecifier, base::FormatFlags::ThreadId); - conditionalAddFlag(base::consts::kLogFileFormatSpecifier, base::FormatFlags::File); - conditionalAddFlag(base::consts::kLogFileBaseFormatSpecifier, base::FormatFlags::FileBase); - conditionalAddFlag(base::consts::kLogLineFormatSpecifier, base::FormatFlags::Line); - conditionalAddFlag(base::consts::kLogLocationFormatSpecifier, base::FormatFlags::Location); - conditionalAddFlag(base::consts::kLogFunctionFormatSpecifier, base::FormatFlags::Function); - conditionalAddFlag(base::consts::kCurrentUserFormatSpecifier, base::FormatFlags::User); - conditionalAddFlag(base::consts::kCurrentHostFormatSpecifier, base::FormatFlags::Host); - conditionalAddFlag(base::consts::kMessageFormatSpecifier, base::FormatFlags::LogMessage); - conditionalAddFlag(base::consts::kVerboseLevelFormatSpecifier, base::FormatFlags::VerboseLevel); - // For date/time we need to extract user's date format first - std::size_t dateIndex = std::string::npos; - if ((dateIndex = formatCopy.find(base::consts::kDateTimeFormatSpecifier)) != std::string::npos) { - while (dateIndex > 0 && formatCopy[dateIndex - 1] == base::consts::kFormatSpecifierChar) { - dateIndex = formatCopy.find(base::consts::kDateTimeFormatSpecifier, dateIndex + 1); - } - if (dateIndex != std::string::npos) { - addFlag(base::FormatFlags::DateTime); - updateDateFormat(dateIndex, formatCopy); - } - } - m_format = formatCopy; - updateFormatSpec(); - } - - inline Level level(void) const { - return m_level; - } - - inline const base::type::string_t& userFormat(void) const { - return m_userFormat; - } - - inline const base::type::string_t& format(void) const { - return m_format; - } - - inline const std::string& dateTimeFormat(void) const { - return m_dateTimeFormat; - } - - inline base::type::EnumType flags(void) const { - return m_flags; - } - - inline bool hasFlag(base::FormatFlags flag) const { - return base::utils::hasFlag(flag, m_flags); - } - - virtual void log(el::base::type::ostream_t& os) const { - os << m_format; - } - - protected: - /// @brief Updates date time format if available in currFormat. - /// @param index Index where %datetime, %date or %time was found - /// @param [in,out] currFormat current format that is being used to format - virtual void updateDateFormat(std::size_t index, base::type::string_t& currFormat) ELPP_FINAL { - if (hasFlag(base::FormatFlags::DateTime)) { - index += ELPP_STRLEN(base::consts::kDateTimeFormatSpecifier); - } - const base::type::char_t* ptr = currFormat.c_str() + index; - if ((currFormat.size() > index) && (ptr[0] == '{')) { - // User has provided format for date/time - ++ptr; - int count = 1; // Start by 1 in order to remove starting brace - std::stringstream ss; - for (; *ptr; ++ptr, ++count) { - if (*ptr == '}') { - ++count; // In order to remove ending brace - break; - } - ss << *ptr; - } - currFormat.erase(index, count); - m_dateTimeFormat = ss.str(); - } - else { - // No format provided, use default - if (hasFlag(base::FormatFlags::DateTime)) { - m_dateTimeFormat = std::string(base::consts::kDefaultDateTimeFormat); - } - } - } - - /// @brief Updates %level from format. This is so that we dont have to do it at log-writing-time. It uses m_format and m_level - virtual void updateFormatSpec(void) ELPP_FINAL { - // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. - if (m_level == Level::Debug) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kDebugLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kDebugLevelShortLogValue); - } - else if (m_level == Level::Info) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kInfoLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kInfoLevelShortLogValue); - } - else if (m_level == Level::Warning) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kWarningLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kWarningLevelShortLogValue); - } - else if (m_level == Level::Error) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kErrorLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kErrorLevelShortLogValue); - } - else if (m_level == Level::Fatal) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kFatalLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kFatalLevelShortLogValue); - } - else if (m_level == Level::Verbose) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kVerboseLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kVerboseLevelShortLogValue); - } - else if (m_level == Level::Trace) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, - base::consts::kTraceLevelLogValue); - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, - base::consts::kTraceLevelShortLogValue); - } - if (hasFlag(base::FormatFlags::User)) { - std::string s = base::utils::s_currentUser; - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kCurrentUserFormatSpecifier, - base::utils::s_currentUser); - } - if (hasFlag(base::FormatFlags::Host)) { - base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kCurrentHostFormatSpecifier, - base::utils::s_currentHost); - } - // Ignore Level::Global and Level::Unknown - } - - inline void addFlag(base::FormatFlags flag) { - base::utils::addFlag(flag, &m_flags); - } - - private: - Level m_level; - base::type::string_t m_userFormat; - base::type::string_t m_format; - std::string m_dateTimeFormat; - base::type::EnumType m_flags; - friend class el::Logger; // To resolve loggerId format specifier easily - }; - } // namespace base - /// @brief Resolving function for format specifier - typedef std::function FormatSpecifierValueResolver; - /// @brief User-provided custom format specifier - /// @see el::Helpers::installCustomFormatSpecifier - /// @see FormatSpecifierValueResolver - class CustomFormatSpecifier { - public: - CustomFormatSpecifier(const char* formatSpecifier, const FormatSpecifierValueResolver& resolver) : - m_formatSpecifier(formatSpecifier), m_resolver(resolver) {} - inline const char* formatSpecifier(void) const { return m_formatSpecifier; } - inline const FormatSpecifierValueResolver& resolver(void) const { return m_resolver; } - inline bool operator==(const char* formatSpecifier) { - return strcmp(m_formatSpecifier, formatSpecifier) == 0; - } - - private: - const char* m_formatSpecifier; - FormatSpecifierValueResolver m_resolver; - }; - /// @brief Represents single configuration that has representing level, configuration type and a string based value. - /// - /// @detail String based value means any value either its boolean, integer or string itself, it will be embedded inside quotes - /// and will be parsed later. - /// - /// Consider some examples below: - /// * el::Configuration confEnabledInfo(el::Level::Info, el::ConfigurationType::Enabled, "true"); - /// * el::Configuration confMaxLogFileSizeInfo(el::Level::Info, el::ConfigurationType::MaxLogFileSize, "2048"); - /// * el::Configuration confFilenameInfo(el::Level::Info, el::ConfigurationType::Filename, "/var/log/my.log"); - class Configuration : public Loggable { - public: - Configuration(const Configuration& c) : - m_level(c.m_level), - m_configurationType(c.m_configurationType), - m_value(c.m_value) { - } - - Configuration& operator=(const Configuration& c) { - m_level = c.m_level; - m_configurationType = c.m_configurationType; - m_value = c.m_value; - return *this; - } - - virtual ~Configuration(void) { - } - - /// @brief Full constructor used to sets value of configuration - Configuration(Level level, ConfigurationType configurationType, const std::string& value) : - m_level(level), - m_configurationType(configurationType), - m_value(value) { - } - - /// @brief Gets level of current configuration - inline Level level(void) const { - return m_level; - } - - /// @brief Gets configuration type of current configuration - inline ConfigurationType configurationType(void) const { - return m_configurationType; - } - - /// @brief Gets string based configuration value - inline const std::string& value(void) const { - return m_value; - } - - /// @brief Set string based configuration value - /// @param value Value to set. Values have to be std::string; For boolean values use "true", "false", for any integral values - /// use them in quotes. They will be parsed when configuring - inline void setValue(const std::string& value) { - m_value = value; - } - - virtual inline void log(el::base::type::ostream_t& os) const { - os << LevelHelper::convertToString(m_level) - << ELPP_LITERAL(" ") << ConfigurationTypeHelper::convertToString(m_configurationType) - << ELPP_LITERAL(" = ") << m_value.c_str(); - } - - /// @brief Used to find configuration from configuration (pointers) repository. Avoid using it. - class Predicate { - public: - Predicate(Level level, ConfigurationType configurationType) : - m_level(level), - m_configurationType(configurationType) { - } - - inline bool operator()(const Configuration* conf) const { - return ((conf != nullptr) && (conf->level() == m_level) && (conf->configurationType() == m_configurationType)); - } - - private: - Level m_level; - ConfigurationType m_configurationType; - }; - - private: - Level m_level; - ConfigurationType m_configurationType; - std::string m_value; - }; - - /// @brief Thread-safe Configuration repository - /// - /// @detail This repository represents configurations for all the levels and configuration type mapped to a value. - class Configurations : public base::utils::RegistryWithPred { - public: - /// @brief Default constructor with empty repository - Configurations(void) : - m_configurationFile(std::string()), - m_isFromFile(false) { - } - - /// @brief Constructor used to set configurations using configuration file. - /// @param configurationFile Full path to configuration file - /// @param useDefaultsForRemaining Lets you set the remaining configurations to default. - /// @param base If provided, this configuration will be based off existing repository that this argument is pointing to. - /// @see parseFromFile(const std::string&, Configurations* base) - /// @see setRemainingToDefault() - Configurations(const std::string& configurationFile, bool useDefaultsForRemaining = true, Configurations* base = nullptr) : - m_configurationFile(configurationFile), - m_isFromFile(false) { - parseFromFile(configurationFile, base); - if (useDefaultsForRemaining) { - setRemainingToDefault(); - } - } - - virtual ~Configurations(void) { - } - - /// @brief Parses configuration from file. - /// @param configurationFile Full path to configuration file - /// @param base Configurations to base new configuration repository off. This value is used when you want to use - /// existing Configurations to base all the values and then set rest of configuration via configuration file. - /// @return True if successfully parsed, false otherwise. You may define 'ELPP_DEBUG_ASSERT_FAILURE' to make sure you - /// do not proceed without successful parse. - inline bool parseFromFile(const std::string& configurationFile, Configurations* base = nullptr) { - // We initial assertion with true because if we have assertion diabled, we want to pass this - // check and if assertion is enabled we will have values re-assigned any way. - bool assertionPassed = true; - ELPP_ASSERT((assertionPassed = base::utils::File::pathExists(configurationFile.c_str(), true)), - "Configuration file [" << configurationFile << "] does not exist!"); - if (!assertionPassed) { - return false; - } - bool success = Parser::parseFromFile(configurationFile, this, base); - m_isFromFile = success; - return success; - } - - /// @brief Parse configurations from configuration string. - /// - /// @detail This configuration string has same syntax as configuration file contents. Make sure all the necessary - /// new line characters are provided. - /// @param base Configurations to base new configuration repository off. This value is used when you want to use - /// existing Configurations to base all the values and then set rest of configuration via configuration text. - /// @return True if successfully parsed, false otherwise. You may define 'ELPP_DEBUG_ASSERT_FAILURE' to make sure you - /// do not proceed without successful parse. - inline bool parseFromText(const std::string& configurationsString, Configurations* base = nullptr) { - bool success = Parser::parseFromText(configurationsString, this, base); - if (success) { - m_isFromFile = false; - } - return success; - } - - /// @brief Sets configuration based-off an existing configurations. - /// @param base Pointer to existing configurations. - inline void setFromBase(Configurations* base) { - if (base == nullptr || base == this) { - return; - } - base::threading::ScopedLock scopedLock(base->lock()); - for (Configuration*& conf : base->list()) { - set(conf); - } - } - - /// @brief Determines whether or not specified configuration type exists in the repository. - /// - /// @detail Returns as soon as first level is found. - /// @param configurationType Type of configuration to check existence for. - bool hasConfiguration(ConfigurationType configurationType) { - base::type::EnumType lIndex = LevelHelper::kMinValid; - bool result = false; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - if (hasConfiguration(LevelHelper::castFromInt(lIndex), configurationType)) { - result = true; - } - return result; - }); - return result; - } - - /// @brief Determines whether or not specified configuration type exists for specified level - /// @param level Level to check - /// @param configurationType Type of configuration to check existence for. - inline bool hasConfiguration(Level level, ConfigurationType configurationType) { - base::threading::ScopedLock scopedLock(lock()); -#if ELPP_COMPILER_INTEL - // We cant specify template types here, Intel C++ throws compilation error - // "error: type name is not allowed" - return RegistryWithPred::get(level, configurationType) != nullptr; -#else - return RegistryWithPred::get(level, configurationType) != nullptr; -#endif // ELPP_COMPILER_INTEL - } - - /// @brief Sets value of configuration for specified level. - /// - /// @detail Any existing configuration for specified level will be replaced. Also note that configuration types - /// ConfigurationType::MillisecondsWidth and ConfigurationType::PerformanceTracking will be ignored if not set for - /// Level::Global because these configurations are not dependant on level. - /// @param level Level to set configuration for (el::Level). - /// @param configurationType Type of configuration (el::ConfigurationType) - /// @param value A string based value. Regardless of what the data type of configuration is, it will always be string - /// from users' point of view. This is then parsed later to be used internally. - /// @see Configuration::setValue(const std::string& value) - /// @see el::Level - /// @see el::ConfigurationType - inline void set(Level level, ConfigurationType configurationType, const std::string& value) { - base::threading::ScopedLock scopedLock(lock()); - unsafeSet(level, configurationType, value); // This is not unsafe anymore as we have locked mutex - if (level == Level::Global) { - unsafeSetGlobally(configurationType, value, false); // Again this is not unsafe either - } - } - - /// @brief Sets single configuration based on other single configuration. - /// @see set(Level level, ConfigurationType configurationType, const std::string& value) - inline void set(Configuration* conf) { - if (conf == nullptr) { - return; - } - set(conf->level(), conf->configurationType(), conf->value()); - } - - inline Configuration* get(Level level, ConfigurationType configurationType) { - base::threading::ScopedLock scopedLock(lock()); - return RegistryWithPred::get(level, configurationType); - } - - /// @brief Sets configuration for all levels. - /// @param configurationType Type of configuration - /// @param value String based value - /// @see Configurations::set(Level level, ConfigurationType configurationType, const std::string& value) - inline void setGlobally(ConfigurationType configurationType, const std::string& value) { - setGlobally(configurationType, value, false); - } - - /// @brief Clears repository so that all the configurations are unset - inline void clear(void) { - base::threading::ScopedLock scopedLock(lock()); - unregisterAll(); - } - - /// @brief Gets configuration file used in parsing this configurations. - /// - /// @detail If this repository was set manually or by text this returns empty string. - inline const std::string& configurationFile(void) const { - return m_configurationFile; - } - - /// @brief Sets configurations to "factory based" configurations. - void setToDefault(void) { - setGlobally(ConfigurationType::Enabled, std::string("true"), true); -#if !defined(ELPP_NO_DEFAULT_LOG_FILE) - setGlobally(ConfigurationType::Filename, std::string(base::consts::kDefaultLogFile), true); -#else - ELPP_UNUSED(base::consts::kDefaultLogFile); -#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) - setGlobally(ConfigurationType::ToFile, std::string("true"), true); - setGlobally(ConfigurationType::ToStandardOutput, std::string("true"), true); - setGlobally(ConfigurationType::MillisecondsWidth, std::string("3"), true); - setGlobally(ConfigurationType::PerformanceTracking, std::string("true"), true); - setGlobally(ConfigurationType::MaxLogFileSize, std::string("0"), true); - setGlobally(ConfigurationType::LogFlushThreshold, std::string("0"), true); - - setGlobally(ConfigurationType::Format, std::string("%datetime %level [%logger] %msg"), true); - set(Level::Debug, ConfigurationType::Format, std::string("%datetime %level [%logger] [%user@%host] [%func] [%loc] %msg")); - // INFO and WARNING are set to default by Level::Global - set(Level::Error, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); - set(Level::Fatal, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); - set(Level::Verbose, ConfigurationType::Format, std::string("%datetime %level-%vlevel [%logger] %msg")); - set(Level::Trace, ConfigurationType::Format, std::string("%datetime %level [%logger] [%func] [%loc] %msg")); - } - - /// @brief Lets you set the remaining configurations to default. - /// - /// @detail By remaining, it means that the level/type a configuration does not exist for. - /// This function is useful when you want to minimize chances of failures, e.g, if you have a configuration file that sets - /// configuration for all the configurations except for Enabled or not, we use this so that ENABLED is set to default i.e, - /// true. If you dont do this explicitley (either by calling this function or by using second param in Constructor - /// and try to access a value, an error is thrown - void setRemainingToDefault(void) { - base::threading::ScopedLock scopedLock(lock()); - unsafeSetIfNotExist(Level::Global, ConfigurationType::Enabled, std::string("true")); -#if !defined(ELPP_NO_DEFAULT_LOG_FILE) - unsafeSetIfNotExist(Level::Global, ConfigurationType::Filename, std::string(base::consts::kDefaultLogFile)); -#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) - unsafeSetIfNotExist(Level::Global, ConfigurationType::ToFile, std::string("true")); - unsafeSetIfNotExist(Level::Global, ConfigurationType::ToStandardOutput, std::string("true")); - unsafeSetIfNotExist(Level::Global, ConfigurationType::MillisecondsWidth, std::string("3")); - unsafeSetIfNotExist(Level::Global, ConfigurationType::PerformanceTracking, std::string("true")); - unsafeSetIfNotExist(Level::Global, ConfigurationType::MaxLogFileSize, std::string("0")); - unsafeSetIfNotExist(Level::Global, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); - unsafeSetIfNotExist(Level::Debug, ConfigurationType::Format, - std::string("%datetime %level [%logger] [%user@%host] [%func] [%loc] %msg")); - // INFO and WARNING are set to default by Level::Global - unsafeSetIfNotExist(Level::Error, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); - unsafeSetIfNotExist(Level::Fatal, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); - unsafeSetIfNotExist(Level::Verbose, ConfigurationType::Format, std::string("%datetime %level-%vlevel [%logger] %msg")); - unsafeSetIfNotExist(Level::Trace, ConfigurationType::Format, std::string("%datetime %level [%logger] [%func] [%loc] %msg")); - } - - /// @brief Parser used internally to parse configurations from file or text. - /// - /// @detail This class makes use of base::utils::Str. - /// You should not need this unless you are working on some tool for Easylogging++ - class Parser : base::StaticClass { - public: - /// @brief Parses configuration from file. - /// @param configurationFile Full path to configuration file - /// @param sender Sender configurations pointer. Usually 'this' is used from calling class - /// @param base Configurations to base new configuration repository off. This value is used when you want to use - /// existing Configurations to base all the values and then set rest of configuration via configuration file. - /// @return True if successfully parsed, false otherwise. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you - /// do not proceed without successful parse. - static bool parseFromFile(const std::string& configurationFile, Configurations* sender, Configurations* base = nullptr) { - sender->setFromBase(base); - std::ifstream fileStream_(configurationFile.c_str(), std::ifstream::in); - ELPP_ASSERT(fileStream_.is_open(), "Unable to open configuration file [" << configurationFile << "] for parsing."); - bool parsedSuccessfully = false; - std::string line = std::string(); - Level currLevel = Level::Unknown; - std::string currConfigStr = std::string(); - std::string currLevelStr = std::string(); - while (fileStream_.good()) { - std::getline(fileStream_, line); - parsedSuccessfully = parseLine(&line, &currConfigStr, &currLevelStr, &currLevel, sender); - ELPP_ASSERT(parsedSuccessfully, "Unable to parse configuration line: " << line); - } - return parsedSuccessfully; - } - - /// @brief Parse configurations from configuration string. - /// - /// @detail This configuration string has same syntax as configuration file contents. Make sure all the necessary - /// new line characters are provided. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you - /// do not proceed without successful parse (This is recommended) - /// @param configurationsString - /// @param sender Sender configurations pointer. Usually 'this' is used from calling class - /// @param base Configurations to base new configuration repository off. This value is used when you want to use - /// existing Configurations to base all the values and then set rest of configuration via configuration text. - /// @return True if successfully parsed, false otherwise. - static bool parseFromText(const std::string& configurationsString, Configurations* sender, Configurations* base = nullptr) { - sender->setFromBase(base); - bool parsedSuccessfully = false; - std::stringstream ss(configurationsString); - std::string line = std::string(); - Level currLevel = Level::Unknown; - std::string currConfigStr = std::string(); - std::string currLevelStr = std::string(); - while (std::getline(ss, line)) { - parsedSuccessfully = parseLine(&line, &currConfigStr, &currLevelStr, &currLevel, sender); - ELPP_ASSERT(parsedSuccessfully, "Unable to parse configuration line: " << line); - } - return parsedSuccessfully; - } - - private: - friend class el::Loggers; - static void ignoreComments(std::string* line) { - std::size_t foundAt = 0; - std::size_t quotesStart = line->find("\""); - std::size_t quotesEnd = std::string::npos; - if (quotesStart != std::string::npos) { - quotesEnd = line->find("\"", quotesStart + 1); - while (quotesEnd != std::string::npos && line->at(quotesEnd - 1) == '\\') { - // Do not erase slash yet - we will erase it in parseLine(..) while loop - quotesEnd = line->find("\"", quotesEnd + 2); - } - } - if ((foundAt = line->find(base::consts::kConfigurationComment)) != std::string::npos) { - if (foundAt < quotesEnd) { - foundAt = line->find(base::consts::kConfigurationComment, quotesEnd + 1); - } - *line = line->substr(0, foundAt); - } - } - static inline bool isLevel(const std::string& line) { - return base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationLevel)); - } - - static inline bool isComment(const std::string& line) { - return base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationComment)); - } - - static inline bool isConfig(const std::string& line) { - std::size_t assignment = line.find('='); - return line != "" && - (line[0] >= 65 || line[0] <= 90 || line[0] >= 97 || line[0] <= 122) && - (assignment != std::string::npos) && - (line.size() > assignment); - } - - static bool parseLine(std::string* line, std::string* currConfigStr, std::string* currLevelStr, Level* currLevel, Configurations* conf) { - ConfigurationType currConfig = ConfigurationType::Unknown; - std::string currValue = std::string(); - *line = base::utils::Str::trim(*line); - if (isComment(*line)) return true; - ignoreComments(line); - *line = base::utils::Str::trim(*line); - if (line->empty()) { - // Comment ignored - return true; - } - if (isLevel(*line)) { - if (line->size() <= 2) { - return true; - } - *currLevelStr = line->substr(1, line->size() - 2); - *currLevelStr = base::utils::Str::toUpper(*currLevelStr); - *currLevelStr = base::utils::Str::trim(*currLevelStr); - *currLevel = LevelHelper::convertFromString(currLevelStr->c_str()); - return true; - } - if (isConfig(*line)) { - std::size_t assignment = line->find('='); - *currConfigStr = line->substr(0, assignment); - *currConfigStr = base::utils::Str::toUpper(*currConfigStr); - *currConfigStr = base::utils::Str::trim(*currConfigStr); - currConfig = ConfigurationTypeHelper::convertFromString(currConfigStr->c_str()); - currValue = line->substr(assignment + 1); - currValue = base::utils::Str::trim(currValue); - std::size_t quotesStart = currValue.find("\"", 0); - std::size_t quotesEnd = std::string::npos; - if (quotesStart != std::string::npos) { - quotesEnd = currValue.find("\"", quotesStart + 1); - while (quotesEnd != std::string::npos && currValue.at(quotesEnd - 1) == '\\') { - currValue = currValue.erase(quotesEnd - 1, 1); - quotesEnd = currValue.find("\"", quotesEnd + 2); - } - } - if (quotesStart != std::string::npos && quotesEnd != std::string::npos) { - // Quote provided - check and strip if valid - ELPP_ASSERT((quotesStart < quotesEnd), "Configuration error - No ending quote found in [" - << currConfigStr << "]"); - ELPP_ASSERT((quotesStart + 1 != quotesEnd), "Empty configuration value for [" << currConfigStr << "]"); - if ((quotesStart != quotesEnd) && (quotesStart + 1 != quotesEnd)) { - // Explicit check in case if assertion is disabled - currValue = currValue.substr(quotesStart + 1, quotesEnd - 1); - } - } - } - ELPP_ASSERT(*currLevel != Level::Unknown, "Unrecognized severity level [" << *currLevelStr << "]"); - ELPP_ASSERT(currConfig != ConfigurationType::Unknown, "Unrecognized configuration [" << *currConfigStr << "]"); - if (*currLevel == Level::Unknown || currConfig == ConfigurationType::Unknown) { - return false; // unrecognizable level or config - } - conf->set(*currLevel, currConfig, currValue); - return true; - } - }; - - private: - std::string m_configurationFile; - bool m_isFromFile; - friend class el::Loggers; - - /// @brief Unsafely sets configuration if does not already exist - void unsafeSetIfNotExist(Level level, ConfigurationType configurationType, const std::string& value) { - Configuration* conf = RegistryWithPred::get(level, configurationType); - if (conf == nullptr) { - unsafeSet(level, configurationType, value); - } - } - - /// @brief Thread unsafe set - void unsafeSet(Level level, ConfigurationType configurationType, const std::string& value) { - Configuration* conf = RegistryWithPred::get(level, configurationType); - if (conf == nullptr) { - registerNew(new Configuration(level, configurationType, value)); - } - else { - conf->setValue(value); - } - if (level == Level::Global) { - unsafeSetGlobally(configurationType, value, false); - } - } - - /// @brief Sets configurations for all levels including Level::Global if includeGlobalLevel is true - /// @see Configurations::setGlobally(ConfigurationType configurationType, const std::string& value) - void setGlobally(ConfigurationType configurationType, const std::string& value, bool includeGlobalLevel) { - if (includeGlobalLevel) { - set(Level::Global, configurationType, value); - } - base::type::EnumType lIndex = LevelHelper::kMinValid; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - set(LevelHelper::castFromInt(lIndex), configurationType, value); - return false; // Do not break lambda function yet as we need to set all levels regardless - }); - } - - /// @brief Sets configurations (Unsafely) for all levels including Level::Global if includeGlobalLevel is true - /// @see Configurations::setGlobally(ConfigurationType configurationType, const std::string& value) - void unsafeSetGlobally(ConfigurationType configurationType, const std::string& value, bool includeGlobalLevel) { - if (includeGlobalLevel) { - unsafeSet(Level::Global, configurationType, value); - } - base::type::EnumType lIndex = LevelHelper::kMinValid; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - unsafeSet(LevelHelper::castFromInt(lIndex), configurationType, value); - return false; // Do not break lambda function yet as we need to set all levels regardless - }); - } - }; - - namespace base { - typedef std::shared_ptr FileStreamPtr; - typedef std::map LogStreamsReferenceMap; - /// @brief Configurations with data types. - /// - /// @detail el::Configurations have string based values. This is whats used internally in order to read correct configurations. - /// This is to perform faster while writing logs using correct configurations. - /// - /// This is thread safe and final class containing non-virtual destructor (means nothing should inherit this class) - class TypedConfigurations : public base::threading::ThreadSafe { - public: - /// @brief Constructor to initialize (construct) the object off el::Configurations - /// @param configurations Configurations pointer/reference to base this typed configurations off. - /// @param logStreamsReference Use ELPP->registeredLoggers()->logStreamsReference() - TypedConfigurations(Configurations* configurations, base::LogStreamsReferenceMap* logStreamsReference) { - m_configurations = configurations; - m_logStreamsReference = logStreamsReference; - build(m_configurations); - } - - TypedConfigurations(const TypedConfigurations& other) { - this->m_configurations = other.m_configurations; - this->m_logStreamsReference = other.m_logStreamsReference; - build(m_configurations); - } - - virtual ~TypedConfigurations(void) { - } - - const Configurations* configurations(void) const { - return m_configurations; - } - - inline bool enabled(Level level) { - return getConfigByVal(level, &m_enabledMap, "enabled"); - } - - inline bool toFile(Level level) { - return getConfigByVal(level, &m_toFileMap, "toFile"); - } - - inline const std::string& filename(Level level) { - return getConfigByRef(level, &m_filenameMap, "filename"); - } - - inline bool toStandardOutput(Level level) { - return getConfigByVal(level, &m_toStandardOutputMap, "toStandardOutput"); - } - - inline const base::LogFormat& logFormat(Level level) { - return getConfigByRef(level, &m_logFormatMap, "logFormat"); - } - - inline const base::MillisecondsWidth& millisecondsWidth(Level level = Level::Global) { - return getConfigByRef(level, &m_millisecondsWidthMap, "millisecondsWidth"); - } - - inline bool performanceTracking(Level level = Level::Global) { - return getConfigByVal(level, &m_performanceTrackingMap, "performanceTracking"); - } - - inline base::type::fstream_t* fileStream(Level level) { - return getConfigByRef(level, &m_fileStreamMap, "fileStream").get(); - } - - inline std::size_t maxLogFileSize(Level level) { - return getConfigByVal(level, &m_maxLogFileSizeMap, "maxLogFileSize"); - } - - inline std::size_t logFlushThreshold(Level level) { - return getConfigByVal(level, &m_logFlushThresholdMap, "logFlushThreshold"); - } - - private: - Configurations* m_configurations; - std::map m_enabledMap; - std::map m_toFileMap; - std::map m_filenameMap; - std::map m_toStandardOutputMap; - std::map m_logFormatMap; - std::map m_millisecondsWidthMap; - std::map m_performanceTrackingMap; - std::map m_fileStreamMap; - std::map m_maxLogFileSizeMap; - std::map m_logFlushThresholdMap; - base::LogStreamsReferenceMap* m_logStreamsReference; - - friend class el::Helpers; - friend class el::base::MessageBuilder; - friend class el::base::Writer; - friend class el::base::DefaultLogDispatchCallback; - friend class el::base::LogDispatcher; - - template - inline Conf_T getConfigByVal(Level level, const std::map* confMap, const char* confName) { - base::threading::ScopedLock scopedLock(lock()); - return unsafeGetConfigByVal(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope - } - - template - inline Conf_T& getConfigByRef(Level level, std::map* confMap, const char* confName) { - base::threading::ScopedLock scopedLock(lock()); - return unsafeGetConfigByRef(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope - } - - template - inline Conf_T unsafeGetConfigByVal(Level level, const std::map* confMap, const char* confName) { - ELPP_UNUSED(confName); - typename std::map::const_iterator it = confMap->find(level); - if (it == confMap->end()) { - try { - return confMap->at(Level::Global); - } - catch (...) { - ELPP_INTERNAL_ERROR("Unable to get configuration [" << confName << "] for level [" - << LevelHelper::convertToString(level) << "]" - << std::endl << "Please ensure you have properly configured logger.", false); - return Conf_T(); - } - } - return it->second; - } - - template - inline Conf_T& unsafeGetConfigByRef(Level level, std::map* confMap, const char* confName) { - ELPP_UNUSED(confName); - typename std::map::iterator it = confMap->find(level); - if (it == confMap->end()) { - try { - return confMap->at(Level::Global); - } - catch (...) { - ELPP_INTERNAL_ERROR("Unable to get configuration [" << confName << "] for level [" - << LevelHelper::convertToString(level) << "]" - << std::endl << "Please ensure you have properly configured logger.", false); - } - } - return it->second; - } - - template - void setValue(Level level, const Conf_T& value, std::map* confMap, bool includeGlobalLevel = true) { - // If map is empty and we are allowed to add into generic level (Level::Global), do it! - if (confMap->empty() && includeGlobalLevel) { - confMap->insert(std::make_pair(Level::Global, value)); - return; - } - // If same value exist in generic level already, dont add it to explicit level - typename std::map::iterator it = confMap->find(Level::Global); - if (it != confMap->end() && it->second == value) { - return; - } - // Now make sure we dont double up values if we really need to add it to explicit level - it = confMap->find(level); - if (it == confMap->end()) { - // Value not found for level, add new - confMap->insert(std::make_pair(level, value)); - } - else { - // Value found, just update value - confMap->at(level) = value; - } - } - - void build(Configurations* configurations) { - base::threading::ScopedLock scopedLock(lock()); - auto getBool = [](std::string boolStr) -> bool { // Pass by value for trimming - base::utils::Str::trim(boolStr); - return (boolStr == "TRUE" || boolStr == "true" || boolStr == "1"); - }; - std::vector withFileSizeLimit; - for (Configurations::const_iterator it = configurations->begin(); it != configurations->end(); ++it) { - Configuration* conf = *it; - // We cannot use switch on strong enums because Intel C++ dont support them yet - if (conf->configurationType() == ConfigurationType::Enabled) { - setValue(conf->level(), getBool(conf->value()), &m_enabledMap); - } - else if (conf->configurationType() == ConfigurationType::ToFile) { - setValue(conf->level(), getBool(conf->value()), &m_toFileMap); - } - else if (conf->configurationType() == ConfigurationType::ToStandardOutput) { - setValue(conf->level(), getBool(conf->value()), &m_toStandardOutputMap); - } - else if (conf->configurationType() == ConfigurationType::Filename) { - // We do not yet configure filename but we will configure in another - // loop. This is because if file cannot be created, we will force ToFile - // to be false. Because configuring logger is not necessarily performance - // sensative operation, we can live with another loop; (by the way this loop - // is not very heavy either) - } - else if (conf->configurationType() == ConfigurationType::Format) { - setValue(conf->level(), base::LogFormat(conf->level(), - base::type::string_t(conf->value().begin(), conf->value().end())), &m_logFormatMap); - } - else if (conf->configurationType() == ConfigurationType::MillisecondsWidth) { - setValue(Level::Global, - base::MillisecondsWidth(static_cast(getULong(conf->value()))), &m_millisecondsWidthMap); - } - else if (conf->configurationType() == ConfigurationType::PerformanceTracking) { - setValue(Level::Global, getBool(conf->value()), &m_performanceTrackingMap); - } - else if (conf->configurationType() == ConfigurationType::MaxLogFileSize) { - setValue(conf->level(), static_cast(getULong(conf->value())), &m_maxLogFileSizeMap); -#if !defined(ELPP_NO_DEFAULT_LOG_FILE) - withFileSizeLimit.push_back(conf); -#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) - } - else if (conf->configurationType() == ConfigurationType::LogFlushThreshold) { - setValue(conf->level(), static_cast(getULong(conf->value())), &m_logFlushThresholdMap); - } - } - // As mentioned early, we will now set filename configuration in separate loop to deal with non-existent files - for (Configurations::const_iterator it = configurations->begin(); it != configurations->end(); ++it) { - Configuration* conf = *it; - if (conf->configurationType() == ConfigurationType::Filename) { - insertFile(conf->level(), conf->value()); - } - } - for (std::vector::iterator conf = withFileSizeLimit.begin(); - conf != withFileSizeLimit.end(); ++conf) { - // This is not unsafe as mutex is locked in currect scope - unsafeValidateFileRolling((*conf)->level(), base::defaultPreRollOutCallback); - } - } - - unsigned long getULong(std::string confVal) { - bool valid = true; - base::utils::Str::trim(confVal); - valid = !confVal.empty() && std::find_if(confVal.begin(), confVal.end(), - [](char c) { return !base::utils::Str::isDigit(c); }) == confVal.end(); - if (!valid) { - valid = false; - ELPP_ASSERT(valid, "Configuration value not a valid integer [" << confVal << "]"); - return 0; - } - return atol(confVal.c_str()); - } - - std::string resolveFilename(const std::string& filename) { - std::string resultingFilename = filename; - std::size_t dateIndex = std::string::npos; - std::string dateTimeFormatSpecifierStr = std::string(base::consts::kDateTimeFormatSpecifierForFilename); - if ((dateIndex = resultingFilename.find(dateTimeFormatSpecifierStr.c_str())) != std::string::npos) { - while (dateIndex > 0 && resultingFilename[dateIndex - 1] == base::consts::kFormatSpecifierChar) { - dateIndex = resultingFilename.find(dateTimeFormatSpecifierStr.c_str(), dateIndex + 1); - } - if (dateIndex != std::string::npos) { - const char* ptr = resultingFilename.c_str() + dateIndex; - // Goto end of specifier - ptr += dateTimeFormatSpecifierStr.size(); - std::string fmt; - if ((resultingFilename.size() > dateIndex) && (ptr[0] == '{')) { - // User has provided format for date/time - ++ptr; - int count = 1; // Start by 1 in order to remove starting brace - std::stringstream ss; - for (; *ptr; ++ptr, ++count) { - if (*ptr == '}') { - ++count; // In order to remove ending brace - break; - } - ss << *ptr; - } - resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), count); - fmt = ss.str(); - } - else { - fmt = std::string(base::consts::kDefaultDateTimeFormatInFilename); - } - base::MillisecondsWidth msWidth(3); - std::string now = base::utils::DateTime::getDateTime(fmt.c_str(), &msWidth); - base::utils::Str::replaceAll(now, '/', '-'); // Replace path element since we are dealing with filename - base::utils::Str::replaceAll(resultingFilename, dateTimeFormatSpecifierStr, now); - } - } - return resultingFilename; - } - - void insertFile(Level level, const std::string& fullFilename) { - std::string resolvedFilename = resolveFilename(fullFilename); - if (resolvedFilename.empty()) { - std::cerr << "Could not load empty file for logging, please re-check your configurations for level [" - << LevelHelper::convertToString(level) << "]"; - } - std::string filePath = base::utils::File::extractPathFromFilename(resolvedFilename, base::consts::kFilePathSeperator); - if (filePath.size() < resolvedFilename.size()) { - base::utils::File::createPath(filePath); - } - auto create = [&](Level level) { - base::LogStreamsReferenceMap::iterator filestreamIter = m_logStreamsReference->find(resolvedFilename); - base::type::fstream_t* fs = nullptr; - if (filestreamIter == m_logStreamsReference->end()) { - // We need a completely new stream, nothing to share with - fs = base::utils::File::newFileStream(resolvedFilename); - m_filenameMap.insert(std::make_pair(level, resolvedFilename)); - m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(fs))); - m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level)))); - } - else { - // Woops! we have an existing one, share it! - m_filenameMap.insert(std::make_pair(level, filestreamIter->first)); - m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(filestreamIter->second))); - fs = filestreamIter->second.get(); - } - if (fs == nullptr) { - // We display bad file error from newFileStream() - ELPP_INTERNAL_ERROR("Setting [TO_FILE] of [" - << LevelHelper::convertToString(level) << "] to FALSE", false); - setValue(level, false, &m_toFileMap); - } - }; - // If we dont have file conf for any level, create it for Level::Global first - // otherwise create for specified level - create(m_filenameMap.empty() && m_fileStreamMap.empty() ? Level::Global : level); - } - - bool unsafeValidateFileRolling(Level level, const PreRollOutCallback& PreRollOutCallback) { - base::type::fstream_t* fs = unsafeGetConfigByRef(level, &m_fileStreamMap, "fileStream").get(); - if (fs == nullptr) { - return true; - } - std::size_t maxLogFileSize = unsafeGetConfigByVal(level, &m_maxLogFileSizeMap, "maxLogFileSize"); - std::size_t currFileSize = base::utils::File::getSizeOfFile(fs); - if (maxLogFileSize != 0 && currFileSize >= maxLogFileSize) { - std::string fname = unsafeGetConfigByRef(level, &m_filenameMap, "filename"); - ELPP_INTERNAL_INFO(1, "Truncating log file [" << fname << "] as a result of configurations for level [" - << LevelHelper::convertToString(level) << "]"); - fs->close(); - PreRollOutCallback(fname.c_str(), currFileSize); - fs->open(fname, std::fstream::out | std::fstream::trunc); - return true; - } - return false; - } - - bool validateFileRolling(Level level, const PreRollOutCallback& PreRollOutCallback) { - base::threading::ScopedLock scopedLock(lock()); - return unsafeValidateFileRolling(level, PreRollOutCallback); - } - }; - /// @brief Class that keeps record of current line hit for occasional logging - class HitCounter { - public: - HitCounter(void) : - m_filename(""), - m_lineNumber(0), - m_hitCounts(0) { - } - - HitCounter(const char* filename, unsigned long int lineNumber) : - m_filename(filename), - m_lineNumber(lineNumber), - m_hitCounts(0) { - } - - HitCounter(const HitCounter& hitCounter) : - m_filename(hitCounter.m_filename), - m_lineNumber(hitCounter.m_lineNumber), - m_hitCounts(hitCounter.m_hitCounts) { - } - - HitCounter& operator=(const HitCounter& hitCounter) { - m_filename = hitCounter.m_filename; - m_lineNumber = hitCounter.m_lineNumber; - m_hitCounts = hitCounter.m_hitCounts; - return *this; - } - - virtual ~HitCounter(void) { - } - - /// @brief Resets location of current hit counter - inline void resetLocation(const char* filename, unsigned long int lineNumber) { - m_filename = filename; - m_lineNumber = lineNumber; - } - - /// @brief Validates hit counts and resets it if necessary - inline void validateHitCounts(std::size_t n) { - if (m_hitCounts >= base::consts::kMaxLogPerCounter) { - m_hitCounts = (n >= 1 ? base::consts::kMaxLogPerCounter % n : 0); - } - ++m_hitCounts; - } - - inline const char* filename(void) const { - return m_filename; - } - - inline unsigned long int lineNumber(void) const { - return m_lineNumber; - } - - inline std::size_t hitCounts(void) const { - return m_hitCounts; - } - - inline void increment(void) { - ++m_hitCounts; - } - - class Predicate { - public: - Predicate(const char* filename, unsigned long int lineNumber) - : m_filename(filename), - m_lineNumber(lineNumber) { - } - inline bool operator()(const HitCounter* counter) { - return ((counter != nullptr) && - (strcmp(counter->m_filename, m_filename) == 0) && - (counter->m_lineNumber == m_lineNumber)); - } - - private: - const char* m_filename; - unsigned long int m_lineNumber; - }; - - private: - const char* m_filename; - unsigned long int m_lineNumber; - std::size_t m_hitCounts; - }; - /// @brief Repository for hit counters used across the application - class RegisteredHitCounters : public base::utils::RegistryWithPred { - public: - /// @brief Validates counter for every N, i.e, registers new if does not exist otherwise updates original one - /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned - bool validateEveryN(const char* filename, unsigned long int lineNumber, std::size_t n) { - base::threading::ScopedLock scopedLock(lock()); - base::HitCounter* counter = get(filename, lineNumber); - if (counter == nullptr) { - registerNew(counter = new base::HitCounter(filename, lineNumber)); - } - counter->validateHitCounts(n); - bool result = (n >= 1 && counter->hitCounts() != 0 && counter->hitCounts() % n == 0); - return result; - } - - /// @brief Validates counter for hits >= N, i.e, registers new if does not exist otherwise updates original one - /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned - bool validateAfterN(const char* filename, unsigned long int lineNumber, std::size_t n) { - base::threading::ScopedLock scopedLock(lock()); - base::HitCounter* counter = get(filename, lineNumber); - if (counter == nullptr) { - registerNew(counter = new base::HitCounter(filename, lineNumber)); - } - // Do not use validateHitCounts here since we do not want to reset counter here - // Note the >= instead of > because we are incrementing - // after this check - if (counter->hitCounts() >= n) - return true; - counter->increment(); - return false; - } - - /// @brief Validates counter for hits are <= n, i.e, registers new if does not exist otherwise updates original one - /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned - bool validateNTimes(const char* filename, unsigned long int lineNumber, std::size_t n) { - base::threading::ScopedLock scopedLock(lock()); - base::HitCounter* counter = get(filename, lineNumber); - if (counter == nullptr) { - registerNew(counter = new base::HitCounter(filename, lineNumber)); - } - counter->increment(); - // Do not use validateHitCounts here since we do not want to reset counter here - if (counter->hitCounts() <= n) - return true; - return false; - } - - /// @brief Gets hit counter registered at specified position - inline const base::HitCounter* getCounter(const char* filename, unsigned long int lineNumber) { - base::threading::ScopedLock scopedLock(lock()); - return get(filename, lineNumber); - } - }; - /// @brief Action to be taken for dispatching - enum class DispatchAction : base::type::EnumType { - None = 1, NormalLog = 2, SysLog = 4 - }; - } // namespace base - template - class Callback : protected base::threading::ThreadSafe { - public: - Callback(void) : m_enabled(true) {} - inline bool enabled(void) const { return m_enabled; } - inline void setEnabled(bool enabled) { - base::threading::ScopedLock scopedLock(lock()); - m_enabled = enabled; - } - protected: - virtual void handle(const T* handlePtr) = 0; - private: - bool m_enabled; - }; - class LogDispatchData { - public: - LogDispatchData() : m_logMessage(nullptr), m_dispatchAction(base::DispatchAction::None) {} - inline const LogMessage* logMessage(void) const { return m_logMessage; } - inline base::DispatchAction dispatchAction(void) const { return m_dispatchAction; } - private: - LogMessage* m_logMessage; - base::DispatchAction m_dispatchAction; - friend class base::LogDispatcher; - - inline void setLogMessage(LogMessage* logMessage) { m_logMessage = logMessage; } - inline void setDispatchAction(base::DispatchAction dispatchAction) { m_dispatchAction = dispatchAction; } - }; - class LogDispatchCallback : public Callback { - private: - friend class base::LogDispatcher; - }; - class PerformanceTrackingCallback : public Callback { - private: - friend class base::PerformanceTracker; - }; - class LogBuilder : base::NoCopy { - public: - virtual ~LogBuilder(void) { ELPP_INTERNAL_INFO(3, "Destroying log builder...") } - virtual base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const = 0; - void convertToColoredOutput(base::type::string_t* logLine, Level level) { - if (!base::utils::s_termSupportsColor) return; - const base::type::char_t* resetColor = ELPP_LITERAL("\x1b[0m"); - if (level == Level::Error || level == Level::Fatal) - *logLine = ELPP_LITERAL("\x1b[31m") + *logLine + resetColor; - else if (level == Level::Warning) - *logLine = ELPP_LITERAL("\x1b[33m") + *logLine + resetColor; - } - private: - friend class el::base::DefaultLogDispatchCallback; - }; - typedef std::shared_ptr LogBuilderPtr; - /// @brief Represents a logger holding ID and configurations we need to write logs - /// - /// @detail This class does not write logs itself instead its used by writer to read configuations from. - class Logger : public base::threading::ThreadSafe, public Loggable { - public: - Logger(const std::string& id, base::LogStreamsReferenceMap* logStreamsReference) : - m_id(id), - m_typedConfigurations(nullptr), - m_parentApplicationName(std::string()), - m_isConfigured(false), - m_logStreamsReference(logStreamsReference) { - initUnflushedCount(); - } - - Logger(const std::string& id, const Configurations& configurations, base::LogStreamsReferenceMap* logStreamsReference) : - m_id(id), - m_typedConfigurations(nullptr), - m_parentApplicationName(std::string()), - m_isConfigured(false), - m_logStreamsReference(logStreamsReference) { - initUnflushedCount(); - configure(configurations); - } - - Logger(const Logger& logger) { - base::utils::safeDelete(m_typedConfigurations); - m_id = logger.m_id; - m_typedConfigurations = logger.m_typedConfigurations; - m_parentApplicationName = logger.m_parentApplicationName; - m_isConfigured = logger.m_isConfigured; - m_configurations = logger.m_configurations; - m_unflushedCount = logger.m_unflushedCount; - m_logStreamsReference = logger.m_logStreamsReference; - } - - Logger& operator=(const Logger& logger) { - base::utils::safeDelete(m_typedConfigurations); - m_id = logger.m_id; - m_typedConfigurations = logger.m_typedConfigurations; - m_parentApplicationName = logger.m_parentApplicationName; - m_isConfigured = logger.m_isConfigured; - m_configurations = logger.m_configurations; - m_unflushedCount = logger.m_unflushedCount; - m_logStreamsReference = logger.m_logStreamsReference; - return *this; - } - - virtual ~Logger(void) { - base::utils::safeDelete(m_typedConfigurations); - } - - virtual inline void log(el::base::type::ostream_t& os) const { - os << m_id.c_str(); - } - - /// @brief Configures the logger using specified configurations. - void configure(const Configurations& configurations) { - m_isConfigured = false; // we set it to false in case if we fail - initUnflushedCount(); - if (m_typedConfigurations != nullptr) { - Configurations* c = const_cast(m_typedConfigurations->configurations()); - if (c->hasConfiguration(Level::Global, ConfigurationType::Filename)) { - // This check is definitely needed for cases like ELPP_NO_DEFAULT_LOG_FILE - flush(); - } - } - base::threading::ScopedLock scopedLock(lock()); - if (m_configurations != configurations) { - m_configurations.setFromBase(const_cast(&configurations)); - } - base::utils::safeDelete(m_typedConfigurations); - m_typedConfigurations = new base::TypedConfigurations(&m_configurations, m_logStreamsReference); - resolveLoggerFormatSpec(); - m_isConfigured = true; - } - - /// @brief Reconfigures logger using existing configurations - inline void reconfigure(void) { - ELPP_INTERNAL_INFO(1, "Reconfiguring logger [" << m_id << "]"); - configure(m_configurations); - } - - inline const std::string& id(void) const { - return m_id; - } - - inline const std::string& parentApplicationName(void) const { - return m_parentApplicationName; - } - - inline void setParentApplicationName(const std::string& parentApplicationName) { - m_parentApplicationName = parentApplicationName; - } - - inline Configurations* configurations(void) { - return &m_configurations; - } - - inline base::TypedConfigurations* typedConfigurations(void) { - return m_typedConfigurations; - } - - static inline bool isValidId(const std::string& id) { - for (std::string::const_iterator it = id.begin(); it != id.end(); ++it) { - if (!base::utils::Str::contains(base::consts::kValidLoggerIdSymbols, *it)) { - return false; - } - } - return true; - } - /// @brief Flushes logger to sync all log files for all levels - inline void flush(void) { - ELPP_INTERNAL_INFO(3, "Flushing logger [" << m_id << "] all levels"); - base::threading::ScopedLock scopedLock(lock()); - base::type::EnumType lIndex = LevelHelper::kMinValid; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - flush(LevelHelper::castFromInt(lIndex), nullptr); - return false; - }); - } - - inline void flush(Level level, base::type::fstream_t* fs) { - if (fs == nullptr && m_typedConfigurations->toFile(level)) { - fs = m_typedConfigurations->fileStream(level); - } - if (fs != nullptr) { - fs->flush(); - m_unflushedCount.find(level)->second = 0; - } - } - - inline bool isFlushNeeded(Level level) { - return ++m_unflushedCount.find(level)->second >= m_typedConfigurations->logFlushThreshold(level); - } - - inline LogBuilder* logBuilder(void) const { - return m_logBuilder.get(); - } - - inline void setLogBuilder(const LogBuilderPtr& logBuilder) { - m_logBuilder = logBuilder; - } - - inline bool enabled(Level level) const { - return m_typedConfigurations->enabled(level); - } - -#if ELPP_VARIADIC_TEMPLATES_SUPPORTED -# define LOGGER_LEVEL_WRITERS_SIGNATURES(FUNCTION_NAME)\ - template \ - inline void FUNCTION_NAME(const char*, const T&, const Args&...);\ - template \ - inline void FUNCTION_NAME(const T&); - - template - inline void verbose(int, const char*, const T&, const Args&...); - - template - inline void verbose(int, const T&); - - LOGGER_LEVEL_WRITERS_SIGNATURES(info) - LOGGER_LEVEL_WRITERS_SIGNATURES(debug) - LOGGER_LEVEL_WRITERS_SIGNATURES(warn) - LOGGER_LEVEL_WRITERS_SIGNATURES(error) - LOGGER_LEVEL_WRITERS_SIGNATURES(fatal) - LOGGER_LEVEL_WRITERS_SIGNATURES(trace) -# undef LOGGER_LEVEL_WRITERS_SIGNATURES -#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED - private: - std::string m_id; - base::TypedConfigurations* m_typedConfigurations; - base::type::stringstream_t m_stream; - std::string m_parentApplicationName; - bool m_isConfigured; - Configurations m_configurations; - std::map m_unflushedCount; - base::LogStreamsReferenceMap* m_logStreamsReference; - LogBuilderPtr m_logBuilder; - - friend class el::LogMessage; - friend class el::Loggers; - friend class el::Helpers; - friend class el::base::RegisteredLoggers; - friend class el::base::DefaultLogDispatchCallback; - friend class el::base::MessageBuilder; - friend class el::base::Writer; - friend class el::base::PErrorWriter; - friend class el::base::Storage; - friend class el::base::PerformanceTracker; - friend class el::base::LogDispatcher; - - Logger(void); - -#if ELPP_VARIADIC_TEMPLATES_SUPPORTED - template - void log_(Level, int, const char*, const T&, const Args&...); - - template - inline void log_(Level, int, const T&); - - template - void log(Level, const char*, const T&, const Args&...); - - template - inline void log(Level, const T&); -#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED - - void initUnflushedCount(void) { - m_unflushedCount.clear(); - base::type::EnumType lIndex = LevelHelper::kMinValid; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - m_unflushedCount.insert(std::make_pair(LevelHelper::castFromInt(lIndex), 0)); - return false; - }); - } - - inline base::type::stringstream_t& stream(void) { - return m_stream; - } - - void resolveLoggerFormatSpec(void) const { - base::type::EnumType lIndex = LevelHelper::kMinValid; - LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { - base::LogFormat* logFormat = - const_cast(&m_typedConfigurations->logFormat(LevelHelper::castFromInt(lIndex))); - base::utils::Str::replaceFirstWithEscape(logFormat->m_format, base::consts::kLoggerIdFormatSpecifier, m_id); - return false; - }); - } - }; - namespace base { - /// @brief Loggers repository - class RegisteredLoggers : public base::utils::Registry { - public: - explicit RegisteredLoggers(const LogBuilderPtr& defaultLogBuilder) : - m_defaultLogBuilder(defaultLogBuilder) { - m_defaultConfigurations.setToDefault(); - } - - virtual ~RegisteredLoggers(void) { - flushAll(); - } - - inline void setDefaultConfigurations(const Configurations& configurations) { - base::threading::ScopedLock scopedLock(lock()); - m_defaultConfigurations.setFromBase(const_cast(&configurations)); - } - - inline Configurations* defaultConfigurations(void) { - return &m_defaultConfigurations; - } - - Logger* get(const std::string& id, bool forceCreation = true) { - base::threading::ScopedLock scopedLock(lock()); - Logger* logger_ = base::utils::Registry::get(id); - if (logger_ == nullptr && forceCreation) { - bool validId = Logger::isValidId(id); - if (!validId) { - ELPP_ASSERT(validId, "Invalid logger ID [" << id << "]. Not registering this logger."); - return nullptr; - } - logger_ = new Logger(id, m_defaultConfigurations, &m_logStreamsReference); - logger_->m_logBuilder = m_defaultLogBuilder; - registerNew(id, logger_); - } - return logger_; - } - - bool remove(const std::string& id) { - if (id == "default") { - return false; - } - Logger* logger = base::utils::Registry::get(id); - if (logger != nullptr) { - unregister(logger); - } - return true; - } - - inline bool has(const std::string& id) { - return get(id, false) != nullptr; - } - - inline void unregister(Logger*& logger) { - base::threading::ScopedLock scopedLock(lock()); - base::utils::Registry::unregister(logger->id()); - } - - inline base::LogStreamsReferenceMap* logStreamsReference(void) { - return &m_logStreamsReference; - } - - inline void flushAll(void) { - ELPP_INTERNAL_INFO(1, "Flushing all log files"); - base::threading::ScopedLock scopedLock(lock()); - for (base::LogStreamsReferenceMap::iterator it = m_logStreamsReference.begin(); - it != m_logStreamsReference.end(); ++it) { - if (it->second.get() == nullptr) continue; - it->second->flush(); - } - } - - private: - LogBuilderPtr m_defaultLogBuilder; - Configurations m_defaultConfigurations; - base::LogStreamsReferenceMap m_logStreamsReference; - friend class el::base::Storage; - }; - /// @brief Represents registries for verbose logging - class VRegistry : base::NoCopy, public base::threading::ThreadSafe { - public: - explicit VRegistry(base::type::VerboseLevel level, base::type::EnumType* pFlags) : m_level(level), m_pFlags(pFlags) { - } - - /// @brief Sets verbose level. Accepted range is 0-9 - inline void setLevel(base::type::VerboseLevel level) { - base::threading::ScopedLock scopedLock(lock()); - if (level < 0) - m_level = 0; - else if (level > 9) - m_level = base::consts::kMaxVerboseLevel; - else - m_level = level; - } - - inline base::type::VerboseLevel level(void) const { - return m_level; - } - - inline void clearModules(void) { - base::threading::ScopedLock scopedLock(lock()); - m_modules.clear(); - } - - void setModules(const char* modules) { - base::threading::ScopedLock scopedLock(lock()); - auto addSuffix = [](std::stringstream& ss, const char* sfx, const char* prev) { - if (prev != nullptr && base::utils::Str::endsWith(ss.str(), std::string(prev))) { - std::string chr(ss.str().substr(0, ss.str().size() - strlen(prev))); - ss.str(std::string("")); - ss << chr; - } - if (base::utils::Str::endsWith(ss.str(), std::string(sfx))) { - std::string chr(ss.str().substr(0, ss.str().size() - strlen(sfx))); - ss.str(std::string("")); - ss << chr; - } - ss << sfx; - }; - auto insert = [&](std::stringstream& ss, base::type::VerboseLevel level) { - if (!base::utils::hasFlag(LoggingFlag::DisableVModulesExtensions, *m_pFlags)) { - addSuffix(ss, ".h", nullptr); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".c", ".h"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".cpp", ".c"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".cc", ".cpp"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".cxx", ".cc"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".-inl.h", ".cxx"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".hxx", ".-inl.h"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".hpp", ".hxx"); - m_modules.insert(std::make_pair(ss.str(), level)); - addSuffix(ss, ".hh", ".hpp"); - } - m_modules.insert(std::make_pair(ss.str(), level)); - }; - bool isMod = true; - bool isLevel = false; - std::stringstream ss; - int level = -1; - for (; *modules; ++modules) { - switch (*modules) { - case '=': - isLevel = true; - isMod = false; - break; - case ',': - isLevel = false; - isMod = true; - if (!ss.str().empty() && level != -1) { - insert(ss, level); - ss.str(std::string("")); - level = -1; - } - break; - default: - if (isMod) { - ss << *modules; - } - else if (isLevel) { - if (isdigit(*modules)) { - level = static_cast(*modules) - 48; - } - } - break; - } - } - if (!ss.str().empty() && level != -1) { - insert(ss, level); - } - } - - bool allowed(base::type::VerboseLevel vlevel, const char* file) { - base::threading::ScopedLock scopedLock(lock()); - if (m_modules.empty() || file == nullptr) { - return vlevel <= m_level; - } - else { - std::map::iterator it = m_modules.begin(); - for (; it != m_modules.end(); ++it) { - if (base::utils::Str::wildCardMatch(file, it->first.c_str())) { - return vlevel <= it->second; - } - } - if (base::utils::hasFlag(LoggingFlag::AllowVerboseIfModuleNotSpecified, *m_pFlags)) { - return true; - } - return false; - } - } - - inline const std::map& modules(void) const { - return m_modules; - } - - void setFromArgs(const base::utils::CommandLineArgs* commandLineArgs) { - if (commandLineArgs->hasParam("-v") || commandLineArgs->hasParam("--verbose") || - commandLineArgs->hasParam("-V") || commandLineArgs->hasParam("--VERBOSE")) { - setLevel(base::consts::kMaxVerboseLevel); - } - else if (commandLineArgs->hasParamWithValue("--v")) { - setLevel(atoi(commandLineArgs->getParamValue("--v"))); - } - else if (commandLineArgs->hasParamWithValue("--V")) { - setLevel(atoi(commandLineArgs->getParamValue("--V"))); - } - else if ((commandLineArgs->hasParamWithValue("-vmodule")) && vModulesEnabled()) { - setModules(commandLineArgs->getParamValue("-vmodule")); - } - else if (commandLineArgs->hasParamWithValue("-VMODULE") && vModulesEnabled()) { - setModules(commandLineArgs->getParamValue("-VMODULE")); - } - } - - /// @brief Whether or not vModules enabled - inline bool vModulesEnabled(void) { - return !base::utils::hasFlag(LoggingFlag::DisableVModules, *m_pFlags); - } - - private: - base::type::VerboseLevel m_level; - base::type::EnumType* m_pFlags; - std::map m_modules; - }; - } // namespace base - class LogMessage { - public: - LogMessage(Level level, const std::string& file, unsigned long int line, const std::string& func, - base::type::VerboseLevel verboseLevel, Logger* logger) : - m_level(level), m_file(file), m_line(line), m_func(func), - m_verboseLevel(verboseLevel), m_logger(logger), m_message(std::move(logger->stream().str())) { - } - inline Level level(void) const { return m_level; } - inline const std::string& file(void) const { return m_file; } - inline unsigned long int line(void) const { return m_line; } // NOLINT - inline const std::string& func(void) const { return m_func; } - inline base::type::VerboseLevel verboseLevel(void) const { return m_verboseLevel; } - inline Logger* logger(void) const { return m_logger; } - inline const base::type::string_t& message(void) const { return m_message; } - private: - Level m_level; - std::string m_file; - unsigned long int m_line; - std::string m_func; - base::type::VerboseLevel m_verboseLevel; - Logger* m_logger; - base::type::string_t m_message; - }; - namespace base { -#if ELPP_ASYNC_LOGGING - class AsyncLogItem { - public: - explicit AsyncLogItem(const LogMessage& logMessage, const LogDispatchData& data, const base::type::string_t& logLine) - : m_logMessage(logMessage), m_dispatchData(data), m_logLine(logLine) {} - virtual ~AsyncLogItem() {} - inline LogMessage* logMessage(void) { return &m_logMessage; } - inline LogDispatchData* data(void) { return &m_dispatchData; } - inline base::type::string_t logLine(void) { return m_logLine; } - private: - LogMessage m_logMessage; - LogDispatchData m_dispatchData; - base::type::string_t m_logLine; - }; - class AsyncLogQueue : public base::threading::ThreadSafe { - public: - virtual ~AsyncLogQueue() { - ELPP_INTERNAL_INFO(6, "~AsyncLogQueue"); - } - - inline AsyncLogItem next(void) { - base::threading::ScopedLock scopedLock(lock()); - AsyncLogItem result = m_queue.front(); - m_queue.pop(); - return result; - } - - inline void push(const AsyncLogItem& item) { - base::threading::ScopedLock scopedLock(lock()); - m_queue.push(item); - } - inline void pop(void) { - base::threading::ScopedLock scopedLock(lock()); - m_queue.pop(); - } - inline AsyncLogItem front(void) { - base::threading::ScopedLock scopedLock(lock()); - return m_queue.front(); - } - inline bool empty(void) { - base::threading::ScopedLock scopedLock(lock()); - return m_queue.empty(); - } - private: - std::queue m_queue; - }; - class IWorker { - public: - virtual ~IWorker() {} - virtual void start() = 0; - }; -#endif // ELPP_ASYNC_LOGGING - /// @brief Easylogging++ management storage - class Storage : base::NoCopy, public base::threading::ThreadSafe { - public: -#if ELPP_ASYNC_LOGGING - Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker) : -#else - explicit Storage(const LogBuilderPtr& defaultLogBuilder) : -#endif // ELPP_ASYNC_LOGGING - m_registeredHitCounters(new base::RegisteredHitCounters()), - m_registeredLoggers(new base::RegisteredLoggers(defaultLogBuilder)), - m_flags(0x0), - m_vRegistry(new base::VRegistry(0, &m_flags)), -#if ELPP_ASYNC_LOGGING - m_asyncLogQueue(new base::AsyncLogQueue()), - m_asyncDispatchWorker(asyncDispatchWorker), -#endif // ELPP_ASYNC_LOGGING - m_preRollOutCallback(base::defaultPreRollOutCallback) { - // Register default logger - m_registeredLoggers->get(std::string(base::consts::kDefaultLoggerId)); - // Register performance logger and reconfigure format - Logger* performanceLogger = m_registeredLoggers->get(std::string(base::consts::kPerformanceLoggerId)); - performanceLogger->configurations()->setGlobally(ConfigurationType::Format, std::string("%datetime %level %msg")); - performanceLogger->reconfigure(); -#if defined(ELPP_SYSLOG) - // Register syslog logger and reconfigure format - Logger* sysLogLogger = m_registeredLoggers->get(std::string(base::consts::kSysLogLoggerId)); - sysLogLogger->configurations()->setGlobally(ConfigurationType::Format, std::string("%level: %msg")); - sysLogLogger->reconfigure(); -#else - ELPP_UNUSED(base::consts::kSysLogLoggerId); -#endif // defined(ELPP_SYSLOG) - addFlag(LoggingFlag::AllowVerboseIfModuleNotSpecified); -#if ELPP_ASYNC_LOGGING - installLogDispatchCallback(std::string("AsyncLogDispatchCallback")); -#else - installLogDispatchCallback(std::string("DefaultLogDispatchCallback")); -#endif // ELPP_ASYNC_LOGGING - installPerformanceTrackingCallback(std::string("DefaultPerformanceTrackingCallback")); - ELPP_INTERNAL_INFO(1, "Easylogging++ has been initialized"); -#if ELPP_ASYNC_LOGGING - m_asyncDispatchWorker->start(); -#endif // ELPP_ASYNC_LOGGING - } - - virtual ~Storage(void) { - ELPP_INTERNAL_INFO(4, "Destroying storage"); -#if ELPP_ASYNC_LOGGING - ELPP_INTERNAL_INFO(5, "Replacing log dispatch callback to synchronous"); - uninstallLogDispatchCallback(std::string("AsyncLogDispatchCallback")); - installLogDispatchCallback(std::string("DefaultLogDispatchCallback")); - ELPP_INTERNAL_INFO(5, "Destroying asyncDispatchWorker"); - base::utils::safeDelete(m_asyncDispatchWorker); - ELPP_INTERNAL_INFO(5, "Destroying asyncLogQueue"); - base::utils::safeDelete(m_asyncLogQueue); -#endif // ELPP_ASYNC_LOGGING - ELPP_INTERNAL_INFO(5, "Destroying registeredHitCounters"); - base::utils::safeDelete(m_registeredHitCounters); - ELPP_INTERNAL_INFO(5, "Destroying registeredLoggers"); - base::utils::safeDelete(m_registeredLoggers); - ELPP_INTERNAL_INFO(5, "Destroying vRegistry"); - base::utils::safeDelete(m_vRegistry); - } - - inline bool validateEveryNCounter(const char* filename, unsigned long int lineNumber, std::size_t occasion) { - return hitCounters()->validateEveryN(filename, lineNumber, occasion); - } - - inline bool validateAfterNCounter(const char* filename, unsigned long int lineNumber, std::size_t n) { // NOLINT - return hitCounters()->validateAfterN(filename, lineNumber, n); - } - - inline bool validateNTimesCounter(const char* filename, unsigned long int lineNumber, std::size_t n) { // NOLINT - return hitCounters()->validateNTimes(filename, lineNumber, n); - } - - inline base::RegisteredHitCounters* hitCounters(void) const { - return m_registeredHitCounters; - } - - inline base::RegisteredLoggers* registeredLoggers(void) const { - return m_registeredLoggers; - } - - inline base::VRegistry* vRegistry(void) const { - return m_vRegistry; - } - -#if ELPP_ASYNC_LOGGING - inline base::AsyncLogQueue* asyncLogQueue(void) const { - return m_asyncLogQueue; - } -#endif // ELPP_ASYNC_LOGGING - - inline const base::utils::CommandLineArgs* commandLineArgs(void) const { - return &m_commandLineArgs; - } - - inline void addFlag(LoggingFlag flag) { - base::utils::addFlag(flag, &m_flags); - } - - inline void removeFlag(LoggingFlag flag) { - base::utils::removeFlag(flag, &m_flags); - } - - inline bool hasFlag(LoggingFlag flag) const { - return base::utils::hasFlag(flag, m_flags); - } - - inline base::type::EnumType flags(void) const { - return m_flags; - } - - inline void setFlags(base::type::EnumType flags) { - m_flags = flags; - } - - inline void setPreRollOutCallback(const PreRollOutCallback& callback) { - m_preRollOutCallback = callback; - } - - inline void unsetPreRollOutCallback(void) { - m_preRollOutCallback = base::defaultPreRollOutCallback; - } - - inline PreRollOutCallback& preRollOutCallback(void) { - return m_preRollOutCallback; - } - - inline bool hasCustomFormatSpecifier(const char* formatSpecifier) { - base::threading::ScopedLock scopedLock(lock()); - return std::find(m_customFormatSpecifiers.begin(), m_customFormatSpecifiers.end(), - formatSpecifier) != m_customFormatSpecifiers.end(); - } - - inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) { - if (hasCustomFormatSpecifier(customFormatSpecifier.formatSpecifier())) { - return; - } - base::threading::ScopedLock scopedLock(lock()); - m_customFormatSpecifiers.push_back(customFormatSpecifier); - } - - inline bool uninstallCustomFormatSpecifier(const char* formatSpecifier) { - base::threading::ScopedLock scopedLock(lock()); - std::vector::iterator it = std::find(m_customFormatSpecifiers.begin(), - m_customFormatSpecifiers.end(), formatSpecifier); - if (it != m_customFormatSpecifiers.end() && strcmp(formatSpecifier, it->formatSpecifier()) == 0) { - m_customFormatSpecifiers.erase(it); - return true; - } - return false; - } - - const std::vector* customFormatSpecifiers(void) const { - return &m_customFormatSpecifiers; - } - - inline void setLoggingLevel(Level level) { - m_loggingLevel = level; - } - - template - inline bool installLogDispatchCallback(const std::string& id) { - return installCallback(id, &m_logDispatchCallbacks); - } - - template - inline void uninstallLogDispatchCallback(const std::string& id) { - uninstallCallback(id, &m_logDispatchCallbacks); - } - template - inline T* logDispatchCallback(const std::string& id) { - return callback(id, &m_logDispatchCallbacks); - } - - template - inline bool installPerformanceTrackingCallback(const std::string& id) { - return installCallback(id, &m_performanceTrackingCallbacks); - } - - template - inline void uninstallPerformanceTrackingCallback(const std::string& id) { - uninstallCallback(id, &m_performanceTrackingCallbacks); - } - - template - inline T* performanceTrackingCallback(const std::string& id) { - return callback(id, &m_performanceTrackingCallbacks); - } - private: - base::RegisteredHitCounters* m_registeredHitCounters; - base::RegisteredLoggers* m_registeredLoggers; - base::type::EnumType m_flags; - base::VRegistry* m_vRegistry; -#if ELPP_ASYNC_LOGGING - base::AsyncLogQueue* m_asyncLogQueue; - base::IWorker* m_asyncDispatchWorker; -#endif // ELPP_ASYNC_LOGGING - base::utils::CommandLineArgs m_commandLineArgs; - PreRollOutCallback m_preRollOutCallback; - std::map m_logDispatchCallbacks; - std::map m_performanceTrackingCallbacks; - std::vector m_customFormatSpecifiers; - Level m_loggingLevel; - - friend class el::Helpers; - friend class el::base::DefaultLogDispatchCallback; - friend class el::LogBuilder; - friend class el::base::MessageBuilder; - friend class el::base::Writer; - friend class el::base::PerformanceTracker; - friend class el::base::LogDispatcher; - - void setApplicationArguments(int argc, char** argv) { - m_commandLineArgs.setArgs(argc, argv); - m_vRegistry->setFromArgs(commandLineArgs()); - // default log file -#if !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) - if (m_commandLineArgs.hasParamWithValue(base::consts::kDefaultLogFileParam)) { - Configurations c; - c.setGlobally(ConfigurationType::Filename, std::string(m_commandLineArgs.getParamValue(base::consts::kDefaultLogFileParam))); - registeredLoggers()->setDefaultConfigurations(c); - for (base::RegisteredLoggers::iterator it = registeredLoggers()->begin(); - it != registeredLoggers()->end(); ++it) { - it->second->configure(c); - } - } -#endif // !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) -#if defined(ELPP_LOGGING_FLAGS_FROM_ARG) - if (m_commandLineArgs.hasParamWithValue(base::consts::kLoggingFlagsParam)) { - m_flags = atoi(m_commandLineArgs.getParamValue(base::consts::kLoggingFlagsParam)); - } -#endif // defined(ELPP_LOGGING_FLAGS_FROM_ARG) - } - - inline void setApplicationArguments(int argc, const char** argv) { - setApplicationArguments(argc, const_cast(argv)); - } - - template - inline bool installCallback(const std::string& id, std::map* mapT) { - if (mapT->find(id) == mapT->end()) { - mapT->insert(std::make_pair(id, TPtr(new T()))); - return true; - } - return false; - } - - template - inline void uninstallCallback(const std::string& id, std::map* mapT) { - if (mapT->find(id) != mapT->end()) { - mapT->erase(id); - } - } - - template - inline T* callback(const std::string& id, std::map* mapT) { - typename std::map::iterator iter = mapT->find(id); - if (iter != mapT->end()) { - return static_cast(iter->second.get()); - } - return nullptr; - } - }; - extern ELPP_EXPORT base::type::StoragePointer elStorage; -#define ELPP el::base::elStorage - class DefaultLogDispatchCallback : public LogDispatchCallback { - protected: - void handle(const LogDispatchData* data) { - m_data = data; - dispatch(std::move(m_data->logMessage()->logger()->logBuilder()->build(m_data->logMessage(), - m_data->dispatchAction() == base::DispatchAction::NormalLog))); - } - private: - const LogDispatchData* m_data; - void dispatch(base::type::string_t&& logLine) { - if (m_data->dispatchAction() == base::DispatchAction::NormalLog) { - if (m_data->logMessage()->logger()->m_typedConfigurations->toFile(m_data->logMessage()->level())) { - base::type::fstream_t* fs = m_data->logMessage()->logger()->m_typedConfigurations->fileStream(m_data->logMessage()->level()); - if (fs != nullptr) { - fs->write(logLine.c_str(), logLine.size()); - if (fs->fail()) { - ELPP_INTERNAL_ERROR("Unable to write log to file [" - << m_data->logMessage()->logger()->m_typedConfigurations->filename(m_data->logMessage()->level()) << "].\n" - << "Few possible reasons (could be something else):\n" << " * Permission denied\n" - << " * Disk full\n" << " * Disk is not writable", true); - } - else { - if (ELPP->hasFlag(LoggingFlag::ImmediateFlush) || (m_data->logMessage()->logger()->isFlushNeeded(m_data->logMessage()->level()))) { - m_data->logMessage()->logger()->flush(m_data->logMessage()->level(), fs); - } - } - } - else { - ELPP_INTERNAL_ERROR("Log file for [" << LevelHelper::convertToString(m_data->logMessage()->level()) << "] " - << "has not been configured but [TO_FILE] is configured to TRUE. [Logger ID: " - << m_data->logMessage()->logger()->id() << "]", false); - } - } - if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) { - if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput)) - m_data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, m_data->logMessage()->level()); - ELPP_COUT << ELPP_COUT_LINE(logLine); - } - } -#if defined(ELPP_SYSLOG) - else if (m_data->dispatchAction() == base::DispatchAction::SysLog) { - // Determine syslog priority - int sysLogPriority = 0; - if (m_data->logMessage()->level() == Level::Fatal) - sysLogPriority = LOG_EMERG; - else if (m_data->logMessage()->level() == Level::Error) - sysLogPriority = LOG_ERR; - else if (m_data->logMessage()->level() == Level::Warning) - sysLogPriority = LOG_WARNING; - else if (m_data->logMessage()->level() == Level::Info) - sysLogPriority = LOG_INFO; - else if (m_data->logMessage()->level() == Level::Debug) - sysLogPriority = LOG_DEBUG; - else - sysLogPriority = LOG_NOTICE; -# if defined(ELPP_UNICODE) - char* line = base::utils::Str::wcharPtrToCharPtr(logLine.c_str()); - syslog(sysLogPriority, "%s", line); - free(line); -# else - syslog(sysLogPriority, "%s", logLine.c_str()); -# endif - } -#endif // defined(ELPP_SYSLOG) - } - }; -#if ELPP_ASYNC_LOGGING - class AsyncLogDispatchCallback : public LogDispatchCallback { - protected: - void handle(const LogDispatchData* data) { - base::type::string_t logLine = data->logMessage()->logger()->logBuilder()->build(data->logMessage(), data->dispatchAction() == base::DispatchAction::NormalLog); - if (data->dispatchAction() == base::DispatchAction::NormalLog && data->logMessage()->logger()->typedConfigurations()->toStandardOutput(data->logMessage()->level())) { - if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput)) - data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, data->logMessage()->level()); - ELPP_COUT << ELPP_COUT_LINE(logLine); - } - // Save resources and only queue if we want to write to file otherwise just ignore handler - if (data->logMessage()->logger()->typedConfigurations()->toFile(data->logMessage()->level())) { - ELPP->asyncLogQueue()->push(AsyncLogItem(*(data->logMessage()), *data, logLine)); - } - } - }; - class AsyncDispatchWorker : public base::IWorker, public base::threading::ThreadSafe { - public: - AsyncDispatchWorker() { - setContinueRunning(false); - } - - virtual ~AsyncDispatchWorker() { - setContinueRunning(false); - ELPP_INTERNAL_INFO(6, "Stopping dispatch worker - Cleaning log queue"); - clean(); - ELPP_INTERNAL_INFO(6, "Log queue cleaned"); - } - - inline bool clean() { - std::mutex m; - std::unique_lock lk(m); - cv.wait(lk, [] { return !ELPP->asyncLogQueue()->empty(); }); - emptyQueue(); - lk.unlock(); - cv.notify_one(); - return ELPP->asyncLogQueue()->empty(); - } - - inline void emptyQueue() { - while (!ELPP->asyncLogQueue()->empty()) { - AsyncLogItem data = ELPP->asyncLogQueue()->next(); - handle(&data); - base::threading::msleep(100); - } - } - - virtual inline void start() { - base::threading::msleep(5000); // Wait extra few seconds - setContinueRunning(true); - std::thread t1(&AsyncDispatchWorker::runner, this); - t1.join(); - } - - void handle(AsyncLogItem* logItem) { - LogDispatchData* data = logItem->data(); - LogMessage* logMessage = logItem->logMessage(); - Logger* logger = logMessage->logger(); - base::TypedConfigurations* conf = logger->typedConfigurations(); - base::type::string_t logLine = logItem->logLine(); - if (data->dispatchAction() == base::DispatchAction::NormalLog) { - if (conf->toFile(logMessage->level())) { - base::type::fstream_t* fs = conf->fileStream(logMessage->level()); - if (fs != nullptr) { - fs->write(logLine.c_str(), logLine.size()); - if (fs->fail()) { - ELPP_INTERNAL_ERROR("Unable to write log to file [" - << conf->filename(logMessage->level()) << "].\n" - << "Few possible reasons (could be something else):\n" << " * Permission denied\n" - << " * Disk full\n" << " * Disk is not writable", true); - } - else { - if (ELPP->hasFlag(LoggingFlag::ImmediateFlush) || (logger->isFlushNeeded(logMessage->level()))) { - logger->flush(logMessage->level(), fs); - } - } - } - else { - ELPP_INTERNAL_ERROR("Log file for [" << LevelHelper::convertToString(logMessage->level()) << "] " - << "has not been configured but [TO_FILE] is configured to TRUE. [Logger ID: " << logger->id() << "]", false); - } - } - } -# if defined(ELPP_SYSLOG) - else if (data->dispatchAction() == base::DispatchAction::SysLog) { - // Determine syslog priority - int sysLogPriority = 0; - if (logMessage->level() == Level::Fatal) - sysLogPriority = LOG_EMERG; - else if (logMessage->level() == Level::Error) - sysLogPriority = LOG_ERR; - else if (logMessage->level() == Level::Warning) - sysLogPriority = LOG_WARNING; - else if (logMessage->level() == Level::Info) - sysLogPriority = LOG_INFO; - else if (logMessage->level() == Level::Debug) - sysLogPriority = LOG_DEBUG; - else - sysLogPriority = LOG_NOTICE; -# if defined(ELPP_UNICODE) - char* line = base::utils::Str::wcharPtrToCharPtr(logLine.c_str()); - syslog(sysLogPriority, "%s", line); - free(line); -# else - syslog(sysLogPriority, "%s", logLine.c_str()); -# endif - } -# endif // defined(ELPP_SYSLOG) - } - - void run() { - while (continueRunning()) { - emptyQueue(); - base::threading::msleep(10); // 10ms - } - } - - static void* runner(void *context) { - static_cast(context)->run(); - return NULL; - } - - void setContinueRunning(bool value) { - base::threading::ScopedLock scopedLock(m_continueRunningMutex); - m_continueRunning = value; - } - bool continueRunning(void) { - return m_continueRunning; - } - private: - std::condition_variable cv; - bool m_continueRunning; - base::threading::Mutex m_continueRunningMutex; - }; -#endif // ELPP_ASYNC_LOGGING - } // namespace base - namespace base { - class DefaultLogBuilder : public LogBuilder { - public: - base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const { - base::TypedConfigurations* tc = logMessage->logger()->typedConfigurations(); - const base::LogFormat* logFormat = &tc->logFormat(logMessage->level()); - base::type::string_t logLine = logFormat->format(); - char buff[base::consts::kSourceFilenameMaxLength + base::consts::kSourceLineMaxLength] = ""; - const char* bufLim = buff + sizeof(buff); - if (logFormat->hasFlag(base::FormatFlags::AppName)) { - // App name - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kAppNameFormatSpecifier, - logMessage->logger()->parentApplicationName()); - } - if (logFormat->hasFlag(base::FormatFlags::ThreadId)) { - // Thread ID - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kThreadIdFormatSpecifier, - base::threading::getCurrentThreadId()); - } - if (logFormat->hasFlag(base::FormatFlags::DateTime)) { - // DateTime - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kDateTimeFormatSpecifier, - base::utils::DateTime::getDateTime(logFormat->dateTimeFormat().c_str(), - &tc->millisecondsWidth(logMessage->level()))); - } - if (logFormat->hasFlag(base::FormatFlags::Function)) { - // Function - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFunctionFormatSpecifier, logMessage->func()); - } - if (logFormat->hasFlag(base::FormatFlags::File)) { - // File - char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceFilenameMaxLength); - base::utils::File::buildStrippedFilename(logMessage->file().c_str(), buff); - buf = base::utils::Str::addToBuff(buff, buf, bufLim); - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFileFormatSpecifier, std::string(buff)); - } - if (logFormat->hasFlag(base::FormatFlags::FileBase)) { - // FileBase - char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceFilenameMaxLength); - base::utils::File::buildBaseFilename(logMessage->file(), buff); - buf = base::utils::Str::addToBuff(buff, buf, bufLim); - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFileBaseFormatSpecifier, std::string(buff)); - } - if (logFormat->hasFlag(base::FormatFlags::Line)) { - // Line - char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceLineMaxLength); - buf = base::utils::Str::convertAndAddToBuff(logMessage->line(), - base::consts::kSourceLineMaxLength, buf, bufLim, false); - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogLineFormatSpecifier, std::string(buff)); - } - if (logFormat->hasFlag(base::FormatFlags::Location)) { - // Location - char* buf = base::utils::Str::clearBuff(buff, - base::consts::kSourceFilenameMaxLength + base::consts::kSourceLineMaxLength); - base::utils::File::buildStrippedFilename(logMessage->file().c_str(), buff); - buf = base::utils::Str::addToBuff(buff, buf, bufLim); - buf = base::utils::Str::addToBuff(":", buf, bufLim); - buf = base::utils::Str::convertAndAddToBuff(logMessage->line(), - base::consts::kSourceLineMaxLength, buf, bufLim, false); - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogLocationFormatSpecifier, std::string(buff)); - } - if (logMessage->level() == Level::Verbose && logFormat->hasFlag(base::FormatFlags::VerboseLevel)) { - // Verbose level - char* buf = base::utils::Str::clearBuff(buff, 1); - buf = base::utils::Str::convertAndAddToBuff(logMessage->verboseLevel(), 1, buf, bufLim, false); - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kVerboseLevelFormatSpecifier, std::string(buff)); - } - if (logFormat->hasFlag(base::FormatFlags::LogMessage)) { - // Log message - base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kMessageFormatSpecifier, logMessage->message()); - } -#if !defined(ELPP_DISABLE_CUSTOM_FORMAT_SPECIFIERS) - for (std::vector::const_iterator it = ELPP->customFormatSpecifiers()->begin(); - it != ELPP->customFormatSpecifiers()->end(); ++it) { - std::string fs(it->formatSpecifier()); - base::type::string_t wcsFormatSpecifier(fs.begin(), fs.end()); - base::utils::Str::replaceFirstWithEscape(logLine, wcsFormatSpecifier, std::string(it->resolver()())); - } -#endif // !defined(ELPP_DISABLE_CUSTOM_FORMAT_SPECIFIERS) - if (appendNewLine) logLine += ELPP_LITERAL("\n"); - return logLine; - } - }; - /// @brief Dispatches log messages - class LogDispatcher : base::NoCopy { - public: - LogDispatcher(bool proceed, LogMessage&& logMessage, base::DispatchAction dispatchAction) : - m_proceed(proceed), - m_logMessage(std::move(logMessage)), - m_dispatchAction(std::move(dispatchAction)) { - } - - void dispatch(void) { - if (m_proceed && m_dispatchAction == base::DispatchAction::None) { - m_proceed = false; - } - if (!m_proceed) { - return; - } - // We minimize the time of ELPP's lock - this lock is released after log is written - base::threading::ScopedLock scopedLock(ELPP->lock()); - base::TypedConfigurations* tc = m_logMessage.logger()->m_typedConfigurations; - if (ELPP->hasFlag(LoggingFlag::StrictLogFileSizeCheck)) { - tc->validateFileRolling(m_logMessage.level(), ELPP->preRollOutCallback()); - } - LogDispatchCallback* callback = nullptr; - LogDispatchData data; - for (const std::pair& h - : ELPP->m_logDispatchCallbacks) { - callback = h.second.get(); - if (callback != nullptr && callback->enabled()) { - data.setLogMessage(&m_logMessage); - data.setDispatchAction(m_dispatchAction); - callback->acquireLock(); - callback->handle(&data); - callback->releaseLock(); - } - } - } - - private: - bool m_proceed; - LogMessage m_logMessage; - base::DispatchAction m_dispatchAction; - }; -#if defined(ELPP_STL_LOGGING) - /// @brief Workarounds to write some STL logs - /// - /// @detail There is workaround needed to loop through some stl containers. In order to do that, we need iterable containers - /// of same type and provide iterator interface and pass it on to writeIterator(). - /// Remember, this is passed by value in constructor so that we dont change original containers. - /// This operation is as expensive as Big-O(std::min(class_.size(), base::consts::kMaxLogPerContainer)) - namespace workarounds { - /// @brief Abstract IterableContainer template that provides interface for iterable classes of type T - template - class IterableContainer { - public: - typedef typename Container::iterator iterator; - typedef typename Container::const_iterator const_iterator; - IterableContainer(void) {} - virtual ~IterableContainer(void) {} - iterator begin(void) { return getContainer().begin(); } - iterator end(void) { return getContainer().end(); } - private: - virtual Container& getContainer(void) = 0; - }; - /// @brief Implements IterableContainer and provides iterable std::priority_queue class - template, typename Comparator = std::less> - class IterablePriorityQueue : public IterableContainer, public std::priority_queue { - public: - IterablePriorityQueue(std::priority_queue queue_) { - std::size_t count_ = 0; - while (++count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) { - this->push(queue_.top()); - queue_.pop(); - } - } - private: - inline Container& getContainer(void) { - return this->c; - } - }; - /// @brief Implements IterableContainer and provides iterable std::queue class - template> - class IterableQueue : public IterableContainer, public std::queue { - public: - IterableQueue(std::queue queue_) { - std::size_t count_ = 0; - while (++count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) { - this->push(queue_.front()); - queue_.pop(); - } - } - private: - inline Container& getContainer(void) { - return this->c; - } - }; - /// @brief Implements IterableContainer and provides iterable std::stack class - template> - class IterableStack : public IterableContainer, public std::stack { - public: - IterableStack(std::stack stack_) { - std::size_t count_ = 0; - while (++count_ < base::consts::kMaxLogPerContainer && !stack_.empty()) { - this->push(stack_.top()); - stack_.pop(); - } - } - private: - inline Container& getContainer(void) { - return this->c; - } - }; - } // namespace workarounds -#endif // defined(ELPP_STL_LOGGING) - // Log message builder - class MessageBuilder { - public: - MessageBuilder(void) : m_logger(nullptr), m_containerLogSeperator(ELPP_LITERAL("")) {} - void initialize(Logger* logger) { - m_logger = logger; - m_containerLogSeperator = ELPP->hasFlag(LoggingFlag::NewLineForContainer) ? - ELPP_LITERAL("\n ") : ELPP_LITERAL(", "); - } - -# define ELPP_SIMPLE_LOG(LOG_TYPE)\ - inline MessageBuilder& operator<<(LOG_TYPE msg) {\ - m_logger->stream() << msg;\ - if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) {\ - m_logger->stream() << " ";\ - }\ - return *this;\ - } - - inline MessageBuilder& operator<<(const std::string& msg) { - return operator<<(msg.c_str()); - } - ELPP_SIMPLE_LOG(char) - ELPP_SIMPLE_LOG(bool) - ELPP_SIMPLE_LOG(signed short) - ELPP_SIMPLE_LOG(unsigned short) - ELPP_SIMPLE_LOG(signed int) - ELPP_SIMPLE_LOG(unsigned int) - ELPP_SIMPLE_LOG(signed long) - ELPP_SIMPLE_LOG(unsigned long) - ELPP_SIMPLE_LOG(float) - ELPP_SIMPLE_LOG(double) - ELPP_SIMPLE_LOG(char*) - ELPP_SIMPLE_LOG(const char*) - ELPP_SIMPLE_LOG(const void*) - ELPP_SIMPLE_LOG(long double) - inline MessageBuilder& operator<<(const std::wstring& msg) { - return operator<<(msg.c_str()); - } - inline MessageBuilder& operator<<(const wchar_t* msg) { - if (msg == nullptr) { - m_logger->stream() << base::consts::kNullPointer; - return *this; - } -# if defined(ELPP_UNICODE) - m_logger->stream() << msg; -# else - char* buff_ = base::utils::Str::wcharPtrToCharPtr(msg); - m_logger->stream() << buff_; - free(buff_); -# endif - if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) { - m_logger->stream() << " "; - } - return *this; - } - // ostream manipulators - inline MessageBuilder& operator<<(std::ostream& (*OStreamMani)(std::ostream&)) { - m_logger->stream() << OStreamMani; - return *this; - } -#define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp) \ - template \ - inline MessageBuilder& operator<<(const temp& template_inst) { \ - return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ - } -#define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp) \ - template \ - inline MessageBuilder& operator<<(const temp& template_inst) { \ - return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ - } -#define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp) \ - template \ - inline MessageBuilder& operator<<(const temp& template_inst) { \ - return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ - } -#define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp) \ - template \ - inline MessageBuilder& operator<<(const temp& template_inst) { \ - return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ - } -#define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp) \ - template \ - inline MessageBuilder& operator<<(const temp& template_inst) { \ - return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ - } - -#if defined(ELPP_STL_LOGGING) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::vector) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::list) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::deque) - ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(std::set) - ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(std::multiset) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::map) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::multimap) - template - inline MessageBuilder& operator<<(const std::queue& queue_) { - base::workarounds::IterableQueue iterableQueue_ = - static_cast >(queue_); - return writeIterator(iterableQueue_.begin(), iterableQueue_.end(), iterableQueue_.size()); - } - template - inline MessageBuilder& operator<<(const std::stack& stack_) { - base::workarounds::IterableStack iterableStack_ = - static_cast >(stack_); - return writeIterator(iterableStack_.begin(), iterableStack_.end(), iterableStack_.size()); - } - template - inline MessageBuilder& operator<<(const std::priority_queue& priorityQueue_) { - base::workarounds::IterablePriorityQueue iterablePriorityQueue_ = - static_cast >(priorityQueue_); - return writeIterator(iterablePriorityQueue_.begin(), iterablePriorityQueue_.end(), iterablePriorityQueue_.size()); - } - template - inline MessageBuilder& operator<<(const std::pair& pair_) { - m_logger->stream() << ELPP_LITERAL("("); - operator << (static_cast(pair_.first)); - m_logger->stream() << ELPP_LITERAL(", "); - operator << (static_cast(pair_.second)); - m_logger->stream() << ELPP_LITERAL(")"); - return *this; - } - template - inline MessageBuilder& operator<<(const std::bitset& bitset_) { - m_logger->stream() << ELPP_LITERAL("["); - operator << (bitset_.to_string()); - m_logger->stream() << ELPP_LITERAL("]"); - return *this; - } -# if defined(ELPP_LOG_STD_ARRAY) - template - inline MessageBuilder& operator<<(const std::array& array) { - return writeIterator(array.begin(), array.end(), array.size()); - } -# endif // defined(ELPP_LOG_STD_ARRAY) -# if defined(ELPP_LOG_UNORDERED_MAP) - ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(std::unordered_map) - ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(std::unordered_multimap) -# endif // defined(ELPP_LOG_UNORDERED_MAP) -# if defined(ELPP_LOG_UNORDERED_SET) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::unordered_set) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::unordered_multiset) -# endif // defined(ELPP_LOG_UNORDERED_SET) -#endif // defined(ELPP_STL_LOGGING) -#if defined(ELPP_QT_LOGGING) - inline MessageBuilder& operator<<(const QString& msg) { -# if defined(ELPP_UNICODE) - m_logger->stream() << msg.toStdWString(); -# else - m_logger->stream() << msg.toStdString(); -# endif // defined(ELPP_UNICODE) - return *this; - } - inline MessageBuilder& operator<<(const QByteArray& msg) { - return operator << (QString(msg)); - } - inline MessageBuilder& operator<<(const QStringRef& msg) { - return operator<<(msg.toString()); - } - inline MessageBuilder& operator<<(qint64 msg) { -# if defined(ELPP_UNICODE) - m_logger->stream() << QString::number(msg).toStdWString(); -# else - m_logger->stream() << QString::number(msg).toStdString(); -# endif // defined(ELPP_UNICODE) - return *this; - } - inline MessageBuilder& operator<<(quint64 msg) { -# if defined(ELPP_UNICODE) - m_logger->stream() << QString::number(msg).toStdWString(); -# else - m_logger->stream() << QString::number(msg).toStdString(); -# endif // defined(ELPP_UNICODE) - return *this; - } - inline MessageBuilder& operator<<(QChar msg) { - m_logger->stream() << msg.toLatin1(); - return *this; - } - inline MessageBuilder& operator<<(const QLatin1String& msg) { - m_logger->stream() << msg.latin1(); - return *this; - } - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QList) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QVector) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QQueue) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QSet) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QLinkedList) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QStack) - template - inline MessageBuilder& operator<<(const QPair& pair_) { - m_logger->stream() << ELPP_LITERAL("("); - operator << (static_cast(pair_.first)); - m_logger->stream() << ELPP_LITERAL(", "); - operator << (static_cast(pair_.second)); - m_logger->stream() << ELPP_LITERAL(")"); - return *this; - } - template - inline MessageBuilder& operator<<(const QMap& map_) { - m_logger->stream() << ELPP_LITERAL("["); - QList keys = map_.keys(); - typename QList::const_iterator begin = keys.begin(); - typename QList::const_iterator end = keys.end(); - int max_ = static_cast(base::consts::kMaxLogPerContainer); // to prevent warning - for (int index_ = 0; begin != end && index_ < max_; ++index_, ++begin) { - m_logger->stream() << ELPP_LITERAL("("); - operator << (static_cast(*begin)); - m_logger->stream() << ELPP_LITERAL(", "); - operator << (static_cast(map_.value(*begin))); - m_logger->stream() << ELPP_LITERAL(")"); - m_logger->stream() << ((index_ < keys.size() - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); - } - if (begin != end) { - m_logger->stream() << ELPP_LITERAL("..."); - } - m_logger->stream() << ELPP_LITERAL("]"); - return *this; - } - template - inline MessageBuilder& operator<<(const QMultiMap& map_) { - operator << (static_cast>(map_)); - return *this; - } - template - inline MessageBuilder& operator<<(const QHash& hash_) { - m_logger->stream() << ELPP_LITERAL("["); - QList keys = hash_.keys(); - typename QList::const_iterator begin = keys.begin(); - typename QList::const_iterator end = keys.end(); - int max_ = static_cast(base::consts::kMaxLogPerContainer); // prevent type warning - for (int index_ = 0; begin != end && index_ < max_; ++index_, ++begin) { - m_logger->stream() << ELPP_LITERAL("("); - operator << (static_cast(*begin)); - m_logger->stream() << ELPP_LITERAL(", "); - operator << (static_cast(hash_.value(*begin))); - m_logger->stream() << ELPP_LITERAL(")"); - m_logger->stream() << ((index_ < keys.size() - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); - } - if (begin != end) { - m_logger->stream() << ELPP_LITERAL("..."); - } - m_logger->stream() << ELPP_LITERAL("]"); - return *this; - } - template - inline MessageBuilder& operator<<(const QMultiHash& multiHash_) { - operator << (static_cast>(multiHash_)); - return *this; - } -#endif // defined(ELPP_QT_LOGGING) -#if defined(ELPP_BOOST_LOGGING) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::vector) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::stable_vector) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::list) - ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::deque) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(boost::container::map) - ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(boost::container::flat_map) - ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(boost::container::set) - ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(boost::container::flat_set) -#endif // defined(ELPP_BOOST_LOGGING) - - /// @brief Macro used internally that can be used externally to make containers easylogging++ friendly - /// - /// @detail This macro expands to write an ostream& operator<< for container. This container is expected to - /// have begin() and end() methods that return respective iterators - /// @param ContainerType Type of container e.g, MyList from WX_DECLARE_LIST(int, MyList); in wxwidgets - /// @param SizeMethod Method used to get size of container. - /// @param ElementInstance Instance of element to be fed out. Insance name is "elem". See WXELPP_ENABLED macro - /// for an example usage -#define MAKE_CONTAINERELPP_FRIENDLY(ContainerType, SizeMethod, ElementInstance) \ - el::base::type::ostream_t& operator<<(el::base::type::ostream_t& ss, const ContainerType& container) {\ - const el::base::type::char_t* sep = ELPP->hasFlag(el::LoggingFlag::NewLineForContainer) ? \ - ELPP_LITERAL("\n ") : ELPP_LITERAL(", ");\ - ContainerType::const_iterator elem = container.begin();\ - ContainerType::const_iterator endElem = container.end();\ - std::size_t size_ = container.SizeMethod; \ - ss << ELPP_LITERAL("[");\ - for (std::size_t i = 0; elem != endElem && i < el::base::consts::kMaxLogPerContainer; ++i, ++elem) { \ - ss << ElementInstance;\ - ss << ((i < size_ - 1) ? sep : ELPP_LITERAL(""));\ - }\ - if (elem != endElem) {\ - ss << ELPP_LITERAL("...");\ - }\ - ss << ELPP_LITERAL("]");\ - return ss;\ - } -#if defined(ELPP_WXWIDGETS_LOGGING) - ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(wxVector) -# define ELPP_WX_PTR_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), *(*elem)) -# define ELPP_WX_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), (*elem)) -# define ELPP_WX_HASH_MAP_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), \ - ELPP_LITERAL("(") << elem->first << ELPP_LITERAL(", ") << elem->second << ELPP_LITERAL(")") -#else -# define ELPP_WX_PTR_ENABLED(ContainerType) -# define ELPP_WX_ENABLED(ContainerType) -# define ELPP_WX_HASH_MAP_ENABLED(ContainerType) -#endif // defined(ELPP_WXWIDGETS_LOGGING) - // Other classes - template - ELPP_SIMPLE_LOG(const Class&) -#undef ELPP_SIMPLE_LOG -#undef ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG -#undef ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG -#undef ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG -#undef ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG -#undef ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG - private: - Logger* m_logger; - const base::type::char_t* m_containerLogSeperator; - - template - inline MessageBuilder& writeIterator(Iterator begin_, Iterator end_, std::size_t size_) { - m_logger->stream() << ELPP_LITERAL("["); - for (std::size_t i = 0; begin_ != end_ && i < base::consts::kMaxLogPerContainer; ++i, ++begin_) { - operator << (*begin_); - m_logger->stream() << ((i < size_ - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); - } - if (begin_ != end_) { - m_logger->stream() << ELPP_LITERAL("..."); - } - m_logger->stream() << ELPP_LITERAL("]"); - if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) { - m_logger->stream() << " "; - } - return *this; - } - }; - /// @brief Writes nothing - Used when certain log is disabled - class NullWriter : base::NoCopy { - public: - NullWriter(void) {} - - // Null manipulator - inline NullWriter& operator<<(std::ostream& (*)(std::ostream&)) { - return *this; - } - - template - inline NullWriter& operator<<(const T&) { - return *this; - } - }; - /// @brief Main entry point of each logging - class Writer : base::NoCopy { - public: - Writer(Level level, const char* file, unsigned long int line, - const char* func, base::DispatchAction dispatchAction = base::DispatchAction::NormalLog, - base::type::VerboseLevel verboseLevel = 0) : - m_level(level), m_file(file), m_line(line), m_func(func), m_verboseLevel(verboseLevel), - m_proceed(false), m_dispatchAction(dispatchAction) { - } - - virtual ~Writer(void) { - processDispatch(); - } - - template - inline Writer& operator<<(const T& log) { -#if ELPP_LOGGING_ENABLED - if (m_proceed) { - m_messageBuilder << log; - } -#endif // ELPP_LOGGING_ENABLED - return *this; - } - - inline Writer& operator<<(std::ostream& (*log)(std::ostream&)) { -#if ELPP_LOGGING_ENABLED - if (m_proceed) { - m_messageBuilder << log; - } -#endif // ELPP_LOGGING_ENABLED - return *this; - } - - Writer& construct(Logger* logger, bool needLock = true) { - m_logger = logger; - initializeLogger(logger->id(), false, needLock); - m_messageBuilder.initialize(m_logger); - return *this; - } - - Writer& construct(int count, const char* loggerIds, ...) { - if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) { - va_list loggersList; - va_start(loggersList, loggerIds); - const char* id = loggerIds; - for (int i = 0; i < count; ++i) { - m_loggerIds.push_back(std::string(id)); - id = va_arg(loggersList, const char*); - } - va_end(loggersList); - initializeLogger(m_loggerIds.at(0)); - } - else { - initializeLogger(std::string(loggerIds)); - } - m_messageBuilder.initialize(m_logger); - return *this; - } - protected: - Level m_level; - const char* m_file; - const unsigned long int m_line; - const char* m_func; - base::type::VerboseLevel m_verboseLevel; - Logger* m_logger; - bool m_proceed; - base::MessageBuilder m_messageBuilder; - base::DispatchAction m_dispatchAction; - std::vector m_loggerIds; - friend class el::Helpers; - - void initializeLogger(const std::string& loggerId, bool lookup = true, bool needLock = true) { - if (lookup) { - m_logger = ELPP->registeredLoggers()->get(loggerId, ELPP->hasFlag(LoggingFlag::CreateLoggerAutomatically)); - } - if (m_logger == nullptr) { - ELPP->acquireLock(); - if (!ELPP->registeredLoggers()->has(std::string(base::consts::kDefaultLoggerId))) { - // Somehow default logger has been unregistered. Not good! Register again - ELPP->registeredLoggers()->get(std::string(base::consts::kDefaultLoggerId)); - } - ELPP->releaseLock(); // Need to unlock it for next writer - Writer(Level::Debug, m_file, m_line, m_func).construct(1, base::consts::kDefaultLoggerId) - << "Logger [" << loggerId << "] is not registered yet!"; - m_proceed = false; - } - else { - if (needLock) { - m_logger->acquireLock(); // This should not be unlocked by checking m_proceed because - // m_proceed can be changed by lines below - } - if (ELPP->hasFlag(LoggingFlag::HierarchicalLogging)) { - m_proceed = m_level == Level::Verbose ? m_logger->enabled(m_level) : - LevelHelper::castToInt(m_level) >= LevelHelper::castToInt(ELPP->m_loggingLevel); - } - else { - m_proceed = m_logger->enabled(m_level); - } - } - } - - void processDispatch() { -#if ELPP_LOGGING_ENABLED - if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) { - bool firstDispatched = false; - base::type::string_t logMessage; - std::size_t i = 0; - do { - if (m_proceed) { - if (firstDispatched) { - m_logger->stream() << logMessage; - } - else { - firstDispatched = true; - if (m_loggerIds.size() > 1) { - logMessage = m_logger->stream().str(); - } - } - triggerDispatch(); - } - else if (m_logger != nullptr) { - m_logger->stream().str(ELPP_LITERAL("")); - m_logger->releaseLock(); - } - if (i + 1 < m_loggerIds.size()) { - initializeLogger(m_loggerIds.at(i + 1)); - } - } while (++i < m_loggerIds.size()); - } - else { - if (m_proceed) { - triggerDispatch(); - } - else if (m_logger != nullptr) { - m_logger->stream().str(ELPP_LITERAL("")); - m_logger->releaseLock(); - } - } -#else - if (m_logger != nullptr) { - m_logger->stream().str(ELPP_LITERAL("")); - m_logger->releaseLock(); - } -#endif // ELPP_LOGGING_ENABLED - } - - void triggerDispatch(void) { - if (m_proceed) { - base::LogDispatcher(m_proceed, LogMessage(m_level, m_file, m_line, m_func, m_verboseLevel, - m_logger), m_dispatchAction).dispatch(); - } - if (m_logger != nullptr) { - m_logger->stream().str(ELPP_LITERAL("")); - m_logger->releaseLock(); - } - if (m_proceed && m_level == Level::Fatal - && !ELPP->hasFlag(LoggingFlag::DisableApplicationAbortOnFatalLog)) { - base::Writer(Level::Warning, m_file, m_line, m_func).construct(1, base::consts::kDefaultLoggerId) - << "Aborting application. Reason: Fatal log at [" << m_file << ":" << m_line << "]"; - std::stringstream reasonStream; - reasonStream << "Fatal log at [" << m_file << ":" << m_line << "]" - << " If you wish to disable 'abort on fatal log' please use " - << "el::Helpers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog)"; - base::utils::abort(1, reasonStream.str()); - } - m_proceed = false; - } - }; - class PErrorWriter : public base::Writer { - public: - PErrorWriter(Level level, const char* file, unsigned long int line, - const char* func, base::DispatchAction dispatchAction = base::DispatchAction::NormalLog, - base::type::VerboseLevel verboseLevel = 0) : - base::Writer(level, file, line, func, dispatchAction, verboseLevel) { - } - - virtual ~PErrorWriter(void) { - if (m_proceed) { -#if ELPP_COMPILER_MSVC - char buff[256]; - strerror_s(buff, 256, errno); - m_logger->stream() << ": " << buff << " [" << errno << "]"; -#else - m_logger->stream() << ": " << strerror(errno) << " [" << errno << "]"; -#endif - } - } - }; - } // namespace base - // Logging from Logger class. Why this is here? Because we have Storage and Writer class available -#if ELPP_VARIADIC_TEMPLATES_SUPPORTED - template - void Logger::log_(Level level, int vlevel, const char* s, const T& value, const Args&... args) { - base::MessageBuilder b; - b.initialize(this); - while (*s) { - if (*s == base::consts::kFormatSpecifierChar) { - if (*(s + 1) == base::consts::kFormatSpecifierChar) { - ++s; - } - else { - if (*(s + 1) == base::consts::kFormatSpecifierCharValue) { - ++s; - b << value; - log_(level, vlevel, ++s, args...); - return; - } - } - } - b << *s++; - } - ELPP_INTERNAL_ERROR("Too many arguments provided. Unable to handle. Please provide more format specifiers", false); - } - template - inline void Logger::log_(Level level, int vlevel, const T& log) { - if (level == Level::Verbose) { - if (ELPP->vRegistry()->allowed(vlevel, __FILE__)) { - base::Writer(Level::Verbose, "FILE", 0, "FUNCTION", - base::DispatchAction::NormalLog, vlevel).construct(this, false) << log; - } - else { - stream().str(ELPP_LITERAL("")); - } - } - else { - base::Writer(level, "FILE", 0, "FUNCTION").construct(this, false) << log; - } - } - template - void Logger::log(Level level, const char* s, const T& value, const Args&... args) { - base::threading::ScopedLock scopedLock(lock()); - log_(level, 0, s, value, args...); - } - template - inline void Logger::log(Level level, const T& log) { - base::threading::ScopedLock scopedLock(lock()); - log_(level, 0, log); - } -# if ELPP_VERBOSE_LOG - template - inline void Logger::verbose(int vlevel, const char* s, const T& value, const Args&... args) { - base::threading::ScopedLock scopedLock(lock()); - log_(el::Level::Verbose, vlevel, s, value, args...); - } - template - inline void Logger::verbose(int vlevel, const T& log) { - base::threading::ScopedLock scopedLock(lock()); - log_(el::Level::Verbose, vlevel, log); - } -# else - template - inline void Logger::verbose(int, const char*, const T&, const Args&...) { - return; - } - template - inline void Logger::verbose(int, const T&) { - return; - } -# endif // ELPP_VERBOSE_LOG -# define LOGGER_LEVEL_WRITERS(FUNCTION_NAME, LOG_LEVEL)\ - template \ - inline void Logger::FUNCTION_NAME(const char* s, const T& value, const Args&... args) {\ - log(LOG_LEVEL, s, value, args...);\ - }\ - template \ - inline void Logger::FUNCTION_NAME(const T& value) {\ - log(LOG_LEVEL, value);\ - } -# define LOGGER_LEVEL_WRITERS_DISABLED(FUNCTION_NAME, LOG_LEVEL)\ - template \ - inline void Logger::FUNCTION_NAME(const char*, const T&, const Args&...) {\ - return;\ - }\ - template \ - inline void Logger::FUNCTION_NAME(const T&) {\ - return;\ - } - -# if ELPP_INFO_LOG - LOGGER_LEVEL_WRITERS(info, Level::Info) -# else - LOGGER_LEVEL_WRITERS_DISABLED(info, Level::Info) -# endif // ELPP_INFO_LOG -# if ELPP_DEBUG_LOG - LOGGER_LEVEL_WRITERS(debug, Level::Debug) -# else - LOGGER_LEVEL_WRITERS_DISABLED(debug, Level::Debug) -# endif // ELPP_DEBUG_LOG -# if ELPP_WARNING_LOG - LOGGER_LEVEL_WRITERS(warn, Level::Warning) -# else - LOGGER_LEVEL_WRITERS_DISABLED(warn, Level::Warning) -# endif // ELPP_WARNING_LOG -# if ELPP_ERROR_LOG - LOGGER_LEVEL_WRITERS(error, Level::Error) -# else - LOGGER_LEVEL_WRITERS_DISABLED(error, Level::Error) -# endif // ELPP_ERROR_LOG -# if ELPP_FATAL_LOG - LOGGER_LEVEL_WRITERS(fatal, Level::Fatal) -# else - LOGGER_LEVEL_WRITERS_DISABLED(fatal, Level::Fatal) -# endif // ELPP_FATAL_LOG -# if ELPP_TRACE_LOG - LOGGER_LEVEL_WRITERS(trace, Level::Trace) -# else - LOGGER_LEVEL_WRITERS_DISABLED(trace, Level::Trace) -# endif // ELPP_TRACE_LOG -# undef LOGGER_LEVEL_WRITERS -# undef LOGGER_LEVEL_WRITERS_DISABLED -#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED -#if ELPP_COMPILER_MSVC -# define ELPP_VARIADIC_FUNC_MSVC(variadicFunction, variadicArgs) variadicFunction variadicArgs -# define ELPP_VARIADIC_FUNC_MSVC_RUN(variadicFunction, ...) ELPP_VARIADIC_FUNC_MSVC(variadicFunction, (__VA_ARGS__)) -# define el_getVALength(...) ELPP_VARIADIC_FUNC_MSVC_RUN(el_resolveVALength, 0, ## __VA_ARGS__,\ - 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) -#else -# if ELPP_COMPILER_CLANG -# define el_getVALength(...) el_resolveVALength(0, __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) -# else -# define el_getVALength(...) el_resolveVALength(0, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) -# endif // ELPP_COMPILER_CLANG -#endif // ELPP_COMPILER_MSVC -#define el_resolveVALength(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N -#define ELPP_WRITE_LOG(writer, level, dispatchAction, ...) \ - writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#define ELPP_WRITE_LOG_IF(writer, condition, level, dispatchAction, ...) if (condition) \ - writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#define ELPP_WRITE_LOG_EVERY_N(writer, occasion, level, dispatchAction, ...) \ - if (ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion)) \ - writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#define ELPP_WRITE_LOG_AFTER_N(writer, n, level, dispatchAction, ...) \ - if (ELPP->validateAfterNCounter(__FILE__, __LINE__, n)) \ - writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#define ELPP_WRITE_LOG_N_TIMES(writer, n, level, dispatchAction, ...) \ - if (ELPP->validateNTimesCounter(__FILE__, __LINE__, n)) \ - writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#undef ELPP_CURR_FILE_PERFORMANCE_LOGGER -#if defined(ELPP_PERFORMANCE_LOGGER) -# define ELPP_CURR_FILE_PERFORMANCE_LOGGER ELPP_PERFORMANCE_LOGGER -#else -# define ELPP_CURR_FILE_PERFORMANCE_LOGGER el::base::consts::kPerformanceLoggerId -#endif - class PerformanceTrackingData { - public: - enum class DataType : base::type::EnumType { - Checkpoint = 1, Complete = 2 - }; - // Do not use constructor, will run into multiple definition error, use init(PerformanceTracker*) - explicit PerformanceTrackingData(DataType dataType) : m_performanceTracker(nullptr), - m_dataType(dataType), m_file(""), m_line(0), m_func("") {} - inline const std::string* blockName(void) const; - inline const struct timeval* startTime(void) const; - inline const struct timeval* endTime(void) const; - inline const struct timeval* lastCheckpointTime(void) const; - inline const base::PerformanceTracker* performanceTracker(void) const { return m_performanceTracker; } - inline PerformanceTrackingData::DataType dataType(void) const { return m_dataType; } - inline bool firstCheckpoint(void) const { return m_firstCheckpoint; } - inline std::string checkpointId(void) const { return m_checkpointId; } - inline const char* file(void) const { return m_file; } - inline unsigned long int line(void) const { return m_line; } - inline const char* func(void) const { return m_func; } - inline const base::type::string_t* formattedTimeTaken() const { return &m_formattedTimeTaken; } - inline const std::string& loggerId(void) const; - private: - base::PerformanceTracker* m_performanceTracker; - base::type::string_t m_formattedTimeTaken; - PerformanceTrackingData::DataType m_dataType; - bool m_firstCheckpoint; - std::string m_checkpointId; - const char* m_file; - unsigned long int m_line; - const char* m_func; - inline void init(base::PerformanceTracker* performanceTracker, bool firstCheckpoint = false) { - m_performanceTracker = performanceTracker; - m_firstCheckpoint = firstCheckpoint; - } - - friend class el::base::PerformanceTracker; - }; - namespace base { - /// @brief Represents performanceTracker block of code that conditionally adds performance status to log - /// either when goes outside the scope of when checkpoint() is called - class PerformanceTracker : public base::threading::ThreadSafe, public Loggable { - public: - PerformanceTracker(const std::string& blockName, - base::TimestampUnit timestampUnit = base::TimestampUnit::Millisecond, - const std::string& loggerId = std::string(ELPP_CURR_FILE_PERFORMANCE_LOGGER), - bool scopedLog = true, Level level = base::consts::kPerformanceTrackerDefaultLevel) : - m_blockName(blockName), m_timestampUnit(timestampUnit), m_loggerId(loggerId), m_scopedLog(scopedLog), - m_level(level), m_hasChecked(false), m_lastCheckpointId(std::string()), m_enabled(false) { -#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED - // We store it locally so that if user happen to change configuration by the end of scope - // or before calling checkpoint, we still depend on state of configuraton at time of construction - el::Logger* loggerPtr = ELPP->registeredLoggers()->get(loggerId, false); - m_enabled = loggerPtr != nullptr && loggerPtr->m_typedConfigurations->performanceTracking(m_level); - if (m_enabled) { - base::utils::DateTime::gettimeofday(&m_startTime); - } -#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED - } - /// @brief Copy constructor - PerformanceTracker(const PerformanceTracker& t) : - m_blockName(t.m_blockName), m_timestampUnit(t.m_timestampUnit), m_loggerId(t.m_loggerId), m_scopedLog(t.m_scopedLog), - m_level(t.m_level), m_hasChecked(t.m_hasChecked), m_lastCheckpointId(t.m_lastCheckpointId), m_enabled(t.m_enabled), - m_startTime(t.m_startTime), m_endTime(t.m_endTime), m_lastCheckpointTime(t.m_lastCheckpointTime) { - } - virtual ~PerformanceTracker(void) { -#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED - if (m_enabled) { - base::threading::ScopedLock scopedLock(lock()); - if (m_scopedLog) { - base::utils::DateTime::gettimeofday(&m_endTime); - base::type::string_t formattedTime = getFormattedTimeTaken(); - PerformanceTrackingData data(PerformanceTrackingData::DataType::Complete); - data.init(this); - data.m_formattedTimeTaken = formattedTime; - PerformanceTrackingCallback* callback = nullptr; - for (const std::pair& h - : ELPP->m_performanceTrackingCallbacks) { - callback = h.second.get(); - if (callback != nullptr && callback->enabled()) { - callback->acquireLock(); - callback->handle(&data); - callback->releaseLock(); - } - } - } - } -#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) - } - /// @brief A checkpoint for current performanceTracker block. - void checkpoint(const std::string& id = std::string(), const char* file = __FILE__, unsigned long int line = __LINE__, const char* func = "") { -#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED - if (m_enabled) { - base::threading::ScopedLock scopedLock(lock()); - base::utils::DateTime::gettimeofday(&m_endTime); - base::type::string_t formattedTime = m_hasChecked ? getFormattedTimeTaken(m_lastCheckpointTime) : ELPP_LITERAL(""); - PerformanceTrackingData data(PerformanceTrackingData::DataType::Checkpoint); - data.init(this); - data.m_checkpointId = id; - data.m_file = file; - data.m_line = line; - data.m_func = func; - data.m_formattedTimeTaken = formattedTime; - PerformanceTrackingCallback* callback = nullptr; - for (const std::pair& h - : ELPP->m_performanceTrackingCallbacks) { - callback = h.second.get(); - if (callback != nullptr && callback->enabled()) { - callback->acquireLock(); - callback->handle(&data); - callback->releaseLock(); - } - } - base::utils::DateTime::gettimeofday(&m_lastCheckpointTime); - m_hasChecked = true; - m_lastCheckpointId = id; - } -#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED - ELPP_UNUSED(id); - ELPP_UNUSED(file); - ELPP_UNUSED(line); - ELPP_UNUSED(func); - } - inline Level level(void) const { return m_level; } - private: - std::string m_blockName; - base::TimestampUnit m_timestampUnit; - std::string m_loggerId; - bool m_scopedLog; - Level m_level; - bool m_hasChecked; - std::string m_lastCheckpointId; - bool m_enabled; - struct timeval m_startTime, m_endTime, m_lastCheckpointTime; - - PerformanceTracker(void); - - friend class el::PerformanceTrackingData; - friend class base::DefaultPerformanceTrackingCallback; - - const inline base::type::string_t getFormattedTimeTaken() const { - return getFormattedTimeTaken(m_startTime); - } - - const base::type::string_t getFormattedTimeTaken(struct timeval startTime) const { - if (ELPP->hasFlag(LoggingFlag::FixedTimeFormat)) { - base::type::stringstream_t ss; - ss << base::utils::DateTime::getTimeDifference(m_endTime, - startTime, m_timestampUnit) << " " << base::consts::kTimeFormats[static_cast(m_timestampUnit)].unit; - return ss.str(); - } - return base::utils::DateTime::formatTime(base::utils::DateTime::getTimeDifference(m_endTime, - startTime, m_timestampUnit), m_timestampUnit); - } - - virtual inline void log(el::base::type::ostream_t& os) const { - os << getFormattedTimeTaken(); - } - }; - class DefaultPerformanceTrackingCallback : public PerformanceTrackingCallback { - protected: - void handle(const PerformanceTrackingData* data) { - m_data = data; - base::type::stringstream_t ss; - if (m_data->dataType() == PerformanceTrackingData::DataType::Complete) { - ss << ELPP_LITERAL("Executed [") << m_data->blockName()->c_str() << ELPP_LITERAL("] in [") << *m_data->formattedTimeTaken() << ELPP_LITERAL("]"); - } - else { - ss << ELPP_LITERAL("Performance checkpoint"); - if (!m_data->checkpointId().empty()) { - ss << ELPP_LITERAL(" [") << m_data->checkpointId().c_str() << ELPP_LITERAL("]"); - } - ss << ELPP_LITERAL(" for block [") << m_data->blockName()->c_str() << ELPP_LITERAL("] : [") << *m_data->performanceTracker(); - if (!ELPP->hasFlag(LoggingFlag::DisablePerformanceTrackingCheckpointComparison) && m_data->performanceTracker()->m_hasChecked) { - ss << ELPP_LITERAL(" ([") << *m_data->formattedTimeTaken() << ELPP_LITERAL("] from "); - if (m_data->performanceTracker()->m_lastCheckpointId.empty()) { - ss << ELPP_LITERAL("last checkpoint"); - } - else { - ss << ELPP_LITERAL("checkpoint '") << m_data->performanceTracker()->m_lastCheckpointId.c_str() << ELPP_LITERAL("'"); - } - ss << ELPP_LITERAL(")]"); - } - else { - ss << ELPP_LITERAL("]"); - } - } - el::base::Writer(m_data->performanceTracker()->level(), m_data->file(), m_data->line(), m_data->func()).construct(1, m_data->loggerId().c_str()) << ss.str(); - } - private: - const PerformanceTrackingData* m_data; - }; - } // namespace base - inline const std::string* PerformanceTrackingData::blockName() const { - return const_cast(&m_performanceTracker->m_blockName); - } - inline const struct timeval* PerformanceTrackingData::startTime() const { - return const_cast(&m_performanceTracker->m_startTime); - } - inline const struct timeval* PerformanceTrackingData::endTime() const { - return const_cast(&m_performanceTracker->m_endTime); - } - inline const struct timeval* PerformanceTrackingData::lastCheckpointTime() const { - return const_cast(&m_performanceTracker->m_lastCheckpointTime); - } - inline const std::string& PerformanceTrackingData::loggerId(void) const { return m_performanceTracker->m_loggerId; } - namespace base { - /// @brief Contains some internal debugging tools like crash handler and stack tracer - namespace debug { - class StackTrace : base::NoCopy { - public: - static const std::size_t kMaxStack = 64; - static const std::size_t kStackStart = 2; // We want to skip c'tor and StackTrace::generateNew() - class StackTraceEntry { - public: - StackTraceEntry(std::size_t index, const char* loc, const char* demang, const char* hex, const char* addr) { - m_index = index; - m_location = std::string(loc); - m_demangled = std::string(demang); - m_hex = std::string(hex); - m_addr = std::string(addr); - } - StackTraceEntry(std::size_t index, char* loc) { - m_index = index; - m_location = std::string(loc); - } - std::size_t m_index; - std::string m_location; - std::string m_demangled; - std::string m_hex; - std::string m_addr; - friend std::ostream& operator<<(std::ostream& ss, const StackTraceEntry& si) { - ss << "[" << si.m_index << "] " << si.m_location << (si.m_demangled.empty() ? "" : ":") << si.m_demangled - << (si.m_hex.empty() ? "" : "+") << si.m_hex << si.m_addr; - return ss; - } - - private: - StackTraceEntry(void); - }; - - StackTrace(void) { - generateNew(); - } - - virtual ~StackTrace(void) { - } - - inline std::vector& getLatestStack(void) { - return m_stack; - } - - friend inline std::ostream& operator<<(std::ostream& os, const StackTrace& st) { - std::vector::const_iterator it = st.m_stack.begin(); - while (it != st.m_stack.end()) { - os << " " << *it++ << "\n"; - } - return os; - } - - private: - std::vector m_stack; - - void generateNew(void) { -#if ELPP_STACKTRACE - m_stack.clear(); - void* stack[kMaxStack]; - std::size_t size = backtrace(stack, kMaxStack); - char** strings = backtrace_symbols(stack, size); - if (size > kStackStart) { // Skip StackTrace c'tor and generateNew - for (std::size_t i = kStackStart; i < size; ++i) { - char* mangName = nullptr; - char* hex = nullptr; - char* addr = nullptr; - for (char* c = strings[i]; *c; ++c) { - switch (*c) { - case '(': - mangName = c; - break; - case '+': - hex = c; - break; - case ')': - addr = c; - break; - } - } - // Perform demangling if parsed properly - if (mangName != nullptr && hex != nullptr && addr != nullptr && mangName < hex) { - *mangName++ = '\0'; - *hex++ = '\0'; - *addr++ = '\0'; - int status = 0; - char* demangName = abi::__cxa_demangle(mangName, 0, 0, &status); - // if demangling is successful, output the demangled function name - if (status == 0) { - // Success (see http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html) - StackTraceEntry entry(i - 1, strings[i], demangName, hex, addr); - m_stack.push_back(entry); - } - else { - // Not successful - we will use mangled name - StackTraceEntry entry(i - 1, strings[i], mangName, hex, addr); - m_stack.push_back(entry); - } - free(demangName); - } - else { - StackTraceEntry entry(i - 1, strings[i]); - m_stack.push_back(entry); - } - } - } - free(strings); -#else - ELPP_INTERNAL_INFO(1, "Stacktrace generation not supported for selected compiler"); -#endif // ELPP_STACKTRACE - } - }; - static std::string crashReason(int sig) { - std::stringstream ss; - bool foundReason = false; - for (int i = 0; i < base::consts::kCrashSignalsCount; ++i) { - if (base::consts::kCrashSignals[i].numb == sig) { - ss << "Application has crashed due to [" << base::consts::kCrashSignals[i].name << "] signal"; - if (ELPP->hasFlag(el::LoggingFlag::LogDetailedCrashReason)) { - ss << std::endl << - " " << base::consts::kCrashSignals[i].brief << std::endl << - " " << base::consts::kCrashSignals[i].detail; - } - foundReason = true; - } - } - if (!foundReason) { - ss << "Application has crashed due to unknown signal [" << sig << "]"; - } - return ss.str(); - } - /// @brief Logs reason of crash from sig - static void logCrashReason(int sig, bool stackTraceIfAvailable, Level level, const char* logger) { - std::stringstream ss; - ss << "CRASH HANDLED; "; - ss << crashReason(sig); -#if ELPP_STACKTRACE - if (stackTraceIfAvailable) { - ss << std::endl << " ======= Backtrace: =========" << std::endl << base::debug::StackTrace(); - } -#else - ELPP_UNUSED(stackTraceIfAvailable); -#endif // ELPP_STACKTRACE - ELPP_WRITE_LOG(el::base::Writer, level, base::DispatchAction::NormalLog, logger) << ss.str(); - } - static inline void crashAbort(int sig) { - base::utils::abort(sig); - } - /// @brief Default application crash handler - /// - /// @detail This function writes log using 'default' logger, prints stack trace for GCC based compilers and aborts program. - static inline void defaultCrashHandler(int sig) { - base::debug::logCrashReason(sig, true, Level::Fatal, base::consts::kDefaultLoggerId); - base::debug::crashAbort(sig); - } - /// @brief Handles unexpected crashes - class CrashHandler : base::NoCopy { - public: - typedef void(*Handler)(int); - - explicit CrashHandler(bool useDefault) { - if (useDefault) { - setHandler(defaultCrashHandler); - } - } - explicit CrashHandler(const Handler& cHandler) { - setHandler(cHandler); - } - void setHandler(const Handler& cHandler) { - m_handler = cHandler; -#if defined(ELPP_HANDLE_SIGABRT) - int i = 0; // SIGABRT is at base::consts::kCrashSignals[0] -#else - int i = 1; -#endif // defined(ELPP_HANDLE_SIGABRT) - for (; i < base::consts::kCrashSignalsCount; ++i) { - m_handler = signal(base::consts::kCrashSignals[i].numb, cHandler); - } - } - - private: - Handler m_handler; - }; - } // namespace debug - } // namespace base - extern base::debug::CrashHandler elCrashHandler; -#define MAKE_LOGGABLE(ClassType, ClassInstance, OutputStreamInstance) \ - el::base::type::ostream_t& operator<<(el::base::type::ostream_t& OutputStreamInstance, const ClassType& ClassInstance) - /// @brief Initializes syslog with process ID, options and facility. calls closelog() on d'tor - class SysLogInitializer { - public: - SysLogInitializer(const char* processIdent, int options = 0, int facility = 0) { -#if defined(ELPP_SYSLOG) - openlog(processIdent, options, facility); -#else - ELPP_UNUSED(processIdent); - ELPP_UNUSED(options); - ELPP_UNUSED(facility); -#endif // defined(ELPP_SYSLOG) - } - virtual ~SysLogInitializer(void) { -#if defined(ELPP_SYSLOG) - closelog(); -#endif // defined(ELPP_SYSLOG) - } - }; -#define ELPP_INITIALIZE_SYSLOG(id, opt, fac) el::SysLogInitializer elSyslogInit(id, opt, fac) - /// @brief Static helpers for developers - class Helpers : base::StaticClass { - public: - /// @brief Shares logging repository (base::Storage) - static inline void setStorage(base::type::StoragePointer storage) { - ELPP = storage; - } - /// @return Main storage repository - static inline base::type::StoragePointer storage() { - return ELPP; - } - /// @brief Sets application arguments and figures out whats active for logging and whats not. - static inline void setArgs(int argc, char** argv) { - ELPP->setApplicationArguments(argc, argv); - } - /// @copydoc setArgs(int argc, char** argv) - static inline void setArgs(int argc, const char** argv) { - ELPP->setApplicationArguments(argc, const_cast(argv)); - } - /// @brief Overrides default crash handler and installs custom handler. - /// @param crashHandler A functor with no return type that takes single int argument. - /// Handler is a typedef with specification: void (*Handler)(int) - static inline void setCrashHandler(const el::base::debug::CrashHandler::Handler& crashHandler) { - el::elCrashHandler.setHandler(crashHandler); - } - /// @brief Abort due to crash with signal in parameter - /// @param sig Crash signal - static inline void crashAbort(int sig, const char* sourceFile = "", unsigned int long line = 0) { - std::stringstream ss; - ss << base::debug::crashReason(sig).c_str(); - ss << " - [Called el::Helpers::crashAbort(" << sig << ")]"; - if (sourceFile != nullptr && strlen(sourceFile) > 0) { - ss << " - Source: " << sourceFile; - if (line > 0) - ss << ":" << line; - else - ss << " (line number not specified)"; - } - base::utils::abort(sig, ss.str()); - } - /// @brief Logs reason of crash as per sig - /// @param sig Crash signal - /// @param stackTraceIfAvailable Includes stack trace if available - /// @param level Logging level - /// @param logger Logger to use for logging - static inline void logCrashReason(int sig, bool stackTraceIfAvailable = false, - Level level = Level::Fatal, const char* logger = base::consts::kDefaultLoggerId) { - el::base::debug::logCrashReason(sig, stackTraceIfAvailable, level, logger); - } - /// @brief Installs pre rollout callback, this callback is triggered when log file is about to be rolled out - /// (can be useful for backing up) - static inline void installPreRollOutCallback(const PreRollOutCallback& callback) { - ELPP->setPreRollOutCallback(callback); - } - /// @brief Uninstalls pre rollout callback - static inline void uninstallPreRollOutCallback(void) { - ELPP->unsetPreRollOutCallback(); - } - /// @brief Installs post log dispatch callback, this callback is triggered when log is dispatched - template - static inline bool installLogDispatchCallback(const std::string& id) { - return ELPP->installLogDispatchCallback(id); - } - /// @brief Uninstalls log dispatch callback - template - static inline void uninstallLogDispatchCallback(const std::string& id) { - ELPP->uninstallLogDispatchCallback(id); - } - template - static inline T* logDispatchCallback(const std::string& id) { - return ELPP->logDispatchCallback(id); - } - /// @brief Installs post performance tracking callback, this callback is triggered when performance tracking is finished - template - static inline bool installPerformanceTrackingCallback(const std::string& id) { - return ELPP->installPerformanceTrackingCallback(id); - } - /// @brief Uninstalls post performance tracking handler - template - static inline void uninstallPerformanceTrackingCallback(const std::string& id) { - ELPP->uninstallPerformanceTrackingCallback(id); - } - template - static inline T* performanceTrackingCallback(const std::string& id) { - return ELPP->performanceTrackingCallback(id); - } - /// @brief Converts template to std::string - useful for loggable classes to log containers within log(std::ostream&) const - template - static std::string convertTemplateToStdString(const T& templ) { - el::Logger* logger = - ELPP->registeredLoggers()->get(el::base::consts::kDefaultLoggerId); - if (logger == nullptr) { - return std::string(); - } - base::MessageBuilder b; - b.initialize(logger); - logger->acquireLock(); - b << templ; -#if defined(ELPP_UNICODE) - std::string s = std::string(logger->stream().str().begin(), logger->stream().str().end()); -#else - std::string s = logger->stream().str(); -#endif // defined(ELPP_UNICODE) - logger->stream().str(ELPP_LITERAL("")); - logger->releaseLock(); - return s; - } - /// @brief Returns command line arguments (pointer) provided to easylogging++ - static inline const el::base::utils::CommandLineArgs* commandLineArgs(void) { - return ELPP->commandLineArgs(); - } - /// @brief Installs user defined format specifier and handler - static inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) { - ELPP->installCustomFormatSpecifier(customFormatSpecifier); - } - /// @brief Uninstalls user defined format specifier and handler - static inline bool uninstallCustomFormatSpecifier(const char* formatSpecifier) { - return ELPP->uninstallCustomFormatSpecifier(formatSpecifier); - } - /// @brief Returns true if custom format specifier is installed - static inline bool hasCustomFormatSpecifier(const char* formatSpecifier) { - return ELPP->hasCustomFormatSpecifier(formatSpecifier); - } - static inline void validateFileRolling(Logger* logger, Level level) { - if (logger == nullptr) return; - logger->m_typedConfigurations->validateFileRolling(level, ELPP->preRollOutCallback()); - } - }; - /// @brief Static helpers to deal with loggers and their configurations - class Loggers : base::StaticClass { - public: - /// @brief Gets existing or registers new logger - static inline Logger* getLogger(const std::string& identity, bool registerIfNotAvailable = true) { - base::threading::ScopedLock scopedLock(ELPP->lock()); - return ELPP->registeredLoggers()->get(identity, registerIfNotAvailable); - } - /// @brief Unregisters logger - use it only when you know what you are doing, you may unregister - /// loggers initialized / used by third-party libs. - static inline bool unregisterLogger(const std::string& identity) { - base::threading::ScopedLock scopedLock(ELPP->lock()); - return ELPP->registeredLoggers()->remove(identity); - } - /// @brief Whether or not logger with id is registered - static inline bool hasLogger(const std::string& identity) { - base::threading::ScopedLock scopedLock(ELPP->lock()); - return ELPP->registeredLoggers()->has(identity); - } - /// @brief Reconfigures specified logger with new configurations - static inline Logger* reconfigureLogger(Logger* logger, const Configurations& configurations) { - if (!logger) return nullptr; - logger->configure(configurations); - return logger; - } - /// @brief Reconfigures logger with new configurations after looking it up using identity - static inline Logger* reconfigureLogger(const std::string& identity, const Configurations& configurations) { - return Loggers::reconfigureLogger(Loggers::getLogger(identity), configurations); - } - /// @brief Reconfigures logger's single configuration - static inline Logger* reconfigureLogger(const std::string& identity, ConfigurationType configurationType, - const std::string& value) { - Logger* logger = Loggers::getLogger(identity); - if (logger == nullptr) { - return nullptr; - } - logger->configurations()->set(Level::Global, configurationType, value); - logger->reconfigure(); - return logger; - } - /// @brief Reconfigures all the existing loggers with new configurations - static inline void reconfigureAllLoggers(const Configurations& configurations) { - for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->begin(); - it != ELPP->registeredLoggers()->end(); ++it) { - Loggers::reconfigureLogger(it->second, configurations); - } - } - /// @brief Reconfigures single configuration for all the loggers - static inline void reconfigureAllLoggers(ConfigurationType configurationType, const std::string& value) { - reconfigureAllLoggers(Level::Global, configurationType, value); - } - /// @brief Reconfigures single configuration for all the loggers for specified level - static inline void reconfigureAllLoggers(Level level, ConfigurationType configurationType, - const std::string& value) { - for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->begin(); - it != ELPP->registeredLoggers()->end(); ++it) { - Logger* logger = it->second; - logger->configurations()->set(level, configurationType, value); - logger->reconfigure(); - } - } - /// @brief Sets default configurations. This configuration is used for future (and conditionally for existing) loggers - static inline void setDefaultConfigurations(const Configurations& configurations, bool reconfigureExistingLoggers = false) { - ELPP->registeredLoggers()->setDefaultConfigurations(configurations); - if (reconfigureExistingLoggers) { - Loggers::reconfigureAllLoggers(configurations); - } - } - /// @brief Returns current default - static inline const Configurations* defaultConfigurations(void) { - return ELPP->registeredLoggers()->defaultConfigurations(); - } - /// @brief Returns log stream reference pointer if needed by user - static inline const base::LogStreamsReferenceMap* logStreamsReference(void) { - return ELPP->registeredLoggers()->logStreamsReference(); - } - /// @brief Default typed configuration based on existing defaultConf - static base::TypedConfigurations defaultTypedConfigurations(void) { - return base::TypedConfigurations( - ELPP->registeredLoggers()->defaultConfigurations(), - ELPP->registeredLoggers()->logStreamsReference()); - } - /// @brief Populates all logger IDs in current repository. - /// @param [out] targetList List of fill up. - static inline std::vector* populateAllLoggerIds(std::vector* targetList) { - targetList->clear(); - for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->list().begin(); - it != ELPP->registeredLoggers()->list().end(); ++it) { - targetList->push_back(it->first); - } - return targetList; - } - /// @brief Sets configurations from global configuration file. - static void configureFromGlobal(const char* globalConfigurationFilePath) { - std::ifstream gcfStream(globalConfigurationFilePath, std::ifstream::in); - ELPP_ASSERT(gcfStream.is_open(), "Unable to open global configuration file [" << globalConfigurationFilePath - << "] for parsing."); - std::string line = std::string(); - std::stringstream ss; - Logger* logger = nullptr; - auto configure = [&](void) { - ELPP_INTERNAL_INFO(8, "Configuring logger: '" << logger->id() << "' with configurations \n" << ss.str() - << "\n--------------"); - Configurations c; - c.parseFromText(ss.str()); - logger->configure(c); - }; - while (gcfStream.good()) { - std::getline(gcfStream, line); - ELPP_INTERNAL_INFO(1, "Parsing line: " << line); - base::utils::Str::trim(line); - if (Configurations::Parser::isComment(line)) continue; - Configurations::Parser::ignoreComments(&line); - base::utils::Str::trim(line); - if (line.size() > 2 && base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationLoggerId))) { - if (!ss.str().empty() && logger != nullptr) { - configure(); - } - ss.str(std::string("")); - line = line.substr(2); - base::utils::Str::trim(line); - if (line.size() > 1) { - ELPP_INTERNAL_INFO(1, "Getting logger: '" << line << "'"); - logger = getLogger(line); - } - } - else { - ss << line << "\n"; - } - } - if (!ss.str().empty() && logger != nullptr) { - configure(); - } - } - /// @brief Configures loggers using command line arg. Ensure you have already set command line args, - /// @return False if invalid argument or argument with no value provided, true if attempted to configure logger. - /// If true is returned that does not mean it has been configured successfully, it only means that it - /// has attempeted to configure logger using configuration file provided in argument - static inline bool configureFromArg(const char* argKey) { -#if defined(ELPP_DISABLE_CONFIGURATION_FROM_PROGRAM_ARGS) - ELPP_UNUSED(argKey); -#else - if (!Helpers::commandLineArgs()->hasParamWithValue(argKey)) { - return false; - } - configureFromGlobal(Helpers::commandLineArgs()->getParamValue(argKey)); -#endif // defined(ELPP_DISABLE_CONFIGURATION_FROM_PROGRAM_ARGS) - return true; - } - /// @brief Flushes all loggers for all levels - Be careful if you dont know how many loggers are registered - static inline void flushAll(void) { - ELPP->registeredLoggers()->flushAll(); - } - /// @brief Adds logging flag used internally. - static inline void addFlag(LoggingFlag flag) { - ELPP->addFlag(flag); - } - /// @brief Removes logging flag used internally. - static inline void removeFlag(LoggingFlag flag) { - ELPP->removeFlag(flag); - } - /// @brief Determines whether or not certain flag is active - static inline bool hasFlag(LoggingFlag flag) { - return ELPP->hasFlag(flag); - } - /// @brief Adds flag and removes it when scope goes out - class ScopedAddFlag { - public: - ScopedAddFlag(LoggingFlag flag) : m_flag(flag) { Loggers::addFlag(m_flag); } - ~ScopedAddFlag(void) { Loggers::removeFlag(m_flag); } - private: - LoggingFlag m_flag; - }; - /// @brief Removes flag and add it when scope goes out - class ScopedRemoveFlag { - public: - ScopedRemoveFlag(LoggingFlag flag) : m_flag(flag) { Loggers::removeFlag(m_flag); } - ~ScopedRemoveFlag(void) { Loggers::addFlag(m_flag); } - private: - LoggingFlag m_flag; - }; - /// @brief Sets hierarchy for logging. Needs to enable logging flag (HierarchicalLogging) - static inline void setLoggingLevel(Level level) { - ELPP->setLoggingLevel(level); - } - /// @brief Sets verbose level on the fly - static inline void setVerboseLevel(base::type::VerboseLevel level) { - ELPP->vRegistry()->setLevel(level); - } - /// @brief Gets current verbose level - static inline base::type::VerboseLevel verboseLevel(void) { - return ELPP->vRegistry()->level(); - } - /// @brief Sets vmodules as specified (on the fly) - static inline void setVModules(const char* modules) { - if (ELPP->vRegistry()->vModulesEnabled()) { - ELPP->vRegistry()->setModules(modules); - } - } - /// @brief Clears vmodules - static inline void clearVModules(void) { - ELPP->vRegistry()->clearModules(); - } - }; - class VersionInfo : base::StaticClass { - public: - /// @brief Current version number - static inline const std::string version(void) { return std::string("9.80"); } - /// @brief Release date of current version - static inline const std::string releaseDate(void) { return std::string("08-01-2015 0850hrs"); } - }; -} // namespace el -#undef VLOG_IS_ON - /// @brief Determines whether verbose logging is on for specified level current file. -#define VLOG_IS_ON(verboseLevel) (ELPP->vRegistry()->allowed(verboseLevel, __FILE__)) -#undef TIMED_BLOCK -#undef TIMED_SCOPE -#undef TIMED_FUNC -#undef ELPP_MIN_UNIT -#if defined(ELPP_PERFORMANCE_MICROSECONDS) -# define ELPP_MIN_UNIT el::base::TimestampUnit::Microsecond -#else -# define ELPP_MIN_UNIT el::base::TimestampUnit::Millisecond -#endif // (defined(ELPP_PERFORMANCE_MICROSECONDS)) - /// @brief Performance tracked scope. Performance gets written when goes out of scope using - /// 'performance' logger. - /// - /// @detail Please note in order to check the performance at a certain time you can use obj.checkpoint(); - /// @see el::base::PerformanceTracker - /// @see el::base::PerformanceTracker::checkpoint - // Note: Do not surround this definition with null macro because of obj instance -#define TIMED_SCOPE(obj, blockname) el::base::PerformanceTracker obj(blockname, ELPP_MIN_UNIT) -#define TIMED_BLOCK(obj, blockName) for (struct { int i; el::base::PerformanceTracker timer; } obj = { 0, \ - el::base::PerformanceTracker(blockName, ELPP_MIN_UNIT) }; obj.i < 1; ++obj.i) - /// @brief Performance tracked function. Performance gets written when goes out of scope using - /// 'performance' logger. - /// - /// @detail Please note in order to check the performance at a certain time you can use obj.checkpoint(); - /// @see el::base::PerformanceTracker - /// @see el::base::PerformanceTracker::checkpoint -#define TIMED_FUNC(obj) TIMED_SCOPE(obj, ELPP_FUNC) -#undef PERFORMANCE_CHECKPOINT -#undef PERFORMANCE_CHECKPOINT_WITH_ID -#define PERFORMANCE_CHECKPOINT(obj) obj.checkpoint(std::string(), __FILE__, __LINE__, ELPP_FUNC) -#define PERFORMANCE_CHECKPOINT_WITH_ID(obj, id) obj.checkpoint(id, __FILE__, __LINE__, ELPP_FUNC) -#undef ELPP_COUNTER -#undef ELPP_COUNTER_POS - /// @brief Gets hit counter for file/line -#define ELPP_COUNTER (ELPP->hitCounters()->getCounter(__FILE__, __LINE__)) - /// @brief Gets hit counter position for file/line, -1 if not registered yet -#define ELPP_COUNTER_POS (ELPP_COUNTER == nullptr ? -1 : ELPP_COUNTER->hitCounts()) - // Undef levels to support LOG(LEVEL) -#undef INFO -#undef WARNING -#undef DEBUG -#undef ERROR -#undef FATAL -#undef TRACE -#undef VERBOSE - // Undef existing -#undef CINFO -#undef CWARNING -#undef CDEBUG -#undef CFATAL -#undef CERROR -#undef CTRACE -#undef CVERBOSE -#undef CINFO_IF -#undef CWARNING_IF -#undef CDEBUG_IF -#undef CERROR_IF -#undef CFATAL_IF -#undef CTRACE_IF -#undef CVERBOSE_IF -#undef CINFO_EVERY_N -#undef CWARNING_EVERY_N -#undef CDEBUG_EVERY_N -#undef CERROR_EVERY_N -#undef CFATAL_EVERY_N -#undef CTRACE_EVERY_N -#undef CVERBOSE_EVERY_N -#undef CINFO_AFTER_N -#undef CWARNING_AFTER_N -#undef CDEBUG_AFTER_N -#undef CERROR_AFTER_N -#undef CFATAL_AFTER_N -#undef CTRACE_AFTER_N -#undef CVERBOSE_AFTER_N -#undef CINFO_N_TIMES -#undef CWARNING_N_TIMES -#undef CDEBUG_N_TIMES -#undef CERROR_N_TIMES -#undef CFATAL_N_TIMES -#undef CTRACE_N_TIMES -#undef CVERBOSE_N_TIMES - // Normal logs -#if ELPP_INFO_LOG -# define CINFO(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Info, dispatchAction, __VA_ARGS__) -#else -# define CINFO(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_INFO_LOG -#if ELPP_WARNING_LOG -# define CWARNING(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Warning, dispatchAction, __VA_ARGS__) -#else -# define CWARNING(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_WARNING_LOG -#if ELPP_DEBUG_LOG -# define CDEBUG(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Debug, dispatchAction, __VA_ARGS__) -#else -# define CDEBUG(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_DEBUG_LOG -#if ELPP_ERROR_LOG -# define CERROR(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Error, dispatchAction, __VA_ARGS__) -#else -# define CERROR(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_ERROR_LOG -#if ELPP_FATAL_LOG -# define CFATAL(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Fatal, dispatchAction, __VA_ARGS__) -#else -# define CFATAL(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_FATAL_LOG -#if ELPP_TRACE_LOG -# define CTRACE(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Trace, dispatchAction, __VA_ARGS__) -#else -# define CTRACE(writer, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_TRACE_LOG -#if ELPP_VERBOSE_LOG -# define CVERBOSE(writer, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel)) writer(\ - el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#else -# define CVERBOSE(writer, vlevel, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_VERBOSE_LOG - // Conditional logs -#if ELPP_INFO_LOG -# define CINFO_IF(writer, condition_, dispatchAction, ...) \ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Info, dispatchAction, __VA_ARGS__) -#else -# define CINFO_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_INFO_LOG -#if ELPP_WARNING_LOG -# define CWARNING_IF(writer, condition_, dispatchAction, ...)\ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Warning, dispatchAction, __VA_ARGS__) -#else -# define CWARNING_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_WARNING_LOG -#if ELPP_DEBUG_LOG -# define CDEBUG_IF(writer, condition_, dispatchAction, ...)\ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Debug, dispatchAction, __VA_ARGS__) -#else -# define CDEBUG_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_DEBUG_LOG -#if ELPP_ERROR_LOG -# define CERROR_IF(writer, condition_, dispatchAction, ...)\ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Error, dispatchAction, __VA_ARGS__) -#else -# define CERROR_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_ERROR_LOG -#if ELPP_FATAL_LOG -# define CFATAL_IF(writer, condition_, dispatchAction, ...)\ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Fatal, dispatchAction, __VA_ARGS__) -#else -# define CFATAL_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_FATAL_LOG -#if ELPP_TRACE_LOG -# define CTRACE_IF(writer, condition_, dispatchAction, ...)\ - ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Trace, dispatchAction, __VA_ARGS__) -#else -# define CTRACE_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_TRACE_LOG -#if ELPP_VERBOSE_LOG -# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel) && (condition_)) writer( \ - el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) -#else -# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_VERBOSE_LOG - // Occasional logs -#if ELPP_INFO_LOG -# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Info, dispatchAction, __VA_ARGS__) -#else -# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_INFO_LOG -#if ELPP_WARNING_LOG -# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Warning, dispatchAction, __VA_ARGS__) -#else -# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_WARNING_LOG -#if ELPP_DEBUG_LOG -# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Debug, dispatchAction, __VA_ARGS__) -#else -# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_DEBUG_LOG -#if ELPP_ERROR_LOG -# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Error, dispatchAction, __VA_ARGS__) -#else -# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_ERROR_LOG -#if ELPP_FATAL_LOG -# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Fatal, dispatchAction, __VA_ARGS__) -#else -# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_FATAL_LOG -#if ELPP_TRACE_LOG -# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...)\ - ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Trace, dispatchAction, __VA_ARGS__) -#else -# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_TRACE_LOG -#if ELPP_VERBOSE_LOG -# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...)\ - CVERBOSE_IF(writer, ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion), vlevel, dispatchAction, __VA_ARGS__) -#else -# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_VERBOSE_LOG - // After N logs -#if ELPP_INFO_LOG -# define CINFO_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) -#else -# define CINFO_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_INFO_LOG -#if ELPP_WARNING_LOG -# define CWARNING_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) -#else -# define CWARNING_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_WARNING_LOG -#if ELPP_DEBUG_LOG -# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) -#else -# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_DEBUG_LOG -#if ELPP_ERROR_LOG -# define CERROR_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) -#else -# define CERROR_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_ERROR_LOG -#if ELPP_FATAL_LOG -# define CFATAL_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) -#else -# define CFATAL_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_FATAL_LOG -#if ELPP_TRACE_LOG -# define CTRACE_AFTER_N(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) -#else -# define CTRACE_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_TRACE_LOG -#if ELPP_VERBOSE_LOG -# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...)\ - CVERBOSE_IF(writer, ELPP->validateAfterNCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) -#else -# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_VERBOSE_LOG - // N Times logs -#if ELPP_INFO_LOG -# define CINFO_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) -#else -# define CINFO_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_INFO_LOG -#if ELPP_WARNING_LOG -# define CWARNING_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) -#else -# define CWARNING_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_WARNING_LOG -#if ELPP_DEBUG_LOG -# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) -#else -# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_DEBUG_LOG -#if ELPP_ERROR_LOG -# define CERROR_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) -#else -# define CERROR_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_ERROR_LOG -#if ELPP_FATAL_LOG -# define CFATAL_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) -#else -# define CFATAL_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_FATAL_LOG -#if ELPP_TRACE_LOG -# define CTRACE_N_TIMES(writer, n, dispatchAction, ...)\ - ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) -#else -# define CTRACE_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_TRACE_LOG -#if ELPP_VERBOSE_LOG -# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...)\ - CVERBOSE_IF(writer, ELPP->validateNTimesCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) -#else -# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() -#endif // ELPP_VERBOSE_LOG - // - // Custom Loggers - Requires (level, dispatchAction, loggerId/s) - // - // undef existing -#undef CLOG -#undef CLOG_VERBOSE -#undef CVLOG -#undef CLOG_IF -#undef CLOG_VERBOSE_IF -#undef CVLOG_IF -#undef CLOG_EVERY_N -#undef CVLOG_EVERY_N -#undef CLOG_AFTER_N -#undef CVLOG_AFTER_N -#undef CLOG_N_TIMES -#undef CVLOG_N_TIMES - // Normal logs -#define CLOG(LEVEL, ...)\ - C##LEVEL(el::base::Writer, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CVLOG(vlevel, ...) CVERBOSE(el::base::Writer, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) - // Conditional logs -#define CLOG_IF(condition, LEVEL, ...)\ - C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CVLOG_IF(condition, vlevel, ...)\ - CVERBOSE_IF(el::base::Writer, condition, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) - // Hit counts based logs -#define CLOG_EVERY_N(n, LEVEL, ...)\ - C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CVLOG_EVERY_N(n, vlevel, ...)\ - CVERBOSE_EVERY_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CLOG_AFTER_N(n, LEVEL, ...)\ - C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CVLOG_AFTER_N(n, vlevel, ...)\ - CVERBOSE_AFTER_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CLOG_N_TIMES(n, LEVEL, ...)\ - C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CVLOG_N_TIMES(n, vlevel, ...)\ - CVERBOSE_N_TIMES(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) - // - // Default Loggers macro using CLOG(), CLOG_VERBOSE() and CVLOG() macros - // - // undef existing -#undef LOG -#undef VLOG -#undef LOG_IF -#undef VLOG_IF -#undef LOG_EVERY_N -#undef VLOG_EVERY_N -#undef LOG_AFTER_N -#undef VLOG_AFTER_N -#undef LOG_N_TIMES -#undef VLOG_N_TIMES -#undef ELPP_CURR_FILE_LOGGER_ID -#if defined(ELPP_DEFAULT_LOGGER) -# define ELPP_CURR_FILE_LOGGER_ID ELPP_DEFAULT_LOGGER -#else -# define ELPP_CURR_FILE_LOGGER_ID el::base::consts::kDefaultLoggerId -#endif -#undef ELPP_TRACE -#define ELPP_TRACE CLOG(TRACE, ELPP_CURR_FILE_LOGGER_ID) - // Normal logs -#define LOG(LEVEL) CLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define VLOG(vlevel) CVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Conditional logs -#define LOG_IF(condition, LEVEL) CLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define VLOG_IF(condition, vlevel) CVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Hit counts based logs -#define LOG_EVERY_N(n, LEVEL) CLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define VLOG_EVERY_N(n, vlevel) CVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) -#define LOG_AFTER_N(n, LEVEL) CLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define VLOG_AFTER_N(n, vlevel) CVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) -#define LOG_N_TIMES(n, LEVEL) CLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define VLOG_N_TIMES(n, vlevel) CVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Generic PLOG() -#undef CPLOG -#undef CPLOG_IF -#undef PLOG -#undef PLOG_IF -#undef DCPLOG -#undef DCPLOG_IF -#undef DPLOG -#undef DPLOG_IF -#define CPLOG(LEVEL, ...)\ - C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define CPLOG_IF(condition, LEVEL, ...)\ - C##LEVEL##_IF(el::base::PErrorWriter, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define DCPLOG(LEVEL, ...)\ - if (ELPP_DEBUG_LOG) C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define DCPLOG_IF(condition, LEVEL, ...)\ - C##LEVEL##_IF(el::base::PErrorWriter, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::NormalLog, __VA_ARGS__) -#define PLOG(LEVEL) CPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define PLOG_IF(condition, LEVEL) CPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DPLOG(LEVEL) DCPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DPLOG_IF(condition, LEVEL) DCPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) - // Generic SYSLOG() -#undef CSYSLOG -#undef CSYSLOG_IF -#undef CSYSLOG_EVERY_N -#undef CSYSLOG_AFTER_N -#undef CSYSLOG_N_TIMES -#undef SYSLOG -#undef SYSLOG_IF -#undef SYSLOG_EVERY_N -#undef SYSLOG_AFTER_N -#undef SYSLOG_N_TIMES -#undef DCSYSLOG -#undef DCSYSLOG_IF -#undef DCSYSLOG_EVERY_N -#undef DCSYSLOG_AFTER_N -#undef DCSYSLOG_N_TIMES -#undef DSYSLOG -#undef DSYSLOG_IF -#undef DSYSLOG_EVERY_N -#undef DSYSLOG_AFTER_N -#undef DSYSLOG_N_TIMES -#if defined(ELPP_SYSLOG) -# define CSYSLOG(LEVEL, ...)\ - C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define CSYSLOG_IF(condition, LEVEL, ...)\ - C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define CSYSLOG_EVERY_N(n, LEVEL, ...) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define CSYSLOG_AFTER_N(n, LEVEL, ...) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define CSYSLOG_N_TIMES(n, LEVEL, ...) C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define SYSLOG(LEVEL) CSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) -# define SYSLOG_IF(condition, LEVEL) CSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) -# define SYSLOG_EVERY_N(n, LEVEL) CSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) -# define SYSLOG_AFTER_N(n, LEVEL) CSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) -# define SYSLOG_N_TIMES(n, LEVEL) CSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) -# define DCSYSLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define DCSYSLOG_IF(condition, LEVEL, ...)\ - C##LEVEL##_IF(el::base::Writer, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::SysLog, __VA_ARGS__) -# define DCSYSLOG_EVERY_N(n, LEVEL, ...)\ - if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define DCSYSLOG_AFTER_N(n, LEVEL, ...)\ - if (ELPP_DEBUG_LOG) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define DCSYSLOG_N_TIMES(n, LEVEL, ...)\ - if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) -# define DSYSLOG(LEVEL) DCSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) -# define DSYSLOG_IF(condition, LEVEL) DCSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) -# define DSYSLOG_EVERY_N(n, LEVEL) DCSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) -# define DSYSLOG_AFTER_N(n, LEVEL) DCSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) -# define DSYSLOG_N_TIMES(n, LEVEL) DCSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) -#else -# define CSYSLOG(LEVEL, ...) el::base::NullWriter() -# define CSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() -# define CSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() -# define CSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() -# define CSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() -# define SYSLOG(LEVEL) el::base::NullWriter() -# define SYSLOG_IF(condition, LEVEL) el::base::NullWriter() -# define SYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() -# define SYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() -# define SYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() -# define DCSYSLOG(LEVEL, ...) el::base::NullWriter() -# define DCSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() -# define DCSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() -# define DCSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() -# define DCSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() -# define DSYSLOG(LEVEL) el::base::NullWriter() -# define DSYSLOG_IF(condition, LEVEL) el::base::NullWriter() -# define DSYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() -# define DSYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() -# define DSYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() -#endif // defined(ELPP_SYSLOG) - // - // Custom Debug Only Loggers - Requires (level, loggerId/s) - // - // undef existing -#undef DCLOG -#undef DCVLOG -#undef DCLOG_IF -#undef DCVLOG_IF -#undef DCLOG_EVERY_N -#undef DCVLOG_EVERY_N -#undef DCLOG_AFTER_N -#undef DCVLOG_AFTER_N -#undef DCLOG_N_TIMES -#undef DCVLOG_N_TIMES - // Normal logs -#define DCLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG(LEVEL, __VA_ARGS__) -#define DCLOG_VERBOSE(vlevel, ...) if (ELPP_DEBUG_LOG) CLOG_VERBOSE(vlevel, __VA_ARGS__) -#define DCVLOG(vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG(vlevel, __VA_ARGS__) - // Conditional logs -#define DCLOG_IF(condition, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_IF(condition, LEVEL, __VA_ARGS__) -#define DCVLOG_IF(condition, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_IF(condition, vlevel, __VA_ARGS__) - // Hit counts based logs -#define DCLOG_EVERY_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_EVERY_N(n, LEVEL, __VA_ARGS__) -#define DCVLOG_EVERY_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_EVERY_N(n, vlevel, __VA_ARGS__) -#define DCLOG_AFTER_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_AFTER_N(n, LEVEL, __VA_ARGS__) -#define DCVLOG_AFTER_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_AFTER_N(n, vlevel, __VA_ARGS__) -#define DCLOG_N_TIMES(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_N_TIMES(n, LEVEL, __VA_ARGS__) -#define DCVLOG_N_TIMES(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_N_TIMES(n, vlevel, __VA_ARGS__) - // - // Default Debug Only Loggers macro using CLOG(), CLOG_VERBOSE() and CVLOG() macros - // - // undef existing -#undef DLOG -#undef DVLOG -#undef DLOG_IF -#undef DVLOG_IF -#undef DLOG_EVERY_N -#undef DVLOG_EVERY_N -#undef DLOG_AFTER_N -#undef DVLOG_AFTER_N -#undef DLOG_N_TIMES -#undef DVLOG_N_TIMES - // Normal logs -#define DLOG(LEVEL) DCLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DVLOG(vlevel) DCVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Conditional logs -#define DLOG_IF(condition, LEVEL) DCLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DVLOG_IF(condition, vlevel) DCVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Hit counts based logs -#define DLOG_EVERY_N(n, LEVEL) DCLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DVLOG_EVERY_N(n, vlevel) DCVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) -#define DLOG_AFTER_N(n, LEVEL) DCLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DVLOG_AFTER_N(n, vlevel) DCVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) -#define DLOG_N_TIMES(n, LEVEL) DCLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) -#define DVLOG_N_TIMES(n, vlevel) DCVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) - // Check macros -#undef CCHECK -#undef CPCHECK -#undef CCHECK_EQ -#undef CCHECK_NE -#undef CCHECK_LT -#undef CCHECK_GT -#undef CCHECK_LE -#undef CCHECK_GE -#undef CCHECK_BOUNDS -#undef CCHECK_NOTNULL -#undef CCHECK_STRCASEEQ -#undef CCHECK_STRCASENE -#undef CHECK -#undef PCHECK -#undef CHECK_EQ -#undef CHECK_NE -#undef CHECK_LT -#undef CHECK_GT -#undef CHECK_LE -#undef CHECK_GE -#undef CHECK_BOUNDS -#undef CHECK_NOTNULL -#undef CHECK_STRCASEEQ -#undef CHECK_STRCASENE -#define CCHECK(condition, ...) CLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " -#define CPCHECK(condition, ...) CPLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " -#define CHECK(condition) CCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) -#define PCHECK(condition) CPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) -#define CCHECK_EQ(a, b, ...) CCHECK(a == b, __VA_ARGS__) -#define CCHECK_NE(a, b, ...) CCHECK(a != b, __VA_ARGS__) -#define CCHECK_LT(a, b, ...) CCHECK(a < b, __VA_ARGS__) -#define CCHECK_GT(a, b, ...) CCHECK(a > b, __VA_ARGS__) -#define CCHECK_LE(a, b, ...) CCHECK(a <= b, __VA_ARGS__) -#define CCHECK_GE(a, b, ...) CCHECK(a >= b, __VA_ARGS__) -#define CCHECK_BOUNDS(val, min, max, ...) CCHECK(val >= min && val <= max, __VA_ARGS__) -#define CHECK_EQ(a, b) CCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_NE(a, b) CCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_LT(a, b) CCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_GT(a, b) CCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_LE(a, b) CCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_GE(a, b) CCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_BOUNDS(val, min, max) CCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) -namespace el { - namespace base { - namespace utils { - template - static T* checkNotNull(T* ptr, const char* name, const char* loggers, ...) { - CLOG_IF(ptr == nullptr, FATAL, loggers) << "Check failed: [" << name << " != nullptr]"; - return ptr; - } - } // namespace utils - } // namespace base -} // namespace el -#define CCHECK_NOTNULL(ptr, ...) el::base::utils::checkNotNull(ptr, #ptr, __VA_ARGS__) -#define CCHECK_STREQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ - << "Check failed: [" << #str1 << " == " << #str2 << "] " -#define CCHECK_STRNE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ - << "Check failed: [" << #str1 << " != " << #str2 << "] " -#define CCHECK_STRCASEEQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ - << "Check failed: [" << #str1 << " == " << #str2 << "] " -#define CCHECK_STRCASENE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ - << "Check failed: [" << #str1 << " != " << #str2 << "] " -#define CHECK_NOTNULL(ptr) CCHECK_NOTNULL(ptr, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_STREQ(str1, str2) CCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_STRNE(str1, str2) CCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_STRCASEEQ(str1, str2) CCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define CHECK_STRCASENE(str1, str2) CCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#undef DCCHECK -#undef DCCHECK_EQ -#undef DCCHECK_NE -#undef DCCHECK_LT -#undef DCCHECK_GT -#undef DCCHECK_LE -#undef DCCHECK_GE -#undef DCCHECK_BOUNDS -#undef DCCHECK_NOTNULL -#undef DCCHECK_STRCASEEQ -#undef DCCHECK_STRCASENE -#undef DCPCHECK -#undef DCHECK -#undef DCHECK_EQ -#undef DCHECK_NE -#undef DCHECK_LT -#undef DCHECK_GT -#undef DCHECK_LE -#undef DCHECK_GE -#undef DCHECK_BOUNDS_ -#undef DCHECK_NOTNULL -#undef DCHECK_STRCASEEQ -#undef DCHECK_STRCASENE -#undef DPCHECK -#define DCCHECK(condition, ...) if (ELPP_DEBUG_LOG) CCHECK(condition, __VA_ARGS__) -#define DCCHECK_EQ(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_EQ(a, b, __VA_ARGS__) -#define DCCHECK_NE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_NE(a, b, __VA_ARGS__) -#define DCCHECK_LT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LT(a, b, __VA_ARGS__) -#define DCCHECK_GT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GT(a, b, __VA_ARGS__) -#define DCCHECK_LE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LE(a, b, __VA_ARGS__) -#define DCCHECK_GE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GE(a, b, __VA_ARGS__) -#define DCCHECK_BOUNDS(val, min, max, ...) if (ELPP_DEBUG_LOG) CCHECK_BOUNDS(val, min, max, __VA_ARGS__) -#define DCCHECK_NOTNULL(ptr, ...) if (ELPP_DEBUG_LOG) CCHECK_NOTNULL(ptr, __VA_ARGS__) -#define DCCHECK_STREQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STREQ(str1, str2, __VA_ARGS__) -#define DCCHECK_STRNE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRNE(str1, str2, __VA_ARGS__) -#define DCCHECK_STRCASEEQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASEEQ(str1, str2, __VA_ARGS__) -#define DCCHECK_STRCASENE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASENE(str1, str2, __VA_ARGS__) -#define DCPCHECK(condition, ...) if (ELPP_DEBUG_LOG) CPCHECK(condition, __VA_ARGS__) -#define DCHECK(condition) DCCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_EQ(a, b) DCCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_NE(a, b) DCCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_LT(a, b) DCCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_GT(a, b) DCCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_LE(a, b) DCCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_GE(a, b) DCCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_BOUNDS(val, min, max) DCCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_NOTNULL(ptr) DCCHECK_NOTNULL(ptr, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_STREQ(str1, str2) DCCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_STRNE(str1, str2) DCCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_STRCASEEQ(str1, str2) DCCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define DCHECK_STRCASENE(str1, str2) DCCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) -#define DPCHECK(condition) DCPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) -#if defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) -# define ELPP_USE_DEF_CRASH_HANDLER false -#else -# define ELPP_USE_DEF_CRASH_HANDLER true -#endif // defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) -#define ELPP_CRASH_HANDLER_INIT -#define ELPP_INIT_EASYLOGGINGPP(val)\ - ELPP_INITI_BASIC_DECLR\ - namespace el {\ - namespace base {\ - el::base::type::StoragePointer elStorage(val);\ - }\ - el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ - } - -#if ELPP_ASYNC_LOGGING -# define INITIALIZE_EASYLOGGINGPP\ - ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()),\ - new el::base::AsyncDispatchWorker()))\ - -#else -# define INITIALIZE_EASYLOGGINGPP\ - ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()))) -#endif // ELPP_ASYNC_LOGGING -#define INITIALIZE_NULL_EASYLOGGINGPP\ - ELPP_INITI_BASIC_DECLR\ - namespace el {\ - namespace base {\ - el::base::type::StoragePointer elStorage;\ - }\ - el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ - } - // NOTE: no ELPP_INITI_BASIC_DECLR when sharing - causes double free corruption on external symbols -#define SHARE_EASYLOGGINGPP(initializedStorage)\ - namespace el {\ - namespace base {\ - el::base::type::StoragePointer elStorage(initializedStorage);\ - }\ - el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ - } - -#if defined(ELPP_UNICODE) -# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv); std::locale::global(std::locale("")) -#else -# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv) -#endif // defined(ELPP_UNICODE) +// +// Easylogging++ v9.80 +// Single-header only, cross-platform logging library for C++ applications +// +// Copyright (c) 2015 muflihun.com +// +// This library is released under the MIT Licence. +// http://easylogging.muflihun.com/licence.php +// +// easylogging@muflihun.com +// +// https://github.com/easylogging/easyloggingpp +// http://easylogging.muflihun.com +// http://muflihun.com +// +#ifndef EASYLOGGINGPP_H +#define EASYLOGGINGPP_H +// Compilers and C++0x/C++11 Evaluation +#if defined(__GNUC__) +# define ELPP_COMPILER_GCC 1 +# define ELPP_GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define ELPP_CXX0X 1 +# elif(ELPP_GCC_VERSION >= 40801) +# define ELPP_CXX11 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +#endif // defined(__GNUC__) +// Visual C++ +#if defined(_MSC_VER) +# define ELPP_COMPILER_MSVC 1 +# define ELPP_CRT_DBG_WARNINGS 1 +# if (_MSC_VER == 1600) +# define ELPP_CXX0X 1 +# elif(_MSC_VER >= 1700) +# define ELPP_CXX11 1 +# endif // (_MSC_VER == 1600) +#endif // defined(_MSC_VER) +// Clang++ +#if defined(__clang__) && (__clang__ == 1) +# define ELPP_COMPILER_CLANG 1 +# define ELPP_CLANG_VERSION (__clang_major__ * 10000 \ + + __clang_minor__ * 100 \ + + __clang_patchlevel__) +# if (ELPP_CLANG_VERSION >= 30300) +# define ELPP_CXX11 1 +# endif // (ELPP_CLANG_VERSION >= 30300) +#endif // defined(__clang__) && (__clang__ == 1) +// MinGW +#if defined(__MINGW32__) || defined(__MINGW64__) +# define ELPP_MINGW 1 +#endif // defined(__MINGW32__) || defined(__MINGW64__) +// Cygwin +#if defined(__CYGWIN__) && (__CYGWIN__ == 1) +# define ELPP_CYGWIN 1 +#endif // defined(__CYGWIN__) && (__CYGWIN__ == 1) +// Intel C++ +#if defined(__INTEL_COMPILER) +# define ELPP_COMPILER_INTEL 1 +#endif +// Operating System Evaluation +// Windows +#if defined(_WIN32) || defined(_WIN64) +# define ELPP_OS_WINDOWS 1 +#endif // defined(_WIN32) || defined(_WIN64) +// Linux +#if (defined(__linux) || defined(__linux__)) +# define ELPP_OS_LINUX 1 +#endif // (defined(__linux) || defined(__linux__)) +// Mac +#if defined(__APPLE__) +# define ELPP_OS_MAC 1 +#endif // defined(__APPLE__) +// FreeBSD +#if defined(__FreeBSD__) +# define ELPP_OS_FREEBSD 1 +#endif +// Solaris +#if defined(__sun) +# define ELPP_OS_SOLARIS 1 +#endif +// Unix +#if ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_SOLARIS) && (!ELPP_OS_WINDOWS)) +# define ELPP_OS_UNIX 1 +#endif // ((ELPP_OS_LINUX || ELPP_OS_MAC || ELPP_OS_FREEBSD || ELPP_OS_SOLARIS) && (!ELPP_OS_WINDOWS)) +// Android +#if defined(__ANDROID__) +# define ELPP_OS_ANDROID 1 +#endif // defined(__ANDROID__) +// Evaluating Cygwin as *nix OS +#if !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN +# undef ELPP_OS_UNIX +# undef ELPP_OS_LINUX +# define ELPP_OS_UNIX 1 +# define ELPP_OS_LINUX 1 +#endif // !ELPP_OS_UNIX && !ELPP_OS_WINDOWS && ELPP_CYGWIN +#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_INFO) +# define ELPP_INTERNAL_DEBUGGING_OUT_INFO std::cout +#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) +#if !defined(ELPP_INTERNAL_DEBUGGING_OUT_ERROR) +# define ELPP_INTERNAL_DEBUGGING_OUT_ERROR std::cerr +#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) +#if !defined(ELPP_INTERNAL_DEBUGGING_ENDL) +# define ELPP_INTERNAL_DEBUGGING_ENDL std::endl +#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) +#if !defined(ELPP_INTERNAL_DEBUGGING_MSG) +# define ELPP_INTERNAL_DEBUGGING_MSG(msg) msg +#endif // !defined(ELPP_INTERNAL_DEBUGGING_OUT) +// Internal Assertions and errors +#if !defined(ELPP_DISABLE_ASSERT) +# if (defined(ELPP_DEBUG_ASSERT_FAILURE)) +# define ELPP_ASSERT(expr, msg) if (!(expr)) { \ + std::stringstream internalInfoStream; internalInfoStream << msg; \ + ELPP_INTERNAL_DEBUGGING_OUT_ERROR \ + << "EASYLOGGING++ ASSERTION FAILED (LINE: " << __LINE__ << ") [" #expr << "] WITH MESSAGE \"" \ + << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" << ELPP_INTERNAL_DEBUGGING_ENDL; base::utils::abort(1, \ + "ELPP Assertion failure, please define ELPP_DEBUG_ASSERT_FAILURE"); } +# else +# define ELPP_ASSERT(expr, msg) if (!(expr)) { \ + std::stringstream internalInfoStream; internalInfoStream << msg; \ + ELPP_INTERNAL_DEBUGGING_OUT_ERROR\ + << "ASSERTION FAILURE FROM EASYLOGGING++ (LINE: " \ + << __LINE__ << ") [" #expr << "] WITH MESSAGE \"" << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << "\"" \ + << ELPP_INTERNAL_DEBUGGING_ENDL; } +# endif // (defined(ELPP_DEBUG_ASSERT_FAILURE)) +#else +# define ELPP_ASSERT(x, y) +#endif //(!defined(ELPP_DISABLE_ASSERT) +#if ELPP_COMPILER_MSVC +# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ + { char buff[256]; strerror_s(buff, 256, errno); \ + ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << buff << " [" << errno << "]";} (void)0 +#else +# define ELPP_INTERNAL_DEBUGGING_WRITE_PERROR \ + ELPP_INTERNAL_DEBUGGING_OUT_ERROR << ": " << strerror(errno) << " [" << errno << "]"; (void)0 +#endif // ELPP_COMPILER_MSVC +#if defined(ELPP_DEBUG_ERRORS) +# if !defined(ELPP_INTERNAL_ERROR) +# define ELPP_INTERNAL_ERROR(msg, pe) { \ + std::stringstream internalInfoStream; internalInfoStream << " " << msg; \ + ELPP_INTERNAL_DEBUGGING_OUT_ERROR \ + << "ERROR FROM EASYLOGGING++ (LINE: " << __LINE__ << ") " \ + << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) << ELPP_INTERNAL_DEBUGGING_ENDL; \ + if (pe) { ELPP_INTERNAL_DEBUGGING_OUT_ERROR << " "; ELPP_INTERNAL_DEBUGGING_WRITE_PERROR; }} (void)0 +# endif +#else +# undef ELPP_INTERNAL_INFO +# define ELPP_INTERNAL_ERROR(msg, pe) +#endif // defined(ELPP_DEBUG_ERRORS) +#if (defined(ELPP_DEBUG_INFO)) +# if !(defined(ELPP_INTERNAL_INFO_LEVEL)) +# define ELPP_INTERNAL_INFO_LEVEL 9 +# endif // !(defined(ELPP_INTERNAL_INFO_LEVEL)) +# if !defined(ELPP_INTERNAL_INFO) +# define ELPP_INTERNAL_INFO(lvl, msg) { if (lvl <= ELPP_INTERNAL_INFO_LEVEL) { \ + std::stringstream internalInfoStream; internalInfoStream << " " << msg; \ + ELPP_INTERNAL_DEBUGGING_OUT_INFO << ELPP_INTERNAL_DEBUGGING_MSG(internalInfoStream.str()) \ + << ELPP_INTERNAL_DEBUGGING_ENDL; }} +# endif +#else +# undef ELPP_INTERNAL_INFO +# define ELPP_INTERNAL_INFO(lvl, msg) +#endif // (defined(ELPP_DEBUG_INFO)) +#if defined(ELPP_STACKTRACE_ON_CRASH) +# if (ELPP_COMPILER_GCC && !ELPP_MINGW) +# define ELPP_STACKTRACE 1 +# else +# if ELPP_COMPILER_MSVC +# pragma message("Stack trace not available for this compiler") +# else +# warning "Stack trace not available for this compiler"; +# endif // ELPP_COMPILER_MSVC +# endif // ELPP_COMPILER_GCC +#endif // (defined(ELPP_STACKTRACE_ON_CRASH)) +// Miscellaneous macros +#define ELPP_UNUSED(x) (void)x +#if ELPP_OS_UNIX +// Log file permissions for unix-based systems +# define ELPP_LOG_PERMS S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IRGRP | S_IXGRP | S_IWOTH | S_IXOTH +#endif // ELPP_OS_UNIX +#if defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC +# if defined(ELPP_EXPORT_SYMBOLS) +# define ELPP_EXPORT __declspec(dllexport) +# else +# define ELPP_EXPORT __declspec(dllimport) +# endif // defined(ELPP_EXPORT_SYMBOLS) +#else +# define ELPP_EXPORT +#endif // defined(ELPP_AS_DLL) && ELPP_COMPILER_MSVC +// Some special functions that are VC++ specific +#undef STRTOK +#undef STRERROR +#undef STRCAT +#undef STRCPY +#if ELPP_CRT_DBG_WARNINGS +# define STRTOK(a, b, c) strtok_s(a, b, c) +# define STRERROR(a, b, c) strerror_s(a, b, c) +# define STRCAT(a, b, len) strcat_s(a, len, b) +# define STRCPY(a, b, len) strcpy_s(a, len, b) +#else +# define STRTOK(a, b, c) strtok(a, b) +# define STRERROR(a, b, c) strerror(c) +# define STRCAT(a, b, len) strcat(a, b) +# define STRCPY(a, b, len) strcpy(a, b) +#endif +// Compiler specific support evaluations +#if (!ELPP_MINGW && !ELPP_COMPILER_CLANG) || defined(ELPP_FORCE_USE_STD_THREAD) +# define ELPP_USE_STD_THREADING 1 +#endif // (!ELPP_MINGW && !ELPP_COMPILER_CLANG) || defined(ELPP_FORCE_USE_STD_THREAD) +#undef ELPP_FINAL +#if ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702) +# define ELPP_FINAL +#else +# define ELPP_FINAL final +#endif // ELPP_COMPILER_INTEL || (ELPP_GCC_VERSION < 40702) +#if defined(ELPP_EXPERIMENTAL_ASYNC) +# define ELPP_ASYNC_LOGGING 1 +#else +# define ELPP_ASYNC_LOGGING 0 +#endif // defined(ELPP_EXPERIMENTAL_ASYNC) +#if defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING +# define ELPP_THREADING_ENABLED 1 +#endif // defined(ELPP_THREAD_SAFE) || ELPP_ASYNC_LOGGING +// Function macro ELPP_FUNC +#undef ELPP_FUNC +#if ELPP_COMPILER_MSVC // Visual C++ +# define ELPP_FUNC __FUNCSIG__ +#elif ELPP_COMPILER_GCC // GCC +# define ELPP_FUNC __PRETTY_FUNCTION__ +#elif ELPP_COMPILER_INTEL // Intel C++ +# define ELPP_FUNC __PRETTY_FUNCTION__ +#elif ELPP_COMPILER_CLANG // Clang++ +# define ELPP_FUNC __PRETTY_FUNCTION__ +#else +# if defined(__func__) +# define ELPP_FUNC __func__ +# else +# define ELPP_FUNC "" +# endif // defined(__func__) +#endif // defined(_MSC_VER) +#undef ELPP_VARIADIC_TEMPLATES_SUPPORTED +// Keep following line commented until features are fixed +#if ELPP_COMPILER_GCC || ELPP_COMPILER_CLANG || ELPP_COMPILER_INTEL || (ELPP_COMPILER_MSVC && _MSC_VER >= 1800) +# define ELPP_VARIADIC_TEMPLATES_SUPPORTED 1 +#endif // ELPP_COMPILER_GCC || ELPP_COMPILER_CLANG || ELPP_COMPILER_INTEL || (ELPP_COMPILER_MSVC && _MSC_VER >= 1800) +// Logging Enable/Disable macros +#if (!defined(ELPP_DISABLE_LOGS)) +# define ELPP_LOGGING_ENABLED 1 +#endif // (!defined(ELPP_DISABLE_LOGS)) +#if (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED) && ((defined(_DEBUG)) || (!defined(NDEBUG)))) +# define ELPP_DEBUG_LOG 1 +#else +# define ELPP_DEBUG_LOG 0 +#endif // (!defined(ELPP_DISABLE_DEBUG_LOGS) && (ELPP_LOGGING_ENABLED) && ((defined(_DEBUG)) || (!defined(NDEBUG)))) +#if (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_INFO_LOG 1 +#else +# define ELPP_INFO_LOG 0 +#endif // (!defined(ELPP_DISABLE_INFO_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_WARNING_LOG 1 +#else +# define ELPP_WARNING_LOG 0 +#endif // (!defined(ELPP_DISABLE_WARNING_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_ERROR_LOG 1 +#else +# define ELPP_ERROR_LOG 0 +#endif // (!defined(ELPP_DISABLE_ERROR_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_FATAL_LOG 1 +#else +# define ELPP_FATAL_LOG 0 +#endif // (!defined(ELPP_DISABLE_FATAL_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_TRACE_LOG 1 +#else +# define ELPP_TRACE_LOG 0 +#endif // (!defined(ELPP_DISABLE_TRACE_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) +# define ELPP_VERBOSE_LOG 1 +#else +# define ELPP_VERBOSE_LOG 0 +#endif // (!defined(ELPP_DISABLE_VERBOSE_LOGS) && (ELPP_LOGGING_ENABLED)) +#if (!(ELPP_CXX0X || ELPP_CXX11)) +# error "Easylogging++ 9.0+ is only compatible with C++0x (or higher) compliant compiler" +#endif // (!(ELPP_CXX0X || ELPP_CXX11)) +// Headers +#if defined(ELPP_SYSLOG) +# include +#endif // defined(ELPP_SYSLOG) +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(ELPP_UNICODE) +# include +# if ELPP_OS_WINDOWS +# include +# endif // ELPP_OS_WINDOWS +#endif // defined(ELPP_UNICODE) +#if ELPP_STACKTRACE +# include +# include +#endif // ELPP_STACKTRACE +#if ELPP_OS_ANDROID +# include +#endif // ELPP_OS_ANDROID +#if ELPP_OS_UNIX +# include +# include +#elif ELPP_OS_WINDOWS +# include +# include +# if defined(WIN32_LEAN_AND_MEAN) +# if defined(ELPP_WINSOCK2) +# include +# else +# include +# endif // defined(ELPP_WINSOCK2) +# endif // defined(WIN32_LEAN_AND_MEAN) +#endif // ELPP_OS_UNIX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if ELPP_THREADING_ENABLED +# if ELPP_USE_STD_THREADING +# include +# include +# else +# if ELPP_OS_UNIX +# include +# endif // ELPP_OS_UNIX +# endif // ELPP_USE_STD_THREADING +#endif // ELPP_THREADING_ENABLED +#if ELPP_ASYNC_LOGGING +# include +# include +# include +#endif // ELPP_ASYNC_LOGGING +#if defined(ELPP_STL_LOGGING) +// For logging STL based templates +# include +# include +# include +# include +# include +# include +# if defined(ELPP_LOG_STD_ARRAY) +# include +# endif // defined(ELPP_LOG_STD_ARRAY) +# if defined(ELPP_LOG_UNORDERED_MAP) +# include +# endif // defined(ELPP_LOG_UNORDERED_MAP) +# if defined(ELPP_LOG_UNORDERED_SET) +# include +# endif // defined(ELPP_UNORDERED_SET) +#endif // defined(ELPP_STL_LOGGING) +#if defined(ELPP_QT_LOGGING) +// For logging Qt based classes & templates +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif // defined(ELPP_QT_LOGGING) +#if defined(ELPP_BOOST_LOGGING) +// For logging boost based classes & templates +# include +# include +# include +# include +# include +# include +# include +# include +#endif // defined(ELPP_BOOST_LOGGING) +#if defined(ELPP_WXWIDGETS_LOGGING) +// For logging wxWidgets based classes & templates +# include +#endif // defined(ELPP_WXWIDGETS_LOGGING) +// Forward declarations +namespace el { + class Logger; + class LogMessage; + class PerformanceTrackingData; + class Loggers; + class Helpers; + template class Callback; + class LogDispatchCallback; + class PerformanceTrackingCallback; + class LogDispatchData; + namespace base { + class Storage; + class RegisteredLoggers; + class PerformanceTracker; + class MessageBuilder; + class Writer; + class PErrorWriter; + class LogDispatcher; + class DefaultLogBuilder; + class DefaultLogDispatchCallback; +#if ELPP_ASYNC_LOGGING + class AsyncLogDispatchCallback; + class AsyncDispatchWorker; +#endif // ELPP_ASYNC_LOGGING + class DefaultPerformanceTrackingCallback; + } // namespace base +} // namespace el + /// @brief Easylogging++ entry namespace +namespace el { + /// @brief Namespace containing base/internal functionality used by Easylogging++ + namespace base { + /// @brief Data types used by Easylogging++ + namespace type { +#undef ELPP_LITERAL +#undef ELPP_STRLEN +#undef ELPP_COUT +#if defined(ELPP_UNICODE) +# define ELPP_LITERAL(txt) L##txt +# define ELPP_STRLEN wcslen +# if defined ELPP_CUSTOM_COUT +# define ELPP_COUT ELPP_CUSTOM_COUT +# else +# define ELPP_COUT std::wcout +# endif // defined ELPP_CUSTOM_COUT + typedef wchar_t char_t; + typedef std::wstring string_t; + typedef std::wstringstream stringstream_t; + typedef std::wfstream fstream_t; + typedef std::wostream ostream_t; +#else +# define ELPP_LITERAL(txt) txt +# define ELPP_STRLEN strlen +# if defined ELPP_CUSTOM_COUT +# define ELPP_COUT ELPP_CUSTOM_COUT +# else +# define ELPP_COUT std::cout +# endif // defined ELPP_CUSTOM_COUT + typedef char char_t; + typedef std::string string_t; + typedef std::stringstream stringstream_t; + typedef std::fstream fstream_t; + typedef std::ostream ostream_t; +#endif // defined(ELPP_UNICODE) +#if defined(ELPP_CUSTOM_COUT_LINE) +# define ELPP_COUT_LINE(logLine) ELPP_CUSTOM_COUT_LINE(logLine) +#else +# define ELPP_COUT_LINE(logLine) logLine << std::flush +#endif // defined(ELPP_CUSTOM_COUT_LINE) + typedef unsigned short EnumType; + typedef std::shared_ptr StoragePointer; + typedef int VerboseLevel; + typedef std::shared_ptr LogDispatchCallbackPtr; + typedef std::shared_ptr PerformanceTrackingCallbackPtr; + } // namespace type + /// @brief Internal helper class that prevent copy constructor for class + /// + /// @detail When using this class simply inherit it privately + class NoCopy { + protected: + NoCopy(void) {} + private: + NoCopy(const NoCopy&); + NoCopy& operator=(const NoCopy&); + }; + /// @brief Internal helper class that makes all default constructors private. + /// + /// @detail This prevents initializing class making it static unless an explicit constructor is declared. + /// When using this class simply inherit it privately + class StaticClass { + private: + StaticClass(void); + StaticClass(const StaticClass&); + StaticClass& operator=(const StaticClass&); + }; + } // namespace base + /// @brief Represents enumeration for severity level used to determine level of logging + /// + /// @detail With Easylogging++, developers may disable or enable any level regardless of + /// what the severity is. Or they can choose to log using hierarchical logging flag + enum class Level : base::type::EnumType { + /// @brief Generic level that represents all the levels. Useful when setting global configuration for all levels + Global = 1, + /// @brief Information that can be useful to back-trace certain events - mostly useful than debug logs. + Trace = 2, + /// @brief Informational events most useful for developers to debug application + Debug = 4, + /// @brief Severe error information that will presumably abort application + Fatal = 8, + /// @brief Information representing errors in application but application will keep running + Error = 16, + /// @brief Useful when application has potentially harmful situtaions + Warning = 32, + /// @brief Information that can be highly useful and vary with verbose logging level. + Verbose = 64, + /// @brief Mainly useful to represent current progress of application + Info = 128, + /// @brief Represents unknown level + Unknown = 1010 + }; + /// @brief Static class that contains helper functions for el::Level + class LevelHelper : base::StaticClass { + public: + /// @brief Represents minimum valid level. Useful when iterating through enum. + static const base::type::EnumType kMinValid = static_cast(Level::Trace); + /// @brief Represents maximum valid level. This is used internally and you should not need it. + static const base::type::EnumType kMaxValid = static_cast(Level::Info); + /// @brief Casts level to int, useful for iterating through enum. + static base::type::EnumType castToInt(Level level) { + return static_cast(level); + } + /// @brief Casts int(ushort) to level, useful for iterating through enum. + static Level castFromInt(base::type::EnumType l) { + return static_cast(l); + } + /// @brief Converts level to associated const char* + /// @return Upper case string based level. + static const char* convertToString(Level level) { + // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. + if (level == Level::Global) return "GLOBAL"; + if (level == Level::Debug) return "DEBUG"; + if (level == Level::Info) return "INFO"; + if (level == Level::Warning) return "WARNING"; + if (level == Level::Error) return "ERROR"; + if (level == Level::Fatal) return "FATAL"; + if (level == Level::Verbose) return "VERBOSE"; + if (level == Level::Trace) return "TRACE"; + return "UNKNOWN"; + } + /// @brief Converts from levelStr to Level + /// @param levelStr Upper case string based level. + /// Lower case is also valid but providing upper case is recommended. + static Level convertFromString(const char* levelStr) { + if ((strcmp(levelStr, "GLOBAL") == 0) || (strcmp(levelStr, "global") == 0)) + return Level::Global; + if ((strcmp(levelStr, "DEBUG") == 0) || (strcmp(levelStr, "debug") == 0)) + return Level::Debug; + if ((strcmp(levelStr, "INFO") == 0) || (strcmp(levelStr, "info") == 0)) + return Level::Info; + if ((strcmp(levelStr, "WARNING") == 0) || (strcmp(levelStr, "warning") == 0)) + return Level::Warning; + if ((strcmp(levelStr, "ERROR") == 0) || (strcmp(levelStr, "error") == 0)) + return Level::Error; + if ((strcmp(levelStr, "FATAL") == 0) || (strcmp(levelStr, "fatal") == 0)) + return Level::Fatal; + if ((strcmp(levelStr, "VERBOSE") == 0) || (strcmp(levelStr, "verbose") == 0)) + return Level::Verbose; + if ((strcmp(levelStr, "TRACE") == 0) || (strcmp(levelStr, "trace") == 0)) + return Level::Trace; + return Level::Unknown; + } + /// @brief Applies specified function to each level starting from startIndex + /// @param startIndex initial value to start the iteration from. This is passed as pointer and + /// is left-shifted so this can be used inside function (fn) to represent current level. + /// @param fn function to apply with each level. This bool represent whether or not to stop iterating through levels. + static inline void forEachLevel(base::type::EnumType* startIndex, const std::function& fn) { + base::type::EnumType lIndexMax = LevelHelper::kMaxValid; + do { + if (fn()) { + break; + } + *startIndex = static_cast(*startIndex << 1); + } while (*startIndex <= lIndexMax); + } + }; + /// @brief Represents enumeration of ConfigurationType used to configure or access certain aspect + /// of logging + enum class ConfigurationType : base::type::EnumType { + /// @brief Determines whether or not corresponding level and logger of logging is enabled + /// You may disable all logs by using el::Level::Global + Enabled = 1, + /// @brief Whether or not to write corresponding log to log file + ToFile = 2, + /// @brief Whether or not to write corresponding level and logger log to standard output. + /// By standard output meaning termnal, command prompt etc + ToStandardOutput = 4, + /// @brief Determines format of logging corresponding level and logger. + Format = 8, + /// @brief Determines log file (full path) to write logs to for correponding level and logger + Filename = 16, + /// @brief Specifies milliseconds width. Width can be within range (1-6) + MillisecondsWidth = 32, + /// @brief Determines whether or not performance tracking is enabled. + /// + /// @detail This does not depend on logger or level. Performance tracking always uses 'performance' logger + PerformanceTracking = 64, + /// @brief Specifies log file max size. + /// + /// @detail If file size of corresponding log file (for corresponding level) is >= specified size, log file will + /// be truncated and re-initiated. + MaxLogFileSize = 128, + /// @brief Specifies number of log entries to hold until we flush pending log data + LogFlushThreshold = 256, + /// @brief Represents unknown configuration + Unknown = 1010 + }; + /// @brief Static class that contains helper functions for el::ConfigurationType + class ConfigurationTypeHelper : base::StaticClass { + public: + /// @brief Represents minimum valid configuration type. Useful when iterating through enum. + static const base::type::EnumType kMinValid = static_cast(ConfigurationType::Enabled); + /// @brief Represents maximum valid configuration type. This is used internally and you should not need it. + static const base::type::EnumType kMaxValid = static_cast(ConfigurationType::MaxLogFileSize); + /// @brief Casts configuration type to int, useful for iterating through enum. + static base::type::EnumType castToInt(ConfigurationType configurationType) { + return static_cast(configurationType); + } + /// @brief Casts int(ushort) to configurationt type, useful for iterating through enum. + static ConfigurationType castFromInt(base::type::EnumType c) { + return static_cast(c); + } + /// @brief Converts configuration type to associated const char* + /// @returns Upper case string based configuration type. + static const char* convertToString(ConfigurationType configurationType) { + // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. + if (configurationType == ConfigurationType::Enabled) return "ENABLED"; + if (configurationType == ConfigurationType::Filename) return "FILENAME"; + if (configurationType == ConfigurationType::Format) return "FORMAT"; + if (configurationType == ConfigurationType::ToFile) return "TO_FILE"; + if (configurationType == ConfigurationType::ToStandardOutput) return "TO_STANDARD_OUTPUT"; + if (configurationType == ConfigurationType::MillisecondsWidth) return "MILLISECONDS_WIDTH"; + if (configurationType == ConfigurationType::PerformanceTracking) return "PERFORMANCE_TRACKING"; + if (configurationType == ConfigurationType::MaxLogFileSize) return "MAX_LOG_FILE_SIZE"; + if (configurationType == ConfigurationType::LogFlushThreshold) return "LOG_FLUSH_THRESHOLD"; + return "UNKNOWN"; + } + /// @brief Converts from configStr to ConfigurationType + /// @param configStr Upper case string based configuration type. + /// Lower case is also valid but providing upper case is recommended. + static ConfigurationType convertFromString(const char* configStr) { + if ((strcmp(configStr, "ENABLED") == 0) || (strcmp(configStr, "enabled") == 0)) + return ConfigurationType::Enabled; + if ((strcmp(configStr, "TO_FILE") == 0) || (strcmp(configStr, "to_file") == 0)) + return ConfigurationType::ToFile; + if ((strcmp(configStr, "TO_STANDARD_OUTPUT") == 0) || (strcmp(configStr, "to_standard_output") == 0)) + return ConfigurationType::ToStandardOutput; + if ((strcmp(configStr, "FORMAT") == 0) || (strcmp(configStr, "format") == 0)) + return ConfigurationType::Format; + if ((strcmp(configStr, "FILENAME") == 0) || (strcmp(configStr, "filename") == 0)) + return ConfigurationType::Filename; + if ((strcmp(configStr, "MILLISECONDS_WIDTH") == 0) || (strcmp(configStr, "milliseconds_width") == 0)) + return ConfigurationType::MillisecondsWidth; + if ((strcmp(configStr, "PERFORMANCE_TRACKING") == 0) || (strcmp(configStr, "performance_tracking") == 0)) + return ConfigurationType::PerformanceTracking; + if ((strcmp(configStr, "MAX_LOG_FILE_SIZE") == 0) || (strcmp(configStr, "max_log_file_size") == 0)) + return ConfigurationType::MaxLogFileSize; + if ((strcmp(configStr, "LOG_FLUSH_THRESHOLD") == 0) || (strcmp(configStr, "log_flush_threshold") == 0)) + return ConfigurationType::LogFlushThreshold; + return ConfigurationType::Unknown; + } + /// @brief Applies specified function to each configuration type starting from startIndex + /// @param startIndex initial value to start the iteration from. This is passed by pointer and is left-shifted + /// so this can be used inside function (fn) to represent current configuration type. + /// @param fn function to apply with each configuration type. + /// This bool represent whether or not to stop iterating through configurations. + static inline void forEachConfigType(base::type::EnumType* startIndex, const std::function& fn) { + base::type::EnumType cIndexMax = ConfigurationTypeHelper::kMaxValid; + do { + if (fn()) { + break; + } + *startIndex = static_cast(*startIndex << 1); + } while (*startIndex <= cIndexMax); + } + }; + /// @brief Flags used while writing logs. This flags are set by user + enum class LoggingFlag : base::type::EnumType { + /// @brief Makes sure we have new line for each container log entry + NewLineForContainer = 1, + /// @brief Makes sure if -vmodule is used and does not specifies a module, then verbose + /// logging is allowed via that module. + AllowVerboseIfModuleNotSpecified = 2, + /// @brief When handling crashes by default, detailed crash reason will be logged as well + LogDetailedCrashReason = 4, + /// @brief Allows to disable application abortion when logged using FATAL level + DisableApplicationAbortOnFatalLog = 8, + /// @brief Flushes log with every log-entry (performance sensative) - Disabled by default + ImmediateFlush = 16, + /// @brief Enables strict file rolling + StrictLogFileSizeCheck = 32, + /// @brief Make terminal output colorful for supported terminals + ColoredTerminalOutput = 64, + /// @brief Supports use of multiple logging in same macro, e.g, CLOG(INFO, "default", "network") + MultiLoggerSupport = 128, + /// @brief Disables comparing performance tracker's checkpoints + DisablePerformanceTrackingCheckpointComparison = 256, + /// @brief Disable VModules + DisableVModules = 512, + /// @brief Disable VModules extensions + DisableVModulesExtensions = 1024, + /// @brief Enables hierarchical logging + HierarchicalLogging = 2048, + /// @brief Creates logger automatically when not available + CreateLoggerAutomatically = 4096, + /// @brief Adds spaces b/w logs that separated by left-shift operator + AutoSpacing = 8192, + /// @brief Preserves time format and does not convert it to sec, hour etc (performance tracking only) + FixedTimeFormat = 16384 + }; + namespace base { + /// @brief Namespace containing constants used internally. + namespace consts { + // Level log values - These are values that are replaced in place of %level format specifier + static const base::type::char_t* kInfoLevelLogValue = ELPP_LITERAL("INFO "); + static const base::type::char_t* kDebugLevelLogValue = ELPP_LITERAL("DEBUG"); + static const base::type::char_t* kWarningLevelLogValue = ELPP_LITERAL("WARN "); + static const base::type::char_t* kErrorLevelLogValue = ELPP_LITERAL("ERROR"); + static const base::type::char_t* kFatalLevelLogValue = ELPP_LITERAL("FATAL"); + static const base::type::char_t* kVerboseLevelLogValue = ELPP_LITERAL("VER"); + static const base::type::char_t* kTraceLevelLogValue = ELPP_LITERAL("TRACE"); + static const base::type::char_t* kInfoLevelShortLogValue = ELPP_LITERAL("I"); + static const base::type::char_t* kDebugLevelShortLogValue = ELPP_LITERAL("D"); + static const base::type::char_t* kWarningLevelShortLogValue = ELPP_LITERAL("W"); + static const base::type::char_t* kErrorLevelShortLogValue = ELPP_LITERAL("E"); + static const base::type::char_t* kFatalLevelShortLogValue = ELPP_LITERAL("F"); + static const base::type::char_t* kVerboseLevelShortLogValue = ELPP_LITERAL("V"); + static const base::type::char_t* kTraceLevelShortLogValue = ELPP_LITERAL("T"); + // Format specifiers - These are used to define log format + static const base::type::char_t* kAppNameFormatSpecifier = ELPP_LITERAL("%app"); + static const base::type::char_t* kLoggerIdFormatSpecifier = ELPP_LITERAL("%logger"); + static const base::type::char_t* kThreadIdFormatSpecifier = ELPP_LITERAL("%thread"); + static const base::type::char_t* kSeverityLevelFormatSpecifier = ELPP_LITERAL("%level"); + static const base::type::char_t* kSeverityLevelShortFormatSpecifier = ELPP_LITERAL("%levshort"); + static const base::type::char_t* kDateTimeFormatSpecifier = ELPP_LITERAL("%datetime"); + static const base::type::char_t* kLogFileFormatSpecifier = ELPP_LITERAL("%file"); + static const base::type::char_t* kLogFileBaseFormatSpecifier = ELPP_LITERAL("%fbase"); + static const base::type::char_t* kLogLineFormatSpecifier = ELPP_LITERAL("%line"); + static const base::type::char_t* kLogLocationFormatSpecifier = ELPP_LITERAL("%loc"); + static const base::type::char_t* kLogFunctionFormatSpecifier = ELPP_LITERAL("%func"); + static const base::type::char_t* kCurrentUserFormatSpecifier = ELPP_LITERAL("%user"); + static const base::type::char_t* kCurrentHostFormatSpecifier = ELPP_LITERAL("%host"); + static const base::type::char_t* kMessageFormatSpecifier = ELPP_LITERAL("%msg"); + static const base::type::char_t* kVerboseLevelFormatSpecifier = ELPP_LITERAL("%vlevel"); + static const char* kDateTimeFormatSpecifierForFilename = "%datetime"; + // Date/time + static const char* kDays[7] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; + static const char* kDaysAbbrev[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + static const char* kMonths[12] = { "January", "February", "March", "Apri", "May", "June", "July", "August", + "September", "October", "November", "December" }; + static const char* kMonthsAbbrev[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + static const char* kDefaultDateTimeFormat = "%Y-%M-%d %H:%m:%s,%g"; + static const char* kDefaultDateTimeFormatInFilename = "%Y-%M-%d_%H-%m"; + static const int kYearBase = 1900; + static const char* kAm = "AM"; + static const char* kPm = "PM"; + // Miscellaneous constants + static const char* kDefaultLoggerId = "default"; + static const char* kPerformanceLoggerId = "performance"; + static const char* kSysLogLoggerId = "syslog"; + static const char* kNullPointer = "nullptr"; + static const char kFormatSpecifierChar = '%'; +#if ELPP_VARIADIC_TEMPLATES_SUPPORTED + static const char kFormatSpecifierCharValue = 'v'; +#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED + static const unsigned int kMaxLogPerContainer = 100; + static const unsigned int kMaxLogPerCounter = 100000; + static const unsigned int kDefaultMillisecondsWidth = 3; + static const base::type::VerboseLevel kMaxVerboseLevel = 9; + static const char* kUnknownUser = "user"; + static const char* kUnknownHost = "unknown-host"; +#if defined(ELPP_DEFAULT_LOG_FILE) + static const char* kDefaultLogFile = ELPP_DEFAULT_LOG_FILE; +#else +# if ELPP_OS_UNIX +# if ELPP_OS_ANDROID + static const char* kDefaultLogFile = "logs/ace.log"; +# else + static const char* kDefaultLogFile = "logs/ace.log"; +# endif // ELPP_OS_ANDROID +# elif ELPP_OS_WINDOWS + static const char* kDefaultLogFile = "logs\\ace.log"; +# endif // ELPP_OS_UNIX +#endif // defined(ELPP_DEFAULT_LOG_FILE) +#if !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) + static const char* kDefaultLogFileParam = "--default-log-file"; +#endif // !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) +#if defined(ELPP_LOGGING_FLAGS_FROM_ARG) + static const char* kLoggingFlagsParam = "--logging-flags"; +#endif // defined(ELPP_LOGGING_FLAGS_FROM_ARG) +#if ELPP_OS_WINDOWS + static const char* kFilePathSeperator = "\\"; +#else + static const char* kFilePathSeperator = "/"; +#endif // ELPP_OS_WINDOWS + static const char* kValidLoggerIdSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._"; + static const char* kConfigurationComment = "##"; + static const char* kConfigurationLevel = "*"; + static const char* kConfigurationLoggerId = "--"; + static const std::size_t kSourceFilenameMaxLength = 100; + static const std::size_t kSourceLineMaxLength = 10; + static const Level kPerformanceTrackerDefaultLevel = Level::Info; + const struct { + double value; + const base::type::char_t* unit; + } kTimeFormats[] = { + { 1000.0f, ELPP_LITERAL("mis") }, + { 1000.0f, ELPP_LITERAL("ms") }, + { 60.0f, ELPP_LITERAL("seconds") }, + { 60.0f, ELPP_LITERAL("minutes") }, + { 24.0f, ELPP_LITERAL("hours") }, + { 7.0f, ELPP_LITERAL("days") } + }; + static const int kTimeFormatsCount = sizeof(kTimeFormats) / sizeof(kTimeFormats[0]); + const struct { + int numb; + const char* name; + const char* brief; + const char* detail; + } kCrashSignals[] = { + // NOTE: Do not re-order, if you do please check CrashHandler(bool) constructor and CrashHandler::setHandler(..) + { SIGABRT, "SIGABRT", "Abnormal termination", + "Program was abnormally terminated." }, + { SIGFPE, "SIGFPE", "Erroneous arithmetic operation", + "Arithemetic operation issue such as division by zero or operation resulting in overflow." }, + { SIGILL, "SIGILL", "Illegal instruction", + "Generally due to a corruption in the code or to an attempt to execute data." }, + { SIGSEGV, "SIGSEGV", "Invalid access to memory", + "Program is trying to read an invalid (unallocated, deleted or corrupted) or inaccessible memory." }, + { SIGINT, "SIGINT", "Interactive attention signal", + "Interruption generated (generally) by user or operating system." }, + }; + static const int kCrashSignalsCount = sizeof(kCrashSignals) / sizeof(kCrashSignals[0]); + } // namespace consts + } // namespace base + typedef std::function PreRollOutCallback; + namespace base { + static inline void defaultPreRollOutCallback(const char*, std::size_t) {} + /// @brief Enum to represent timestamp unit + enum class TimestampUnit : base::type::EnumType { + Microsecond = 0, Millisecond = 1, Second = 2, Minute = 3, Hour = 4, Day = 5 + }; + /// @brief Format flags used to determine specifiers that are active for performance improvements. + enum class FormatFlags : base::type::EnumType { + DateTime = 1 << 1, LoggerId = 1 << 2, File = 1 << 3, Line = 1 << 4, Location = 1 << 5, Function = 1 << 6, + User = 1 << 7, Host = 1 << 8, LogMessage = 1 << 9, VerboseLevel = 1 << 10, AppName = 1 << 11, ThreadId = 1 << 12, + Level = 1 << 13, FileBase = 1 << 14, LevelShort = 1 << 15 + }; + /// @brief A milliseconds width class containing actual width and offset for date/time + class MillisecondsWidth { + public: + MillisecondsWidth(void) { init(base::consts::kDefaultMillisecondsWidth); } + explicit MillisecondsWidth(int width) { init(width); } + bool operator==(const MillisecondsWidth& msWidth) { return m_width == msWidth.m_width && m_offset == msWidth.m_offset; } + int m_width; unsigned int m_offset; + private: + void init(int width) { + if (width < 1 || width > 6) { + width = base::consts::kDefaultMillisecondsWidth; + } + m_width = width; + switch (m_width) { + case 3: m_offset = 1000; break; + case 4: m_offset = 100; break; + case 5: m_offset = 10; break; + case 6: m_offset = 1; break; + default: m_offset = 1000; break; + } + } + }; + /// @brief Namespace containing utility functions/static classes used internally + namespace utils { + /// @brief Deletes memory safely and points to null + template + static inline + typename std::enable_if::value, void>::type + safeDelete(T*& pointer) { + if (pointer == nullptr) + return; + delete pointer; + pointer = nullptr; + } + /// @brief Gets value of const char* but if it is nullptr, a string nullptr is returned + static inline const char* charPtrVal(const char* pointer) { + return pointer == nullptr ? base::consts::kNullPointer : pointer; + } + /// @brief Aborts application due with user-defined status + static inline void abort(int status, const std::string& reason = std::string()) { + // Both status and reason params are there for debugging with tools like gdb etc + ELPP_UNUSED(status); + ELPP_UNUSED(reason); +#if defined(ELPP_COMPILER_MSVC) && defined(_M_IX86) && defined(_DEBUG) + // Ignore msvc critical error dialog - break instead (on debug mode) + _asm int 3 +#else + ::abort(); +#endif // defined(ELPP_COMPILER_MSVC) && defined(_M_IX86) && defined(_DEBUG) + } + /// @brief Bitwise operations for C++11 strong enum class. This casts e into Flag_T and returns value after bitwise operation + /// Use these function as
flag = bitwise::Or(MyEnum::val1, flag);
+ namespace bitwise { + template + static inline base::type::EnumType And(Enum e, base::type::EnumType flag) { + return static_cast(flag) & static_cast(e); + } + template + static inline base::type::EnumType Not(Enum e, base::type::EnumType flag) { + return static_cast(flag) & ~(static_cast(e)); + } + template + static inline base::type::EnumType Or(Enum e, base::type::EnumType flag) { + return static_cast(flag) | static_cast(e); + } + } // namespace bitwise + template + static inline void addFlag(Enum e, base::type::EnumType* flag) { + *flag = base::utils::bitwise::Or(e, *flag); + } + template + static inline void removeFlag(Enum e, base::type::EnumType* flag) { + *flag = base::utils::bitwise::Not(e, *flag); + } + template + static inline bool hasFlag(Enum e, base::type::EnumType flag) { + return base::utils::bitwise::And(e, flag) > 0x0; + } + } // namespace utils + namespace threading { +#if ELPP_THREADING_ENABLED +# if !ELPP_USE_STD_THREADING + namespace internal { + /// @brief A mutex wrapper for compiler that dont yet support std::mutex + class Mutex : base::NoCopy { + public: + Mutex(void) { +# if ELPP_OS_UNIX + pthread_mutex_init(&m_underlyingMutex, nullptr); +# elif ELPP_OS_WINDOWS + InitializeCriticalSection(&m_underlyingMutex); +# endif // ELPP_OS_UNIX + } + + virtual ~Mutex(void) { +# if ELPP_OS_UNIX + pthread_mutex_destroy(&m_underlyingMutex); +# elif ELPP_OS_WINDOWS + DeleteCriticalSection(&m_underlyingMutex); +# endif // ELPP_OS_UNIX + } + + inline void lock(void) { +# if ELPP_OS_UNIX + pthread_mutex_lock(&m_underlyingMutex); +# elif ELPP_OS_WINDOWS + EnterCriticalSection(&m_underlyingMutex); +# endif // ELPP_OS_UNIX + } + + inline bool try_lock(void) { +# if ELPP_OS_UNIX + return (pthread_mutex_trylock(&m_underlyingMutex) == 0); +# elif ELPP_OS_WINDOWS + return TryEnterCriticalSection(&m_underlyingMutex); +# endif // ELPP_OS_UNIX + } + + inline void unlock(void) { +# if ELPP_OS_UNIX + pthread_mutex_unlock(&m_underlyingMutex); +# elif ELPP_OS_WINDOWS + LeaveCriticalSection(&m_underlyingMutex); +# endif // ELPP_OS_UNIX + } + + private: +# if ELPP_OS_UNIX + pthread_mutex_t m_underlyingMutex; +# elif ELPP_OS_WINDOWS + CRITICAL_SECTION m_underlyingMutex; +# endif // ELPP_OS_UNIX + }; + /// @brief Scoped lock for compiler that dont yet support std::lock_guard + template + class ScopedLock : base::NoCopy { + public: + explicit ScopedLock(M& mutex) { + m_mutex = &mutex; + m_mutex->lock(); + } + + virtual ~ScopedLock(void) { + m_mutex->unlock(); + } + private: + M* m_mutex; + ScopedLock(void); + }; + } // namespace internal + /// @brief Gets ID of currently running threading in windows systems. On unix, nothing is returned. + static inline std::string getCurrentThreadId(void) { + std::stringstream ss; +# if (ELPP_OS_WINDOWS) + ss << GetCurrentThreadId(); +# endif // (ELPP_OS_WINDOWS) + return ss.str(); + } + static inline void msleep(int) { + // No implementation for non std::thread version + } + typedef base::threading::internal::Mutex Mutex; + typedef base::threading::internal::ScopedLock ScopedLock; +# else + /// @brief Gets ID of currently running threading using std::this_thread::get_id() + static inline std::string getCurrentThreadId(void) { + std::stringstream ss; + ss << std::this_thread::get_id(); + return ss.str(); + } + static inline void msleep(int ms) { + // Only when async logging enabled - this is because async is strict on compiler +#if ELPP_ASYNC_LOGGING + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); +#endif // ELPP_ASYNC_LOGGING + } + typedef std::mutex Mutex; + typedef std::lock_guard ScopedLock; +# endif // !ELPP_USE_STD_THREADING +#else + namespace internal { + /// @brief Mutex wrapper used when multi-threading is disabled. + class NoMutex : base::NoCopy { + public: + NoMutex(void) {} + inline void lock(void) {} + inline bool try_lock(void) { return true; } + inline void unlock(void) {} + }; + /// @brief Lock guard wrapper used when multi-threading is disabled. + template + class NoScopedLock : base::NoCopy { + public: + explicit NoScopedLock(Mutex&) { + } + virtual ~NoScopedLock(void) { + } + private: + NoScopedLock(void); + }; + } // namespace internal + static inline std::string getCurrentThreadId(void) { + return std::string(); + } + static inline void msleep(int) { + // No custom implementation + } + typedef base::threading::internal::NoMutex Mutex; + typedef base::threading::internal::NoScopedLock ScopedLock; +#endif // ELPP_THREADING_ENABLED + /// @brief Base of thread safe class, this class is inheritable-only + class ThreadSafe { + public: + virtual inline void acquireLock(void) ELPP_FINAL { m_mutex.lock(); } + virtual inline void releaseLock(void) ELPP_FINAL { m_mutex.unlock(); } + virtual inline base::threading::Mutex& lock(void) ELPP_FINAL { return m_mutex; } + protected: + ThreadSafe(void) {} + virtual ~ThreadSafe(void) {} + private: + base::threading::Mutex m_mutex; + }; + } // namespace threading + namespace utils { + class File : base::StaticClass { + public: + /// @brief Creates new out file stream for specified filename. + /// @return Pointer to newly created fstream or nullptr + static base::type::fstream_t* newFileStream(const std::string& filename) { + base::type::fstream_t *fs = new base::type::fstream_t(filename.c_str(), + base::type::fstream_t::out | base::type::fstream_t::app); +#if defined(ELPP_UNICODE) + std::locale elppUnicodeLocale(""); +#if ELPP_OS_WINDOWS + std::locale elppUnicodeLocaleWindows(elppUnicodeLocale, new std::codecvt_utf8_utf16); + elppUnicodeLocale = elppUnicodeLocaleWindows; +#endif + fs->imbue(elppUnicodeLocale); +#endif // defined(ELPP_UNICODE) + if (fs->is_open()) { + fs->flush(); + } + else { + base::utils::safeDelete(fs); + ELPP_INTERNAL_ERROR("Bad file [" << filename << "]", true); + } + return fs; + } + + /// @brief Gets size of file provided in stream + static std::size_t getSizeOfFile(base::type::fstream_t* fs) { + if (fs == nullptr) { + return 0; + } + std::streampos currPos = fs->tellg(); + fs->seekg(0, fs->end); + std::size_t size = static_cast(fs->tellg()); + fs->seekg(currPos); + return size; + } + + /// @brief Determines whether or not provided path exist in current file system + static inline bool pathExists(const char* path, bool considerFile = false) { + if (path == nullptr) { + return false; + } +#if ELPP_OS_UNIX + ELPP_UNUSED(considerFile); + struct stat st; + return (stat(path, &st) == 0); +#elif ELPP_OS_WINDOWS + DWORD fileType = GetFileAttributesA(path); + if (fileType == INVALID_FILE_ATTRIBUTES) { + return false; + } + return considerFile ? true : ((fileType & FILE_ATTRIBUTE_DIRECTORY) == 0 ? false : true); +#endif // ELPP_OS_UNIX + } + + /// @brief Creates specified path on file system + /// @param path Path to create. + static bool createPath(const std::string& path) { + if (path.empty()) { + return false; + } + if (base::utils::File::pathExists(path.c_str())) { + return true; + } + int status = -1; + + char* currPath = const_cast(path.c_str()); + std::string builtPath = std::string(); +#if ELPP_OS_UNIX + if (path[0] == '/') { + builtPath = "/"; + } + currPath = STRTOK(currPath, base::consts::kFilePathSeperator, 0); +#elif ELPP_OS_WINDOWS + // Use secure functions API + char* nextTok_ = nullptr; + currPath = STRTOK(currPath, base::consts::kFilePathSeperator, &nextTok_); + ELPP_UNUSED(nextTok_); +#endif // ELPP_OS_UNIX + while (currPath != nullptr) { + builtPath.append(currPath); + builtPath.append(base::consts::kFilePathSeperator); +#if ELPP_OS_UNIX + status = mkdir(builtPath.c_str(), ELPP_LOG_PERMS); + currPath = STRTOK(nullptr, base::consts::kFilePathSeperator, 0); +#elif ELPP_OS_WINDOWS + status = _mkdir(builtPath.c_str()); + currPath = STRTOK(nullptr, base::consts::kFilePathSeperator, &nextTok_); +#endif // ELPP_OS_UNIX + } + if (status == -1) { + ELPP_INTERNAL_ERROR("Error while creating path [" << path << "]", true); + return false; + } + return true; + } + /// @brief Extracts path of filename with leading slash + static std::string extractPathFromFilename(const std::string& fullPath, + const char* seperator = base::consts::kFilePathSeperator) { + if ((fullPath == "") || (fullPath.find(seperator) == std::string::npos)) { + return fullPath; + } + std::size_t lastSlashAt = fullPath.find_last_of(seperator); + if (lastSlashAt == 0) { + return std::string(seperator); + } + return fullPath.substr(0, lastSlashAt + 1); + } + /// @brief builds stripped filename and puts it in buff + static void buildStrippedFilename(const char* filename, char buff[], + std::size_t limit = base::consts::kSourceFilenameMaxLength) { + std::size_t sizeOfFilename = strlen(filename); + if (sizeOfFilename >= limit) { + filename += (sizeOfFilename - limit); + if (filename[0] != '.' && filename[1] != '.') { // prepend if not already + filename += 3; // 3 = '..' + STRCAT(buff, "..", limit); + } + } + STRCAT(buff, filename, limit); + } + /// @brief builds base filename and puts it in buff + static void buildBaseFilename(const std::string& fullPath, char buff[], + std::size_t limit = base::consts::kSourceFilenameMaxLength, + const char* seperator = base::consts::kFilePathSeperator) { + const char *filename = fullPath.c_str(); + std::size_t lastSlashAt = fullPath.find_last_of(seperator); + filename += lastSlashAt ? lastSlashAt + 1 : 0; + std::size_t sizeOfFilename = strlen(filename); + if (sizeOfFilename >= limit) { + filename += (sizeOfFilename - limit); + if (filename[0] != '.' && filename[1] != '.') { // prepend if not already + filename += 3; // 3 = '..' + STRCAT(buff, "..", limit); + } + } + STRCAT(buff, filename, limit); + } + }; + /// @brief String utilities helper class used internally. You should not use it. + class Str : base::StaticClass { + public: + /// @brief Checks if character is digit. Dont use libc implementation of it to prevent locale issues. + static inline bool isDigit(char c) { + return c >= '0' && c <= '9'; + } + + /// @brief Matches wildcards, '*' and '?' only supported. + static bool wildCardMatch(const char* str, const char* pattern) { + while (*pattern) { + switch (*pattern) { + case '?': + if (!*str) + return false; + ++str; + ++pattern; + break; + case '*': + if (wildCardMatch(str, pattern + 1)) + return true; + if (*str && wildCardMatch(str + 1, pattern)) + return true; + return false; + break; + default: + if (*str++ != *pattern++) + return false; + break; + } + } + return !*str && !*pattern; + } + + /// @brief Trims string from start + /// @param [in,out] str String to trim + static inline std::string& ltrim(std::string& str) { + str.erase(str.begin(), std::find_if(str.begin(), str.end(), std::not1(std::ptr_fun(&std::isspace)))); + return str; + } + + /// @brief Trim string from end + /// @param [in,out] str String to trim + static inline std::string& rtrim(std::string& str) { + str.erase(std::find_if(str.rbegin(), str.rend(), std::not1(std::ptr_fun(&std::isspace))).base(), str.end()); + return str; + } + + /// @brief Trims string from left and right + /// @param [in,out] str String to trim + static inline std::string& trim(std::string& str) { + return ltrim(rtrim(str)); + } + + /// @brief Determines whether or not str starts with specified string + /// @param str String to check + /// @param start String to check against + /// @return Returns true if starts with specified string, false otherwise + static inline bool startsWith(const std::string& str, const std::string& start) { + return (str.length() >= start.length()) && (str.compare(0, start.length(), start) == 0); + } + + /// @brief Determines whether or not str ends with specified string + /// @param str String to check + /// @param end String to check against + /// @return Returns true if ends with specified string, false otherwise + static inline bool endsWith(const std::string& str, const std::string& end) { + return (str.length() >= end.length()) && (str.compare(str.length() - end.length(), end.length(), end) == 0); + } + + /// @brief Replaces all instances of replaceWhat with 'replaceWith'. Original variable is changed for performance. + /// @param [in,out] str String to replace from + /// @param replaceWhat Character to replace + /// @param replaceWith Character to replace with + /// @return Modified version of str + static inline std::string& replaceAll(std::string& str, char replaceWhat, char replaceWith) { + std::replace(str.begin(), str.end(), replaceWhat, replaceWith); + return str; + } + + /// @brief Replaces all instances of 'replaceWhat' with 'replaceWith'. (String version) Replaces in place + /// @param str String to replace from + /// @param replaceWhat Character to replace + /// @param replaceWith Character to replace with + /// @return Modified (original) str + static inline std::string& replaceAll(std::string& str, const std::string& replaceWhat, // NOLINT + const std::string& replaceWith) { + if (replaceWhat == replaceWith) + return str; + std::size_t foundAt = std::string::npos; + while ((foundAt = str.find(replaceWhat, foundAt + 1)) != std::string::npos) { + str.replace(foundAt, replaceWhat.length(), replaceWith); + } + return str; + } + + static void replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat, // NOLINT + const base::type::string_t& replaceWith) { + std::size_t foundAt = base::type::string_t::npos; + while ((foundAt = str.find(replaceWhat, foundAt + 1)) != base::type::string_t::npos) { + if (foundAt > 0 && str[foundAt - 1] == base::consts::kFormatSpecifierChar) { + str.erase(foundAt > 0 ? foundAt - 1 : 0, 1); + ++foundAt; + } + else { + str.replace(foundAt, replaceWhat.length(), replaceWith); + return; + } + } + } +#if defined(ELPP_UNICODE) + static void replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat, // NOLINT + const std::string& replaceWith) { + replaceFirstWithEscape(str, replaceWhat, base::type::string_t(replaceWith.begin(), replaceWith.end())); + } +#endif // defined(ELPP_UNICODE) + /// @brief Converts string to uppercase + /// @param str String to convert + /// @return Uppercase string + static inline std::string& toUpper(std::string& str) { + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + return str; + } + + /// @brief Compares cstring equality - uses strcmp + static inline bool cStringEq(const char* s1, const char* s2) { + if (s1 == nullptr && s2 == nullptr) return true; + if (s1 == nullptr || s2 == nullptr) return false; + return strcmp(s1, s2) == 0; + } + + /// @brief Compares cstring equality (case-insensitive) - uses toupper(char) + /// Dont use strcasecmp because of CRT (VC++) + static bool cStringCaseEq(const char* s1, const char* s2) { + if (s1 == nullptr && s2 == nullptr) return true; + if (s1 == nullptr || s2 == nullptr) return false; + if (strlen(s1) != strlen(s2)) return false; + while (*s1 != '\0' && *s2 != '\0') { + if (::toupper(*s1) != ::toupper(*s2)) return false; + ++s1; + ++s2; + } + return true; + } + + /// @brief Returns true if c exist in str + static inline bool contains(const char* str, char c) { + for (; *str; ++str) { + if (*str == c) + return true; + } + return false; + } + + static inline char* convertAndAddToBuff(std::size_t n, int len, char* buf, const char* bufLim, bool zeroPadded = true) { + char localBuff[10] = ""; + char* p = localBuff + sizeof(localBuff) - 2; + if (n > 0) { + for (; n > 0 && p > localBuff && len > 0; n /= 10, --len) + *--p = static_cast(n % 10 + '0'); + } + else { + *--p = '0'; + --len; + } + if (zeroPadded) + while (p > localBuff && len-- > 0) *--p = static_cast('0'); + return addToBuff(p, buf, bufLim); + } + + static inline char* addToBuff(const char* str, char* buf, const char* bufLim) { + while ((buf < bufLim) && ((*buf = *str++) != '\0')) + ++buf; + return buf; + } + + static inline char* clearBuff(char buff[], std::size_t lim) { + STRCPY(buff, "", lim); + ELPP_UNUSED(lim); // For *nix we dont have anything using lim in above STRCPY macro + return buff; + } + + /// @brief Converst wchar* to char* + /// NOTE: Need to free return value after use! + static char* wcharPtrToCharPtr(const wchar_t* line) { + std::size_t len_ = wcslen(line) + 1; + char* buff_ = static_cast(malloc(len_ + 1)); +# if ELPP_OS_UNIX || (ELPP_OS_WINDOWS && !ELPP_CRT_DBG_WARNINGS) + std::wcstombs(buff_, line, len_); +# elif ELPP_OS_WINDOWS + std::size_t convCount_ = 0; + mbstate_t mbState_; + ::memset(static_cast(&mbState_), 0, sizeof(mbState_)); + wcsrtombs_s(&convCount_, buff_, len_, &line, len_, &mbState_); +# endif // ELPP_OS_UNIX || (ELPP_OS_WINDOWS && !ELPP_CRT_DBG_WARNINGS) + return buff_; + } + }; + /// @brief Operating System helper static class used internally. You should not use it. + class OS : base::StaticClass { + public: +#if ELPP_OS_WINDOWS + /// @brief Gets environment variables for Windows based OS. + /// We are not using getenv(const char*) because of CRT deprecation + /// @param varname Variable name to get environment variable value for + /// @return If variable exist the value of it otherwise nullptr + static const char* getWindowsEnvironmentVariable(const char* varname) { + const DWORD bufferLen = 50; + static char buffer[bufferLen]; + if (GetEnvironmentVariableA(varname, buffer, bufferLen)) { + return buffer; + } + return nullptr; + } +#endif // ELPP_OS_WINDOWS +#if ELPP_OS_ANDROID + /// @brief Reads android property value + static inline std::string getProperty(const char* prop) { + char propVal[PROP_VALUE_MAX + 1]; + int ret = __system_property_get(prop, propVal); + return ret == 0 ? std::string() : std::string(propVal); + } + + /// @brief Reads android device name + static std::string getDeviceName(void) { + std::stringstream ss; + std::string manufacturer = getProperty("ro.product.manufacturer"); + std::string model = getProperty("ro.product.model"); + if (manufacturer.empty() || model.empty()) { + return std::string(); + } + ss << manufacturer << "-" << model; + return ss.str(); + } +#endif // ELPP_OS_ANDROID + + /// @brief Runs command on terminal and returns the output. + /// + /// @detail This is applicable only on unix based systems, for all other OS, an empty string is returned. + /// @param command Bash command + /// @return Result of bash output or empty string if no result found. + static const std::string getBashOutput(const char* command) { +#if (ELPP_OS_UNIX && !ELPP_OS_ANDROID && !ELPP_CYGWIN) + if (command == nullptr) { + return std::string(); + } + FILE* proc = nullptr; + if ((proc = popen(command, "r")) == nullptr) { + ELPP_INTERNAL_ERROR("\nUnable to run command [" << command << "]", true); + return std::string(); + } + char hBuff[4096]; + if (fgets(hBuff, sizeof(hBuff), proc) != nullptr) { + pclose(proc); + if (hBuff[strlen(hBuff) - 1] == '\n') { + hBuff[strlen(hBuff) - 1] = '\0'; + } + return std::string(hBuff); + } + return std::string(); +#else + ELPP_UNUSED(command); + return std::string(); +#endif // (ELPP_OS_UNIX && !ELPP_OS_ANDROID && !ELPP_CYGWIN) + } + + /// @brief Gets environment variable. This is cross-platform and CRT safe (for VC++) + /// @param variableName Environment variable name + /// @param defaultVal If no environment variable or value found the value to return by default + /// @param alternativeBashCommand If environment variable not found what would be alternative bash command + /// in order to look for value user is looking for. E.g, for 'user' alternative command will 'whoami' + static std::string getEnvironmentVariable(const char* variableName, const char* defaultVal, const char* alternativeBashCommand = nullptr) { +#if ELPP_OS_UNIX + const char* val = getenv(variableName); +#elif ELPP_OS_WINDOWS + const char* val = getWindowsEnvironmentVariable(variableName); +#endif // ELPP_OS_UNIX + if ((val == nullptr) || ((strcmp(val, "") == 0))) { +#if ELPP_OS_UNIX && defined(ELPP_FORCE_ENV_VAR_FROM_BASH) + // Try harder on unix-based systems + std::string valBash = base::utils::OS::getBashOutput(alternativeBashCommand); + if (valBash.empty()) { + return std::string(defaultVal); + } + else { + return valBash; + } +#elif ELPP_OS_WINDOWS || ELPP_OS_UNIX + ELPP_UNUSED(alternativeBashCommand); + return std::string(defaultVal); +#endif // ELPP_OS_UNIX && defined(ELPP_FORCE_ENV_VAR_FROM_BASH) + } + return std::string(val); + } + /// @brief Gets current username. + static inline std::string currentUser(void) { +#if ELPP_OS_UNIX && !ELPP_OS_ANDROID + return getEnvironmentVariable("USER", base::consts::kUnknownUser, "whoami"); +#elif ELPP_OS_WINDOWS + return getEnvironmentVariable("USERNAME", base::consts::kUnknownUser); +#elif ELPP_OS_ANDROID + ELPP_UNUSED(base::consts::kUnknownUser); + return std::string("android"); +#else + return std::string(); +#endif // ELPP_OS_UNIX && !ELPP_OS_ANDROID + } + + /// @brief Gets current host name or computer name. + /// + /// @detail For android systems this is device name with its manufacturer and model seperated by hyphen + static inline std::string currentHost(void) { +#if ELPP_OS_UNIX && !ELPP_OS_ANDROID + return getEnvironmentVariable("HOSTNAME", base::consts::kUnknownHost, "hostname"); +#elif ELPP_OS_WINDOWS + return getEnvironmentVariable("COMPUTERNAME", base::consts::kUnknownHost); +#elif ELPP_OS_ANDROID + ELPP_UNUSED(base::consts::kUnknownHost); + return getDeviceName(); +#else + return std::string(); +#endif // ELPP_OS_UNIX && !ELPP_OS_ANDROID + } + /// @brief Whether or not terminal supports colors + static inline bool termSupportsColor(void) { + std::string term = getEnvironmentVariable("TERM", ""); + return term == "xterm" || term == "xterm-color" || term == "xterm-256color" || + term == "screen" || term == "linux" || term == "cygwin"; + } + }; + extern std::string s_currentUser; + extern std::string s_currentHost; + extern bool s_termSupportsColor; +#define ELPP_INITI_BASIC_DECLR \ + namespace el {\ + namespace base {\ + namespace utils {\ + std::string s_currentUser = el::base::utils::OS::currentUser(); \ + std::string s_currentHost = el::base::utils::OS::currentHost(); \ + bool s_termSupportsColor = el::base::utils::OS::termSupportsColor(); \ + }\ + }\ + } + /// @brief Contains utilities for cross-platform date/time. This class make use of el::base::utils::Str + class DateTime : base::StaticClass { + public: + /// @brief Cross platform gettimeofday for Windows and unix platform. This can be used to determine current millisecond. + /// + /// @detail For unix system it uses gettimeofday(timeval*, timezone*) and for Windows, a seperate implementation is provided + /// @param [in,out] tv Pointer that gets updated + static void gettimeofday(struct timeval* tv) { +#if ELPP_OS_WINDOWS + if (tv != nullptr) { +# if ELPP_COMPILER_MSVC || defined(_MSC_EXTENSIONS) + const unsigned __int64 delta_ = 11644473600000000Ui64; +# else + const unsigned __int64 delta_ = 11644473600000000ULL; +# endif // ELPP_COMPILER_MSVC || defined(_MSC_EXTENSIONS) + const double secOffSet = 0.000001; + const unsigned long usecOffSet = 1000000; + FILETIME fileTime; + GetSystemTimeAsFileTime(&fileTime); + unsigned __int64 present = 0; + present |= fileTime.dwHighDateTime; + present = present << 32; + present |= fileTime.dwLowDateTime; + present /= 10; // mic-sec + // Subtract the difference + present -= delta_; + tv->tv_sec = static_cast(present * secOffSet); + tv->tv_usec = static_cast(present % usecOffSet); + } +#else + ::gettimeofday(tv, nullptr); +#endif // ELPP_OS_WINDOWS + } + + /// @brief Gets current date and time with milliseconds. + /// @param format User provided date/time format + /// @param msWidth A pointer to base::MillisecondsWidth from configuration (non-null) + /// @returns string based date time in specified format. + static inline std::string getDateTime(const char* format, const base::MillisecondsWidth* msWidth) { + struct timeval currTime; + gettimeofday(&currTime); + struct ::tm timeInfo; + buildTimeInfo(&currTime, &timeInfo); + const int kBuffSize = 30; + char buff_[kBuffSize] = ""; + parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(currTime.tv_usec / msWidth->m_offset), msWidth); + return std::string(buff_); + } + + /// @brief Formats time to get unit accordingly, units like second if > 1000 or minutes if > 60000 etc + static base::type::string_t formatTime(unsigned long long time, base::TimestampUnit timestampUnit) { + double result = static_cast(time); + base::type::EnumType start = static_cast(timestampUnit); + const base::type::char_t* unit = base::consts::kTimeFormats[start].unit; + for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) { + if (result <= base::consts::kTimeFormats[i].value) { + break; + } + result /= base::consts::kTimeFormats[i].value; + unit = base::consts::kTimeFormats[i + 1].unit; + } + base::type::stringstream_t ss; + ss << result << " " << unit; + return ss.str(); + } + + /// @brief Gets time difference in milli/micro second depending on timestampUnit + static inline unsigned long long getTimeDifference(const struct timeval& endTime, const struct timeval& startTime, base::TimestampUnit timestampUnit) { + if (timestampUnit == base::TimestampUnit::Microsecond) { + return static_cast(static_cast(1000000 * endTime.tv_sec + endTime.tv_usec) - + static_cast(1000000 * startTime.tv_sec + startTime.tv_usec)); + } + else { + return static_cast((((endTime.tv_sec - startTime.tv_sec) * 1000000) + (endTime.tv_usec - startTime.tv_usec)) / 1000); + } + } + + private: + static inline struct ::tm* buildTimeInfo(struct timeval* currTime, struct ::tm* timeInfo) { +#if ELPP_OS_UNIX + time_t rawTime = currTime->tv_sec; + ::localtime_r(&rawTime, timeInfo); + return timeInfo; +#else +# if ELPP_COMPILER_MSVC + ELPP_UNUSED(currTime); + time_t t; + _time64(&t); + localtime_s(timeInfo, &t); + return timeInfo; +# else + // For any other compilers that don't have CRT warnings issue e.g, MinGW or TDM GCC- we use different method + time_t rawTime = currTime->tv_sec; + struct tm* tmInf = localtime(&rawTime); + *timeInfo = *tmInf; + return timeInfo; +# endif // ELPP_COMPILER_MSVC +#endif // ELPP_OS_UNIX + } + static char* parseFormat(char* buf, std::size_t bufSz, const char* format, const struct tm* tInfo, + std::size_t msec, const base::MillisecondsWidth* msWidth) { + const char* bufLim = buf + bufSz; + for (; *format; ++format) { + if (*format == base::consts::kFormatSpecifierChar) { + switch (*++format) { + case base::consts::kFormatSpecifierChar: // Escape + break; + case '\0': // End + --format; + break; + case 'd': // Day + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mday, 2, buf, bufLim); + continue; + case 'a': // Day of week (short) + buf = base::utils::Str::addToBuff(base::consts::kDaysAbbrev[tInfo->tm_wday], buf, bufLim); + continue; + case 'A': // Day of week (long) + buf = base::utils::Str::addToBuff(base::consts::kDays[tInfo->tm_wday], buf, bufLim); + continue; + case 'M': // month + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_mon + 1, 2, buf, bufLim); + continue; + case 'b': // month (short) + buf = base::utils::Str::addToBuff(base::consts::kMonthsAbbrev[tInfo->tm_mon], buf, bufLim); + continue; + case 'B': // month (long) + buf = base::utils::Str::addToBuff(base::consts::kMonths[tInfo->tm_mon], buf, bufLim); + continue; + case 'y': // year (two digits) + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 2, buf, bufLim); + continue; + case 'Y': // year (four digits) + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_year + base::consts::kYearBase, 4, buf, bufLim); + continue; + case 'h': // hour (12-hour) + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour % 12, 2, buf, bufLim); + continue; + case 'H': // hour (24-hour) + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_hour, 2, buf, bufLim); + continue; + case 'm': // minute + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_min, 2, buf, bufLim); + continue; + case 's': // second + buf = base::utils::Str::convertAndAddToBuff(tInfo->tm_sec, 2, buf, bufLim); + continue; + case 'z': // milliseconds + case 'g': + buf = base::utils::Str::convertAndAddToBuff(msec, msWidth->m_width, buf, bufLim); + continue; + case 'F': // AM/PM + buf = base::utils::Str::addToBuff((tInfo->tm_hour >= 12) ? base::consts::kPm : base::consts::kAm, buf, bufLim); + continue; + default: + continue; + } + } + if (buf == bufLim) break; + *buf++ = *format; + } + return buf; + } + }; + /// @brief Command line arguments for application if specified using el::Helpers::setArgs(..) or START_EASYLOGGINGPP(..) + class CommandLineArgs { + public: + CommandLineArgs(void) { + setArgs(0, static_cast(nullptr)); + } + CommandLineArgs(int argc, const char** argv) { + setArgs(argc, argv); + } + CommandLineArgs(int argc, char** argv) { + setArgs(argc, argv); + } + virtual ~CommandLineArgs(void) {} + /// @brief Sets arguments and parses them + inline void setArgs(int argc, const char** argv) { + setArgs(argc, const_cast(argv)); + } + /// @brief Sets arguments and parses them + inline void setArgs(int argc, char** argv) { + m_params.clear(); + m_paramsWithValue.clear(); + if (argc == 0 || argv == nullptr) { + return; + } + m_argc = argc; + m_argv = argv; + for (int i = 1; i < m_argc; ++i) { + const char* v = (strstr(m_argv[i], "=")); + if (v != nullptr && strlen(v) > 0) { + std::string key = std::string(m_argv[i]); + key = key.substr(0, key.find_first_of('=')); + if (hasParamWithValue(key.c_str())) { + ELPP_INTERNAL_INFO(1, "Skipping [" << key << "] arg since it already has value [" + << getParamValue(key.c_str()) << "]"); + } + else { + m_paramsWithValue.insert(std::make_pair(key, std::string(v + 1))); + } + } + if (v == nullptr) { + if (hasParam(m_argv[i])) { + ELPP_INTERNAL_INFO(1, "Skipping [" << m_argv[i] << "] arg since it already exists"); + } + else { + m_params.push_back(std::string(m_argv[i])); + } + } + } + } + /// @brief Returns true if arguments contain paramKey with a value (seperated by '=') + inline bool hasParamWithValue(const char* paramKey) const { + return m_paramsWithValue.find(std::string(paramKey)) != m_paramsWithValue.end(); + } + /// @brief Returns value of arguments + /// @see hasParamWithValue(const char*) + inline const char* getParamValue(const char* paramKey) const { + return m_paramsWithValue.find(std::string(paramKey))->second.c_str(); + } + /// @brief Return true if arguments has a param (not having a value) i,e without '=' + inline bool hasParam(const char* paramKey) const { + return std::find(m_params.begin(), m_params.end(), std::string(paramKey)) != m_params.end(); + } + /// @brief Returns true if no params available. This exclude argv[0] + inline bool empty(void) const { + return m_params.empty() && m_paramsWithValue.empty(); + } + /// @brief Returns total number of arguments. This exclude argv[0] + inline std::size_t size(void) const { + return m_params.size() + m_paramsWithValue.size(); + } + inline friend base::type::ostream_t& operator<<(base::type::ostream_t& os, const CommandLineArgs& c) { + for (int i = 1; i < c.m_argc; ++i) { + os << ELPP_LITERAL("[") << c.m_argv[i] << ELPP_LITERAL("]"); + if (i < c.m_argc - 1) { + os << ELPP_LITERAL(" "); + } + } + return os; + } + + private: + int m_argc; + char** m_argv; + std::map m_paramsWithValue; + std::vector m_params; + }; + /// @brief Abstract registry (aka repository) that provides basic interface for pointer repository specified by T_Ptr type. + /// + /// @detail Most of the functions are virtual final methods but anything implementing this abstract class should implement + /// unregisterAll() and deepCopy(const AbstractRegistry&) and write registerNew() method according to container + /// and few more methods; get() to find element, unregister() to unregister single entry. + /// Please note that this is thread-unsafe and should also implement thread-safety mechanisms in implementation. + template + class AbstractRegistry : public base::threading::ThreadSafe { + public: + typedef typename Container::iterator iterator; + typedef typename Container::const_iterator const_iterator; + + /// @brief Default constructor + AbstractRegistry(void) {} + + /// @brief Move constructor that is useful for base classes + AbstractRegistry(AbstractRegistry&& sr) { + if (this == &sr) { + return; + } + unregisterAll(); + m_list = std::move(sr.m_list); + } + + bool operator==(const AbstractRegistry& other) { + if (size() != other.size()) { + return false; + } + for (std::size_t i = 0; i < m_list.size(); ++i) { + if (m_list.at(i) != other.m_list.at(i)) { + return false; + } + } + return true; + } + + bool operator!=(const AbstractRegistry& other) { + if (size() != other.size()) { + return true; + } + for (std::size_t i = 0; i < m_list.size(); ++i) { + if (m_list.at(i) != other.m_list.at(i)) { + return true; + } + } + return false; + } + + /// @brief Assignment move operator + AbstractRegistry& operator=(AbstractRegistry&& sr) { + if (this == &sr) { + return *this; + } + unregisterAll(); + m_list = std::move(sr.m_list); + return *this; + } + + virtual ~AbstractRegistry(void) { + } + + /// @return Iterator pointer from start of repository + virtual inline iterator begin(void) ELPP_FINAL { + return m_list.begin(); + } + + /// @return Iterator pointer from end of repository + virtual inline iterator end(void) ELPP_FINAL { + return m_list.end(); + } + + + /// @return Constant iterator pointer from start of repository + virtual inline const_iterator cbegin(void) const ELPP_FINAL { + return m_list.cbegin(); + } + + /// @return End of repository + virtual inline const_iterator cend(void) const ELPP_FINAL { + return m_list.cend(); + } + + /// @return Whether or not repository is empty + virtual inline bool empty(void) const ELPP_FINAL { + return m_list.empty(); + } + + /// @return Size of repository + virtual inline std::size_t size(void) const ELPP_FINAL { + return m_list.size(); + } + + /// @brief Returns underlying container by reference + virtual inline Container& list(void) ELPP_FINAL { + return m_list; + } + + /// @brief Returns underlying container by constant reference. + virtual inline const Container& list(void) const ELPP_FINAL { + return m_list; + } + + /// @brief Unregisters all the pointers from current repository. + virtual void unregisterAll(void) = 0; + + protected: + virtual void deepCopy(const AbstractRegistry&) = 0; + void reinitDeepCopy(const AbstractRegistry& sr) { + unregisterAll(); + deepCopy(sr); + } + + private: + Container m_list; + }; + + /// @brief A pointer registry mechanism to manage memory and provide search functionalities. (non-predicate version) + /// + /// @detail NOTE: This is thread-unsafe implementation (although it contains lock function, it does not use these functions) + /// of AbstractRegistry. Any implementation of this class should be + /// explicitly (by using lock functions) + template + class Registry : public AbstractRegistry> { + public: + typedef typename Registry::iterator iterator; + typedef typename Registry::const_iterator const_iterator; + + Registry(void) {} + + /// @brief Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor. + Registry(const Registry& sr) : AbstractRegistry>() { + if (this == &sr) { + return; + } + this->reinitDeepCopy(sr); + } + + /// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element + /// @see unregisterAll() + /// @see deepCopy(const AbstractRegistry&) + Registry& operator=(const Registry& sr) { + if (this == &sr) { + return *this; + } + this->reinitDeepCopy(sr); + return *this; + } + + virtual ~Registry(void) { + unregisterAll(); + } + + protected: + virtual inline void unregisterAll(void) ELPP_FINAL { + if (!this->empty()) { + for (auto&& curr : this->list()) { + base::utils::safeDelete(curr.second); + } + this->list().clear(); + } + } + + /// @brief Registers new registry to repository. + virtual inline void registerNew(const T_Key& uniqKey, T_Ptr* ptr) ELPP_FINAL { + unregister(uniqKey); + this->list().insert(std::make_pair(uniqKey, ptr)); + } + + /// @brief Unregisters single entry mapped to specified unique key + inline void unregister(const T_Key& uniqKey) { + T_Ptr* existing = get(uniqKey); + if (existing != nullptr) { + base::utils::safeDelete(existing); + this->list().erase(uniqKey); + } + } + + /// @brief Gets pointer from repository. If none found, nullptr is returned. + inline T_Ptr* get(const T_Key& uniqKey) { + iterator it = this->list().find(uniqKey); + return it == this->list().end() + ? nullptr + : it->second; + } + + private: + virtual inline void deepCopy(const AbstractRegistry>& sr) ELPP_FINAL { + for (const_iterator it = sr.cbegin(); it != sr.cend(); ++it) { + registerNew(it->first, new T_Ptr(*it->second)); + } + } + }; + + /// @brief A pointer registry mechanism to manage memory and provide search functionalities. (predicate version) + /// + /// @detail NOTE: This is thread-unsafe implementation of AbstractRegistry. Any implementation of this class + /// should be made thread-safe explicitly + template + class RegistryWithPred : public AbstractRegistry> { + public: + typedef typename RegistryWithPred::iterator iterator; + typedef typename RegistryWithPred::const_iterator const_iterator; + + RegistryWithPred(void) { + } + + virtual ~RegistryWithPred(void) { + unregisterAll(); + } + + /// @brief Copy constructor that is useful for base classes. Try to avoid this constructor, use move constructor. + RegistryWithPred(const RegistryWithPred& sr) : AbstractRegistry>() { + if (this == &sr) { + return; + } + this->reinitDeepCopy(sr); + } + + /// @brief Assignment operator that unregisters all the existing registeries and deeply copies each of repo element + /// @see unregisterAll() + /// @see deepCopy(const AbstractRegistry&) + RegistryWithPred& operator=(const RegistryWithPred& sr) { + if (this == &sr) { + return *this; + } + this->reinitDeepCopy(sr); + return *this; + } + + friend inline base::type::ostream_t& operator<<(base::type::ostream_t& os, const RegistryWithPred& sr) { + for (const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) { + os << ELPP_LITERAL(" ") << **it << ELPP_LITERAL("\n"); + } + return os; + } + + protected: + virtual inline void unregisterAll(void) ELPP_FINAL { + if (!this->empty()) { + for (auto&& curr : this->list()) { + base::utils::safeDelete(curr); + } + this->list().clear(); + } + } + + virtual void unregister(T_Ptr*& ptr) ELPP_FINAL { + if (ptr) { + iterator iter = this->begin(); + for (; iter != this->end(); ++iter) { + if (ptr == *iter) { + break; + } + } + if (iter != this->end() && *iter != nullptr) { + this->list().erase(iter); + base::utils::safeDelete(*iter); + } + } + } + + virtual inline void registerNew(T_Ptr* ptr) ELPP_FINAL { + this->list().push_back(ptr); + } + + /// @brief Gets pointer from repository with speicifed arguments. Arguments are passed to predicate + /// in order to validate pointer. + template + inline T_Ptr* get(const T& arg1, const T2 arg2) { + iterator iter = std::find_if(this->list().begin(), this->list().end(), Pred(arg1, arg2)); + if (iter != this->list().end() && *iter != nullptr) { + return *iter; + } + return nullptr; + } + + private: + virtual inline void deepCopy(const AbstractRegistry>& sr) { + for (const_iterator it = sr.list().begin(); it != sr.list().end(); ++it) { + registerNew(new T_Ptr(**it)); + } + } + }; + + } // namespace utils + } // namespace base + /// @brief Base of Easylogging++ friendly class + /// + /// @detail After inheriting this class publicly, implement pure-virtual function `void log(std::ostream&) const` + class Loggable { + public: + virtual ~Loggable(void) {} + virtual void log(el::base::type::ostream_t&) const = 0; + private: + friend inline el::base::type::ostream_t& operator<<(el::base::type::ostream_t& os, const Loggable& loggable) { + loggable.log(os); + return os; + } + }; + namespace base { + /// @brief Represents log format containing flags and date format. This is used internally to start initial log + class LogFormat : public Loggable { + public: + LogFormat(void) : + m_level(Level::Unknown), + m_userFormat(base::type::string_t()), + m_format(base::type::string_t()), + m_dateTimeFormat(std::string()), + m_flags(0x0) { + } + + LogFormat(Level level, const base::type::string_t& format) + : m_level(level), m_userFormat(format) { + parseFromFormat(m_userFormat); + } + + LogFormat(const LogFormat& logFormat) { + m_level = logFormat.m_level; + m_userFormat = logFormat.m_userFormat; + m_format = logFormat.m_format; + m_dateTimeFormat = logFormat.m_dateTimeFormat; + m_flags = logFormat.m_flags; + } + + LogFormat(LogFormat&& logFormat) { + m_level = std::move(logFormat.m_level); + m_userFormat = std::move(logFormat.m_userFormat); + m_format = std::move(logFormat.m_format); + m_dateTimeFormat = std::move(logFormat.m_dateTimeFormat); + m_flags = std::move(logFormat.m_flags); + } + + LogFormat& operator=(const LogFormat& logFormat) { + m_level = logFormat.m_level; + m_userFormat = logFormat.m_userFormat; + m_dateTimeFormat = logFormat.m_dateTimeFormat; + m_flags = logFormat.m_flags; + return *this; + } + + virtual ~LogFormat(void) { + } + + inline bool operator==(const LogFormat& other) { + return m_level == other.m_level && m_userFormat == other.m_userFormat && m_format == other.m_format && + m_dateTimeFormat == other.m_dateTimeFormat && m_flags == other.m_flags; + } + + /// @brief Updates format to be used while logging. + /// @param userFormat User provided format + void parseFromFormat(const base::type::string_t& userFormat) { + // We make copy because we will be changing the format + // i.e, removing user provided date format from original format + // and then storing it. + base::type::string_t formatCopy = userFormat; + m_flags = 0x0; + auto conditionalAddFlag = [&](const base::type::char_t* specifier, base::FormatFlags flag) { + std::size_t foundAt = base::type::string_t::npos; + while ((foundAt = formatCopy.find(specifier, foundAt + 1)) != base::type::string_t::npos) { + if (foundAt > 0 && formatCopy[foundAt - 1] == base::consts::kFormatSpecifierChar) { + if (hasFlag(flag)) { + // If we already have flag we remove the escape chars so that '%%' is turned to '%' + // even after specifier resolution - this is because we only replaceFirst specifier + formatCopy.erase(foundAt > 0 ? foundAt - 1 : 0, 1); + ++foundAt; + } + } + else { + if (!hasFlag(flag)) addFlag(flag); + } + } + }; + conditionalAddFlag(base::consts::kAppNameFormatSpecifier, base::FormatFlags::AppName); + conditionalAddFlag(base::consts::kSeverityLevelFormatSpecifier, base::FormatFlags::Level); + conditionalAddFlag(base::consts::kSeverityLevelShortFormatSpecifier, base::FormatFlags::LevelShort); + conditionalAddFlag(base::consts::kLoggerIdFormatSpecifier, base::FormatFlags::LoggerId); + conditionalAddFlag(base::consts::kThreadIdFormatSpecifier, base::FormatFlags::ThreadId); + conditionalAddFlag(base::consts::kLogFileFormatSpecifier, base::FormatFlags::File); + conditionalAddFlag(base::consts::kLogFileBaseFormatSpecifier, base::FormatFlags::FileBase); + conditionalAddFlag(base::consts::kLogLineFormatSpecifier, base::FormatFlags::Line); + conditionalAddFlag(base::consts::kLogLocationFormatSpecifier, base::FormatFlags::Location); + conditionalAddFlag(base::consts::kLogFunctionFormatSpecifier, base::FormatFlags::Function); + conditionalAddFlag(base::consts::kCurrentUserFormatSpecifier, base::FormatFlags::User); + conditionalAddFlag(base::consts::kCurrentHostFormatSpecifier, base::FormatFlags::Host); + conditionalAddFlag(base::consts::kMessageFormatSpecifier, base::FormatFlags::LogMessage); + conditionalAddFlag(base::consts::kVerboseLevelFormatSpecifier, base::FormatFlags::VerboseLevel); + // For date/time we need to extract user's date format first + std::size_t dateIndex = std::string::npos; + if ((dateIndex = formatCopy.find(base::consts::kDateTimeFormatSpecifier)) != std::string::npos) { + while (dateIndex > 0 && formatCopy[dateIndex - 1] == base::consts::kFormatSpecifierChar) { + dateIndex = formatCopy.find(base::consts::kDateTimeFormatSpecifier, dateIndex + 1); + } + if (dateIndex != std::string::npos) { + addFlag(base::FormatFlags::DateTime); + updateDateFormat(dateIndex, formatCopy); + } + } + m_format = formatCopy; + updateFormatSpec(); + } + + inline Level level(void) const { + return m_level; + } + + inline const base::type::string_t& userFormat(void) const { + return m_userFormat; + } + + inline const base::type::string_t& format(void) const { + return m_format; + } + + inline const std::string& dateTimeFormat(void) const { + return m_dateTimeFormat; + } + + inline base::type::EnumType flags(void) const { + return m_flags; + } + + inline bool hasFlag(base::FormatFlags flag) const { + return base::utils::hasFlag(flag, m_flags); + } + + virtual void log(el::base::type::ostream_t& os) const { + os << m_format; + } + + protected: + /// @brief Updates date time format if available in currFormat. + /// @param index Index where %datetime, %date or %time was found + /// @param [in,out] currFormat current format that is being used to format + virtual void updateDateFormat(std::size_t index, base::type::string_t& currFormat) ELPP_FINAL { + if (hasFlag(base::FormatFlags::DateTime)) { + index += ELPP_STRLEN(base::consts::kDateTimeFormatSpecifier); + } + const base::type::char_t* ptr = currFormat.c_str() + index; + if ((currFormat.size() > index) && (ptr[0] == '{')) { + // User has provided format for date/time + ++ptr; + int count = 1; // Start by 1 in order to remove starting brace + std::stringstream ss; + for (; *ptr; ++ptr, ++count) { + if (*ptr == '}') { + ++count; // In order to remove ending brace + break; + } + ss << *ptr; + } + currFormat.erase(index, count); + m_dateTimeFormat = ss.str(); + } + else { + // No format provided, use default + if (hasFlag(base::FormatFlags::DateTime)) { + m_dateTimeFormat = std::string(base::consts::kDefaultDateTimeFormat); + } + } + } + + /// @brief Updates %level from format. This is so that we dont have to do it at log-writing-time. It uses m_format and m_level + virtual void updateFormatSpec(void) ELPP_FINAL { + // Do not use switch over strongly typed enums because Intel C++ compilers dont support them yet. + if (m_level == Level::Debug) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kDebugLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kDebugLevelShortLogValue); + } + else if (m_level == Level::Info) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kInfoLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kInfoLevelShortLogValue); + } + else if (m_level == Level::Warning) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kWarningLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kWarningLevelShortLogValue); + } + else if (m_level == Level::Error) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kErrorLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kErrorLevelShortLogValue); + } + else if (m_level == Level::Fatal) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kFatalLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kFatalLevelShortLogValue); + } + else if (m_level == Level::Verbose) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kVerboseLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kVerboseLevelShortLogValue); + } + else if (m_level == Level::Trace) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelFormatSpecifier, + base::consts::kTraceLevelLogValue); + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kSeverityLevelShortFormatSpecifier, + base::consts::kTraceLevelShortLogValue); + } + if (hasFlag(base::FormatFlags::User)) { + std::string s = base::utils::s_currentUser; + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kCurrentUserFormatSpecifier, + base::utils::s_currentUser); + } + if (hasFlag(base::FormatFlags::Host)) { + base::utils::Str::replaceFirstWithEscape(m_format, base::consts::kCurrentHostFormatSpecifier, + base::utils::s_currentHost); + } + // Ignore Level::Global and Level::Unknown + } + + inline void addFlag(base::FormatFlags flag) { + base::utils::addFlag(flag, &m_flags); + } + + private: + Level m_level; + base::type::string_t m_userFormat; + base::type::string_t m_format; + std::string m_dateTimeFormat; + base::type::EnumType m_flags; + friend class el::Logger; // To resolve loggerId format specifier easily + }; + } // namespace base + /// @brief Resolving function for format specifier + typedef std::function FormatSpecifierValueResolver; + /// @brief User-provided custom format specifier + /// @see el::Helpers::installCustomFormatSpecifier + /// @see FormatSpecifierValueResolver + class CustomFormatSpecifier { + public: + CustomFormatSpecifier(const char* formatSpecifier, const FormatSpecifierValueResolver& resolver) : + m_formatSpecifier(formatSpecifier), m_resolver(resolver) {} + inline const char* formatSpecifier(void) const { return m_formatSpecifier; } + inline const FormatSpecifierValueResolver& resolver(void) const { return m_resolver; } + inline bool operator==(const char* formatSpecifier) { + return strcmp(m_formatSpecifier, formatSpecifier) == 0; + } + + private: + const char* m_formatSpecifier; + FormatSpecifierValueResolver m_resolver; + }; + /// @brief Represents single configuration that has representing level, configuration type and a string based value. + /// + /// @detail String based value means any value either its boolean, integer or string itself, it will be embedded inside quotes + /// and will be parsed later. + /// + /// Consider some examples below: + /// * el::Configuration confEnabledInfo(el::Level::Info, el::ConfigurationType::Enabled, "true"); + /// * el::Configuration confMaxLogFileSizeInfo(el::Level::Info, el::ConfigurationType::MaxLogFileSize, "2048"); + /// * el::Configuration confFilenameInfo(el::Level::Info, el::ConfigurationType::Filename, "/var/log/my.log"); + class Configuration : public Loggable { + public: + Configuration(const Configuration& c) : + m_level(c.m_level), + m_configurationType(c.m_configurationType), + m_value(c.m_value) { + } + + Configuration& operator=(const Configuration& c) { + m_level = c.m_level; + m_configurationType = c.m_configurationType; + m_value = c.m_value; + return *this; + } + + virtual ~Configuration(void) { + } + + /// @brief Full constructor used to sets value of configuration + Configuration(Level level, ConfigurationType configurationType, const std::string& value) : + m_level(level), + m_configurationType(configurationType), + m_value(value) { + } + + /// @brief Gets level of current configuration + inline Level level(void) const { + return m_level; + } + + /// @brief Gets configuration type of current configuration + inline ConfigurationType configurationType(void) const { + return m_configurationType; + } + + /// @brief Gets string based configuration value + inline const std::string& value(void) const { + return m_value; + } + + /// @brief Set string based configuration value + /// @param value Value to set. Values have to be std::string; For boolean values use "true", "false", for any integral values + /// use them in quotes. They will be parsed when configuring + inline void setValue(const std::string& value) { + m_value = value; + } + + virtual inline void log(el::base::type::ostream_t& os) const { + os << LevelHelper::convertToString(m_level) + << ELPP_LITERAL(" ") << ConfigurationTypeHelper::convertToString(m_configurationType) + << ELPP_LITERAL(" = ") << m_value.c_str(); + } + + /// @brief Used to find configuration from configuration (pointers) repository. Avoid using it. + class Predicate { + public: + Predicate(Level level, ConfigurationType configurationType) : + m_level(level), + m_configurationType(configurationType) { + } + + inline bool operator()(const Configuration* conf) const { + return ((conf != nullptr) && (conf->level() == m_level) && (conf->configurationType() == m_configurationType)); + } + + private: + Level m_level; + ConfigurationType m_configurationType; + }; + + private: + Level m_level; + ConfigurationType m_configurationType; + std::string m_value; + }; + + /// @brief Thread-safe Configuration repository + /// + /// @detail This repository represents configurations for all the levels and configuration type mapped to a value. + class Configurations : public base::utils::RegistryWithPred { + public: + /// @brief Default constructor with empty repository + Configurations(void) : + m_configurationFile(std::string()), + m_isFromFile(false) { + } + + /// @brief Constructor used to set configurations using configuration file. + /// @param configurationFile Full path to configuration file + /// @param useDefaultsForRemaining Lets you set the remaining configurations to default. + /// @param base If provided, this configuration will be based off existing repository that this argument is pointing to. + /// @see parseFromFile(const std::string&, Configurations* base) + /// @see setRemainingToDefault() + Configurations(const std::string& configurationFile, bool useDefaultsForRemaining = true, Configurations* base = nullptr) : + m_configurationFile(configurationFile), + m_isFromFile(false) { + parseFromFile(configurationFile, base); + if (useDefaultsForRemaining) { + setRemainingToDefault(); + } + } + + virtual ~Configurations(void) { + } + + /// @brief Parses configuration from file. + /// @param configurationFile Full path to configuration file + /// @param base Configurations to base new configuration repository off. This value is used when you want to use + /// existing Configurations to base all the values and then set rest of configuration via configuration file. + /// @return True if successfully parsed, false otherwise. You may define 'ELPP_DEBUG_ASSERT_FAILURE' to make sure you + /// do not proceed without successful parse. + inline bool parseFromFile(const std::string& configurationFile, Configurations* base = nullptr) { + // We initial assertion with true because if we have assertion diabled, we want to pass this + // check and if assertion is enabled we will have values re-assigned any way. + bool assertionPassed = true; + ELPP_ASSERT((assertionPassed = base::utils::File::pathExists(configurationFile.c_str(), true)), + "Configuration file [" << configurationFile << "] does not exist!"); + if (!assertionPassed) { + return false; + } + bool success = Parser::parseFromFile(configurationFile, this, base); + m_isFromFile = success; + return success; + } + + /// @brief Parse configurations from configuration string. + /// + /// @detail This configuration string has same syntax as configuration file contents. Make sure all the necessary + /// new line characters are provided. + /// @param base Configurations to base new configuration repository off. This value is used when you want to use + /// existing Configurations to base all the values and then set rest of configuration via configuration text. + /// @return True if successfully parsed, false otherwise. You may define 'ELPP_DEBUG_ASSERT_FAILURE' to make sure you + /// do not proceed without successful parse. + inline bool parseFromText(const std::string& configurationsString, Configurations* base = nullptr) { + bool success = Parser::parseFromText(configurationsString, this, base); + if (success) { + m_isFromFile = false; + } + return success; + } + + /// @brief Sets configuration based-off an existing configurations. + /// @param base Pointer to existing configurations. + inline void setFromBase(Configurations* base) { + if (base == nullptr || base == this) { + return; + } + base::threading::ScopedLock scopedLock(base->lock()); + for (Configuration*& conf : base->list()) { + set(conf); + } + } + + /// @brief Determines whether or not specified configuration type exists in the repository. + /// + /// @detail Returns as soon as first level is found. + /// @param configurationType Type of configuration to check existence for. + bool hasConfiguration(ConfigurationType configurationType) { + base::type::EnumType lIndex = LevelHelper::kMinValid; + bool result = false; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + if (hasConfiguration(LevelHelper::castFromInt(lIndex), configurationType)) { + result = true; + } + return result; + }); + return result; + } + + /// @brief Determines whether or not specified configuration type exists for specified level + /// @param level Level to check + /// @param configurationType Type of configuration to check existence for. + inline bool hasConfiguration(Level level, ConfigurationType configurationType) { + base::threading::ScopedLock scopedLock(lock()); +#if ELPP_COMPILER_INTEL + // We cant specify template types here, Intel C++ throws compilation error + // "error: type name is not allowed" + return RegistryWithPred::get(level, configurationType) != nullptr; +#else + return RegistryWithPred::get(level, configurationType) != nullptr; +#endif // ELPP_COMPILER_INTEL + } + + /// @brief Sets value of configuration for specified level. + /// + /// @detail Any existing configuration for specified level will be replaced. Also note that configuration types + /// ConfigurationType::MillisecondsWidth and ConfigurationType::PerformanceTracking will be ignored if not set for + /// Level::Global because these configurations are not dependant on level. + /// @param level Level to set configuration for (el::Level). + /// @param configurationType Type of configuration (el::ConfigurationType) + /// @param value A string based value. Regardless of what the data type of configuration is, it will always be string + /// from users' point of view. This is then parsed later to be used internally. + /// @see Configuration::setValue(const std::string& value) + /// @see el::Level + /// @see el::ConfigurationType + inline void set(Level level, ConfigurationType configurationType, const std::string& value) { + base::threading::ScopedLock scopedLock(lock()); + unsafeSet(level, configurationType, value); // This is not unsafe anymore as we have locked mutex + if (level == Level::Global) { + unsafeSetGlobally(configurationType, value, false); // Again this is not unsafe either + } + } + + /// @brief Sets single configuration based on other single configuration. + /// @see set(Level level, ConfigurationType configurationType, const std::string& value) + inline void set(Configuration* conf) { + if (conf == nullptr) { + return; + } + set(conf->level(), conf->configurationType(), conf->value()); + } + + inline Configuration* get(Level level, ConfigurationType configurationType) { + base::threading::ScopedLock scopedLock(lock()); + return RegistryWithPred::get(level, configurationType); + } + + /// @brief Sets configuration for all levels. + /// @param configurationType Type of configuration + /// @param value String based value + /// @see Configurations::set(Level level, ConfigurationType configurationType, const std::string& value) + inline void setGlobally(ConfigurationType configurationType, const std::string& value) { + setGlobally(configurationType, value, false); + } + + /// @brief Clears repository so that all the configurations are unset + inline void clear(void) { + base::threading::ScopedLock scopedLock(lock()); + unregisterAll(); + } + + /// @brief Gets configuration file used in parsing this configurations. + /// + /// @detail If this repository was set manually or by text this returns empty string. + inline const std::string& configurationFile(void) const { + return m_configurationFile; + } + + /// @brief Sets configurations to "factory based" configurations. + void setToDefault(void) { + setGlobally(ConfigurationType::Enabled, std::string("true"), true); +#if !defined(ELPP_NO_DEFAULT_LOG_FILE) + setGlobally(ConfigurationType::Filename, std::string(base::consts::kDefaultLogFile), true); +#else + ELPP_UNUSED(base::consts::kDefaultLogFile); +#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) + setGlobally(ConfigurationType::ToFile, std::string("true"), true); + setGlobally(ConfigurationType::ToStandardOutput, std::string("true"), true); + setGlobally(ConfigurationType::MillisecondsWidth, std::string("3"), true); + setGlobally(ConfigurationType::PerformanceTracking, std::string("true"), true); + setGlobally(ConfigurationType::MaxLogFileSize, std::string("0"), true); + setGlobally(ConfigurationType::LogFlushThreshold, std::string("0"), true); + + setGlobally(ConfigurationType::Format, std::string("%datetime %level [%logger] %msg"), true); + set(Level::Debug, ConfigurationType::Format, std::string("%datetime %level [%logger] [%user@%host] [%func] [%loc] %msg")); + // INFO and WARNING are set to default by Level::Global + set(Level::Error, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); + set(Level::Fatal, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); + set(Level::Verbose, ConfigurationType::Format, std::string("%datetime %level-%vlevel [%logger] %msg")); + set(Level::Trace, ConfigurationType::Format, std::string("%datetime %level [%logger] [%func] [%loc] %msg")); + } + + /// @brief Lets you set the remaining configurations to default. + /// + /// @detail By remaining, it means that the level/type a configuration does not exist for. + /// This function is useful when you want to minimize chances of failures, e.g, if you have a configuration file that sets + /// configuration for all the configurations except for Enabled or not, we use this so that ENABLED is set to default i.e, + /// true. If you dont do this explicitley (either by calling this function or by using second param in Constructor + /// and try to access a value, an error is thrown + void setRemainingToDefault(void) { + base::threading::ScopedLock scopedLock(lock()); + unsafeSetIfNotExist(Level::Global, ConfigurationType::Enabled, std::string("true")); +#if !defined(ELPP_NO_DEFAULT_LOG_FILE) + unsafeSetIfNotExist(Level::Global, ConfigurationType::Filename, std::string(base::consts::kDefaultLogFile)); +#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) + unsafeSetIfNotExist(Level::Global, ConfigurationType::ToFile, std::string("true")); + unsafeSetIfNotExist(Level::Global, ConfigurationType::ToStandardOutput, std::string("true")); + unsafeSetIfNotExist(Level::Global, ConfigurationType::MillisecondsWidth, std::string("3")); + unsafeSetIfNotExist(Level::Global, ConfigurationType::PerformanceTracking, std::string("true")); + unsafeSetIfNotExist(Level::Global, ConfigurationType::MaxLogFileSize, std::string("0")); + unsafeSetIfNotExist(Level::Global, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); + unsafeSetIfNotExist(Level::Debug, ConfigurationType::Format, + std::string("%datetime %level [%logger] [%user@%host] [%func] [%loc] %msg")); + // INFO and WARNING are set to default by Level::Global + unsafeSetIfNotExist(Level::Error, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); + unsafeSetIfNotExist(Level::Fatal, ConfigurationType::Format, std::string("%datetime %level [%logger] %msg")); + unsafeSetIfNotExist(Level::Verbose, ConfigurationType::Format, std::string("%datetime %level-%vlevel [%logger] %msg")); + unsafeSetIfNotExist(Level::Trace, ConfigurationType::Format, std::string("%datetime %level [%logger] [%func] [%loc] %msg")); + } + + /// @brief Parser used internally to parse configurations from file or text. + /// + /// @detail This class makes use of base::utils::Str. + /// You should not need this unless you are working on some tool for Easylogging++ + class Parser : base::StaticClass { + public: + /// @brief Parses configuration from file. + /// @param configurationFile Full path to configuration file + /// @param sender Sender configurations pointer. Usually 'this' is used from calling class + /// @param base Configurations to base new configuration repository off. This value is used when you want to use + /// existing Configurations to base all the values and then set rest of configuration via configuration file. + /// @return True if successfully parsed, false otherwise. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you + /// do not proceed without successful parse. + static bool parseFromFile(const std::string& configurationFile, Configurations* sender, Configurations* base = nullptr) { + sender->setFromBase(base); + std::ifstream fileStream_(configurationFile.c_str(), std::ifstream::in); + ELPP_ASSERT(fileStream_.is_open(), "Unable to open configuration file [" << configurationFile << "] for parsing."); + bool parsedSuccessfully = false; + std::string line = std::string(); + Level currLevel = Level::Unknown; + std::string currConfigStr = std::string(); + std::string currLevelStr = std::string(); + while (fileStream_.good()) { + std::getline(fileStream_, line); + parsedSuccessfully = parseLine(&line, &currConfigStr, &currLevelStr, &currLevel, sender); + ELPP_ASSERT(parsedSuccessfully, "Unable to parse configuration line: " << line); + } + return parsedSuccessfully; + } + + /// @brief Parse configurations from configuration string. + /// + /// @detail This configuration string has same syntax as configuration file contents. Make sure all the necessary + /// new line characters are provided. You may define '_STOP_ON_FIRSTELPP_ASSERTION' to make sure you + /// do not proceed without successful parse (This is recommended) + /// @param configurationsString + /// @param sender Sender configurations pointer. Usually 'this' is used from calling class + /// @param base Configurations to base new configuration repository off. This value is used when you want to use + /// existing Configurations to base all the values and then set rest of configuration via configuration text. + /// @return True if successfully parsed, false otherwise. + static bool parseFromText(const std::string& configurationsString, Configurations* sender, Configurations* base = nullptr) { + sender->setFromBase(base); + bool parsedSuccessfully = false; + std::stringstream ss(configurationsString); + std::string line = std::string(); + Level currLevel = Level::Unknown; + std::string currConfigStr = std::string(); + std::string currLevelStr = std::string(); + while (std::getline(ss, line)) { + parsedSuccessfully = parseLine(&line, &currConfigStr, &currLevelStr, &currLevel, sender); + ELPP_ASSERT(parsedSuccessfully, "Unable to parse configuration line: " << line); + } + return parsedSuccessfully; + } + + private: + friend class el::Loggers; + static void ignoreComments(std::string* line) { + std::size_t foundAt = 0; + std::size_t quotesStart = line->find("\""); + std::size_t quotesEnd = std::string::npos; + if (quotesStart != std::string::npos) { + quotesEnd = line->find("\"", quotesStart + 1); + while (quotesEnd != std::string::npos && line->at(quotesEnd - 1) == '\\') { + // Do not erase slash yet - we will erase it in parseLine(..) while loop + quotesEnd = line->find("\"", quotesEnd + 2); + } + } + if ((foundAt = line->find(base::consts::kConfigurationComment)) != std::string::npos) { + if (foundAt < quotesEnd) { + foundAt = line->find(base::consts::kConfigurationComment, quotesEnd + 1); + } + *line = line->substr(0, foundAt); + } + } + static inline bool isLevel(const std::string& line) { + return base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationLevel)); + } + + static inline bool isComment(const std::string& line) { + return base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationComment)); + } + + static inline bool isConfig(const std::string& line) { + std::size_t assignment = line.find('='); + return line != "" && + (line[0] >= 65 || line[0] <= 90 || line[0] >= 97 || line[0] <= 122) && + (assignment != std::string::npos) && + (line.size() > assignment); + } + + static bool parseLine(std::string* line, std::string* currConfigStr, std::string* currLevelStr, Level* currLevel, Configurations* conf) { + ConfigurationType currConfig = ConfigurationType::Unknown; + std::string currValue = std::string(); + *line = base::utils::Str::trim(*line); + if (isComment(*line)) return true; + ignoreComments(line); + *line = base::utils::Str::trim(*line); + if (line->empty()) { + // Comment ignored + return true; + } + if (isLevel(*line)) { + if (line->size() <= 2) { + return true; + } + *currLevelStr = line->substr(1, line->size() - 2); + *currLevelStr = base::utils::Str::toUpper(*currLevelStr); + *currLevelStr = base::utils::Str::trim(*currLevelStr); + *currLevel = LevelHelper::convertFromString(currLevelStr->c_str()); + return true; + } + if (isConfig(*line)) { + std::size_t assignment = line->find('='); + *currConfigStr = line->substr(0, assignment); + *currConfigStr = base::utils::Str::toUpper(*currConfigStr); + *currConfigStr = base::utils::Str::trim(*currConfigStr); + currConfig = ConfigurationTypeHelper::convertFromString(currConfigStr->c_str()); + currValue = line->substr(assignment + 1); + currValue = base::utils::Str::trim(currValue); + std::size_t quotesStart = currValue.find("\"", 0); + std::size_t quotesEnd = std::string::npos; + if (quotesStart != std::string::npos) { + quotesEnd = currValue.find("\"", quotesStart + 1); + while (quotesEnd != std::string::npos && currValue.at(quotesEnd - 1) == '\\') { + currValue = currValue.erase(quotesEnd - 1, 1); + quotesEnd = currValue.find("\"", quotesEnd + 2); + } + } + if (quotesStart != std::string::npos && quotesEnd != std::string::npos) { + // Quote provided - check and strip if valid + ELPP_ASSERT((quotesStart < quotesEnd), "Configuration error - No ending quote found in [" + << currConfigStr << "]"); + ELPP_ASSERT((quotesStart + 1 != quotesEnd), "Empty configuration value for [" << currConfigStr << "]"); + if ((quotesStart != quotesEnd) && (quotesStart + 1 != quotesEnd)) { + // Explicit check in case if assertion is disabled + currValue = currValue.substr(quotesStart + 1, quotesEnd - 1); + } + } + } + ELPP_ASSERT(*currLevel != Level::Unknown, "Unrecognized severity level [" << *currLevelStr << "]"); + ELPP_ASSERT(currConfig != ConfigurationType::Unknown, "Unrecognized configuration [" << *currConfigStr << "]"); + if (*currLevel == Level::Unknown || currConfig == ConfigurationType::Unknown) { + return false; // unrecognizable level or config + } + conf->set(*currLevel, currConfig, currValue); + return true; + } + }; + + private: + std::string m_configurationFile; + bool m_isFromFile; + friend class el::Loggers; + + /// @brief Unsafely sets configuration if does not already exist + void unsafeSetIfNotExist(Level level, ConfigurationType configurationType, const std::string& value) { + Configuration* conf = RegistryWithPred::get(level, configurationType); + if (conf == nullptr) { + unsafeSet(level, configurationType, value); + } + } + + /// @brief Thread unsafe set + void unsafeSet(Level level, ConfigurationType configurationType, const std::string& value) { + Configuration* conf = RegistryWithPred::get(level, configurationType); + if (conf == nullptr) { + registerNew(new Configuration(level, configurationType, value)); + } + else { + conf->setValue(value); + } + if (level == Level::Global) { + unsafeSetGlobally(configurationType, value, false); + } + } + + /// @brief Sets configurations for all levels including Level::Global if includeGlobalLevel is true + /// @see Configurations::setGlobally(ConfigurationType configurationType, const std::string& value) + void setGlobally(ConfigurationType configurationType, const std::string& value, bool includeGlobalLevel) { + if (includeGlobalLevel) { + set(Level::Global, configurationType, value); + } + base::type::EnumType lIndex = LevelHelper::kMinValid; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + set(LevelHelper::castFromInt(lIndex), configurationType, value); + return false; // Do not break lambda function yet as we need to set all levels regardless + }); + } + + /// @brief Sets configurations (Unsafely) for all levels including Level::Global if includeGlobalLevel is true + /// @see Configurations::setGlobally(ConfigurationType configurationType, const std::string& value) + void unsafeSetGlobally(ConfigurationType configurationType, const std::string& value, bool includeGlobalLevel) { + if (includeGlobalLevel) { + unsafeSet(Level::Global, configurationType, value); + } + base::type::EnumType lIndex = LevelHelper::kMinValid; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + unsafeSet(LevelHelper::castFromInt(lIndex), configurationType, value); + return false; // Do not break lambda function yet as we need to set all levels regardless + }); + } + }; + + namespace base { + typedef std::shared_ptr FileStreamPtr; + typedef std::map LogStreamsReferenceMap; + /// @brief Configurations with data types. + /// + /// @detail el::Configurations have string based values. This is whats used internally in order to read correct configurations. + /// This is to perform faster while writing logs using correct configurations. + /// + /// This is thread safe and final class containing non-virtual destructor (means nothing should inherit this class) + class TypedConfigurations : public base::threading::ThreadSafe { + public: + /// @brief Constructor to initialize (construct) the object off el::Configurations + /// @param configurations Configurations pointer/reference to base this typed configurations off. + /// @param logStreamsReference Use ELPP->registeredLoggers()->logStreamsReference() + TypedConfigurations(Configurations* configurations, base::LogStreamsReferenceMap* logStreamsReference) { + m_configurations = configurations; + m_logStreamsReference = logStreamsReference; + build(m_configurations); + } + + TypedConfigurations(const TypedConfigurations& other) { + this->m_configurations = other.m_configurations; + this->m_logStreamsReference = other.m_logStreamsReference; + build(m_configurations); + } + + virtual ~TypedConfigurations(void) { + } + + const Configurations* configurations(void) const { + return m_configurations; + } + + inline bool enabled(Level level) { + return getConfigByVal(level, &m_enabledMap, "enabled"); + } + + inline bool toFile(Level level) { + return getConfigByVal(level, &m_toFileMap, "toFile"); + } + + inline const std::string& filename(Level level) { + return getConfigByRef(level, &m_filenameMap, "filename"); + } + + inline bool toStandardOutput(Level level) { + return getConfigByVal(level, &m_toStandardOutputMap, "toStandardOutput"); + } + + inline const base::LogFormat& logFormat(Level level) { + return getConfigByRef(level, &m_logFormatMap, "logFormat"); + } + + inline const base::MillisecondsWidth& millisecondsWidth(Level level = Level::Global) { + return getConfigByRef(level, &m_millisecondsWidthMap, "millisecondsWidth"); + } + + inline bool performanceTracking(Level level = Level::Global) { + return getConfigByVal(level, &m_performanceTrackingMap, "performanceTracking"); + } + + inline base::type::fstream_t* fileStream(Level level) { + return getConfigByRef(level, &m_fileStreamMap, "fileStream").get(); + } + + inline std::size_t maxLogFileSize(Level level) { + return getConfigByVal(level, &m_maxLogFileSizeMap, "maxLogFileSize"); + } + + inline std::size_t logFlushThreshold(Level level) { + return getConfigByVal(level, &m_logFlushThresholdMap, "logFlushThreshold"); + } + + private: + Configurations* m_configurations; + std::map m_enabledMap; + std::map m_toFileMap; + std::map m_filenameMap; + std::map m_toStandardOutputMap; + std::map m_logFormatMap; + std::map m_millisecondsWidthMap; + std::map m_performanceTrackingMap; + std::map m_fileStreamMap; + std::map m_maxLogFileSizeMap; + std::map m_logFlushThresholdMap; + base::LogStreamsReferenceMap* m_logStreamsReference; + + friend class el::Helpers; + friend class el::base::MessageBuilder; + friend class el::base::Writer; + friend class el::base::DefaultLogDispatchCallback; + friend class el::base::LogDispatcher; + + template + inline Conf_T getConfigByVal(Level level, const std::map* confMap, const char* confName) { + base::threading::ScopedLock scopedLock(lock()); + return unsafeGetConfigByVal(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope + } + + template + inline Conf_T& getConfigByRef(Level level, std::map* confMap, const char* confName) { + base::threading::ScopedLock scopedLock(lock()); + return unsafeGetConfigByRef(level, confMap, confName); // This is not unsafe anymore - mutex locked in scope + } + + template + inline Conf_T unsafeGetConfigByVal(Level level, const std::map* confMap, const char* confName) { + ELPP_UNUSED(confName); + typename std::map::const_iterator it = confMap->find(level); + if (it == confMap->end()) { + try { + return confMap->at(Level::Global); + } + catch (...) { + ELPP_INTERNAL_ERROR("Unable to get configuration [" << confName << "] for level [" + << LevelHelper::convertToString(level) << "]" + << std::endl << "Please ensure you have properly configured logger.", false); + return Conf_T(); + } + } + return it->second; + } + + template + inline Conf_T& unsafeGetConfigByRef(Level level, std::map* confMap, const char* confName) { + ELPP_UNUSED(confName); + typename std::map::iterator it = confMap->find(level); + if (it == confMap->end()) { + try { + return confMap->at(Level::Global); + } + catch (...) { + ELPP_INTERNAL_ERROR("Unable to get configuration [" << confName << "] for level [" + << LevelHelper::convertToString(level) << "]" + << std::endl << "Please ensure you have properly configured logger.", false); + } + } + return it->second; + } + + template + void setValue(Level level, const Conf_T& value, std::map* confMap, bool includeGlobalLevel = true) { + // If map is empty and we are allowed to add into generic level (Level::Global), do it! + if (confMap->empty() && includeGlobalLevel) { + confMap->insert(std::make_pair(Level::Global, value)); + return; + } + // If same value exist in generic level already, dont add it to explicit level + typename std::map::iterator it = confMap->find(Level::Global); + if (it != confMap->end() && it->second == value) { + return; + } + // Now make sure we dont double up values if we really need to add it to explicit level + it = confMap->find(level); + if (it == confMap->end()) { + // Value not found for level, add new + confMap->insert(std::make_pair(level, value)); + } + else { + // Value found, just update value + confMap->at(level) = value; + } + } + + void build(Configurations* configurations) { + base::threading::ScopedLock scopedLock(lock()); + auto getBool = [](std::string boolStr) -> bool { // Pass by value for trimming + base::utils::Str::trim(boolStr); + return (boolStr == "TRUE" || boolStr == "true" || boolStr == "1"); + }; + std::vector withFileSizeLimit; + for (Configurations::const_iterator it = configurations->begin(); it != configurations->end(); ++it) { + Configuration* conf = *it; + // We cannot use switch on strong enums because Intel C++ dont support them yet + if (conf->configurationType() == ConfigurationType::Enabled) { + setValue(conf->level(), getBool(conf->value()), &m_enabledMap); + } + else if (conf->configurationType() == ConfigurationType::ToFile) { + setValue(conf->level(), getBool(conf->value()), &m_toFileMap); + } + else if (conf->configurationType() == ConfigurationType::ToStandardOutput) { + setValue(conf->level(), getBool(conf->value()), &m_toStandardOutputMap); + } + else if (conf->configurationType() == ConfigurationType::Filename) { + // We do not yet configure filename but we will configure in another + // loop. This is because if file cannot be created, we will force ToFile + // to be false. Because configuring logger is not necessarily performance + // sensative operation, we can live with another loop; (by the way this loop + // is not very heavy either) + } + else if (conf->configurationType() == ConfigurationType::Format) { + setValue(conf->level(), base::LogFormat(conf->level(), + base::type::string_t(conf->value().begin(), conf->value().end())), &m_logFormatMap); + } + else if (conf->configurationType() == ConfigurationType::MillisecondsWidth) { + setValue(Level::Global, + base::MillisecondsWidth(static_cast(getULong(conf->value()))), &m_millisecondsWidthMap); + } + else if (conf->configurationType() == ConfigurationType::PerformanceTracking) { + setValue(Level::Global, getBool(conf->value()), &m_performanceTrackingMap); + } + else if (conf->configurationType() == ConfigurationType::MaxLogFileSize) { + setValue(conf->level(), static_cast(getULong(conf->value())), &m_maxLogFileSizeMap); +#if !defined(ELPP_NO_DEFAULT_LOG_FILE) + withFileSizeLimit.push_back(conf); +#endif // !defined(ELPP_NO_DEFAULT_LOG_FILE) + } + else if (conf->configurationType() == ConfigurationType::LogFlushThreshold) { + setValue(conf->level(), static_cast(getULong(conf->value())), &m_logFlushThresholdMap); + } + } + // As mentioned early, we will now set filename configuration in separate loop to deal with non-existent files + for (Configurations::const_iterator it = configurations->begin(); it != configurations->end(); ++it) { + Configuration* conf = *it; + if (conf->configurationType() == ConfigurationType::Filename) { + insertFile(conf->level(), conf->value()); + } + } + for (std::vector::iterator conf = withFileSizeLimit.begin(); + conf != withFileSizeLimit.end(); ++conf) { + // This is not unsafe as mutex is locked in currect scope + unsafeValidateFileRolling((*conf)->level(), base::defaultPreRollOutCallback); + } + } + + unsigned long getULong(std::string confVal) { + bool valid = true; + base::utils::Str::trim(confVal); + valid = !confVal.empty() && std::find_if(confVal.begin(), confVal.end(), + [](char c) { return !base::utils::Str::isDigit(c); }) == confVal.end(); + if (!valid) { + valid = false; + ELPP_ASSERT(valid, "Configuration value not a valid integer [" << confVal << "]"); + return 0; + } + return atol(confVal.c_str()); + } + + std::string resolveFilename(const std::string& filename) { + std::string resultingFilename = filename; + std::size_t dateIndex = std::string::npos; + std::string dateTimeFormatSpecifierStr = std::string(base::consts::kDateTimeFormatSpecifierForFilename); + if ((dateIndex = resultingFilename.find(dateTimeFormatSpecifierStr.c_str())) != std::string::npos) { + while (dateIndex > 0 && resultingFilename[dateIndex - 1] == base::consts::kFormatSpecifierChar) { + dateIndex = resultingFilename.find(dateTimeFormatSpecifierStr.c_str(), dateIndex + 1); + } + if (dateIndex != std::string::npos) { + const char* ptr = resultingFilename.c_str() + dateIndex; + // Goto end of specifier + ptr += dateTimeFormatSpecifierStr.size(); + std::string fmt; + if ((resultingFilename.size() > dateIndex) && (ptr[0] == '{')) { + // User has provided format for date/time + ++ptr; + int count = 1; // Start by 1 in order to remove starting brace + std::stringstream ss; + for (; *ptr; ++ptr, ++count) { + if (*ptr == '}') { + ++count; // In order to remove ending brace + break; + } + ss << *ptr; + } + resultingFilename.erase(dateIndex + dateTimeFormatSpecifierStr.size(), count); + fmt = ss.str(); + } + else { + fmt = std::string(base::consts::kDefaultDateTimeFormatInFilename); + } + base::MillisecondsWidth msWidth(3); + std::string now = base::utils::DateTime::getDateTime(fmt.c_str(), &msWidth); + base::utils::Str::replaceAll(now, '/', '-'); // Replace path element since we are dealing with filename + base::utils::Str::replaceAll(resultingFilename, dateTimeFormatSpecifierStr, now); + } + } + return resultingFilename; + } + + void insertFile(Level level, const std::string& fullFilename) { + std::string resolvedFilename = resolveFilename(fullFilename); + if (resolvedFilename.empty()) { + std::cerr << "Could not load empty file for logging, please re-check your configurations for level [" + << LevelHelper::convertToString(level) << "]"; + } + std::string filePath = base::utils::File::extractPathFromFilename(resolvedFilename, base::consts::kFilePathSeperator); + if (filePath.size() < resolvedFilename.size()) { + base::utils::File::createPath(filePath); + } + auto create = [&](Level level) { + base::LogStreamsReferenceMap::iterator filestreamIter = m_logStreamsReference->find(resolvedFilename); + base::type::fstream_t* fs = nullptr; + if (filestreamIter == m_logStreamsReference->end()) { + // We need a completely new stream, nothing to share with + fs = base::utils::File::newFileStream(resolvedFilename); + m_filenameMap.insert(std::make_pair(level, resolvedFilename)); + m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(fs))); + m_logStreamsReference->insert(std::make_pair(resolvedFilename, base::FileStreamPtr(m_fileStreamMap.at(level)))); + } + else { + // Woops! we have an existing one, share it! + m_filenameMap.insert(std::make_pair(level, filestreamIter->first)); + m_fileStreamMap.insert(std::make_pair(level, base::FileStreamPtr(filestreamIter->second))); + fs = filestreamIter->second.get(); + } + if (fs == nullptr) { + // We display bad file error from newFileStream() + ELPP_INTERNAL_ERROR("Setting [TO_FILE] of [" + << LevelHelper::convertToString(level) << "] to FALSE", false); + setValue(level, false, &m_toFileMap); + } + }; + // If we dont have file conf for any level, create it for Level::Global first + // otherwise create for specified level + create(m_filenameMap.empty() && m_fileStreamMap.empty() ? Level::Global : level); + } + + bool unsafeValidateFileRolling(Level level, const PreRollOutCallback& PreRollOutCallback) { + base::type::fstream_t* fs = unsafeGetConfigByRef(level, &m_fileStreamMap, "fileStream").get(); + if (fs == nullptr) { + return true; + } + std::size_t maxLogFileSize = unsafeGetConfigByVal(level, &m_maxLogFileSizeMap, "maxLogFileSize"); + std::size_t currFileSize = base::utils::File::getSizeOfFile(fs); + if (maxLogFileSize != 0 && currFileSize >= maxLogFileSize) { + std::string fname = unsafeGetConfigByRef(level, &m_filenameMap, "filename"); + ELPP_INTERNAL_INFO(1, "Truncating log file [" << fname << "] as a result of configurations for level [" + << LevelHelper::convertToString(level) << "]"); + fs->close(); + PreRollOutCallback(fname.c_str(), currFileSize); + fs->open(fname, std::fstream::out | std::fstream::trunc); + return true; + } + return false; + } + + bool validateFileRolling(Level level, const PreRollOutCallback& PreRollOutCallback) { + base::threading::ScopedLock scopedLock(lock()); + return unsafeValidateFileRolling(level, PreRollOutCallback); + } + }; + /// @brief Class that keeps record of current line hit for occasional logging + class HitCounter { + public: + HitCounter(void) : + m_filename(""), + m_lineNumber(0), + m_hitCounts(0) { + } + + HitCounter(const char* filename, unsigned long int lineNumber) : + m_filename(filename), + m_lineNumber(lineNumber), + m_hitCounts(0) { + } + + HitCounter(const HitCounter& hitCounter) : + m_filename(hitCounter.m_filename), + m_lineNumber(hitCounter.m_lineNumber), + m_hitCounts(hitCounter.m_hitCounts) { + } + + HitCounter& operator=(const HitCounter& hitCounter) { + m_filename = hitCounter.m_filename; + m_lineNumber = hitCounter.m_lineNumber; + m_hitCounts = hitCounter.m_hitCounts; + return *this; + } + + virtual ~HitCounter(void) { + } + + /// @brief Resets location of current hit counter + inline void resetLocation(const char* filename, unsigned long int lineNumber) { + m_filename = filename; + m_lineNumber = lineNumber; + } + + /// @brief Validates hit counts and resets it if necessary + inline void validateHitCounts(std::size_t n) { + if (m_hitCounts >= base::consts::kMaxLogPerCounter) { + m_hitCounts = (n >= 1 ? base::consts::kMaxLogPerCounter % n : 0); + } + ++m_hitCounts; + } + + inline const char* filename(void) const { + return m_filename; + } + + inline unsigned long int lineNumber(void) const { + return m_lineNumber; + } + + inline std::size_t hitCounts(void) const { + return m_hitCounts; + } + + inline void increment(void) { + ++m_hitCounts; + } + + class Predicate { + public: + Predicate(const char* filename, unsigned long int lineNumber) + : m_filename(filename), + m_lineNumber(lineNumber) { + } + inline bool operator()(const HitCounter* counter) { + return ((counter != nullptr) && + (strcmp(counter->m_filename, m_filename) == 0) && + (counter->m_lineNumber == m_lineNumber)); + } + + private: + const char* m_filename; + unsigned long int m_lineNumber; + }; + + private: + const char* m_filename; + unsigned long int m_lineNumber; + std::size_t m_hitCounts; + }; + /// @brief Repository for hit counters used across the application + class RegisteredHitCounters : public base::utils::RegistryWithPred { + public: + /// @brief Validates counter for every N, i.e, registers new if does not exist otherwise updates original one + /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned + bool validateEveryN(const char* filename, unsigned long int lineNumber, std::size_t n) { + base::threading::ScopedLock scopedLock(lock()); + base::HitCounter* counter = get(filename, lineNumber); + if (counter == nullptr) { + registerNew(counter = new base::HitCounter(filename, lineNumber)); + } + counter->validateHitCounts(n); + bool result = (n >= 1 && counter->hitCounts() != 0 && counter->hitCounts() % n == 0); + return result; + } + + /// @brief Validates counter for hits >= N, i.e, registers new if does not exist otherwise updates original one + /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned + bool validateAfterN(const char* filename, unsigned long int lineNumber, std::size_t n) { + base::threading::ScopedLock scopedLock(lock()); + base::HitCounter* counter = get(filename, lineNumber); + if (counter == nullptr) { + registerNew(counter = new base::HitCounter(filename, lineNumber)); + } + // Do not use validateHitCounts here since we do not want to reset counter here + // Note the >= instead of > because we are incrementing + // after this check + if (counter->hitCounts() >= n) + return true; + counter->increment(); + return false; + } + + /// @brief Validates counter for hits are <= n, i.e, registers new if does not exist otherwise updates original one + /// @return True if validation resulted in triggering hit. Meaning logs should be written everytime true is returned + bool validateNTimes(const char* filename, unsigned long int lineNumber, std::size_t n) { + base::threading::ScopedLock scopedLock(lock()); + base::HitCounter* counter = get(filename, lineNumber); + if (counter == nullptr) { + registerNew(counter = new base::HitCounter(filename, lineNumber)); + } + counter->increment(); + // Do not use validateHitCounts here since we do not want to reset counter here + if (counter->hitCounts() <= n) + return true; + return false; + } + + /// @brief Gets hit counter registered at specified position + inline const base::HitCounter* getCounter(const char* filename, unsigned long int lineNumber) { + base::threading::ScopedLock scopedLock(lock()); + return get(filename, lineNumber); + } + }; + /// @brief Action to be taken for dispatching + enum class DispatchAction : base::type::EnumType { + None = 1, NormalLog = 2, SysLog = 4 + }; + } // namespace base + template + class Callback : protected base::threading::ThreadSafe { + public: + Callback(void) : m_enabled(true) {} + inline bool enabled(void) const { return m_enabled; } + inline void setEnabled(bool enabled) { + base::threading::ScopedLock scopedLock(lock()); + m_enabled = enabled; + } + protected: + virtual void handle(const T* handlePtr) = 0; + private: + bool m_enabled; + }; + class LogDispatchData { + public: + LogDispatchData() : m_logMessage(nullptr), m_dispatchAction(base::DispatchAction::None) {} + inline const LogMessage* logMessage(void) const { return m_logMessage; } + inline base::DispatchAction dispatchAction(void) const { return m_dispatchAction; } + private: + LogMessage* m_logMessage; + base::DispatchAction m_dispatchAction; + friend class base::LogDispatcher; + + inline void setLogMessage(LogMessage* logMessage) { m_logMessage = logMessage; } + inline void setDispatchAction(base::DispatchAction dispatchAction) { m_dispatchAction = dispatchAction; } + }; + class LogDispatchCallback : public Callback { + private: + friend class base::LogDispatcher; + }; + class PerformanceTrackingCallback : public Callback { + private: + friend class base::PerformanceTracker; + }; + class LogBuilder : base::NoCopy { + public: + virtual ~LogBuilder(void) { ELPP_INTERNAL_INFO(3, "Destroying log builder...") } + virtual base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const = 0; + void convertToColoredOutput(base::type::string_t* logLine, Level level) { + if (!base::utils::s_termSupportsColor) return; + const base::type::char_t* resetColor = ELPP_LITERAL("\x1b[0m"); + if (level == Level::Error || level == Level::Fatal) + *logLine = ELPP_LITERAL("\x1b[31m") + *logLine + resetColor; + else if (level == Level::Warning) + *logLine = ELPP_LITERAL("\x1b[33m") + *logLine + resetColor; + } + private: + friend class el::base::DefaultLogDispatchCallback; + }; + typedef std::shared_ptr LogBuilderPtr; + /// @brief Represents a logger holding ID and configurations we need to write logs + /// + /// @detail This class does not write logs itself instead its used by writer to read configuations from. + class Logger : public base::threading::ThreadSafe, public Loggable { + public: + Logger(const std::string& id, base::LogStreamsReferenceMap* logStreamsReference) : + m_id(id), + m_typedConfigurations(nullptr), + m_parentApplicationName(std::string()), + m_isConfigured(false), + m_logStreamsReference(logStreamsReference) { + initUnflushedCount(); + } + + Logger(const std::string& id, const Configurations& configurations, base::LogStreamsReferenceMap* logStreamsReference) : + m_id(id), + m_typedConfigurations(nullptr), + m_parentApplicationName(std::string()), + m_isConfigured(false), + m_logStreamsReference(logStreamsReference) { + initUnflushedCount(); + configure(configurations); + } + + Logger(const Logger& logger) { + base::utils::safeDelete(m_typedConfigurations); + m_id = logger.m_id; + m_typedConfigurations = logger.m_typedConfigurations; + m_parentApplicationName = logger.m_parentApplicationName; + m_isConfigured = logger.m_isConfigured; + m_configurations = logger.m_configurations; + m_unflushedCount = logger.m_unflushedCount; + m_logStreamsReference = logger.m_logStreamsReference; + } + + Logger& operator=(const Logger& logger) { + base::utils::safeDelete(m_typedConfigurations); + m_id = logger.m_id; + m_typedConfigurations = logger.m_typedConfigurations; + m_parentApplicationName = logger.m_parentApplicationName; + m_isConfigured = logger.m_isConfigured; + m_configurations = logger.m_configurations; + m_unflushedCount = logger.m_unflushedCount; + m_logStreamsReference = logger.m_logStreamsReference; + return *this; + } + + virtual ~Logger(void) { + base::utils::safeDelete(m_typedConfigurations); + } + + virtual inline void log(el::base::type::ostream_t& os) const { + os << m_id.c_str(); + } + + /// @brief Configures the logger using specified configurations. + void configure(const Configurations& configurations) { + m_isConfigured = false; // we set it to false in case if we fail + initUnflushedCount(); + if (m_typedConfigurations != nullptr) { + Configurations* c = const_cast(m_typedConfigurations->configurations()); + if (c->hasConfiguration(Level::Global, ConfigurationType::Filename)) { + // This check is definitely needed for cases like ELPP_NO_DEFAULT_LOG_FILE + flush(); + } + } + base::threading::ScopedLock scopedLock(lock()); + if (m_configurations != configurations) { + m_configurations.setFromBase(const_cast(&configurations)); + } + base::utils::safeDelete(m_typedConfigurations); + m_typedConfigurations = new base::TypedConfigurations(&m_configurations, m_logStreamsReference); + resolveLoggerFormatSpec(); + m_isConfigured = true; + } + + /// @brief Reconfigures logger using existing configurations + inline void reconfigure(void) { + ELPP_INTERNAL_INFO(1, "Reconfiguring logger [" << m_id << "]"); + configure(m_configurations); + } + + inline const std::string& id(void) const { + return m_id; + } + + inline const std::string& parentApplicationName(void) const { + return m_parentApplicationName; + } + + inline void setParentApplicationName(const std::string& parentApplicationName) { + m_parentApplicationName = parentApplicationName; + } + + inline Configurations* configurations(void) { + return &m_configurations; + } + + inline base::TypedConfigurations* typedConfigurations(void) { + return m_typedConfigurations; + } + + static inline bool isValidId(const std::string& id) { + for (std::string::const_iterator it = id.begin(); it != id.end(); ++it) { + if (!base::utils::Str::contains(base::consts::kValidLoggerIdSymbols, *it)) { + return false; + } + } + return true; + } + /// @brief Flushes logger to sync all log files for all levels + inline void flush(void) { + ELPP_INTERNAL_INFO(3, "Flushing logger [" << m_id << "] all levels"); + base::threading::ScopedLock scopedLock(lock()); + base::type::EnumType lIndex = LevelHelper::kMinValid; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + flush(LevelHelper::castFromInt(lIndex), nullptr); + return false; + }); + } + + inline void flush(Level level, base::type::fstream_t* fs) { + if (fs == nullptr && m_typedConfigurations->toFile(level)) { + fs = m_typedConfigurations->fileStream(level); + } + if (fs != nullptr) { + fs->flush(); + m_unflushedCount.find(level)->second = 0; + } + } + + inline bool isFlushNeeded(Level level) { + return ++m_unflushedCount.find(level)->second >= m_typedConfigurations->logFlushThreshold(level); + } + + inline LogBuilder* logBuilder(void) const { + return m_logBuilder.get(); + } + + inline void setLogBuilder(const LogBuilderPtr& logBuilder) { + m_logBuilder = logBuilder; + } + + inline bool enabled(Level level) const { + return m_typedConfigurations->enabled(level); + } + +#if ELPP_VARIADIC_TEMPLATES_SUPPORTED +# define LOGGER_LEVEL_WRITERS_SIGNATURES(FUNCTION_NAME)\ + template \ + inline void FUNCTION_NAME(const char*, const T&, const Args&...);\ + template \ + inline void FUNCTION_NAME(const T&); + + template + inline void verbose(int, const char*, const T&, const Args&...); + + template + inline void verbose(int, const T&); + + LOGGER_LEVEL_WRITERS_SIGNATURES(info) + LOGGER_LEVEL_WRITERS_SIGNATURES(debug) + LOGGER_LEVEL_WRITERS_SIGNATURES(warn) + LOGGER_LEVEL_WRITERS_SIGNATURES(error) + LOGGER_LEVEL_WRITERS_SIGNATURES(fatal) + LOGGER_LEVEL_WRITERS_SIGNATURES(trace) +# undef LOGGER_LEVEL_WRITERS_SIGNATURES +#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED + private: + std::string m_id; + base::TypedConfigurations* m_typedConfigurations; + base::type::stringstream_t m_stream; + std::string m_parentApplicationName; + bool m_isConfigured; + Configurations m_configurations; + std::map m_unflushedCount; + base::LogStreamsReferenceMap* m_logStreamsReference; + LogBuilderPtr m_logBuilder; + + friend class el::LogMessage; + friend class el::Loggers; + friend class el::Helpers; + friend class el::base::RegisteredLoggers; + friend class el::base::DefaultLogDispatchCallback; + friend class el::base::MessageBuilder; + friend class el::base::Writer; + friend class el::base::PErrorWriter; + friend class el::base::Storage; + friend class el::base::PerformanceTracker; + friend class el::base::LogDispatcher; + + Logger(void); + +#if ELPP_VARIADIC_TEMPLATES_SUPPORTED + template + void log_(Level, int, const char*, const T&, const Args&...); + + template + inline void log_(Level, int, const T&); + + template + void log(Level, const char*, const T&, const Args&...); + + template + inline void log(Level, const T&); +#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED + + void initUnflushedCount(void) { + m_unflushedCount.clear(); + base::type::EnumType lIndex = LevelHelper::kMinValid; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + m_unflushedCount.insert(std::make_pair(LevelHelper::castFromInt(lIndex), 0)); + return false; + }); + } + + inline base::type::stringstream_t& stream(void) { + return m_stream; + } + + void resolveLoggerFormatSpec(void) const { + base::type::EnumType lIndex = LevelHelper::kMinValid; + LevelHelper::forEachLevel(&lIndex, [&](void) -> bool { + base::LogFormat* logFormat = + const_cast(&m_typedConfigurations->logFormat(LevelHelper::castFromInt(lIndex))); + base::utils::Str::replaceFirstWithEscape(logFormat->m_format, base::consts::kLoggerIdFormatSpecifier, m_id); + return false; + }); + } + }; + namespace base { + /// @brief Loggers repository + class RegisteredLoggers : public base::utils::Registry { + public: + explicit RegisteredLoggers(const LogBuilderPtr& defaultLogBuilder) : + m_defaultLogBuilder(defaultLogBuilder) { + m_defaultConfigurations.setToDefault(); + } + + virtual ~RegisteredLoggers(void) { + flushAll(); + } + + inline void setDefaultConfigurations(const Configurations& configurations) { + base::threading::ScopedLock scopedLock(lock()); + m_defaultConfigurations.setFromBase(const_cast(&configurations)); + } + + inline Configurations* defaultConfigurations(void) { + return &m_defaultConfigurations; + } + + Logger* get(const std::string& id, bool forceCreation = true) { + base::threading::ScopedLock scopedLock(lock()); + Logger* logger_ = base::utils::Registry::get(id); + if (logger_ == nullptr && forceCreation) { + bool validId = Logger::isValidId(id); + if (!validId) { + ELPP_ASSERT(validId, "Invalid logger ID [" << id << "]. Not registering this logger."); + return nullptr; + } + logger_ = new Logger(id, m_defaultConfigurations, &m_logStreamsReference); + logger_->m_logBuilder = m_defaultLogBuilder; + registerNew(id, logger_); + } + return logger_; + } + + bool remove(const std::string& id) { + if (id == "default") { + return false; + } + Logger* logger = base::utils::Registry::get(id); + if (logger != nullptr) { + unregister(logger); + } + return true; + } + + inline bool has(const std::string& id) { + return get(id, false) != nullptr; + } + + inline void unregister(Logger*& logger) { + base::threading::ScopedLock scopedLock(lock()); + base::utils::Registry::unregister(logger->id()); + } + + inline base::LogStreamsReferenceMap* logStreamsReference(void) { + return &m_logStreamsReference; + } + + inline void flushAll(void) { + ELPP_INTERNAL_INFO(1, "Flushing all log files"); + base::threading::ScopedLock scopedLock(lock()); + for (base::LogStreamsReferenceMap::iterator it = m_logStreamsReference.begin(); + it != m_logStreamsReference.end(); ++it) { + if (it->second.get() == nullptr) continue; + it->second->flush(); + } + } + + private: + LogBuilderPtr m_defaultLogBuilder; + Configurations m_defaultConfigurations; + base::LogStreamsReferenceMap m_logStreamsReference; + friend class el::base::Storage; + }; + /// @brief Represents registries for verbose logging + class VRegistry : base::NoCopy, public base::threading::ThreadSafe { + public: + explicit VRegistry(base::type::VerboseLevel level, base::type::EnumType* pFlags) : m_level(level), m_pFlags(pFlags) { + } + + /// @brief Sets verbose level. Accepted range is 0-9 + inline void setLevel(base::type::VerboseLevel level) { + base::threading::ScopedLock scopedLock(lock()); + if (level < 0) + m_level = 0; + else if (level > 9) + m_level = base::consts::kMaxVerboseLevel; + else + m_level = level; + } + + inline base::type::VerboseLevel level(void) const { + return m_level; + } + + inline void clearModules(void) { + base::threading::ScopedLock scopedLock(lock()); + m_modules.clear(); + } + + void setModules(const char* modules) { + base::threading::ScopedLock scopedLock(lock()); + auto addSuffix = [](std::stringstream& ss, const char* sfx, const char* prev) { + if (prev != nullptr && base::utils::Str::endsWith(ss.str(), std::string(prev))) { + std::string chr(ss.str().substr(0, ss.str().size() - strlen(prev))); + ss.str(std::string("")); + ss << chr; + } + if (base::utils::Str::endsWith(ss.str(), std::string(sfx))) { + std::string chr(ss.str().substr(0, ss.str().size() - strlen(sfx))); + ss.str(std::string("")); + ss << chr; + } + ss << sfx; + }; + auto insert = [&](std::stringstream& ss, base::type::VerboseLevel level) { + if (!base::utils::hasFlag(LoggingFlag::DisableVModulesExtensions, *m_pFlags)) { + addSuffix(ss, ".h", nullptr); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".c", ".h"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".cpp", ".c"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".cc", ".cpp"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".cxx", ".cc"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".-inl.h", ".cxx"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".hxx", ".-inl.h"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".hpp", ".hxx"); + m_modules.insert(std::make_pair(ss.str(), level)); + addSuffix(ss, ".hh", ".hpp"); + } + m_modules.insert(std::make_pair(ss.str(), level)); + }; + bool isMod = true; + bool isLevel = false; + std::stringstream ss; + int level = -1; + for (; *modules; ++modules) { + switch (*modules) { + case '=': + isLevel = true; + isMod = false; + break; + case ',': + isLevel = false; + isMod = true; + if (!ss.str().empty() && level != -1) { + insert(ss, level); + ss.str(std::string("")); + level = -1; + } + break; + default: + if (isMod) { + ss << *modules; + } + else if (isLevel) { + if (isdigit(*modules)) { + level = static_cast(*modules) - 48; + } + } + break; + } + } + if (!ss.str().empty() && level != -1) { + insert(ss, level); + } + } + + bool allowed(base::type::VerboseLevel vlevel, const char* file) { + base::threading::ScopedLock scopedLock(lock()); + if (m_modules.empty() || file == nullptr) { + return vlevel <= m_level; + } + else { + std::map::iterator it = m_modules.begin(); + for (; it != m_modules.end(); ++it) { + if (base::utils::Str::wildCardMatch(file, it->first.c_str())) { + return vlevel <= it->second; + } + } + if (base::utils::hasFlag(LoggingFlag::AllowVerboseIfModuleNotSpecified, *m_pFlags)) { + return true; + } + return false; + } + } + + inline const std::map& modules(void) const { + return m_modules; + } + + void setFromArgs(const base::utils::CommandLineArgs* commandLineArgs) { + if (commandLineArgs->hasParam("-v") || commandLineArgs->hasParam("--verbose") || + commandLineArgs->hasParam("-V") || commandLineArgs->hasParam("--VERBOSE")) { + setLevel(base::consts::kMaxVerboseLevel); + } + else if (commandLineArgs->hasParamWithValue("--v")) { + setLevel(atoi(commandLineArgs->getParamValue("--v"))); + } + else if (commandLineArgs->hasParamWithValue("--V")) { + setLevel(atoi(commandLineArgs->getParamValue("--V"))); + } + else if ((commandLineArgs->hasParamWithValue("-vmodule")) && vModulesEnabled()) { + setModules(commandLineArgs->getParamValue("-vmodule")); + } + else if (commandLineArgs->hasParamWithValue("-VMODULE") && vModulesEnabled()) { + setModules(commandLineArgs->getParamValue("-VMODULE")); + } + } + + /// @brief Whether or not vModules enabled + inline bool vModulesEnabled(void) { + return !base::utils::hasFlag(LoggingFlag::DisableVModules, *m_pFlags); + } + + private: + base::type::VerboseLevel m_level; + base::type::EnumType* m_pFlags; + std::map m_modules; + }; + } // namespace base + class LogMessage { + public: + LogMessage(Level level, const std::string& file, unsigned long int line, const std::string& func, + base::type::VerboseLevel verboseLevel, Logger* logger) : + m_level(level), m_file(file), m_line(line), m_func(func), + m_verboseLevel(verboseLevel), m_logger(logger), m_message(std::move(logger->stream().str())) { + } + inline Level level(void) const { return m_level; } + inline const std::string& file(void) const { return m_file; } + inline unsigned long int line(void) const { return m_line; } // NOLINT + inline const std::string& func(void) const { return m_func; } + inline base::type::VerboseLevel verboseLevel(void) const { return m_verboseLevel; } + inline Logger* logger(void) const { return m_logger; } + inline const base::type::string_t& message(void) const { return m_message; } + private: + Level m_level; + std::string m_file; + unsigned long int m_line; + std::string m_func; + base::type::VerboseLevel m_verboseLevel; + Logger* m_logger; + base::type::string_t m_message; + }; + namespace base { +#if ELPP_ASYNC_LOGGING + class AsyncLogItem { + public: + explicit AsyncLogItem(const LogMessage& logMessage, const LogDispatchData& data, const base::type::string_t& logLine) + : m_logMessage(logMessage), m_dispatchData(data), m_logLine(logLine) {} + virtual ~AsyncLogItem() {} + inline LogMessage* logMessage(void) { return &m_logMessage; } + inline LogDispatchData* data(void) { return &m_dispatchData; } + inline base::type::string_t logLine(void) { return m_logLine; } + private: + LogMessage m_logMessage; + LogDispatchData m_dispatchData; + base::type::string_t m_logLine; + }; + class AsyncLogQueue : public base::threading::ThreadSafe { + public: + virtual ~AsyncLogQueue() { + ELPP_INTERNAL_INFO(6, "~AsyncLogQueue"); + } + + inline AsyncLogItem next(void) { + base::threading::ScopedLock scopedLock(lock()); + AsyncLogItem result = m_queue.front(); + m_queue.pop(); + return result; + } + + inline void push(const AsyncLogItem& item) { + base::threading::ScopedLock scopedLock(lock()); + m_queue.push(item); + } + inline void pop(void) { + base::threading::ScopedLock scopedLock(lock()); + m_queue.pop(); + } + inline AsyncLogItem front(void) { + base::threading::ScopedLock scopedLock(lock()); + return m_queue.front(); + } + inline bool empty(void) { + base::threading::ScopedLock scopedLock(lock()); + return m_queue.empty(); + } + private: + std::queue m_queue; + }; + class IWorker { + public: + virtual ~IWorker() {} + virtual void start() = 0; + }; +#endif // ELPP_ASYNC_LOGGING + /// @brief Easylogging++ management storage + class Storage : base::NoCopy, public base::threading::ThreadSafe { + public: +#if ELPP_ASYNC_LOGGING + Storage(const LogBuilderPtr& defaultLogBuilder, base::IWorker* asyncDispatchWorker) : +#else + explicit Storage(const LogBuilderPtr& defaultLogBuilder) : +#endif // ELPP_ASYNC_LOGGING + m_registeredHitCounters(new base::RegisteredHitCounters()), + m_registeredLoggers(new base::RegisteredLoggers(defaultLogBuilder)), + m_flags(0x0), + m_vRegistry(new base::VRegistry(0, &m_flags)), +#if ELPP_ASYNC_LOGGING + m_asyncLogQueue(new base::AsyncLogQueue()), + m_asyncDispatchWorker(asyncDispatchWorker), +#endif // ELPP_ASYNC_LOGGING + m_preRollOutCallback(base::defaultPreRollOutCallback) { + // Register default logger + m_registeredLoggers->get(std::string(base::consts::kDefaultLoggerId)); + // Register performance logger and reconfigure format + Logger* performanceLogger = m_registeredLoggers->get(std::string(base::consts::kPerformanceLoggerId)); + performanceLogger->configurations()->setGlobally(ConfigurationType::Format, std::string("%datetime %level %msg")); + performanceLogger->reconfigure(); +#if defined(ELPP_SYSLOG) + // Register syslog logger and reconfigure format + Logger* sysLogLogger = m_registeredLoggers->get(std::string(base::consts::kSysLogLoggerId)); + sysLogLogger->configurations()->setGlobally(ConfigurationType::Format, std::string("%level: %msg")); + sysLogLogger->reconfigure(); +#else + ELPP_UNUSED(base::consts::kSysLogLoggerId); +#endif // defined(ELPP_SYSLOG) + addFlag(LoggingFlag::AllowVerboseIfModuleNotSpecified); +#if ELPP_ASYNC_LOGGING + installLogDispatchCallback(std::string("AsyncLogDispatchCallback")); +#else + installLogDispatchCallback(std::string("DefaultLogDispatchCallback")); +#endif // ELPP_ASYNC_LOGGING + installPerformanceTrackingCallback(std::string("DefaultPerformanceTrackingCallback")); + ELPP_INTERNAL_INFO(1, "Easylogging++ has been initialized"); +#if ELPP_ASYNC_LOGGING + m_asyncDispatchWorker->start(); +#endif // ELPP_ASYNC_LOGGING + } + + virtual ~Storage(void) { + ELPP_INTERNAL_INFO(4, "Destroying storage"); +#if ELPP_ASYNC_LOGGING + ELPP_INTERNAL_INFO(5, "Replacing log dispatch callback to synchronous"); + uninstallLogDispatchCallback(std::string("AsyncLogDispatchCallback")); + installLogDispatchCallback(std::string("DefaultLogDispatchCallback")); + ELPP_INTERNAL_INFO(5, "Destroying asyncDispatchWorker"); + base::utils::safeDelete(m_asyncDispatchWorker); + ELPP_INTERNAL_INFO(5, "Destroying asyncLogQueue"); + base::utils::safeDelete(m_asyncLogQueue); +#endif // ELPP_ASYNC_LOGGING + ELPP_INTERNAL_INFO(5, "Destroying registeredHitCounters"); + base::utils::safeDelete(m_registeredHitCounters); + ELPP_INTERNAL_INFO(5, "Destroying registeredLoggers"); + base::utils::safeDelete(m_registeredLoggers); + ELPP_INTERNAL_INFO(5, "Destroying vRegistry"); + base::utils::safeDelete(m_vRegistry); + } + + inline bool validateEveryNCounter(const char* filename, unsigned long int lineNumber, std::size_t occasion) { + return hitCounters()->validateEveryN(filename, lineNumber, occasion); + } + + inline bool validateAfterNCounter(const char* filename, unsigned long int lineNumber, std::size_t n) { // NOLINT + return hitCounters()->validateAfterN(filename, lineNumber, n); + } + + inline bool validateNTimesCounter(const char* filename, unsigned long int lineNumber, std::size_t n) { // NOLINT + return hitCounters()->validateNTimes(filename, lineNumber, n); + } + + inline base::RegisteredHitCounters* hitCounters(void) const { + return m_registeredHitCounters; + } + + inline base::RegisteredLoggers* registeredLoggers(void) const { + return m_registeredLoggers; + } + + inline base::VRegistry* vRegistry(void) const { + return m_vRegistry; + } + +#if ELPP_ASYNC_LOGGING + inline base::AsyncLogQueue* asyncLogQueue(void) const { + return m_asyncLogQueue; + } +#endif // ELPP_ASYNC_LOGGING + + inline const base::utils::CommandLineArgs* commandLineArgs(void) const { + return &m_commandLineArgs; + } + + inline void addFlag(LoggingFlag flag) { + base::utils::addFlag(flag, &m_flags); + } + + inline void removeFlag(LoggingFlag flag) { + base::utils::removeFlag(flag, &m_flags); + } + + inline bool hasFlag(LoggingFlag flag) const { + return base::utils::hasFlag(flag, m_flags); + } + + inline base::type::EnumType flags(void) const { + return m_flags; + } + + inline void setFlags(base::type::EnumType flags) { + m_flags = flags; + } + + inline void setPreRollOutCallback(const PreRollOutCallback& callback) { + m_preRollOutCallback = callback; + } + + inline void unsetPreRollOutCallback(void) { + m_preRollOutCallback = base::defaultPreRollOutCallback; + } + + inline PreRollOutCallback& preRollOutCallback(void) { + return m_preRollOutCallback; + } + + inline bool hasCustomFormatSpecifier(const char* formatSpecifier) { + base::threading::ScopedLock scopedLock(lock()); + return std::find(m_customFormatSpecifiers.begin(), m_customFormatSpecifiers.end(), + formatSpecifier) != m_customFormatSpecifiers.end(); + } + + inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) { + if (hasCustomFormatSpecifier(customFormatSpecifier.formatSpecifier())) { + return; + } + base::threading::ScopedLock scopedLock(lock()); + m_customFormatSpecifiers.push_back(customFormatSpecifier); + } + + inline bool uninstallCustomFormatSpecifier(const char* formatSpecifier) { + base::threading::ScopedLock scopedLock(lock()); + std::vector::iterator it = std::find(m_customFormatSpecifiers.begin(), + m_customFormatSpecifiers.end(), formatSpecifier); + if (it != m_customFormatSpecifiers.end() && strcmp(formatSpecifier, it->formatSpecifier()) == 0) { + m_customFormatSpecifiers.erase(it); + return true; + } + return false; + } + + const std::vector* customFormatSpecifiers(void) const { + return &m_customFormatSpecifiers; + } + + inline void setLoggingLevel(Level level) { + m_loggingLevel = level; + } + + template + inline bool installLogDispatchCallback(const std::string& id) { + return installCallback(id, &m_logDispatchCallbacks); + } + + template + inline void uninstallLogDispatchCallback(const std::string& id) { + uninstallCallback(id, &m_logDispatchCallbacks); + } + template + inline T* logDispatchCallback(const std::string& id) { + return callback(id, &m_logDispatchCallbacks); + } + + template + inline bool installPerformanceTrackingCallback(const std::string& id) { + return installCallback(id, &m_performanceTrackingCallbacks); + } + + template + inline void uninstallPerformanceTrackingCallback(const std::string& id) { + uninstallCallback(id, &m_performanceTrackingCallbacks); + } + + template + inline T* performanceTrackingCallback(const std::string& id) { + return callback(id, &m_performanceTrackingCallbacks); + } + private: + base::RegisteredHitCounters* m_registeredHitCounters; + base::RegisteredLoggers* m_registeredLoggers; + base::type::EnumType m_flags; + base::VRegistry* m_vRegistry; +#if ELPP_ASYNC_LOGGING + base::AsyncLogQueue* m_asyncLogQueue; + base::IWorker* m_asyncDispatchWorker; +#endif // ELPP_ASYNC_LOGGING + base::utils::CommandLineArgs m_commandLineArgs; + PreRollOutCallback m_preRollOutCallback; + std::map m_logDispatchCallbacks; + std::map m_performanceTrackingCallbacks; + std::vector m_customFormatSpecifiers; + Level m_loggingLevel; + + friend class el::Helpers; + friend class el::base::DefaultLogDispatchCallback; + friend class el::LogBuilder; + friend class el::base::MessageBuilder; + friend class el::base::Writer; + friend class el::base::PerformanceTracker; + friend class el::base::LogDispatcher; + + void setApplicationArguments(int argc, char** argv) { + m_commandLineArgs.setArgs(argc, argv); + m_vRegistry->setFromArgs(commandLineArgs()); + // default log file +#if !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) + if (m_commandLineArgs.hasParamWithValue(base::consts::kDefaultLogFileParam)) { + Configurations c; + c.setGlobally(ConfigurationType::Filename, std::string(m_commandLineArgs.getParamValue(base::consts::kDefaultLogFileParam))); + registeredLoggers()->setDefaultConfigurations(c); + for (base::RegisteredLoggers::iterator it = registeredLoggers()->begin(); + it != registeredLoggers()->end(); ++it) { + it->second->configure(c); + } + } +#endif // !defined(ELPP_DISABLE_LOG_FILE_FROM_ARG) +#if defined(ELPP_LOGGING_FLAGS_FROM_ARG) + if (m_commandLineArgs.hasParamWithValue(base::consts::kLoggingFlagsParam)) { + m_flags = atoi(m_commandLineArgs.getParamValue(base::consts::kLoggingFlagsParam)); + } +#endif // defined(ELPP_LOGGING_FLAGS_FROM_ARG) + } + + inline void setApplicationArguments(int argc, const char** argv) { + setApplicationArguments(argc, const_cast(argv)); + } + + template + inline bool installCallback(const std::string& id, std::map* mapT) { + if (mapT->find(id) == mapT->end()) { + mapT->insert(std::make_pair(id, TPtr(new T()))); + return true; + } + return false; + } + + template + inline void uninstallCallback(const std::string& id, std::map* mapT) { + if (mapT->find(id) != mapT->end()) { + mapT->erase(id); + } + } + + template + inline T* callback(const std::string& id, std::map* mapT) { + typename std::map::iterator iter = mapT->find(id); + if (iter != mapT->end()) { + return static_cast(iter->second.get()); + } + return nullptr; + } + }; + extern ELPP_EXPORT base::type::StoragePointer elStorage; +#define ELPP el::base::elStorage + class DefaultLogDispatchCallback : public LogDispatchCallback { + protected: + void handle(const LogDispatchData* data) { + m_data = data; + dispatch(std::move(m_data->logMessage()->logger()->logBuilder()->build(m_data->logMessage(), + m_data->dispatchAction() == base::DispatchAction::NormalLog))); + } + private: + const LogDispatchData* m_data; + void dispatch(base::type::string_t&& logLine) { + if (m_data->dispatchAction() == base::DispatchAction::NormalLog) { + if (m_data->logMessage()->logger()->m_typedConfigurations->toFile(m_data->logMessage()->level())) { + base::type::fstream_t* fs = m_data->logMessage()->logger()->m_typedConfigurations->fileStream(m_data->logMessage()->level()); + if (fs != nullptr) { + fs->write(logLine.c_str(), logLine.size()); + if (fs->fail()) { + ELPP_INTERNAL_ERROR("Unable to write log to file [" + << m_data->logMessage()->logger()->m_typedConfigurations->filename(m_data->logMessage()->level()) << "].\n" + << "Few possible reasons (could be something else):\n" << " * Permission denied\n" + << " * Disk full\n" << " * Disk is not writable", true); + } + else { + if (ELPP->hasFlag(LoggingFlag::ImmediateFlush) || (m_data->logMessage()->logger()->isFlushNeeded(m_data->logMessage()->level()))) { + m_data->logMessage()->logger()->flush(m_data->logMessage()->level(), fs); + } + } + } + else { + ELPP_INTERNAL_ERROR("Log file for [" << LevelHelper::convertToString(m_data->logMessage()->level()) << "] " + << "has not been configured but [TO_FILE] is configured to TRUE. [Logger ID: " + << m_data->logMessage()->logger()->id() << "]", false); + } + } + if (m_data->logMessage()->logger()->m_typedConfigurations->toStandardOutput(m_data->logMessage()->level())) { + if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput)) + m_data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, m_data->logMessage()->level()); + ELPP_COUT << ELPP_COUT_LINE(logLine); + } + } +#if defined(ELPP_SYSLOG) + else if (m_data->dispatchAction() == base::DispatchAction::SysLog) { + // Determine syslog priority + int sysLogPriority = 0; + if (m_data->logMessage()->level() == Level::Fatal) + sysLogPriority = LOG_EMERG; + else if (m_data->logMessage()->level() == Level::Error) + sysLogPriority = LOG_ERR; + else if (m_data->logMessage()->level() == Level::Warning) + sysLogPriority = LOG_WARNING; + else if (m_data->logMessage()->level() == Level::Info) + sysLogPriority = LOG_INFO; + else if (m_data->logMessage()->level() == Level::Debug) + sysLogPriority = LOG_DEBUG; + else + sysLogPriority = LOG_NOTICE; +# if defined(ELPP_UNICODE) + char* line = base::utils::Str::wcharPtrToCharPtr(logLine.c_str()); + syslog(sysLogPriority, "%s", line); + free(line); +# else + syslog(sysLogPriority, "%s", logLine.c_str()); +# endif + } +#endif // defined(ELPP_SYSLOG) + } + }; +#if ELPP_ASYNC_LOGGING + class AsyncLogDispatchCallback : public LogDispatchCallback { + protected: + void handle(const LogDispatchData* data) { + base::type::string_t logLine = data->logMessage()->logger()->logBuilder()->build(data->logMessage(), data->dispatchAction() == base::DispatchAction::NormalLog); + if (data->dispatchAction() == base::DispatchAction::NormalLog && data->logMessage()->logger()->typedConfigurations()->toStandardOutput(data->logMessage()->level())) { + if (ELPP->hasFlag(LoggingFlag::ColoredTerminalOutput)) + data->logMessage()->logger()->logBuilder()->convertToColoredOutput(&logLine, data->logMessage()->level()); + ELPP_COUT << ELPP_COUT_LINE(logLine); + } + // Save resources and only queue if we want to write to file otherwise just ignore handler + if (data->logMessage()->logger()->typedConfigurations()->toFile(data->logMessage()->level())) { + ELPP->asyncLogQueue()->push(AsyncLogItem(*(data->logMessage()), *data, logLine)); + } + } + }; + class AsyncDispatchWorker : public base::IWorker, public base::threading::ThreadSafe { + public: + AsyncDispatchWorker() { + setContinueRunning(false); + } + + virtual ~AsyncDispatchWorker() { + setContinueRunning(false); + ELPP_INTERNAL_INFO(6, "Stopping dispatch worker - Cleaning log queue"); + clean(); + ELPP_INTERNAL_INFO(6, "Log queue cleaned"); + } + + inline bool clean() { + std::mutex m; + std::unique_lock lk(m); + cv.wait(lk, [] { return !ELPP->asyncLogQueue()->empty(); }); + emptyQueue(); + lk.unlock(); + cv.notify_one(); + return ELPP->asyncLogQueue()->empty(); + } + + inline void emptyQueue() { + while (!ELPP->asyncLogQueue()->empty()) { + AsyncLogItem data = ELPP->asyncLogQueue()->next(); + handle(&data); + base::threading::msleep(100); + } + } + + virtual inline void start() { + base::threading::msleep(5000); // Wait extra few seconds + setContinueRunning(true); + std::thread t1(&AsyncDispatchWorker::runner, this); + t1.join(); + } + + void handle(AsyncLogItem* logItem) { + LogDispatchData* data = logItem->data(); + LogMessage* logMessage = logItem->logMessage(); + Logger* logger = logMessage->logger(); + base::TypedConfigurations* conf = logger->typedConfigurations(); + base::type::string_t logLine = logItem->logLine(); + if (data->dispatchAction() == base::DispatchAction::NormalLog) { + if (conf->toFile(logMessage->level())) { + base::type::fstream_t* fs = conf->fileStream(logMessage->level()); + if (fs != nullptr) { + fs->write(logLine.c_str(), logLine.size()); + if (fs->fail()) { + ELPP_INTERNAL_ERROR("Unable to write log to file [" + << conf->filename(logMessage->level()) << "].\n" + << "Few possible reasons (could be something else):\n" << " * Permission denied\n" + << " * Disk full\n" << " * Disk is not writable", true); + } + else { + if (ELPP->hasFlag(LoggingFlag::ImmediateFlush) || (logger->isFlushNeeded(logMessage->level()))) { + logger->flush(logMessage->level(), fs); + } + } + } + else { + ELPP_INTERNAL_ERROR("Log file for [" << LevelHelper::convertToString(logMessage->level()) << "] " + << "has not been configured but [TO_FILE] is configured to TRUE. [Logger ID: " << logger->id() << "]", false); + } + } + } +# if defined(ELPP_SYSLOG) + else if (data->dispatchAction() == base::DispatchAction::SysLog) { + // Determine syslog priority + int sysLogPriority = 0; + if (logMessage->level() == Level::Fatal) + sysLogPriority = LOG_EMERG; + else if (logMessage->level() == Level::Error) + sysLogPriority = LOG_ERR; + else if (logMessage->level() == Level::Warning) + sysLogPriority = LOG_WARNING; + else if (logMessage->level() == Level::Info) + sysLogPriority = LOG_INFO; + else if (logMessage->level() == Level::Debug) + sysLogPriority = LOG_DEBUG; + else + sysLogPriority = LOG_NOTICE; +# if defined(ELPP_UNICODE) + char* line = base::utils::Str::wcharPtrToCharPtr(logLine.c_str()); + syslog(sysLogPriority, "%s", line); + free(line); +# else + syslog(sysLogPriority, "%s", logLine.c_str()); +# endif + } +# endif // defined(ELPP_SYSLOG) + } + + void run() { + while (continueRunning()) { + emptyQueue(); + base::threading::msleep(10); // 10ms + } + } + + static void* runner(void *context) { + static_cast(context)->run(); + return NULL; + } + + void setContinueRunning(bool value) { + base::threading::ScopedLock scopedLock(m_continueRunningMutex); + m_continueRunning = value; + } + bool continueRunning(void) { + return m_continueRunning; + } + private: + std::condition_variable cv; + bool m_continueRunning; + base::threading::Mutex m_continueRunningMutex; + }; +#endif // ELPP_ASYNC_LOGGING + } // namespace base + namespace base { + class DefaultLogBuilder : public LogBuilder { + public: + base::type::string_t build(const LogMessage* logMessage, bool appendNewLine) const { + base::TypedConfigurations* tc = logMessage->logger()->typedConfigurations(); + const base::LogFormat* logFormat = &tc->logFormat(logMessage->level()); + base::type::string_t logLine = logFormat->format(); + char buff[base::consts::kSourceFilenameMaxLength + base::consts::kSourceLineMaxLength] = ""; + const char* bufLim = buff + sizeof(buff); + if (logFormat->hasFlag(base::FormatFlags::AppName)) { + // App name + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kAppNameFormatSpecifier, + logMessage->logger()->parentApplicationName()); + } + if (logFormat->hasFlag(base::FormatFlags::ThreadId)) { + // Thread ID + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kThreadIdFormatSpecifier, + base::threading::getCurrentThreadId()); + } + if (logFormat->hasFlag(base::FormatFlags::DateTime)) { + // DateTime + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kDateTimeFormatSpecifier, + base::utils::DateTime::getDateTime(logFormat->dateTimeFormat().c_str(), + &tc->millisecondsWidth(logMessage->level()))); + } + if (logFormat->hasFlag(base::FormatFlags::Function)) { + // Function + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFunctionFormatSpecifier, logMessage->func()); + } + if (logFormat->hasFlag(base::FormatFlags::File)) { + // File + char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceFilenameMaxLength); + base::utils::File::buildStrippedFilename(logMessage->file().c_str(), buff); + buf = base::utils::Str::addToBuff(buff, buf, bufLim); + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFileFormatSpecifier, std::string(buff)); + } + if (logFormat->hasFlag(base::FormatFlags::FileBase)) { + // FileBase + char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceFilenameMaxLength); + base::utils::File::buildBaseFilename(logMessage->file(), buff); + buf = base::utils::Str::addToBuff(buff, buf, bufLim); + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogFileBaseFormatSpecifier, std::string(buff)); + } + if (logFormat->hasFlag(base::FormatFlags::Line)) { + // Line + char* buf = base::utils::Str::clearBuff(buff, base::consts::kSourceLineMaxLength); + buf = base::utils::Str::convertAndAddToBuff(logMessage->line(), + base::consts::kSourceLineMaxLength, buf, bufLim, false); + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogLineFormatSpecifier, std::string(buff)); + } + if (logFormat->hasFlag(base::FormatFlags::Location)) { + // Location + char* buf = base::utils::Str::clearBuff(buff, + base::consts::kSourceFilenameMaxLength + base::consts::kSourceLineMaxLength); + base::utils::File::buildStrippedFilename(logMessage->file().c_str(), buff); + buf = base::utils::Str::addToBuff(buff, buf, bufLim); + buf = base::utils::Str::addToBuff(":", buf, bufLim); + buf = base::utils::Str::convertAndAddToBuff(logMessage->line(), + base::consts::kSourceLineMaxLength, buf, bufLim, false); + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kLogLocationFormatSpecifier, std::string(buff)); + } + if (logMessage->level() == Level::Verbose && logFormat->hasFlag(base::FormatFlags::VerboseLevel)) { + // Verbose level + char* buf = base::utils::Str::clearBuff(buff, 1); + buf = base::utils::Str::convertAndAddToBuff(logMessage->verboseLevel(), 1, buf, bufLim, false); + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kVerboseLevelFormatSpecifier, std::string(buff)); + } + if (logFormat->hasFlag(base::FormatFlags::LogMessage)) { + // Log message + base::utils::Str::replaceFirstWithEscape(logLine, base::consts::kMessageFormatSpecifier, logMessage->message()); + } +#if !defined(ELPP_DISABLE_CUSTOM_FORMAT_SPECIFIERS) + for (std::vector::const_iterator it = ELPP->customFormatSpecifiers()->begin(); + it != ELPP->customFormatSpecifiers()->end(); ++it) { + std::string fs(it->formatSpecifier()); + base::type::string_t wcsFormatSpecifier(fs.begin(), fs.end()); + base::utils::Str::replaceFirstWithEscape(logLine, wcsFormatSpecifier, std::string(it->resolver()())); + } +#endif // !defined(ELPP_DISABLE_CUSTOM_FORMAT_SPECIFIERS) + if (appendNewLine) logLine += ELPP_LITERAL("\n"); + return logLine; + } + }; + /// @brief Dispatches log messages + class LogDispatcher : base::NoCopy { + public: + LogDispatcher(bool proceed, LogMessage&& logMessage, base::DispatchAction dispatchAction) : + m_proceed(proceed), + m_logMessage(std::move(logMessage)), + m_dispatchAction(std::move(dispatchAction)) { + } + + void dispatch(void) { + if (m_proceed && m_dispatchAction == base::DispatchAction::None) { + m_proceed = false; + } + if (!m_proceed) { + return; + } + // We minimize the time of ELPP's lock - this lock is released after log is written + base::threading::ScopedLock scopedLock(ELPP->lock()); + base::TypedConfigurations* tc = m_logMessage.logger()->m_typedConfigurations; + if (ELPP->hasFlag(LoggingFlag::StrictLogFileSizeCheck)) { + tc->validateFileRolling(m_logMessage.level(), ELPP->preRollOutCallback()); + } + LogDispatchCallback* callback = nullptr; + LogDispatchData data; + for (const std::pair& h + : ELPP->m_logDispatchCallbacks) { + callback = h.second.get(); + if (callback != nullptr && callback->enabled()) { + data.setLogMessage(&m_logMessage); + data.setDispatchAction(m_dispatchAction); + callback->acquireLock(); + callback->handle(&data); + callback->releaseLock(); + } + } + } + + private: + bool m_proceed; + LogMessage m_logMessage; + base::DispatchAction m_dispatchAction; + }; +#if defined(ELPP_STL_LOGGING) + /// @brief Workarounds to write some STL logs + /// + /// @detail There is workaround needed to loop through some stl containers. In order to do that, we need iterable containers + /// of same type and provide iterator interface and pass it on to writeIterator(). + /// Remember, this is passed by value in constructor so that we dont change original containers. + /// This operation is as expensive as Big-O(std::min(class_.size(), base::consts::kMaxLogPerContainer)) + namespace workarounds { + /// @brief Abstract IterableContainer template that provides interface for iterable classes of type T + template + class IterableContainer { + public: + typedef typename Container::iterator iterator; + typedef typename Container::const_iterator const_iterator; + IterableContainer(void) {} + virtual ~IterableContainer(void) {} + iterator begin(void) { return getContainer().begin(); } + iterator end(void) { return getContainer().end(); } + private: + virtual Container& getContainer(void) = 0; + }; + /// @brief Implements IterableContainer and provides iterable std::priority_queue class + template, typename Comparator = std::less> + class IterablePriorityQueue : public IterableContainer, public std::priority_queue { + public: + IterablePriorityQueue(std::priority_queue queue_) { + std::size_t count_ = 0; + while (++count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) { + this->push(queue_.top()); + queue_.pop(); + } + } + private: + inline Container& getContainer(void) { + return this->c; + } + }; + /// @brief Implements IterableContainer and provides iterable std::queue class + template> + class IterableQueue : public IterableContainer, public std::queue { + public: + IterableQueue(std::queue queue_) { + std::size_t count_ = 0; + while (++count_ < base::consts::kMaxLogPerContainer && !queue_.empty()) { + this->push(queue_.front()); + queue_.pop(); + } + } + private: + inline Container& getContainer(void) { + return this->c; + } + }; + /// @brief Implements IterableContainer and provides iterable std::stack class + template> + class IterableStack : public IterableContainer, public std::stack { + public: + IterableStack(std::stack stack_) { + std::size_t count_ = 0; + while (++count_ < base::consts::kMaxLogPerContainer && !stack_.empty()) { + this->push(stack_.top()); + stack_.pop(); + } + } + private: + inline Container& getContainer(void) { + return this->c; + } + }; + } // namespace workarounds +#endif // defined(ELPP_STL_LOGGING) + // Log message builder + class MessageBuilder { + public: + MessageBuilder(void) : m_logger(nullptr), m_containerLogSeperator(ELPP_LITERAL("")) {} + void initialize(Logger* logger) { + m_logger = logger; + m_containerLogSeperator = ELPP->hasFlag(LoggingFlag::NewLineForContainer) ? + ELPP_LITERAL("\n ") : ELPP_LITERAL(", "); + } + +# define ELPP_SIMPLE_LOG(LOG_TYPE)\ + inline MessageBuilder& operator<<(LOG_TYPE msg) {\ + m_logger->stream() << msg;\ + if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) {\ + m_logger->stream() << " ";\ + }\ + return *this;\ + } + + inline MessageBuilder& operator<<(const std::string& msg) { + return operator<<(msg.c_str()); + } + ELPP_SIMPLE_LOG(char) + ELPP_SIMPLE_LOG(bool) + ELPP_SIMPLE_LOG(signed short) + ELPP_SIMPLE_LOG(unsigned short) + ELPP_SIMPLE_LOG(signed int) + ELPP_SIMPLE_LOG(unsigned int) + ELPP_SIMPLE_LOG(signed long) + ELPP_SIMPLE_LOG(unsigned long) + ELPP_SIMPLE_LOG(float) + ELPP_SIMPLE_LOG(double) + ELPP_SIMPLE_LOG(char*) + ELPP_SIMPLE_LOG(const char*) + ELPP_SIMPLE_LOG(const void*) + ELPP_SIMPLE_LOG(long double) + inline MessageBuilder& operator<<(const std::wstring& msg) { + return operator<<(msg.c_str()); + } + inline MessageBuilder& operator<<(const wchar_t* msg) { + if (msg == nullptr) { + m_logger->stream() << base::consts::kNullPointer; + return *this; + } +# if defined(ELPP_UNICODE) + m_logger->stream() << msg; +# else + char* buff_ = base::utils::Str::wcharPtrToCharPtr(msg); + m_logger->stream() << buff_; + free(buff_); +# endif + if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) { + m_logger->stream() << " "; + } + return *this; + } + // ostream manipulators + inline MessageBuilder& operator<<(std::ostream& (*OStreamMani)(std::ostream&)) { + m_logger->stream() << OStreamMani; + return *this; + } +#define ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(temp) \ + template \ + inline MessageBuilder& operator<<(const temp& template_inst) { \ + return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ + } +#define ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(temp) \ + template \ + inline MessageBuilder& operator<<(const temp& template_inst) { \ + return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ + } +#define ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(temp) \ + template \ + inline MessageBuilder& operator<<(const temp& template_inst) { \ + return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ + } +#define ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(temp) \ + template \ + inline MessageBuilder& operator<<(const temp& template_inst) { \ + return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ + } +#define ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(temp) \ + template \ + inline MessageBuilder& operator<<(const temp& template_inst) { \ + return writeIterator(template_inst.begin(), template_inst.end(), template_inst.size()); \ + } + +#if defined(ELPP_STL_LOGGING) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::vector) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::list) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(std::deque) + ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(std::set) + ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(std::multiset) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::map) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::multimap) + template + inline MessageBuilder& operator<<(const std::queue& queue_) { + base::workarounds::IterableQueue iterableQueue_ = + static_cast >(queue_); + return writeIterator(iterableQueue_.begin(), iterableQueue_.end(), iterableQueue_.size()); + } + template + inline MessageBuilder& operator<<(const std::stack& stack_) { + base::workarounds::IterableStack iterableStack_ = + static_cast >(stack_); + return writeIterator(iterableStack_.begin(), iterableStack_.end(), iterableStack_.size()); + } + template + inline MessageBuilder& operator<<(const std::priority_queue& priorityQueue_) { + base::workarounds::IterablePriorityQueue iterablePriorityQueue_ = + static_cast >(priorityQueue_); + return writeIterator(iterablePriorityQueue_.begin(), iterablePriorityQueue_.end(), iterablePriorityQueue_.size()); + } + template + inline MessageBuilder& operator<<(const std::pair& pair_) { + m_logger->stream() << ELPP_LITERAL("("); + operator << (static_cast(pair_.first)); + m_logger->stream() << ELPP_LITERAL(", "); + operator << (static_cast(pair_.second)); + m_logger->stream() << ELPP_LITERAL(")"); + return *this; + } + template + inline MessageBuilder& operator<<(const std::bitset& bitset_) { + m_logger->stream() << ELPP_LITERAL("["); + operator << (bitset_.to_string()); + m_logger->stream() << ELPP_LITERAL("]"); + return *this; + } +# if defined(ELPP_LOG_STD_ARRAY) + template + inline MessageBuilder& operator<<(const std::array& array) { + return writeIterator(array.begin(), array.end(), array.size()); + } +# endif // defined(ELPP_LOG_STD_ARRAY) +# if defined(ELPP_LOG_UNORDERED_MAP) + ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(std::unordered_map) + ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG(std::unordered_multimap) +# endif // defined(ELPP_LOG_UNORDERED_MAP) +# if defined(ELPP_LOG_UNORDERED_SET) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::unordered_set) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(std::unordered_multiset) +# endif // defined(ELPP_LOG_UNORDERED_SET) +#endif // defined(ELPP_STL_LOGGING) +#if defined(ELPP_QT_LOGGING) + inline MessageBuilder& operator<<(const QString& msg) { +# if defined(ELPP_UNICODE) + m_logger->stream() << msg.toStdWString(); +# else + m_logger->stream() << msg.toStdString(); +# endif // defined(ELPP_UNICODE) + return *this; + } + inline MessageBuilder& operator<<(const QByteArray& msg) { + return operator << (QString(msg)); + } + inline MessageBuilder& operator<<(const QStringRef& msg) { + return operator<<(msg.toString()); + } + inline MessageBuilder& operator<<(qint64 msg) { +# if defined(ELPP_UNICODE) + m_logger->stream() << QString::number(msg).toStdWString(); +# else + m_logger->stream() << QString::number(msg).toStdString(); +# endif // defined(ELPP_UNICODE) + return *this; + } + inline MessageBuilder& operator<<(quint64 msg) { +# if defined(ELPP_UNICODE) + m_logger->stream() << QString::number(msg).toStdWString(); +# else + m_logger->stream() << QString::number(msg).toStdString(); +# endif // defined(ELPP_UNICODE) + return *this; + } + inline MessageBuilder& operator<<(QChar msg) { + m_logger->stream() << msg.toLatin1(); + return *this; + } + inline MessageBuilder& operator<<(const QLatin1String& msg) { + m_logger->stream() << msg.latin1(); + return *this; + } + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QList) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QVector) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QQueue) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QSet) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QLinkedList) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(QStack) + template + inline MessageBuilder& operator<<(const QPair& pair_) { + m_logger->stream() << ELPP_LITERAL("("); + operator << (static_cast(pair_.first)); + m_logger->stream() << ELPP_LITERAL(", "); + operator << (static_cast(pair_.second)); + m_logger->stream() << ELPP_LITERAL(")"); + return *this; + } + template + inline MessageBuilder& operator<<(const QMap& map_) { + m_logger->stream() << ELPP_LITERAL("["); + QList keys = map_.keys(); + typename QList::const_iterator begin = keys.begin(); + typename QList::const_iterator end = keys.end(); + int max_ = static_cast(base::consts::kMaxLogPerContainer); // to prevent warning + for (int index_ = 0; begin != end && index_ < max_; ++index_, ++begin) { + m_logger->stream() << ELPP_LITERAL("("); + operator << (static_cast(*begin)); + m_logger->stream() << ELPP_LITERAL(", "); + operator << (static_cast(map_.value(*begin))); + m_logger->stream() << ELPP_LITERAL(")"); + m_logger->stream() << ((index_ < keys.size() - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); + } + if (begin != end) { + m_logger->stream() << ELPP_LITERAL("..."); + } + m_logger->stream() << ELPP_LITERAL("]"); + return *this; + } + template + inline MessageBuilder& operator<<(const QMultiMap& map_) { + operator << (static_cast>(map_)); + return *this; + } + template + inline MessageBuilder& operator<<(const QHash& hash_) { + m_logger->stream() << ELPP_LITERAL("["); + QList keys = hash_.keys(); + typename QList::const_iterator begin = keys.begin(); + typename QList::const_iterator end = keys.end(); + int max_ = static_cast(base::consts::kMaxLogPerContainer); // prevent type warning + for (int index_ = 0; begin != end && index_ < max_; ++index_, ++begin) { + m_logger->stream() << ELPP_LITERAL("("); + operator << (static_cast(*begin)); + m_logger->stream() << ELPP_LITERAL(", "); + operator << (static_cast(hash_.value(*begin))); + m_logger->stream() << ELPP_LITERAL(")"); + m_logger->stream() << ((index_ < keys.size() - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); + } + if (begin != end) { + m_logger->stream() << ELPP_LITERAL("..."); + } + m_logger->stream() << ELPP_LITERAL("]"); + return *this; + } + template + inline MessageBuilder& operator<<(const QMultiHash& multiHash_) { + operator << (static_cast>(multiHash_)); + return *this; + } +#endif // defined(ELPP_QT_LOGGING) +#if defined(ELPP_BOOST_LOGGING) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::vector) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::stable_vector) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::list) + ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG(boost::container::deque) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(boost::container::map) + ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG(boost::container::flat_map) + ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(boost::container::set) + ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG(boost::container::flat_set) +#endif // defined(ELPP_BOOST_LOGGING) + + /// @brief Macro used internally that can be used externally to make containers easylogging++ friendly + /// + /// @detail This macro expands to write an ostream& operator<< for container. This container is expected to + /// have begin() and end() methods that return respective iterators + /// @param ContainerType Type of container e.g, MyList from WX_DECLARE_LIST(int, MyList); in wxwidgets + /// @param SizeMethod Method used to get size of container. + /// @param ElementInstance Instance of element to be fed out. Insance name is "elem". See WXELPP_ENABLED macro + /// for an example usage +#define MAKE_CONTAINERELPP_FRIENDLY(ContainerType, SizeMethod, ElementInstance) \ + el::base::type::ostream_t& operator<<(el::base::type::ostream_t& ss, const ContainerType& container) {\ + const el::base::type::char_t* sep = ELPP->hasFlag(el::LoggingFlag::NewLineForContainer) ? \ + ELPP_LITERAL("\n ") : ELPP_LITERAL(", ");\ + ContainerType::const_iterator elem = container.begin();\ + ContainerType::const_iterator endElem = container.end();\ + std::size_t size_ = container.SizeMethod; \ + ss << ELPP_LITERAL("[");\ + for (std::size_t i = 0; elem != endElem && i < el::base::consts::kMaxLogPerContainer; ++i, ++elem) { \ + ss << ElementInstance;\ + ss << ((i < size_ - 1) ? sep : ELPP_LITERAL(""));\ + }\ + if (elem != endElem) {\ + ss << ELPP_LITERAL("...");\ + }\ + ss << ELPP_LITERAL("]");\ + return ss;\ + } +#if defined(ELPP_WXWIDGETS_LOGGING) + ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG(wxVector) +# define ELPP_WX_PTR_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), *(*elem)) +# define ELPP_WX_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), (*elem)) +# define ELPP_WX_HASH_MAP_ENABLED(ContainerType) MAKE_CONTAINERELPP_FRIENDLY(ContainerType, size(), \ + ELPP_LITERAL("(") << elem->first << ELPP_LITERAL(", ") << elem->second << ELPP_LITERAL(")") +#else +# define ELPP_WX_PTR_ENABLED(ContainerType) +# define ELPP_WX_ENABLED(ContainerType) +# define ELPP_WX_HASH_MAP_ENABLED(ContainerType) +#endif // defined(ELPP_WXWIDGETS_LOGGING) + // Other classes + template + ELPP_SIMPLE_LOG(const Class&) +#undef ELPP_SIMPLE_LOG +#undef ELPP_ITERATOR_CONTAINER_LOG_ONE_ARG +#undef ELPP_ITERATOR_CONTAINER_LOG_TWO_ARG +#undef ELPP_ITERATOR_CONTAINER_LOG_THREE_ARG +#undef ELPP_ITERATOR_CONTAINER_LOG_FOUR_ARG +#undef ELPP_ITERATOR_CONTAINER_LOG_FIVE_ARG + private: + Logger* m_logger; + const base::type::char_t* m_containerLogSeperator; + + template + inline MessageBuilder& writeIterator(Iterator begin_, Iterator end_, std::size_t size_) { + m_logger->stream() << ELPP_LITERAL("["); + for (std::size_t i = 0; begin_ != end_ && i < base::consts::kMaxLogPerContainer; ++i, ++begin_) { + operator << (*begin_); + m_logger->stream() << ((i < size_ - 1) ? m_containerLogSeperator : ELPP_LITERAL("")); + } + if (begin_ != end_) { + m_logger->stream() << ELPP_LITERAL("..."); + } + m_logger->stream() << ELPP_LITERAL("]"); + if (ELPP->hasFlag(LoggingFlag::AutoSpacing)) { + m_logger->stream() << " "; + } + return *this; + } + }; + /// @brief Writes nothing - Used when certain log is disabled + class NullWriter : base::NoCopy { + public: + NullWriter(void) {} + + // Null manipulator + inline NullWriter& operator<<(std::ostream& (*)(std::ostream&)) { + return *this; + } + + template + inline NullWriter& operator<<(const T&) { + return *this; + } + }; + /// @brief Main entry point of each logging + class Writer : base::NoCopy { + public: + Writer(Level level, const char* file, unsigned long int line, + const char* func, base::DispatchAction dispatchAction = base::DispatchAction::NormalLog, + base::type::VerboseLevel verboseLevel = 0) : + m_level(level), m_file(file), m_line(line), m_func(func), m_verboseLevel(verboseLevel), + m_proceed(false), m_dispatchAction(dispatchAction) { + } + + virtual ~Writer(void) { + processDispatch(); + } + + template + inline Writer& operator<<(const T& log) { +#if ELPP_LOGGING_ENABLED + if (m_proceed) { + m_messageBuilder << log; + } +#endif // ELPP_LOGGING_ENABLED + return *this; + } + + inline Writer& operator<<(std::ostream& (*log)(std::ostream&)) { +#if ELPP_LOGGING_ENABLED + if (m_proceed) { + m_messageBuilder << log; + } +#endif // ELPP_LOGGING_ENABLED + return *this; + } + + Writer& construct(Logger* logger, bool needLock = true) { + m_logger = logger; + initializeLogger(logger->id(), false, needLock); + m_messageBuilder.initialize(m_logger); + return *this; + } + + Writer& construct(int count, const char* loggerIds, ...) { + if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) { + va_list loggersList; + va_start(loggersList, loggerIds); + const char* id = loggerIds; + for (int i = 0; i < count; ++i) { + m_loggerIds.push_back(std::string(id)); + id = va_arg(loggersList, const char*); + } + va_end(loggersList); + initializeLogger(m_loggerIds.at(0)); + } + else { + initializeLogger(std::string(loggerIds)); + } + m_messageBuilder.initialize(m_logger); + return *this; + } + protected: + Level m_level; + const char* m_file; + const unsigned long int m_line; + const char* m_func; + base::type::VerboseLevel m_verboseLevel; + Logger* m_logger; + bool m_proceed; + base::MessageBuilder m_messageBuilder; + base::DispatchAction m_dispatchAction; + std::vector m_loggerIds; + friend class el::Helpers; + + void initializeLogger(const std::string& loggerId, bool lookup = true, bool needLock = true) { + if (lookup) { + m_logger = ELPP->registeredLoggers()->get(loggerId, ELPP->hasFlag(LoggingFlag::CreateLoggerAutomatically)); + } + if (m_logger == nullptr) { + ELPP->acquireLock(); + if (!ELPP->registeredLoggers()->has(std::string(base::consts::kDefaultLoggerId))) { + // Somehow default logger has been unregistered. Not good! Register again + ELPP->registeredLoggers()->get(std::string(base::consts::kDefaultLoggerId)); + } + ELPP->releaseLock(); // Need to unlock it for next writer + Writer(Level::Debug, m_file, m_line, m_func).construct(1, base::consts::kDefaultLoggerId) + << "Logger [" << loggerId << "] is not registered yet!"; + m_proceed = false; + } + else { + if (needLock) { + m_logger->acquireLock(); // This should not be unlocked by checking m_proceed because + // m_proceed can be changed by lines below + } + if (ELPP->hasFlag(LoggingFlag::HierarchicalLogging)) { + m_proceed = m_level == Level::Verbose ? m_logger->enabled(m_level) : + LevelHelper::castToInt(m_level) >= LevelHelper::castToInt(ELPP->m_loggingLevel); + } + else { + m_proceed = m_logger->enabled(m_level); + } + } + } + + void processDispatch() { +#if ELPP_LOGGING_ENABLED + if (ELPP->hasFlag(LoggingFlag::MultiLoggerSupport)) { + bool firstDispatched = false; + base::type::string_t logMessage; + std::size_t i = 0; + do { + if (m_proceed) { + if (firstDispatched) { + m_logger->stream() << logMessage; + } + else { + firstDispatched = true; + if (m_loggerIds.size() > 1) { + logMessage = m_logger->stream().str(); + } + } + triggerDispatch(); + } + else if (m_logger != nullptr) { + m_logger->stream().str(ELPP_LITERAL("")); + m_logger->releaseLock(); + } + if (i + 1 < m_loggerIds.size()) { + initializeLogger(m_loggerIds.at(i + 1)); + } + } while (++i < m_loggerIds.size()); + } + else { + if (m_proceed) { + triggerDispatch(); + } + else if (m_logger != nullptr) { + m_logger->stream().str(ELPP_LITERAL("")); + m_logger->releaseLock(); + } + } +#else + if (m_logger != nullptr) { + m_logger->stream().str(ELPP_LITERAL("")); + m_logger->releaseLock(); + } +#endif // ELPP_LOGGING_ENABLED + } + + void triggerDispatch(void) { + if (m_proceed) { + base::LogDispatcher(m_proceed, LogMessage(m_level, m_file, m_line, m_func, m_verboseLevel, + m_logger), m_dispatchAction).dispatch(); + } + if (m_logger != nullptr) { + m_logger->stream().str(ELPP_LITERAL("")); + m_logger->releaseLock(); + } + if (m_proceed && m_level == Level::Fatal + && !ELPP->hasFlag(LoggingFlag::DisableApplicationAbortOnFatalLog)) { + base::Writer(Level::Warning, m_file, m_line, m_func).construct(1, base::consts::kDefaultLoggerId) + << "Aborting application. Reason: Fatal log at [" << m_file << ":" << m_line << "]"; + std::stringstream reasonStream; + reasonStream << "Fatal log at [" << m_file << ":" << m_line << "]" + << " If you wish to disable 'abort on fatal log' please use " + << "el::Helpers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog)"; + base::utils::abort(1, reasonStream.str()); + } + m_proceed = false; + } + }; + class PErrorWriter : public base::Writer { + public: + PErrorWriter(Level level, const char* file, unsigned long int line, + const char* func, base::DispatchAction dispatchAction = base::DispatchAction::NormalLog, + base::type::VerboseLevel verboseLevel = 0) : + base::Writer(level, file, line, func, dispatchAction, verboseLevel) { + } + + virtual ~PErrorWriter(void) { + if (m_proceed) { +#if ELPP_COMPILER_MSVC + char buff[256]; + strerror_s(buff, 256, errno); + m_logger->stream() << ": " << buff << " [" << errno << "]"; +#else + m_logger->stream() << ": " << strerror(errno) << " [" << errno << "]"; +#endif + } + } + }; + } // namespace base + // Logging from Logger class. Why this is here? Because we have Storage and Writer class available +#if ELPP_VARIADIC_TEMPLATES_SUPPORTED + template + void Logger::log_(Level level, int vlevel, const char* s, const T& value, const Args&... args) { + base::MessageBuilder b; + b.initialize(this); + while (*s) { + if (*s == base::consts::kFormatSpecifierChar) { + if (*(s + 1) == base::consts::kFormatSpecifierChar) { + ++s; + } + else { + if (*(s + 1) == base::consts::kFormatSpecifierCharValue) { + ++s; + b << value; + log_(level, vlevel, ++s, args...); + return; + } + } + } + b << *s++; + } + ELPP_INTERNAL_ERROR("Too many arguments provided. Unable to handle. Please provide more format specifiers", false); + } + template + inline void Logger::log_(Level level, int vlevel, const T& log) { + if (level == Level::Verbose) { + if (ELPP->vRegistry()->allowed(vlevel, __FILE__)) { + base::Writer(Level::Verbose, "FILE", 0, "FUNCTION", + base::DispatchAction::NormalLog, vlevel).construct(this, false) << log; + } + else { + stream().str(ELPP_LITERAL("")); + } + } + else { + base::Writer(level, "FILE", 0, "FUNCTION").construct(this, false) << log; + } + } + template + void Logger::log(Level level, const char* s, const T& value, const Args&... args) { + base::threading::ScopedLock scopedLock(lock()); + log_(level, 0, s, value, args...); + } + template + inline void Logger::log(Level level, const T& log) { + base::threading::ScopedLock scopedLock(lock()); + log_(level, 0, log); + } +# if ELPP_VERBOSE_LOG + template + inline void Logger::verbose(int vlevel, const char* s, const T& value, const Args&... args) { + base::threading::ScopedLock scopedLock(lock()); + log_(el::Level::Verbose, vlevel, s, value, args...); + } + template + inline void Logger::verbose(int vlevel, const T& log) { + base::threading::ScopedLock scopedLock(lock()); + log_(el::Level::Verbose, vlevel, log); + } +# else + template + inline void Logger::verbose(int, const char*, const T&, const Args&...) { + return; + } + template + inline void Logger::verbose(int, const T&) { + return; + } +# endif // ELPP_VERBOSE_LOG +# define LOGGER_LEVEL_WRITERS(FUNCTION_NAME, LOG_LEVEL)\ + template \ + inline void Logger::FUNCTION_NAME(const char* s, const T& value, const Args&... args) {\ + log(LOG_LEVEL, s, value, args...);\ + }\ + template \ + inline void Logger::FUNCTION_NAME(const T& value) {\ + log(LOG_LEVEL, value);\ + } +# define LOGGER_LEVEL_WRITERS_DISABLED(FUNCTION_NAME, LOG_LEVEL)\ + template \ + inline void Logger::FUNCTION_NAME(const char*, const T&, const Args&...) {\ + return;\ + }\ + template \ + inline void Logger::FUNCTION_NAME(const T&) {\ + return;\ + } + +# if ELPP_INFO_LOG + LOGGER_LEVEL_WRITERS(info, Level::Info) +# else + LOGGER_LEVEL_WRITERS_DISABLED(info, Level::Info) +# endif // ELPP_INFO_LOG +# if ELPP_DEBUG_LOG + LOGGER_LEVEL_WRITERS(debug, Level::Debug) +# else + LOGGER_LEVEL_WRITERS_DISABLED(debug, Level::Debug) +# endif // ELPP_DEBUG_LOG +# if ELPP_WARNING_LOG + LOGGER_LEVEL_WRITERS(warn, Level::Warning) +# else + LOGGER_LEVEL_WRITERS_DISABLED(warn, Level::Warning) +# endif // ELPP_WARNING_LOG +# if ELPP_ERROR_LOG + LOGGER_LEVEL_WRITERS(error, Level::Error) +# else + LOGGER_LEVEL_WRITERS_DISABLED(error, Level::Error) +# endif // ELPP_ERROR_LOG +# if ELPP_FATAL_LOG + LOGGER_LEVEL_WRITERS(fatal, Level::Fatal) +# else + LOGGER_LEVEL_WRITERS_DISABLED(fatal, Level::Fatal) +# endif // ELPP_FATAL_LOG +# if ELPP_TRACE_LOG + LOGGER_LEVEL_WRITERS(trace, Level::Trace) +# else + LOGGER_LEVEL_WRITERS_DISABLED(trace, Level::Trace) +# endif // ELPP_TRACE_LOG +# undef LOGGER_LEVEL_WRITERS +# undef LOGGER_LEVEL_WRITERS_DISABLED +#endif // ELPP_VARIADIC_TEMPLATES_SUPPORTED +#if ELPP_COMPILER_MSVC +# define ELPP_VARIADIC_FUNC_MSVC(variadicFunction, variadicArgs) variadicFunction variadicArgs +# define ELPP_VARIADIC_FUNC_MSVC_RUN(variadicFunction, ...) ELPP_VARIADIC_FUNC_MSVC(variadicFunction, (__VA_ARGS__)) +# define el_getVALength(...) ELPP_VARIADIC_FUNC_MSVC_RUN(el_resolveVALength, 0, ## __VA_ARGS__,\ + 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +#else +# if ELPP_COMPILER_CLANG +# define el_getVALength(...) el_resolveVALength(0, __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +# else +# define el_getVALength(...) el_resolveVALength(0, ## __VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) +# endif // ELPP_COMPILER_CLANG +#endif // ELPP_COMPILER_MSVC +#define el_resolveVALength(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N +#define ELPP_WRITE_LOG(writer, level, dispatchAction, ...) \ + writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#define ELPP_WRITE_LOG_IF(writer, condition, level, dispatchAction, ...) if (condition) \ + writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#define ELPP_WRITE_LOG_EVERY_N(writer, occasion, level, dispatchAction, ...) \ + if (ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion)) \ + writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#define ELPP_WRITE_LOG_AFTER_N(writer, n, level, dispatchAction, ...) \ + if (ELPP->validateAfterNCounter(__FILE__, __LINE__, n)) \ + writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#define ELPP_WRITE_LOG_N_TIMES(writer, n, level, dispatchAction, ...) \ + if (ELPP->validateNTimesCounter(__FILE__, __LINE__, n)) \ + writer(level, __FILE__, __LINE__, ELPP_FUNC, dispatchAction).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#undef ELPP_CURR_FILE_PERFORMANCE_LOGGER +#if defined(ELPP_PERFORMANCE_LOGGER) +# define ELPP_CURR_FILE_PERFORMANCE_LOGGER ELPP_PERFORMANCE_LOGGER +#else +# define ELPP_CURR_FILE_PERFORMANCE_LOGGER el::base::consts::kPerformanceLoggerId +#endif + class PerformanceTrackingData { + public: + enum class DataType : base::type::EnumType { + Checkpoint = 1, Complete = 2 + }; + // Do not use constructor, will run into multiple definition error, use init(PerformanceTracker*) + explicit PerformanceTrackingData(DataType dataType) : m_performanceTracker(nullptr), + m_dataType(dataType), m_file(""), m_line(0), m_func("") {} + inline const std::string* blockName(void) const; + inline const struct timeval* startTime(void) const; + inline const struct timeval* endTime(void) const; + inline const struct timeval* lastCheckpointTime(void) const; + inline const base::PerformanceTracker* performanceTracker(void) const { return m_performanceTracker; } + inline PerformanceTrackingData::DataType dataType(void) const { return m_dataType; } + inline bool firstCheckpoint(void) const { return m_firstCheckpoint; } + inline std::string checkpointId(void) const { return m_checkpointId; } + inline const char* file(void) const { return m_file; } + inline unsigned long int line(void) const { return m_line; } + inline const char* func(void) const { return m_func; } + inline const base::type::string_t* formattedTimeTaken() const { return &m_formattedTimeTaken; } + inline const std::string& loggerId(void) const; + private: + base::PerformanceTracker* m_performanceTracker; + base::type::string_t m_formattedTimeTaken; + PerformanceTrackingData::DataType m_dataType; + bool m_firstCheckpoint; + std::string m_checkpointId; + const char* m_file; + unsigned long int m_line; + const char* m_func; + inline void init(base::PerformanceTracker* performanceTracker, bool firstCheckpoint = false) { + m_performanceTracker = performanceTracker; + m_firstCheckpoint = firstCheckpoint; + } + + friend class el::base::PerformanceTracker; + }; + namespace base { + /// @brief Represents performanceTracker block of code that conditionally adds performance status to log + /// either when goes outside the scope of when checkpoint() is called + class PerformanceTracker : public base::threading::ThreadSafe, public Loggable { + public: + PerformanceTracker(const std::string& blockName, + base::TimestampUnit timestampUnit = base::TimestampUnit::Millisecond, + const std::string& loggerId = std::string(ELPP_CURR_FILE_PERFORMANCE_LOGGER), + bool scopedLog = true, Level level = base::consts::kPerformanceTrackerDefaultLevel) : + m_blockName(blockName), m_timestampUnit(timestampUnit), m_loggerId(loggerId), m_scopedLog(scopedLog), + m_level(level), m_hasChecked(false), m_lastCheckpointId(std::string()), m_enabled(false) { +#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED + // We store it locally so that if user happen to change configuration by the end of scope + // or before calling checkpoint, we still depend on state of configuraton at time of construction + el::Logger* loggerPtr = ELPP->registeredLoggers()->get(loggerId, false); + m_enabled = loggerPtr != nullptr && loggerPtr->m_typedConfigurations->performanceTracking(m_level); + if (m_enabled) { + base::utils::DateTime::gettimeofday(&m_startTime); + } +#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED + } + /// @brief Copy constructor + PerformanceTracker(const PerformanceTracker& t) : + m_blockName(t.m_blockName), m_timestampUnit(t.m_timestampUnit), m_loggerId(t.m_loggerId), m_scopedLog(t.m_scopedLog), + m_level(t.m_level), m_hasChecked(t.m_hasChecked), m_lastCheckpointId(t.m_lastCheckpointId), m_enabled(t.m_enabled), + m_startTime(t.m_startTime), m_endTime(t.m_endTime), m_lastCheckpointTime(t.m_lastCheckpointTime) { + } + virtual ~PerformanceTracker(void) { +#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED + if (m_enabled) { + base::threading::ScopedLock scopedLock(lock()); + if (m_scopedLog) { + base::utils::DateTime::gettimeofday(&m_endTime); + base::type::string_t formattedTime = getFormattedTimeTaken(); + PerformanceTrackingData data(PerformanceTrackingData::DataType::Complete); + data.init(this); + data.m_formattedTimeTaken = formattedTime; + PerformanceTrackingCallback* callback = nullptr; + for (const std::pair& h + : ELPP->m_performanceTrackingCallbacks) { + callback = h.second.get(); + if (callback != nullptr && callback->enabled()) { + callback->acquireLock(); + callback->handle(&data); + callback->releaseLock(); + } + } + } + } +#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) + } + /// @brief A checkpoint for current performanceTracker block. + void checkpoint(const std::string& id = std::string(), const char* file = __FILE__, unsigned long int line = __LINE__, const char* func = "") { +#if !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED + if (m_enabled) { + base::threading::ScopedLock scopedLock(lock()); + base::utils::DateTime::gettimeofday(&m_endTime); + base::type::string_t formattedTime = m_hasChecked ? getFormattedTimeTaken(m_lastCheckpointTime) : ELPP_LITERAL(""); + PerformanceTrackingData data(PerformanceTrackingData::DataType::Checkpoint); + data.init(this); + data.m_checkpointId = id; + data.m_file = file; + data.m_line = line; + data.m_func = func; + data.m_formattedTimeTaken = formattedTime; + PerformanceTrackingCallback* callback = nullptr; + for (const std::pair& h + : ELPP->m_performanceTrackingCallbacks) { + callback = h.second.get(); + if (callback != nullptr && callback->enabled()) { + callback->acquireLock(); + callback->handle(&data); + callback->releaseLock(); + } + } + base::utils::DateTime::gettimeofday(&m_lastCheckpointTime); + m_hasChecked = true; + m_lastCheckpointId = id; + } +#endif // !defined(ELPP_DISABLE_PERFORMANCE_TRACKING) && ELPP_LOGGING_ENABLED + ELPP_UNUSED(id); + ELPP_UNUSED(file); + ELPP_UNUSED(line); + ELPP_UNUSED(func); + } + inline Level level(void) const { return m_level; } + private: + std::string m_blockName; + base::TimestampUnit m_timestampUnit; + std::string m_loggerId; + bool m_scopedLog; + Level m_level; + bool m_hasChecked; + std::string m_lastCheckpointId; + bool m_enabled; + struct timeval m_startTime, m_endTime, m_lastCheckpointTime; + + PerformanceTracker(void); + + friend class el::PerformanceTrackingData; + friend class base::DefaultPerformanceTrackingCallback; + + const inline base::type::string_t getFormattedTimeTaken() const { + return getFormattedTimeTaken(m_startTime); + } + + const base::type::string_t getFormattedTimeTaken(struct timeval startTime) const { + if (ELPP->hasFlag(LoggingFlag::FixedTimeFormat)) { + base::type::stringstream_t ss; + ss << base::utils::DateTime::getTimeDifference(m_endTime, + startTime, m_timestampUnit) << " " << base::consts::kTimeFormats[static_cast(m_timestampUnit)].unit; + return ss.str(); + } + return base::utils::DateTime::formatTime(base::utils::DateTime::getTimeDifference(m_endTime, + startTime, m_timestampUnit), m_timestampUnit); + } + + virtual inline void log(el::base::type::ostream_t& os) const { + os << getFormattedTimeTaken(); + } + }; + class DefaultPerformanceTrackingCallback : public PerformanceTrackingCallback { + protected: + void handle(const PerformanceTrackingData* data) { + m_data = data; + base::type::stringstream_t ss; + if (m_data->dataType() == PerformanceTrackingData::DataType::Complete) { + ss << ELPP_LITERAL("Executed [") << m_data->blockName()->c_str() << ELPP_LITERAL("] in [") << *m_data->formattedTimeTaken() << ELPP_LITERAL("]"); + } + else { + ss << ELPP_LITERAL("Performance checkpoint"); + if (!m_data->checkpointId().empty()) { + ss << ELPP_LITERAL(" [") << m_data->checkpointId().c_str() << ELPP_LITERAL("]"); + } + ss << ELPP_LITERAL(" for block [") << m_data->blockName()->c_str() << ELPP_LITERAL("] : [") << *m_data->performanceTracker(); + if (!ELPP->hasFlag(LoggingFlag::DisablePerformanceTrackingCheckpointComparison) && m_data->performanceTracker()->m_hasChecked) { + ss << ELPP_LITERAL(" ([") << *m_data->formattedTimeTaken() << ELPP_LITERAL("] from "); + if (m_data->performanceTracker()->m_lastCheckpointId.empty()) { + ss << ELPP_LITERAL("last checkpoint"); + } + else { + ss << ELPP_LITERAL("checkpoint '") << m_data->performanceTracker()->m_lastCheckpointId.c_str() << ELPP_LITERAL("'"); + } + ss << ELPP_LITERAL(")]"); + } + else { + ss << ELPP_LITERAL("]"); + } + } + el::base::Writer(m_data->performanceTracker()->level(), m_data->file(), m_data->line(), m_data->func()).construct(1, m_data->loggerId().c_str()) << ss.str(); + } + private: + const PerformanceTrackingData* m_data; + }; + } // namespace base + inline const std::string* PerformanceTrackingData::blockName() const { + return const_cast(&m_performanceTracker->m_blockName); + } + inline const struct timeval* PerformanceTrackingData::startTime() const { + return const_cast(&m_performanceTracker->m_startTime); + } + inline const struct timeval* PerformanceTrackingData::endTime() const { + return const_cast(&m_performanceTracker->m_endTime); + } + inline const struct timeval* PerformanceTrackingData::lastCheckpointTime() const { + return const_cast(&m_performanceTracker->m_lastCheckpointTime); + } + inline const std::string& PerformanceTrackingData::loggerId(void) const { return m_performanceTracker->m_loggerId; } + namespace base { + /// @brief Contains some internal debugging tools like crash handler and stack tracer + namespace debug { + class StackTrace : base::NoCopy { + public: + static const std::size_t kMaxStack = 64; + static const std::size_t kStackStart = 2; // We want to skip c'tor and StackTrace::generateNew() + class StackTraceEntry { + public: + StackTraceEntry(std::size_t index, const char* loc, const char* demang, const char* hex, const char* addr) { + m_index = index; + m_location = std::string(loc); + m_demangled = std::string(demang); + m_hex = std::string(hex); + m_addr = std::string(addr); + } + StackTraceEntry(std::size_t index, char* loc) { + m_index = index; + m_location = std::string(loc); + } + std::size_t m_index; + std::string m_location; + std::string m_demangled; + std::string m_hex; + std::string m_addr; + friend std::ostream& operator<<(std::ostream& ss, const StackTraceEntry& si) { + ss << "[" << si.m_index << "] " << si.m_location << (si.m_demangled.empty() ? "" : ":") << si.m_demangled + << (si.m_hex.empty() ? "" : "+") << si.m_hex << si.m_addr; + return ss; + } + + private: + StackTraceEntry(void); + }; + + StackTrace(void) { + generateNew(); + } + + virtual ~StackTrace(void) { + } + + inline std::vector& getLatestStack(void) { + return m_stack; + } + + friend inline std::ostream& operator<<(std::ostream& os, const StackTrace& st) { + std::vector::const_iterator it = st.m_stack.begin(); + while (it != st.m_stack.end()) { + os << " " << *it++ << "\n"; + } + return os; + } + + private: + std::vector m_stack; + + void generateNew(void) { +#if ELPP_STACKTRACE + m_stack.clear(); + void* stack[kMaxStack]; + std::size_t size = backtrace(stack, kMaxStack); + char** strings = backtrace_symbols(stack, size); + if (size > kStackStart) { // Skip StackTrace c'tor and generateNew + for (std::size_t i = kStackStart; i < size; ++i) { + char* mangName = nullptr; + char* hex = nullptr; + char* addr = nullptr; + for (char* c = strings[i]; *c; ++c) { + switch (*c) { + case '(': + mangName = c; + break; + case '+': + hex = c; + break; + case ')': + addr = c; + break; + } + } + // Perform demangling if parsed properly + if (mangName != nullptr && hex != nullptr && addr != nullptr && mangName < hex) { + *mangName++ = '\0'; + *hex++ = '\0'; + *addr++ = '\0'; + int status = 0; + char* demangName = abi::__cxa_demangle(mangName, 0, 0, &status); + // if demangling is successful, output the demangled function name + if (status == 0) { + // Success (see http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html) + StackTraceEntry entry(i - 1, strings[i], demangName, hex, addr); + m_stack.push_back(entry); + } + else { + // Not successful - we will use mangled name + StackTraceEntry entry(i - 1, strings[i], mangName, hex, addr); + m_stack.push_back(entry); + } + free(demangName); + } + else { + StackTraceEntry entry(i - 1, strings[i]); + m_stack.push_back(entry); + } + } + } + free(strings); +#else + ELPP_INTERNAL_INFO(1, "Stacktrace generation not supported for selected compiler"); +#endif // ELPP_STACKTRACE + } + }; + static std::string crashReason(int sig) { + std::stringstream ss; + bool foundReason = false; + for (int i = 0; i < base::consts::kCrashSignalsCount; ++i) { + if (base::consts::kCrashSignals[i].numb == sig) { + ss << "Application has crashed due to [" << base::consts::kCrashSignals[i].name << "] signal"; + if (ELPP->hasFlag(el::LoggingFlag::LogDetailedCrashReason)) { + ss << std::endl << + " " << base::consts::kCrashSignals[i].brief << std::endl << + " " << base::consts::kCrashSignals[i].detail; + } + foundReason = true; + } + } + if (!foundReason) { + ss << "Application has crashed due to unknown signal [" << sig << "]"; + } + return ss.str(); + } + /// @brief Logs reason of crash from sig + static void logCrashReason(int sig, bool stackTraceIfAvailable, Level level, const char* logger) { + std::stringstream ss; + ss << "CRASH HANDLED; "; + ss << crashReason(sig); +#if ELPP_STACKTRACE + if (stackTraceIfAvailable) { + ss << std::endl << " ======= Backtrace: =========" << std::endl << base::debug::StackTrace(); + } +#else + ELPP_UNUSED(stackTraceIfAvailable); +#endif // ELPP_STACKTRACE + ELPP_WRITE_LOG(el::base::Writer, level, base::DispatchAction::NormalLog, logger) << ss.str(); + } + static inline void crashAbort(int sig) { + base::utils::abort(sig); + } + /// @brief Default application crash handler + /// + /// @detail This function writes log using 'default' logger, prints stack trace for GCC based compilers and aborts program. + static inline void defaultCrashHandler(int sig) { + base::debug::logCrashReason(sig, true, Level::Fatal, base::consts::kDefaultLoggerId); + base::debug::crashAbort(sig); + } + /// @brief Handles unexpected crashes + class CrashHandler : base::NoCopy { + public: + typedef void(*Handler)(int); + + explicit CrashHandler(bool useDefault) { + if (useDefault) { + setHandler(defaultCrashHandler); + } + } + explicit CrashHandler(const Handler& cHandler) { + setHandler(cHandler); + } + void setHandler(const Handler& cHandler) { + m_handler = cHandler; +#if defined(ELPP_HANDLE_SIGABRT) + int i = 0; // SIGABRT is at base::consts::kCrashSignals[0] +#else + int i = 1; +#endif // defined(ELPP_HANDLE_SIGABRT) + for (; i < base::consts::kCrashSignalsCount; ++i) { + m_handler = signal(base::consts::kCrashSignals[i].numb, cHandler); + } + } + + private: + Handler m_handler; + }; + } // namespace debug + } // namespace base + extern base::debug::CrashHandler elCrashHandler; +#define MAKE_LOGGABLE(ClassType, ClassInstance, OutputStreamInstance) \ + el::base::type::ostream_t& operator<<(el::base::type::ostream_t& OutputStreamInstance, const ClassType& ClassInstance) + /// @brief Initializes syslog with process ID, options and facility. calls closelog() on d'tor + class SysLogInitializer { + public: + SysLogInitializer(const char* processIdent, int options = 0, int facility = 0) { +#if defined(ELPP_SYSLOG) + openlog(processIdent, options, facility); +#else + ELPP_UNUSED(processIdent); + ELPP_UNUSED(options); + ELPP_UNUSED(facility); +#endif // defined(ELPP_SYSLOG) + } + virtual ~SysLogInitializer(void) { +#if defined(ELPP_SYSLOG) + closelog(); +#endif // defined(ELPP_SYSLOG) + } + }; +#define ELPP_INITIALIZE_SYSLOG(id, opt, fac) el::SysLogInitializer elSyslogInit(id, opt, fac) + /// @brief Static helpers for developers + class Helpers : base::StaticClass { + public: + /// @brief Shares logging repository (base::Storage) + static inline void setStorage(base::type::StoragePointer storage) { + ELPP = storage; + } + /// @return Main storage repository + static inline base::type::StoragePointer storage() { + return ELPP; + } + /// @brief Sets application arguments and figures out whats active for logging and whats not. + static inline void setArgs(int argc, char** argv) { + ELPP->setApplicationArguments(argc, argv); + } + /// @copydoc setArgs(int argc, char** argv) + static inline void setArgs(int argc, const char** argv) { + ELPP->setApplicationArguments(argc, const_cast(argv)); + } + /// @brief Overrides default crash handler and installs custom handler. + /// @param crashHandler A functor with no return type that takes single int argument. + /// Handler is a typedef with specification: void (*Handler)(int) + static inline void setCrashHandler(const el::base::debug::CrashHandler::Handler& crashHandler) { + el::elCrashHandler.setHandler(crashHandler); + } + /// @brief Abort due to crash with signal in parameter + /// @param sig Crash signal + static inline void crashAbort(int sig, const char* sourceFile = "", unsigned int long line = 0) { + std::stringstream ss; + ss << base::debug::crashReason(sig).c_str(); + ss << " - [Called el::Helpers::crashAbort(" << sig << ")]"; + if (sourceFile != nullptr && strlen(sourceFile) > 0) { + ss << " - Source: " << sourceFile; + if (line > 0) + ss << ":" << line; + else + ss << " (line number not specified)"; + } + base::utils::abort(sig, ss.str()); + } + /// @brief Logs reason of crash as per sig + /// @param sig Crash signal + /// @param stackTraceIfAvailable Includes stack trace if available + /// @param level Logging level + /// @param logger Logger to use for logging + static inline void logCrashReason(int sig, bool stackTraceIfAvailable = false, + Level level = Level::Fatal, const char* logger = base::consts::kDefaultLoggerId) { + el::base::debug::logCrashReason(sig, stackTraceIfAvailable, level, logger); + } + /// @brief Installs pre rollout callback, this callback is triggered when log file is about to be rolled out + /// (can be useful for backing up) + static inline void installPreRollOutCallback(const PreRollOutCallback& callback) { + ELPP->setPreRollOutCallback(callback); + } + /// @brief Uninstalls pre rollout callback + static inline void uninstallPreRollOutCallback(void) { + ELPP->unsetPreRollOutCallback(); + } + /// @brief Installs post log dispatch callback, this callback is triggered when log is dispatched + template + static inline bool installLogDispatchCallback(const std::string& id) { + return ELPP->installLogDispatchCallback(id); + } + /// @brief Uninstalls log dispatch callback + template + static inline void uninstallLogDispatchCallback(const std::string& id) { + ELPP->uninstallLogDispatchCallback(id); + } + template + static inline T* logDispatchCallback(const std::string& id) { + return ELPP->logDispatchCallback(id); + } + /// @brief Installs post performance tracking callback, this callback is triggered when performance tracking is finished + template + static inline bool installPerformanceTrackingCallback(const std::string& id) { + return ELPP->installPerformanceTrackingCallback(id); + } + /// @brief Uninstalls post performance tracking handler + template + static inline void uninstallPerformanceTrackingCallback(const std::string& id) { + ELPP->uninstallPerformanceTrackingCallback(id); + } + template + static inline T* performanceTrackingCallback(const std::string& id) { + return ELPP->performanceTrackingCallback(id); + } + /// @brief Converts template to std::string - useful for loggable classes to log containers within log(std::ostream&) const + template + static std::string convertTemplateToStdString(const T& templ) { + el::Logger* logger = + ELPP->registeredLoggers()->get(el::base::consts::kDefaultLoggerId); + if (logger == nullptr) { + return std::string(); + } + base::MessageBuilder b; + b.initialize(logger); + logger->acquireLock(); + b << templ; +#if defined(ELPP_UNICODE) + std::string s = std::string(logger->stream().str().begin(), logger->stream().str().end()); +#else + std::string s = logger->stream().str(); +#endif // defined(ELPP_UNICODE) + logger->stream().str(ELPP_LITERAL("")); + logger->releaseLock(); + return s; + } + /// @brief Returns command line arguments (pointer) provided to easylogging++ + static inline const el::base::utils::CommandLineArgs* commandLineArgs(void) { + return ELPP->commandLineArgs(); + } + /// @brief Installs user defined format specifier and handler + static inline void installCustomFormatSpecifier(const CustomFormatSpecifier& customFormatSpecifier) { + ELPP->installCustomFormatSpecifier(customFormatSpecifier); + } + /// @brief Uninstalls user defined format specifier and handler + static inline bool uninstallCustomFormatSpecifier(const char* formatSpecifier) { + return ELPP->uninstallCustomFormatSpecifier(formatSpecifier); + } + /// @brief Returns true if custom format specifier is installed + static inline bool hasCustomFormatSpecifier(const char* formatSpecifier) { + return ELPP->hasCustomFormatSpecifier(formatSpecifier); + } + static inline void validateFileRolling(Logger* logger, Level level) { + if (logger == nullptr) return; + logger->m_typedConfigurations->validateFileRolling(level, ELPP->preRollOutCallback()); + } + }; + /// @brief Static helpers to deal with loggers and their configurations + class Loggers : base::StaticClass { + public: + /// @brief Gets existing or registers new logger + static inline Logger* getLogger(const std::string& identity, bool registerIfNotAvailable = true) { + base::threading::ScopedLock scopedLock(ELPP->lock()); + return ELPP->registeredLoggers()->get(identity, registerIfNotAvailable); + } + /// @brief Unregisters logger - use it only when you know what you are doing, you may unregister + /// loggers initialized / used by third-party libs. + static inline bool unregisterLogger(const std::string& identity) { + base::threading::ScopedLock scopedLock(ELPP->lock()); + return ELPP->registeredLoggers()->remove(identity); + } + /// @brief Whether or not logger with id is registered + static inline bool hasLogger(const std::string& identity) { + base::threading::ScopedLock scopedLock(ELPP->lock()); + return ELPP->registeredLoggers()->has(identity); + } + /// @brief Reconfigures specified logger with new configurations + static inline Logger* reconfigureLogger(Logger* logger, const Configurations& configurations) { + if (!logger) return nullptr; + logger->configure(configurations); + return logger; + } + /// @brief Reconfigures logger with new configurations after looking it up using identity + static inline Logger* reconfigureLogger(const std::string& identity, const Configurations& configurations) { + return Loggers::reconfigureLogger(Loggers::getLogger(identity), configurations); + } + /// @brief Reconfigures logger's single configuration + static inline Logger* reconfigureLogger(const std::string& identity, ConfigurationType configurationType, + const std::string& value) { + Logger* logger = Loggers::getLogger(identity); + if (logger == nullptr) { + return nullptr; + } + logger->configurations()->set(Level::Global, configurationType, value); + logger->reconfigure(); + return logger; + } + /// @brief Reconfigures all the existing loggers with new configurations + static inline void reconfigureAllLoggers(const Configurations& configurations) { + for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->begin(); + it != ELPP->registeredLoggers()->end(); ++it) { + Loggers::reconfigureLogger(it->second, configurations); + } + } + /// @brief Reconfigures single configuration for all the loggers + static inline void reconfigureAllLoggers(ConfigurationType configurationType, const std::string& value) { + reconfigureAllLoggers(Level::Global, configurationType, value); + } + /// @brief Reconfigures single configuration for all the loggers for specified level + static inline void reconfigureAllLoggers(Level level, ConfigurationType configurationType, + const std::string& value) { + for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->begin(); + it != ELPP->registeredLoggers()->end(); ++it) { + Logger* logger = it->second; + logger->configurations()->set(level, configurationType, value); + logger->reconfigure(); + } + } + /// @brief Sets default configurations. This configuration is used for future (and conditionally for existing) loggers + static inline void setDefaultConfigurations(const Configurations& configurations, bool reconfigureExistingLoggers = false) { + ELPP->registeredLoggers()->setDefaultConfigurations(configurations); + if (reconfigureExistingLoggers) { + Loggers::reconfigureAllLoggers(configurations); + } + } + /// @brief Returns current default + static inline const Configurations* defaultConfigurations(void) { + return ELPP->registeredLoggers()->defaultConfigurations(); + } + /// @brief Returns log stream reference pointer if needed by user + static inline const base::LogStreamsReferenceMap* logStreamsReference(void) { + return ELPP->registeredLoggers()->logStreamsReference(); + } + /// @brief Default typed configuration based on existing defaultConf + static base::TypedConfigurations defaultTypedConfigurations(void) { + return base::TypedConfigurations( + ELPP->registeredLoggers()->defaultConfigurations(), + ELPP->registeredLoggers()->logStreamsReference()); + } + /// @brief Populates all logger IDs in current repository. + /// @param [out] targetList List of fill up. + static inline std::vector* populateAllLoggerIds(std::vector* targetList) { + targetList->clear(); + for (base::RegisteredLoggers::iterator it = ELPP->registeredLoggers()->list().begin(); + it != ELPP->registeredLoggers()->list().end(); ++it) { + targetList->push_back(it->first); + } + return targetList; + } + /// @brief Sets configurations from global configuration file. + static void configureFromGlobal(const char* globalConfigurationFilePath) { + std::ifstream gcfStream(globalConfigurationFilePath, std::ifstream::in); + ELPP_ASSERT(gcfStream.is_open(), "Unable to open global configuration file [" << globalConfigurationFilePath + << "] for parsing."); + std::string line = std::string(); + std::stringstream ss; + Logger* logger = nullptr; + auto configure = [&](void) { + ELPP_INTERNAL_INFO(8, "Configuring logger: '" << logger->id() << "' with configurations \n" << ss.str() + << "\n--------------"); + Configurations c; + c.parseFromText(ss.str()); + logger->configure(c); + }; + while (gcfStream.good()) { + std::getline(gcfStream, line); + ELPP_INTERNAL_INFO(1, "Parsing line: " << line); + base::utils::Str::trim(line); + if (Configurations::Parser::isComment(line)) continue; + Configurations::Parser::ignoreComments(&line); + base::utils::Str::trim(line); + if (line.size() > 2 && base::utils::Str::startsWith(line, std::string(base::consts::kConfigurationLoggerId))) { + if (!ss.str().empty() && logger != nullptr) { + configure(); + } + ss.str(std::string("")); + line = line.substr(2); + base::utils::Str::trim(line); + if (line.size() > 1) { + ELPP_INTERNAL_INFO(1, "Getting logger: '" << line << "'"); + logger = getLogger(line); + } + } + else { + ss << line << "\n"; + } + } + if (!ss.str().empty() && logger != nullptr) { + configure(); + } + } + /// @brief Configures loggers using command line arg. Ensure you have already set command line args, + /// @return False if invalid argument or argument with no value provided, true if attempted to configure logger. + /// If true is returned that does not mean it has been configured successfully, it only means that it + /// has attempeted to configure logger using configuration file provided in argument + static inline bool configureFromArg(const char* argKey) { +#if defined(ELPP_DISABLE_CONFIGURATION_FROM_PROGRAM_ARGS) + ELPP_UNUSED(argKey); +#else + if (!Helpers::commandLineArgs()->hasParamWithValue(argKey)) { + return false; + } + configureFromGlobal(Helpers::commandLineArgs()->getParamValue(argKey)); +#endif // defined(ELPP_DISABLE_CONFIGURATION_FROM_PROGRAM_ARGS) + return true; + } + /// @brief Flushes all loggers for all levels - Be careful if you dont know how many loggers are registered + static inline void flushAll(void) { + ELPP->registeredLoggers()->flushAll(); + } + /// @brief Adds logging flag used internally. + static inline void addFlag(LoggingFlag flag) { + ELPP->addFlag(flag); + } + /// @brief Removes logging flag used internally. + static inline void removeFlag(LoggingFlag flag) { + ELPP->removeFlag(flag); + } + /// @brief Determines whether or not certain flag is active + static inline bool hasFlag(LoggingFlag flag) { + return ELPP->hasFlag(flag); + } + /// @brief Adds flag and removes it when scope goes out + class ScopedAddFlag { + public: + ScopedAddFlag(LoggingFlag flag) : m_flag(flag) { Loggers::addFlag(m_flag); } + ~ScopedAddFlag(void) { Loggers::removeFlag(m_flag); } + private: + LoggingFlag m_flag; + }; + /// @brief Removes flag and add it when scope goes out + class ScopedRemoveFlag { + public: + ScopedRemoveFlag(LoggingFlag flag) : m_flag(flag) { Loggers::removeFlag(m_flag); } + ~ScopedRemoveFlag(void) { Loggers::addFlag(m_flag); } + private: + LoggingFlag m_flag; + }; + /// @brief Sets hierarchy for logging. Needs to enable logging flag (HierarchicalLogging) + static inline void setLoggingLevel(Level level) { + ELPP->setLoggingLevel(level); + } + /// @brief Sets verbose level on the fly + static inline void setVerboseLevel(base::type::VerboseLevel level) { + ELPP->vRegistry()->setLevel(level); + } + /// @brief Gets current verbose level + static inline base::type::VerboseLevel verboseLevel(void) { + return ELPP->vRegistry()->level(); + } + /// @brief Sets vmodules as specified (on the fly) + static inline void setVModules(const char* modules) { + if (ELPP->vRegistry()->vModulesEnabled()) { + ELPP->vRegistry()->setModules(modules); + } + } + /// @brief Clears vmodules + static inline void clearVModules(void) { + ELPP->vRegistry()->clearModules(); + } + }; + class VersionInfo : base::StaticClass { + public: + /// @brief Current version number + static inline const std::string version(void) { return std::string("9.80"); } + /// @brief Release date of current version + static inline const std::string releaseDate(void) { return std::string("08-01-2015 0850hrs"); } + }; +} // namespace el +#undef VLOG_IS_ON + /// @brief Determines whether verbose logging is on for specified level current file. +#define VLOG_IS_ON(verboseLevel) (ELPP->vRegistry()->allowed(verboseLevel, __FILE__)) +#undef TIMED_BLOCK +#undef TIMED_SCOPE +#undef TIMED_FUNC +#undef ELPP_MIN_UNIT +#if defined(ELPP_PERFORMANCE_MICROSECONDS) +# define ELPP_MIN_UNIT el::base::TimestampUnit::Microsecond +#else +# define ELPP_MIN_UNIT el::base::TimestampUnit::Millisecond +#endif // (defined(ELPP_PERFORMANCE_MICROSECONDS)) + /// @brief Performance tracked scope. Performance gets written when goes out of scope using + /// 'performance' logger. + /// + /// @detail Please note in order to check the performance at a certain time you can use obj.checkpoint(); + /// @see el::base::PerformanceTracker + /// @see el::base::PerformanceTracker::checkpoint + // Note: Do not surround this definition with null macro because of obj instance +#define TIMED_SCOPE(obj, blockname) el::base::PerformanceTracker obj(blockname, ELPP_MIN_UNIT) +#define TIMED_BLOCK(obj, blockName) for (struct { int i; el::base::PerformanceTracker timer; } obj = { 0, \ + el::base::PerformanceTracker(blockName, ELPP_MIN_UNIT) }; obj.i < 1; ++obj.i) + /// @brief Performance tracked function. Performance gets written when goes out of scope using + /// 'performance' logger. + /// + /// @detail Please note in order to check the performance at a certain time you can use obj.checkpoint(); + /// @see el::base::PerformanceTracker + /// @see el::base::PerformanceTracker::checkpoint +#define TIMED_FUNC(obj) TIMED_SCOPE(obj, ELPP_FUNC) +#undef PERFORMANCE_CHECKPOINT +#undef PERFORMANCE_CHECKPOINT_WITH_ID +#define PERFORMANCE_CHECKPOINT(obj) obj.checkpoint(std::string(), __FILE__, __LINE__, ELPP_FUNC) +#define PERFORMANCE_CHECKPOINT_WITH_ID(obj, id) obj.checkpoint(id, __FILE__, __LINE__, ELPP_FUNC) +#undef ELPP_COUNTER +#undef ELPP_COUNTER_POS + /// @brief Gets hit counter for file/line +#define ELPP_COUNTER (ELPP->hitCounters()->getCounter(__FILE__, __LINE__)) + /// @brief Gets hit counter position for file/line, -1 if not registered yet +#define ELPP_COUNTER_POS (ELPP_COUNTER == nullptr ? -1 : ELPP_COUNTER->hitCounts()) + // Undef levels to support LOG(LEVEL) +#undef INFO +#undef WARNING +#undef DEBUG +#undef ERROR +#undef FATAL +#undef TRACE +#undef VERBOSE + // Undef existing +#undef CINFO +#undef CWARNING +#undef CDEBUG +#undef CFATAL +#undef CERROR +#undef CTRACE +#undef CVERBOSE +#undef CINFO_IF +#undef CWARNING_IF +#undef CDEBUG_IF +#undef CERROR_IF +#undef CFATAL_IF +#undef CTRACE_IF +#undef CVERBOSE_IF +#undef CINFO_EVERY_N +#undef CWARNING_EVERY_N +#undef CDEBUG_EVERY_N +#undef CERROR_EVERY_N +#undef CFATAL_EVERY_N +#undef CTRACE_EVERY_N +#undef CVERBOSE_EVERY_N +#undef CINFO_AFTER_N +#undef CWARNING_AFTER_N +#undef CDEBUG_AFTER_N +#undef CERROR_AFTER_N +#undef CFATAL_AFTER_N +#undef CTRACE_AFTER_N +#undef CVERBOSE_AFTER_N +#undef CINFO_N_TIMES +#undef CWARNING_N_TIMES +#undef CDEBUG_N_TIMES +#undef CERROR_N_TIMES +#undef CFATAL_N_TIMES +#undef CTRACE_N_TIMES +#undef CVERBOSE_N_TIMES + // Normal logs +#if ELPP_INFO_LOG +# define CINFO(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Info, dispatchAction, __VA_ARGS__) +#else +# define CINFO(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_INFO_LOG +#if ELPP_WARNING_LOG +# define CWARNING(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Warning, dispatchAction, __VA_ARGS__) +#else +# define CWARNING(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_WARNING_LOG +#if ELPP_DEBUG_LOG +# define CDEBUG(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Debug, dispatchAction, __VA_ARGS__) +#else +# define CDEBUG(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_DEBUG_LOG +#if ELPP_ERROR_LOG +# define CERROR(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Error, dispatchAction, __VA_ARGS__) +#else +# define CERROR(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_ERROR_LOG +#if ELPP_FATAL_LOG +# define CFATAL(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Fatal, dispatchAction, __VA_ARGS__) +#else +# define CFATAL(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_FATAL_LOG +#if ELPP_TRACE_LOG +# define CTRACE(writer, dispatchAction, ...) ELPP_WRITE_LOG(writer, el::Level::Trace, dispatchAction, __VA_ARGS__) +#else +# define CTRACE(writer, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_TRACE_LOG +#if ELPP_VERBOSE_LOG +# define CVERBOSE(writer, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel)) writer(\ + el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#else +# define CVERBOSE(writer, vlevel, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_VERBOSE_LOG + // Conditional logs +#if ELPP_INFO_LOG +# define CINFO_IF(writer, condition_, dispatchAction, ...) \ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Info, dispatchAction, __VA_ARGS__) +#else +# define CINFO_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_INFO_LOG +#if ELPP_WARNING_LOG +# define CWARNING_IF(writer, condition_, dispatchAction, ...)\ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Warning, dispatchAction, __VA_ARGS__) +#else +# define CWARNING_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_WARNING_LOG +#if ELPP_DEBUG_LOG +# define CDEBUG_IF(writer, condition_, dispatchAction, ...)\ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Debug, dispatchAction, __VA_ARGS__) +#else +# define CDEBUG_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_DEBUG_LOG +#if ELPP_ERROR_LOG +# define CERROR_IF(writer, condition_, dispatchAction, ...)\ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Error, dispatchAction, __VA_ARGS__) +#else +# define CERROR_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_ERROR_LOG +#if ELPP_FATAL_LOG +# define CFATAL_IF(writer, condition_, dispatchAction, ...)\ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Fatal, dispatchAction, __VA_ARGS__) +#else +# define CFATAL_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_FATAL_LOG +#if ELPP_TRACE_LOG +# define CTRACE_IF(writer, condition_, dispatchAction, ...)\ + ELPP_WRITE_LOG_IF(writer, (condition_), el::Level::Trace, dispatchAction, __VA_ARGS__) +#else +# define CTRACE_IF(writer, condition_, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_TRACE_LOG +#if ELPP_VERBOSE_LOG +# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) if (VLOG_IS_ON(vlevel) && (condition_)) writer( \ + el::Level::Verbose, __FILE__, __LINE__, ELPP_FUNC, dispatchAction, vlevel).construct(el_getVALength(__VA_ARGS__), __VA_ARGS__) +#else +# define CVERBOSE_IF(writer, condition_, vlevel, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_VERBOSE_LOG + // Occasional logs +#if ELPP_INFO_LOG +# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Info, dispatchAction, __VA_ARGS__) +#else +# define CINFO_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_INFO_LOG +#if ELPP_WARNING_LOG +# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Warning, dispatchAction, __VA_ARGS__) +#else +# define CWARNING_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_WARNING_LOG +#if ELPP_DEBUG_LOG +# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Debug, dispatchAction, __VA_ARGS__) +#else +# define CDEBUG_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_DEBUG_LOG +#if ELPP_ERROR_LOG +# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Error, dispatchAction, __VA_ARGS__) +#else +# define CERROR_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_ERROR_LOG +#if ELPP_FATAL_LOG +# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Fatal, dispatchAction, __VA_ARGS__) +#else +# define CFATAL_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_FATAL_LOG +#if ELPP_TRACE_LOG +# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...)\ + ELPP_WRITE_LOG_EVERY_N(writer, occasion, el::Level::Trace, dispatchAction, __VA_ARGS__) +#else +# define CTRACE_EVERY_N(writer, occasion, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_TRACE_LOG +#if ELPP_VERBOSE_LOG +# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...)\ + CVERBOSE_IF(writer, ELPP->validateEveryNCounter(__FILE__, __LINE__, occasion), vlevel, dispatchAction, __VA_ARGS__) +#else +# define CVERBOSE_EVERY_N(writer, occasion, vlevel, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_VERBOSE_LOG + // After N logs +#if ELPP_INFO_LOG +# define CINFO_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) +#else +# define CINFO_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_INFO_LOG +#if ELPP_WARNING_LOG +# define CWARNING_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) +#else +# define CWARNING_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_WARNING_LOG +#if ELPP_DEBUG_LOG +# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) +#else +# define CDEBUG_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_DEBUG_LOG +#if ELPP_ERROR_LOG +# define CERROR_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) +#else +# define CERROR_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_ERROR_LOG +#if ELPP_FATAL_LOG +# define CFATAL_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) +#else +# define CFATAL_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_FATAL_LOG +#if ELPP_TRACE_LOG +# define CTRACE_AFTER_N(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_AFTER_N(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) +#else +# define CTRACE_AFTER_N(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_TRACE_LOG +#if ELPP_VERBOSE_LOG +# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...)\ + CVERBOSE_IF(writer, ELPP->validateAfterNCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) +#else +# define CVERBOSE_AFTER_N(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_VERBOSE_LOG + // N Times logs +#if ELPP_INFO_LOG +# define CINFO_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Info, dispatchAction, __VA_ARGS__) +#else +# define CINFO_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_INFO_LOG +#if ELPP_WARNING_LOG +# define CWARNING_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Warning, dispatchAction, __VA_ARGS__) +#else +# define CWARNING_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_WARNING_LOG +#if ELPP_DEBUG_LOG +# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Debug, dispatchAction, __VA_ARGS__) +#else +# define CDEBUG_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_DEBUG_LOG +#if ELPP_ERROR_LOG +# define CERROR_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Error, dispatchAction, __VA_ARGS__) +#else +# define CERROR_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_ERROR_LOG +#if ELPP_FATAL_LOG +# define CFATAL_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Fatal, dispatchAction, __VA_ARGS__) +#else +# define CFATAL_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_FATAL_LOG +#if ELPP_TRACE_LOG +# define CTRACE_N_TIMES(writer, n, dispatchAction, ...)\ + ELPP_WRITE_LOG_N_TIMES(writer, n, el::Level::Trace, dispatchAction, __VA_ARGS__) +#else +# define CTRACE_N_TIMES(writer, n, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_TRACE_LOG +#if ELPP_VERBOSE_LOG +# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...)\ + CVERBOSE_IF(writer, ELPP->validateNTimesCounter(__FILE__, __LINE__, n), vlevel, dispatchAction, __VA_ARGS__) +#else +# define CVERBOSE_N_TIMES(writer, n, vlevel, dispatchAction, ...) el::base::NullWriter() +#endif // ELPP_VERBOSE_LOG + // + // Custom Loggers - Requires (level, dispatchAction, loggerId/s) + // + // undef existing +#undef CLOG +#undef CLOG_VERBOSE +#undef CVLOG +#undef CLOG_IF +#undef CLOG_VERBOSE_IF +#undef CVLOG_IF +#undef CLOG_EVERY_N +#undef CVLOG_EVERY_N +#undef CLOG_AFTER_N +#undef CVLOG_AFTER_N +#undef CLOG_N_TIMES +#undef CVLOG_N_TIMES + // Normal logs +#define CLOG(LEVEL, ...)\ + C##LEVEL(el::base::Writer, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CVLOG(vlevel, ...) CVERBOSE(el::base::Writer, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) + // Conditional logs +#define CLOG_IF(condition, LEVEL, ...)\ + C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CVLOG_IF(condition, vlevel, ...)\ + CVERBOSE_IF(el::base::Writer, condition, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) + // Hit counts based logs +#define CLOG_EVERY_N(n, LEVEL, ...)\ + C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CVLOG_EVERY_N(n, vlevel, ...)\ + CVERBOSE_EVERY_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CLOG_AFTER_N(n, LEVEL, ...)\ + C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CVLOG_AFTER_N(n, vlevel, ...)\ + CVERBOSE_AFTER_N(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CLOG_N_TIMES(n, LEVEL, ...)\ + C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CVLOG_N_TIMES(n, vlevel, ...)\ + CVERBOSE_N_TIMES(el::base::Writer, n, vlevel, el::base::DispatchAction::NormalLog, __VA_ARGS__) + // + // Default Loggers macro using CLOG(), CLOG_VERBOSE() and CVLOG() macros + // + // undef existing +#undef LOG +#undef VLOG +#undef LOG_IF +#undef VLOG_IF +#undef LOG_EVERY_N +#undef VLOG_EVERY_N +#undef LOG_AFTER_N +#undef VLOG_AFTER_N +#undef LOG_N_TIMES +#undef VLOG_N_TIMES +#undef ELPP_CURR_FILE_LOGGER_ID +#if defined(ELPP_DEFAULT_LOGGER) +# define ELPP_CURR_FILE_LOGGER_ID ELPP_DEFAULT_LOGGER +#else +# define ELPP_CURR_FILE_LOGGER_ID el::base::consts::kDefaultLoggerId +#endif +#undef ELPP_TRACE +#define ELPP_TRACE CLOG(TRACE, ELPP_CURR_FILE_LOGGER_ID) + // Normal logs +#define LOG(LEVEL) CLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define VLOG(vlevel) CVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Conditional logs +#define LOG_IF(condition, LEVEL) CLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define VLOG_IF(condition, vlevel) CVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Hit counts based logs +#define LOG_EVERY_N(n, LEVEL) CLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define VLOG_EVERY_N(n, vlevel) CVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) +#define LOG_AFTER_N(n, LEVEL) CLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define VLOG_AFTER_N(n, vlevel) CVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) +#define LOG_N_TIMES(n, LEVEL) CLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define VLOG_N_TIMES(n, vlevel) CVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Generic PLOG() +#undef CPLOG +#undef CPLOG_IF +#undef PLOG +#undef PLOG_IF +#undef DCPLOG +#undef DCPLOG_IF +#undef DPLOG +#undef DPLOG_IF +#define CPLOG(LEVEL, ...)\ + C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define CPLOG_IF(condition, LEVEL, ...)\ + C##LEVEL##_IF(el::base::PErrorWriter, condition, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define DCPLOG(LEVEL, ...)\ + if (ELPP_DEBUG_LOG) C##LEVEL(el::base::PErrorWriter, el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define DCPLOG_IF(condition, LEVEL, ...)\ + C##LEVEL##_IF(el::base::PErrorWriter, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::NormalLog, __VA_ARGS__) +#define PLOG(LEVEL) CPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define PLOG_IF(condition, LEVEL) CPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DPLOG(LEVEL) DCPLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DPLOG_IF(condition, LEVEL) DCPLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) + // Generic SYSLOG() +#undef CSYSLOG +#undef CSYSLOG_IF +#undef CSYSLOG_EVERY_N +#undef CSYSLOG_AFTER_N +#undef CSYSLOG_N_TIMES +#undef SYSLOG +#undef SYSLOG_IF +#undef SYSLOG_EVERY_N +#undef SYSLOG_AFTER_N +#undef SYSLOG_N_TIMES +#undef DCSYSLOG +#undef DCSYSLOG_IF +#undef DCSYSLOG_EVERY_N +#undef DCSYSLOG_AFTER_N +#undef DCSYSLOG_N_TIMES +#undef DSYSLOG +#undef DSYSLOG_IF +#undef DSYSLOG_EVERY_N +#undef DSYSLOG_AFTER_N +#undef DSYSLOG_N_TIMES +#if defined(ELPP_SYSLOG) +# define CSYSLOG(LEVEL, ...)\ + C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define CSYSLOG_IF(condition, LEVEL, ...)\ + C##LEVEL##_IF(el::base::Writer, condition, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define CSYSLOG_EVERY_N(n, LEVEL, ...) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define CSYSLOG_AFTER_N(n, LEVEL, ...) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define CSYSLOG_N_TIMES(n, LEVEL, ...) C##LEVEL##_N_TIMES(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define SYSLOG(LEVEL) CSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) +# define SYSLOG_IF(condition, LEVEL) CSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) +# define SYSLOG_EVERY_N(n, LEVEL) CSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) +# define SYSLOG_AFTER_N(n, LEVEL) CSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) +# define SYSLOG_N_TIMES(n, LEVEL) CSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) +# define DCSYSLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) C##LEVEL(el::base::Writer, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define DCSYSLOG_IF(condition, LEVEL, ...)\ + C##LEVEL##_IF(el::base::Writer, (ELPP_DEBUG_LOG) && (condition), el::base::DispatchAction::SysLog, __VA_ARGS__) +# define DCSYSLOG_EVERY_N(n, LEVEL, ...)\ + if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define DCSYSLOG_AFTER_N(n, LEVEL, ...)\ + if (ELPP_DEBUG_LOG) C##LEVEL##_AFTER_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define DCSYSLOG_N_TIMES(n, LEVEL, ...)\ + if (ELPP_DEBUG_LOG) C##LEVEL##_EVERY_N(el::base::Writer, n, el::base::DispatchAction::SysLog, __VA_ARGS__) +# define DSYSLOG(LEVEL) DCSYSLOG(LEVEL, el::base::consts::kSysLogLoggerId) +# define DSYSLOG_IF(condition, LEVEL) DCSYSLOG_IF(condition, LEVEL, el::base::consts::kSysLogLoggerId) +# define DSYSLOG_EVERY_N(n, LEVEL) DCSYSLOG_EVERY_N(n, LEVEL, el::base::consts::kSysLogLoggerId) +# define DSYSLOG_AFTER_N(n, LEVEL) DCSYSLOG_AFTER_N(n, LEVEL, el::base::consts::kSysLogLoggerId) +# define DSYSLOG_N_TIMES(n, LEVEL) DCSYSLOG_N_TIMES(n, LEVEL, el::base::consts::kSysLogLoggerId) +#else +# define CSYSLOG(LEVEL, ...) el::base::NullWriter() +# define CSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() +# define CSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() +# define CSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() +# define CSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() +# define SYSLOG(LEVEL) el::base::NullWriter() +# define SYSLOG_IF(condition, LEVEL) el::base::NullWriter() +# define SYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() +# define SYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() +# define SYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() +# define DCSYSLOG(LEVEL, ...) el::base::NullWriter() +# define DCSYSLOG_IF(condition, LEVEL, ...) el::base::NullWriter() +# define DCSYSLOG_EVERY_N(n, LEVEL, ...) el::base::NullWriter() +# define DCSYSLOG_AFTER_N(n, LEVEL, ...) el::base::NullWriter() +# define DCSYSLOG_N_TIMES(n, LEVEL, ...) el::base::NullWriter() +# define DSYSLOG(LEVEL) el::base::NullWriter() +# define DSYSLOG_IF(condition, LEVEL) el::base::NullWriter() +# define DSYSLOG_EVERY_N(n, LEVEL) el::base::NullWriter() +# define DSYSLOG_AFTER_N(n, LEVEL) el::base::NullWriter() +# define DSYSLOG_N_TIMES(n, LEVEL) el::base::NullWriter() +#endif // defined(ELPP_SYSLOG) + // + // Custom Debug Only Loggers - Requires (level, loggerId/s) + // + // undef existing +#undef DCLOG +#undef DCVLOG +#undef DCLOG_IF +#undef DCVLOG_IF +#undef DCLOG_EVERY_N +#undef DCVLOG_EVERY_N +#undef DCLOG_AFTER_N +#undef DCVLOG_AFTER_N +#undef DCLOG_N_TIMES +#undef DCVLOG_N_TIMES + // Normal logs +#define DCLOG(LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG(LEVEL, __VA_ARGS__) +#define DCLOG_VERBOSE(vlevel, ...) if (ELPP_DEBUG_LOG) CLOG_VERBOSE(vlevel, __VA_ARGS__) +#define DCVLOG(vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG(vlevel, __VA_ARGS__) + // Conditional logs +#define DCLOG_IF(condition, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_IF(condition, LEVEL, __VA_ARGS__) +#define DCVLOG_IF(condition, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_IF(condition, vlevel, __VA_ARGS__) + // Hit counts based logs +#define DCLOG_EVERY_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_EVERY_N(n, LEVEL, __VA_ARGS__) +#define DCVLOG_EVERY_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_EVERY_N(n, vlevel, __VA_ARGS__) +#define DCLOG_AFTER_N(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_AFTER_N(n, LEVEL, __VA_ARGS__) +#define DCVLOG_AFTER_N(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_AFTER_N(n, vlevel, __VA_ARGS__) +#define DCLOG_N_TIMES(n, LEVEL, ...) if (ELPP_DEBUG_LOG) CLOG_N_TIMES(n, LEVEL, __VA_ARGS__) +#define DCVLOG_N_TIMES(n, vlevel, ...) if (ELPP_DEBUG_LOG) CVLOG_N_TIMES(n, vlevel, __VA_ARGS__) + // + // Default Debug Only Loggers macro using CLOG(), CLOG_VERBOSE() and CVLOG() macros + // + // undef existing +#undef DLOG +#undef DVLOG +#undef DLOG_IF +#undef DVLOG_IF +#undef DLOG_EVERY_N +#undef DVLOG_EVERY_N +#undef DLOG_AFTER_N +#undef DVLOG_AFTER_N +#undef DLOG_N_TIMES +#undef DVLOG_N_TIMES + // Normal logs +#define DLOG(LEVEL) DCLOG(LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DVLOG(vlevel) DCVLOG(vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Conditional logs +#define DLOG_IF(condition, LEVEL) DCLOG_IF(condition, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DVLOG_IF(condition, vlevel) DCVLOG_IF(condition, vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Hit counts based logs +#define DLOG_EVERY_N(n, LEVEL) DCLOG_EVERY_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DVLOG_EVERY_N(n, vlevel) DCVLOG_EVERY_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) +#define DLOG_AFTER_N(n, LEVEL) DCLOG_AFTER_N(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DVLOG_AFTER_N(n, vlevel) DCVLOG_AFTER_N(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) +#define DLOG_N_TIMES(n, LEVEL) DCLOG_N_TIMES(n, LEVEL, ELPP_CURR_FILE_LOGGER_ID) +#define DVLOG_N_TIMES(n, vlevel) DCVLOG_N_TIMES(n, vlevel, ELPP_CURR_FILE_LOGGER_ID) + // Check macros +#undef CCHECK +#undef CPCHECK +#undef CCHECK_EQ +#undef CCHECK_NE +#undef CCHECK_LT +#undef CCHECK_GT +#undef CCHECK_LE +#undef CCHECK_GE +#undef CCHECK_BOUNDS +#undef CCHECK_NOTNULL +#undef CCHECK_STRCASEEQ +#undef CCHECK_STRCASENE +#undef CHECK +#undef PCHECK +#undef CHECK_EQ +#undef CHECK_NE +#undef CHECK_LT +#undef CHECK_GT +#undef CHECK_LE +#undef CHECK_GE +#undef CHECK_BOUNDS +#undef CHECK_NOTNULL +#undef CHECK_STRCASEEQ +#undef CHECK_STRCASENE +#define CCHECK(condition, ...) CLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " +#define CPCHECK(condition, ...) CPLOG_IF(!(condition), FATAL, __VA_ARGS__) << "Check failed: [" << #condition << "] " +#define CHECK(condition) CCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) +#define PCHECK(condition) CPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) +#define CCHECK_EQ(a, b, ...) CCHECK(a == b, __VA_ARGS__) +#define CCHECK_NE(a, b, ...) CCHECK(a != b, __VA_ARGS__) +#define CCHECK_LT(a, b, ...) CCHECK(a < b, __VA_ARGS__) +#define CCHECK_GT(a, b, ...) CCHECK(a > b, __VA_ARGS__) +#define CCHECK_LE(a, b, ...) CCHECK(a <= b, __VA_ARGS__) +#define CCHECK_GE(a, b, ...) CCHECK(a >= b, __VA_ARGS__) +#define CCHECK_BOUNDS(val, min, max, ...) CCHECK(val >= min && val <= max, __VA_ARGS__) +#define CHECK_EQ(a, b) CCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_NE(a, b) CCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_LT(a, b) CCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_GT(a, b) CCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_LE(a, b) CCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_GE(a, b) CCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_BOUNDS(val, min, max) CCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) +namespace el { + namespace base { + namespace utils { + template + static T* checkNotNull(T* ptr, const char* name, const char* loggers, ...) { + CLOG_IF(ptr == nullptr, FATAL, loggers) << "Check failed: [" << name << " != nullptr]"; + return ptr; + } + } // namespace utils + } // namespace base +} // namespace el +#define CCHECK_NOTNULL(ptr, ...) el::base::utils::checkNotNull(ptr, #ptr, __VA_ARGS__) +#define CCHECK_STREQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ + << "Check failed: [" << #str1 << " == " << #str2 << "] " +#define CCHECK_STRNE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringEq(str1, str2), FATAL, __VA_ARGS__) \ + << "Check failed: [" << #str1 << " != " << #str2 << "] " +#define CCHECK_STRCASEEQ(str1, str2, ...) CLOG_IF(!el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ + << "Check failed: [" << #str1 << " == " << #str2 << "] " +#define CCHECK_STRCASENE(str1, str2, ...) CLOG_IF(el::base::utils::Str::cStringCaseEq(str1, str2), FATAL, __VA_ARGS__) \ + << "Check failed: [" << #str1 << " != " << #str2 << "] " +#define CHECK_NOTNULL(ptr) CCHECK_NOTNULL(ptr, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_STREQ(str1, str2) CCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_STRNE(str1, str2) CCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_STRCASEEQ(str1, str2) CCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define CHECK_STRCASENE(str1, str2) CCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#undef DCCHECK +#undef DCCHECK_EQ +#undef DCCHECK_NE +#undef DCCHECK_LT +#undef DCCHECK_GT +#undef DCCHECK_LE +#undef DCCHECK_GE +#undef DCCHECK_BOUNDS +#undef DCCHECK_NOTNULL +#undef DCCHECK_STRCASEEQ +#undef DCCHECK_STRCASENE +#undef DCPCHECK +#undef DCHECK +#undef DCHECK_EQ +#undef DCHECK_NE +#undef DCHECK_LT +#undef DCHECK_GT +#undef DCHECK_LE +#undef DCHECK_GE +#undef DCHECK_BOUNDS_ +#undef DCHECK_NOTNULL +#undef DCHECK_STRCASEEQ +#undef DCHECK_STRCASENE +#undef DPCHECK +#define DCCHECK(condition, ...) if (ELPP_DEBUG_LOG) CCHECK(condition, __VA_ARGS__) +#define DCCHECK_EQ(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_EQ(a, b, __VA_ARGS__) +#define DCCHECK_NE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_NE(a, b, __VA_ARGS__) +#define DCCHECK_LT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LT(a, b, __VA_ARGS__) +#define DCCHECK_GT(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GT(a, b, __VA_ARGS__) +#define DCCHECK_LE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_LE(a, b, __VA_ARGS__) +#define DCCHECK_GE(a, b, ...) if (ELPP_DEBUG_LOG) CCHECK_GE(a, b, __VA_ARGS__) +#define DCCHECK_BOUNDS(val, min, max, ...) if (ELPP_DEBUG_LOG) CCHECK_BOUNDS(val, min, max, __VA_ARGS__) +#define DCCHECK_NOTNULL(ptr, ...) if (ELPP_DEBUG_LOG) CCHECK_NOTNULL(ptr, __VA_ARGS__) +#define DCCHECK_STREQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STREQ(str1, str2, __VA_ARGS__) +#define DCCHECK_STRNE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRNE(str1, str2, __VA_ARGS__) +#define DCCHECK_STRCASEEQ(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASEEQ(str1, str2, __VA_ARGS__) +#define DCCHECK_STRCASENE(str1, str2, ...) if (ELPP_DEBUG_LOG) CCHECK_STRCASENE(str1, str2, __VA_ARGS__) +#define DCPCHECK(condition, ...) if (ELPP_DEBUG_LOG) CPCHECK(condition, __VA_ARGS__) +#define DCHECK(condition) DCCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_EQ(a, b) DCCHECK_EQ(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_NE(a, b) DCCHECK_NE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_LT(a, b) DCCHECK_LT(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_GT(a, b) DCCHECK_GT(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_LE(a, b) DCCHECK_LE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_GE(a, b) DCCHECK_GE(a, b, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_BOUNDS(val, min, max) DCCHECK_BOUNDS(val, min, max, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_NOTNULL(ptr) DCCHECK_NOTNULL(ptr, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_STREQ(str1, str2) DCCHECK_STREQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_STRNE(str1, str2) DCCHECK_STRNE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_STRCASEEQ(str1, str2) DCCHECK_STRCASEEQ(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define DCHECK_STRCASENE(str1, str2) DCCHECK_STRCASENE(str1, str2, ELPP_CURR_FILE_LOGGER_ID) +#define DPCHECK(condition) DCPCHECK(condition, ELPP_CURR_FILE_LOGGER_ID) +#if defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) +# define ELPP_USE_DEF_CRASH_HANDLER false +#else +# define ELPP_USE_DEF_CRASH_HANDLER true +#endif // defined(ELPP_DISABLE_DEFAULT_CRASH_HANDLING) +#define ELPP_CRASH_HANDLER_INIT +#define ELPP_INIT_EASYLOGGINGPP(val)\ + ELPP_INITI_BASIC_DECLR\ + namespace el {\ + namespace base {\ + el::base::type::StoragePointer elStorage(val);\ + }\ + el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ + } + +#if ELPP_ASYNC_LOGGING +# define INITIALIZE_EASYLOGGINGPP\ + ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()),\ + new el::base::AsyncDispatchWorker()))\ + +#else +# define INITIALIZE_EASYLOGGINGPP\ + ELPP_INIT_EASYLOGGINGPP(new el::base::Storage(el::LogBuilderPtr(new el::base::DefaultLogBuilder()))) +#endif // ELPP_ASYNC_LOGGING +#define INITIALIZE_NULL_EASYLOGGINGPP\ + ELPP_INITI_BASIC_DECLR\ + namespace el {\ + namespace base {\ + el::base::type::StoragePointer elStorage;\ + }\ + el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ + } + // NOTE: no ELPP_INITI_BASIC_DECLR when sharing - causes double free corruption on external symbols +#define SHARE_EASYLOGGINGPP(initializedStorage)\ + namespace el {\ + namespace base {\ + el::base::type::StoragePointer elStorage(initializedStorage);\ + }\ + el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER);\ + } + +#if defined(ELPP_UNICODE) +# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv); std::locale::global(std::locale("")) +#else +# define START_EASYLOGGINGPP(argc, argv) el::Helpers::setArgs(argc, argv) +#endif // defined(ELPP_UNICODE) #endif // EASYLOGGINGPP_H \ No newline at end of file diff --git a/extensions/common/glm/CMakeLists.txt b/extensions/common/glm/CMakeLists.txt index fe28b5d975..aaeae6269e 100644 --- a/extensions/common/glm/CMakeLists.txt +++ b/extensions/common/glm/CMakeLists.txt @@ -1,43 +1,43 @@ -set(NAME glm_dummy) - -file(GLOB ROOT_SOURCE *.cpp) -file(GLOB ROOT_INLINE *.inl) -file(GLOB ROOT_HEADER *.hpp) -file(GLOB ROOT_TEXT ../*.txt) -file(GLOB ROOT_NAT ../util/glm.natvis) - -file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) -file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) -file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) - -file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) -file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) -file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) - -file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) -file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) -file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) - -source_group("Text Files" FILES ${ROOT_TEXT}) -source_group("Core Files" FILES ${CORE_SOURCE}) -source_group("Core Files" FILES ${CORE_INLINE}) -source_group("Core Files" FILES ${CORE_HEADER}) -source_group("GTC Files" FILES ${GTC_SOURCE}) -source_group("GTC Files" FILES ${GTC_INLINE}) -source_group("GTC Files" FILES ${GTC_HEADER}) -source_group("GTX Files" FILES ${GTX_SOURCE}) -source_group("GTX Files" FILES ${GTX_INLINE}) -source_group("GTX Files" FILES ${GTX_HEADER}) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) - -if(GLM_TEST_ENABLE) - add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT} - ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} - ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} - ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} - ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) -endif(GLM_TEST_ENABLE) - -#add_library(glm STATIC glm.cpp) -#add_library(glm_shared SHARED glm.cpp) +set(NAME glm_dummy) + +file(GLOB ROOT_SOURCE *.cpp) +file(GLOB ROOT_INLINE *.inl) +file(GLOB ROOT_HEADER *.hpp) +file(GLOB ROOT_TEXT ../*.txt) +file(GLOB ROOT_NAT ../util/glm.natvis) + +file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) +file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) +file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) + +file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) +file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) +file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) + +file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) +file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) +file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) + +source_group("Text Files" FILES ${ROOT_TEXT}) +source_group("Core Files" FILES ${CORE_SOURCE}) +source_group("Core Files" FILES ${CORE_INLINE}) +source_group("Core Files" FILES ${CORE_HEADER}) +source_group("GTC Files" FILES ${GTC_SOURCE}) +source_group("GTC Files" FILES ${GTC_INLINE}) +source_group("GTC Files" FILES ${GTC_HEADER}) +source_group("GTX Files" FILES ${GTX_SOURCE}) +source_group("GTX Files" FILES ${GTX_INLINE}) +source_group("GTX Files" FILES ${GTX_HEADER}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +if(GLM_TEST_ENABLE) + add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT} + ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} + ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} + ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} + ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) +endif(GLM_TEST_ENABLE) + +#add_library(glm STATIC glm.cpp) +#add_library(glm_shared SHARED glm.cpp) diff --git a/extensions/common/glm/common.hpp b/extensions/common/glm/common.hpp index 57beb106a9..9ee5425643 100644 --- a/extensions/common/glm/common.hpp +++ b/extensions/common/glm/common.hpp @@ -1,35 +1,35 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/common.hpp -/// @date 2013-12-24 / 2013-12-24 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "detail/func_common.hpp" +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/common.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "detail/func_common.hpp" diff --git a/extensions/common/glm/detail/_features.hpp b/extensions/common/glm/detail/_features.hpp index ce2a35d9c1..1e6089d231 100644 --- a/extensions/common/glm/detail/_features.hpp +++ b/extensions/common/glm/detail/_features.hpp @@ -1,428 +1,428 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_features.hpp -/// @date 2013-02-20 / 2013-02-20 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// #define GLM_CXX98_EXCEPTIONS -// #define GLM_CXX98_RTTI - -// #define GLM_CXX11_RVALUE_REFERENCES -// Rvalue references - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html - -// GLM_CXX11_TRAILING_RETURN -// Rvalue references for *this - GCC not supported -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm - -// GLM_CXX11_NONSTATIC_MEMBER_INIT -// Initialization of class objects by rvalues - GCC any -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html - -// GLM_CXX11_NONSTATIC_MEMBER_INIT -// Non-static data member initializers - GCC 4.7 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm - -// #define GLM_CXX11_VARIADIC_TEMPLATE -// Variadic templates - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf - -// -// Extending variadic template template parameters - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf - -// #define GLM_CXX11_GENERALIZED_INITIALIZERS -// Initializer lists - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm - -// #define GLM_CXX11_STATIC_ASSERT -// Static assertions - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html - -// #define GLM_CXX11_AUTO_TYPE -// auto-typed variables - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf - -// #define GLM_CXX11_AUTO_TYPE -// Multi-declarator auto - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf - -// #define GLM_CXX11_AUTO_TYPE -// Removal of auto as a storage-class specifier - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm - -// #define GLM_CXX11_AUTO_TYPE -// New function declarator syntax - GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm - -// #define GLM_CXX11_LAMBDAS -// New wording for C++0x lambdas - GCC 4.5 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf - -// #define GLM_CXX11_DECLTYPE -// Declared type of an expression - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf - -// -// Right angle brackets - GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html - -// -// Default template arguments for function templates DR226 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 - -// -// Solving the SFINAE problem for expressions DR339 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html - -// #define GLM_CXX11_ALIAS_TEMPLATE -// Template aliases N2258 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf - -// -// Extern templates N1987 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm - -// #define GLM_CXX11_NULLPTR -// Null pointer constant N2431 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf - -// #define GLM_CXX11_STRONG_ENUMS -// Strongly-typed enums N2347 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf - -// -// Forward declarations for enums N2764 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf - -// -// Generalized attributes N2761 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf - -// -// Generalized constant expressions N2235 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf - -// -// Alignment support N2341 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf - -// #define GLM_CXX11_DELEGATING_CONSTRUCTORS -// Delegating constructors N1986 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf - -// -// Inheriting constructors N2540 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm - -// #define GLM_CXX11_EXPLICIT_CONVERSIONS -// Explicit conversion operators N2437 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf - -// -// New character types N2249 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html - -// -// Unicode string literals N2442 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -// -// Raw string literals N2442 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm - -// -// Universal character name literals N2170 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html - -// #define GLM_CXX11_USER_LITERALS -// User-defined literals N2765 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf - -// -// Standard Layout Types N2342 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm - -// #define GLM_CXX11_DEFAULTED_FUNCTIONS -// #define GLM_CXX11_DELETED_FUNCTIONS -// Defaulted and deleted functions N2346 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm - -// -// Extended friend declarations N1791 GCC 4.7 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf - -// -// Extending sizeof N2253 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html - -// #define GLM_CXX11_INLINE_NAMESPACES -// Inline namespaces N2535 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm - -// #define GLM_CXX11_UNRESTRICTED_UNIONS -// Unrestricted unions N2544 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf - -// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS -// Local and unnamed types as template arguments N2657 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm - -// #define GLM_CXX11_RANGE_FOR -// Range-based for N2930 GCC 4.6 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html - -// #define GLM_CXX11_OVERRIDE_CONTROL -// Explicit virtual overrides N2928 N3206 N3272 GCC 4.7 -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm - -// -// Minimal support for garbage collection and reachability-based leak detection N2670 No -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm - -// #define GLM_CXX11_NOEXCEPT -// Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only) -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html - -// -// Defining move special member functions N3053 GCC 4.6 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html - -// -// Sequence points N2239 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html - -// -// Atomic operations N2427 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html - -// -// Strong Compare and Exchange N2748 GCC 4.5 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html - -// -// Bidirectional Fences N2752 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm - -// -// Memory model N2429 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm - -// -// Data-dependency ordering: atomics and memory model N2664 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm - -// -// Propagating exceptions N2179 GCC 4.4 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html - -// -// Abandoning a process and at_quick_exit N2440 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm - -// -// Allow atomics use in signal handlers N2547 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm - -// -// Thread-local storage N2659 GCC 4.8 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm - -// -// Dynamic initialization and destruction with concurrency N2660 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm - -// -// __func__ predefined identifier N2340 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm - -// -// C99 preprocessor N1653 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm - -// -// long long N1811 GCC 4.3 -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf - -// -// Extended integral types N1988 Yes -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf - -#if(GLM_COMPILER & GLM_COMPILER_GCC) - -# if(GLM_COMPILER >= GLM_COMPILER_GCC43) -# define GLM_CXX11_STATIC_ASSERT -# endif - -#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) -# if(__has_feature(cxx_exceptions)) -# define GLM_CXX98_EXCEPTIONS -# endif - -# if(__has_feature(cxx_rtti)) -# define GLM_CXX98_RTTI -# endif - -# if(__has_feature(cxx_access_control_sfinae)) -# define GLM_CXX11_ACCESS_CONTROL_SFINAE -# endif - -# if(__has_feature(cxx_alias_templates)) -# define GLM_CXX11_ALIAS_TEMPLATE -# endif - -# if(__has_feature(cxx_alignas)) -# define GLM_CXX11_ALIGNAS -# endif - -# if(__has_feature(cxx_attributes)) -# define GLM_CXX11_ATTRIBUTES -# endif - -# if(__has_feature(cxx_constexpr)) -# define GLM_CXX11_CONSTEXPR -# endif - -# if(__has_feature(cxx_decltype)) -# define GLM_CXX11_DECLTYPE -# endif - -# if(__has_feature(cxx_default_function_template_args)) -# define GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS -# endif - -# if(__has_feature(cxx_defaulted_functions)) -# define GLM_CXX11_DEFAULTED_FUNCTIONS -# endif - -# if(__has_feature(cxx_delegating_constructors)) -# define GLM_CXX11_DELEGATING_CONSTRUCTORS -# endif - -# if(__has_feature(cxx_deleted_functions)) -# define GLM_CXX11_DELETED_FUNCTIONS -# endif - -# if(__has_feature(cxx_explicit_conversions)) -# define GLM_CXX11_EXPLICIT_CONVERSIONS -# endif - -# if(__has_feature(cxx_generalized_initializers)) -# define GLM_CXX11_GENERALIZED_INITIALIZERS -# endif - -# if(__has_feature(cxx_implicit_moves)) -# define GLM_CXX11_IMPLICIT_MOVES -# endif - -# if(__has_feature(cxx_inheriting_constructors)) -# define GLM_CXX11_INHERITING_CONSTRUCTORS -# endif - -# if(__has_feature(cxx_inline_namespaces)) -# define GLM_CXX11_INLINE_NAMESPACES -# endif - -# if(__has_feature(cxx_lambdas)) -# define GLM_CXX11_LAMBDAS -# endif - -# if(__has_feature(cxx_local_type_template_args)) -# define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS -# endif - -# if(__has_feature(cxx_noexcept)) -# define GLM_CXX11_NOEXCEPT -# endif - -# if(__has_feature(cxx_nonstatic_member_init)) -# define GLM_CXX11_NONSTATIC_MEMBER_INIT -# endif - -# if(__has_feature(cxx_nullptr)) -# define GLM_CXX11_NULLPTR -# endif - -# if(__has_feature(cxx_override_control)) -# define GLM_CXX11_OVERRIDE_CONTROL -# endif - -# if(__has_feature(cxx_reference_qualified_functions)) -# define GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS -# endif - -# if(__has_feature(cxx_range_for)) -# define GLM_CXX11_RANGE_FOR -# endif - -# if(__has_feature(cxx_raw_string_literals)) -# define GLM_CXX11_RAW_STRING_LITERALS -# endif - -# if(__has_feature(cxx_rvalue_references)) -# define GLM_CXX11_RVALUE_REFERENCES -# endif - -# if(__has_feature(cxx_static_assert)) -# define GLM_CXX11_STATIC_ASSERT -# endif - -# if(__has_feature(cxx_auto_type)) -# define GLM_CXX11_AUTO_TYPE -# endif - -# if(__has_feature(cxx_strong_enums)) -# define GLM_CXX11_STRONG_ENUMS -# endif - -# if(__has_feature(cxx_trailing_return)) -# define GLM_CXX11_TRAILING_RETURN -# endif - -# if(__has_feature(cxx_unicode_literals)) -# define GLM_CXX11_UNICODE_LITERALS -# endif - -# if(__has_feature(cxx_unrestricted_unions)) -# define GLM_CXX11_UNRESTRICTED_UNIONS -# endif - -# if(__has_feature(cxx_user_literals)) -# define GLM_CXX11_USER_LITERALS -# endif - -# if(__has_feature(cxx_variadic_templates)) -# define GLM_CXX11_VARIADIC_TEMPLATES -# endif - -#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_features.hpp +/// @date 2013-02-20 / 2013-02-20 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +// #define GLM_CXX98_EXCEPTIONS +// #define GLM_CXX98_RTTI + +// #define GLM_CXX11_RVALUE_REFERENCES +// Rvalue references - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html + +// GLM_CXX11_TRAILING_RETURN +// Rvalue references for *this - GCC not supported +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm + +// GLM_CXX11_NONSTATIC_MEMBER_INIT +// Initialization of class objects by rvalues - GCC any +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1610.html + +// GLM_CXX11_NONSTATIC_MEMBER_INIT +// Non-static data member initializers - GCC 4.7 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2756.htm + +// #define GLM_CXX11_VARIADIC_TEMPLATE +// Variadic templates - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf + +// +// Extending variadic template template parameters - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf + +// #define GLM_CXX11_GENERALIZED_INITIALIZERS +// Initializer lists - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm + +// #define GLM_CXX11_STATIC_ASSERT +// Static assertions - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html + +// #define GLM_CXX11_AUTO_TYPE +// auto-typed variables - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf + +// #define GLM_CXX11_AUTO_TYPE +// Multi-declarator auto - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1737.pdf + +// #define GLM_CXX11_AUTO_TYPE +// Removal of auto as a storage-class specifier - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2546.htm + +// #define GLM_CXX11_AUTO_TYPE +// New function declarator syntax - GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm + +// #define GLM_CXX11_LAMBDAS +// New wording for C++0x lambdas - GCC 4.5 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2927.pdf + +// #define GLM_CXX11_DECLTYPE +// Declared type of an expression - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf + +// +// Right angle brackets - GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html + +// +// Default template arguments for function templates DR226 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226 + +// +// Solving the SFINAE problem for expressions DR339 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html + +// #define GLM_CXX11_ALIAS_TEMPLATE +// Template aliases N2258 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf + +// +// Extern templates N1987 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm + +// #define GLM_CXX11_NULLPTR +// Null pointer constant N2431 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf + +// #define GLM_CXX11_STRONG_ENUMS +// Strongly-typed enums N2347 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf + +// +// Forward declarations for enums N2764 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf + +// +// Generalized attributes N2761 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf + +// +// Generalized constant expressions N2235 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf + +// +// Alignment support N2341 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf + +// #define GLM_CXX11_DELEGATING_CONSTRUCTORS +// Delegating constructors N1986 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf + +// +// Inheriting constructors N2540 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm + +// #define GLM_CXX11_EXPLICIT_CONVERSIONS +// Explicit conversion operators N2437 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf + +// +// New character types N2249 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2249.html + +// +// Unicode string literals N2442 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +// +// Raw string literals N2442 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm + +// +// Universal character name literals N2170 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2170.html + +// #define GLM_CXX11_USER_LITERALS +// User-defined literals N2765 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf + +// +// Standard Layout Types N2342 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2342.htm + +// #define GLM_CXX11_DEFAULTED_FUNCTIONS +// #define GLM_CXX11_DELETED_FUNCTIONS +// Defaulted and deleted functions N2346 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm + +// +// Extended friend declarations N1791 GCC 4.7 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf + +// +// Extending sizeof N2253 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html + +// #define GLM_CXX11_INLINE_NAMESPACES +// Inline namespaces N2535 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm + +// #define GLM_CXX11_UNRESTRICTED_UNIONS +// Unrestricted unions N2544 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf + +// #define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS +// Local and unnamed types as template arguments N2657 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm + +// #define GLM_CXX11_RANGE_FOR +// Range-based for N2930 GCC 4.6 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2930.html + +// #define GLM_CXX11_OVERRIDE_CONTROL +// Explicit virtual overrides N2928 N3206 N3272 GCC 4.7 +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm + +// +// Minimal support for garbage collection and reachability-based leak detection N2670 No +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm + +// #define GLM_CXX11_NOEXCEPT +// Allowing move constructors to throw [noexcept] N3050 GCC 4.6 (core language only) +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html + +// +// Defining move special member functions N3053 GCC 4.6 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html + +// +// Sequence points N2239 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html + +// +// Atomic operations N2427 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html + +// +// Strong Compare and Exchange N2748 GCC 4.5 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html + +// +// Bidirectional Fences N2752 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2752.htm + +// +// Memory model N2429 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2429.htm + +// +// Data-dependency ordering: atomics and memory model N2664 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2664.htm + +// +// Propagating exceptions N2179 GCC 4.4 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2179.html + +// +// Abandoning a process and at_quick_exit N2440 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2440.htm + +// +// Allow atomics use in signal handlers N2547 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2547.htm + +// +// Thread-local storage N2659 GCC 4.8 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm + +// +// Dynamic initialization and destruction with concurrency N2660 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm + +// +// __func__ predefined identifier N2340 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm + +// +// C99 preprocessor N1653 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm + +// +// long long N1811 GCC 4.3 +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf + +// +// Extended integral types N1988 Yes +// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1988.pdf + +#if(GLM_COMPILER & GLM_COMPILER_GCC) + +# if(GLM_COMPILER >= GLM_COMPILER_GCC43) +# define GLM_CXX11_STATIC_ASSERT +# endif + +#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) +# if(__has_feature(cxx_exceptions)) +# define GLM_CXX98_EXCEPTIONS +# endif + +# if(__has_feature(cxx_rtti)) +# define GLM_CXX98_RTTI +# endif + +# if(__has_feature(cxx_access_control_sfinae)) +# define GLM_CXX11_ACCESS_CONTROL_SFINAE +# endif + +# if(__has_feature(cxx_alias_templates)) +# define GLM_CXX11_ALIAS_TEMPLATE +# endif + +# if(__has_feature(cxx_alignas)) +# define GLM_CXX11_ALIGNAS +# endif + +# if(__has_feature(cxx_attributes)) +# define GLM_CXX11_ATTRIBUTES +# endif + +# if(__has_feature(cxx_constexpr)) +# define GLM_CXX11_CONSTEXPR +# endif + +# if(__has_feature(cxx_decltype)) +# define GLM_CXX11_DECLTYPE +# endif + +# if(__has_feature(cxx_default_function_template_args)) +# define GLM_CXX11_DEFAULT_FUNCTION_TEMPLATE_ARGS +# endif + +# if(__has_feature(cxx_defaulted_functions)) +# define GLM_CXX11_DEFAULTED_FUNCTIONS +# endif + +# if(__has_feature(cxx_delegating_constructors)) +# define GLM_CXX11_DELEGATING_CONSTRUCTORS +# endif + +# if(__has_feature(cxx_deleted_functions)) +# define GLM_CXX11_DELETED_FUNCTIONS +# endif + +# if(__has_feature(cxx_explicit_conversions)) +# define GLM_CXX11_EXPLICIT_CONVERSIONS +# endif + +# if(__has_feature(cxx_generalized_initializers)) +# define GLM_CXX11_GENERALIZED_INITIALIZERS +# endif + +# if(__has_feature(cxx_implicit_moves)) +# define GLM_CXX11_IMPLICIT_MOVES +# endif + +# if(__has_feature(cxx_inheriting_constructors)) +# define GLM_CXX11_INHERITING_CONSTRUCTORS +# endif + +# if(__has_feature(cxx_inline_namespaces)) +# define GLM_CXX11_INLINE_NAMESPACES +# endif + +# if(__has_feature(cxx_lambdas)) +# define GLM_CXX11_LAMBDAS +# endif + +# if(__has_feature(cxx_local_type_template_args)) +# define GLM_CXX11_LOCAL_TYPE_TEMPLATE_ARGS +# endif + +# if(__has_feature(cxx_noexcept)) +# define GLM_CXX11_NOEXCEPT +# endif + +# if(__has_feature(cxx_nonstatic_member_init)) +# define GLM_CXX11_NONSTATIC_MEMBER_INIT +# endif + +# if(__has_feature(cxx_nullptr)) +# define GLM_CXX11_NULLPTR +# endif + +# if(__has_feature(cxx_override_control)) +# define GLM_CXX11_OVERRIDE_CONTROL +# endif + +# if(__has_feature(cxx_reference_qualified_functions)) +# define GLM_CXX11_REFERENCE_QUALIFIED_FUNCTIONS +# endif + +# if(__has_feature(cxx_range_for)) +# define GLM_CXX11_RANGE_FOR +# endif + +# if(__has_feature(cxx_raw_string_literals)) +# define GLM_CXX11_RAW_STRING_LITERALS +# endif + +# if(__has_feature(cxx_rvalue_references)) +# define GLM_CXX11_RVALUE_REFERENCES +# endif + +# if(__has_feature(cxx_static_assert)) +# define GLM_CXX11_STATIC_ASSERT +# endif + +# if(__has_feature(cxx_auto_type)) +# define GLM_CXX11_AUTO_TYPE +# endif + +# if(__has_feature(cxx_strong_enums)) +# define GLM_CXX11_STRONG_ENUMS +# endif + +# if(__has_feature(cxx_trailing_return)) +# define GLM_CXX11_TRAILING_RETURN +# endif + +# if(__has_feature(cxx_unicode_literals)) +# define GLM_CXX11_UNICODE_LITERALS +# endif + +# if(__has_feature(cxx_unrestricted_unions)) +# define GLM_CXX11_UNRESTRICTED_UNIONS +# endif + +# if(__has_feature(cxx_user_literals)) +# define GLM_CXX11_USER_LITERALS +# endif + +# if(__has_feature(cxx_variadic_templates)) +# define GLM_CXX11_VARIADIC_TEMPLATES +# endif + +#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM)) diff --git a/extensions/common/glm/detail/_fixes.hpp b/extensions/common/glm/detail/_fixes.hpp index 9728cafb73..ba7a34f0ec 100644 --- a/extensions/common/glm/detail/_fixes.hpp +++ b/extensions/common/glm/detail/_fixes.hpp @@ -1,59 +1,59 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_fixes.hpp -/// @date 2011-02-21 / 2011-11-22 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#include - -//! Workaround for compatibility with other libraries -#ifdef max -#undef max -#endif - -//! Workaround for compatibility with other libraries -#ifdef min -#undef min -#endif - -//! Workaround for Android -#ifdef isnan -#undef isnan -#endif - -//! Workaround for Android -#ifdef isinf -#undef isinf -#endif - -//! Workaround for Chrone Native Client -#ifdef log2 -#undef log2 -#endif - +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_fixes.hpp +/// @date 2011-02-21 / 2011-11-22 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#include + +//! Workaround for compatibility with other libraries +#ifdef max +#undef max +#endif + +//! Workaround for compatibility with other libraries +#ifdef min +#undef min +#endif + +//! Workaround for Android +#ifdef isnan +#undef isnan +#endif + +//! Workaround for Android +#ifdef isinf +#undef isinf +#endif + +//! Workaround for Chrone Native Client +#ifdef log2 +#undef log2 +#endif + diff --git a/extensions/common/glm/detail/_noise.hpp b/extensions/common/glm/detail/_noise.hpp index 296709d4b9..a51ac5ca33 100644 --- a/extensions/common/glm/detail/_noise.hpp +++ b/extensions/common/glm/detail/_noise.hpp @@ -1,136 +1,136 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_noise.hpp -/// @date 2013-12-24 / 2013-12-24 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "../vec2.hpp" -#include "../vec3.hpp" -#include "../vec4.hpp" -#include "../common.hpp" - -namespace glm{ -namespace detail -{ - template - GLM_FUNC_QUALIFIER T mod289(T const & x) - { - return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0); - } - - template - GLM_FUNC_QUALIFIER T permute(T const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } - - template - GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) - { - return mod289(((x * static_cast(34)) + static_cast(1)) * x); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType permute(vecType const & x) - { - return mod289(((x * T(34)) + T(1)) * x); - } -*/ - template - GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } - - template - GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) - { - return T(1.79284291400159) - T(0.85373472095314) * r; - } -*/ - - template - GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } - - template - GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } -/* - template class vecType> - GLM_FUNC_QUALIFIER vecType fade(vecType const & t) - { - return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); - } -*/ -}//namespace detail -}//namespace glm - +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_noise.hpp +/// @date 2013-12-24 / 2013-12-24 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "../vec2.hpp" +#include "../vec3.hpp" +#include "../vec4.hpp" +#include "../common.hpp" + +namespace glm{ +namespace detail +{ + template + GLM_FUNC_QUALIFIER T mod289(T const & x) + { + return x - floor(x * static_cast(1.0) / static_cast(289.0)) * static_cast(289.0); + } + + template + GLM_FUNC_QUALIFIER T permute(T const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec2 permute(tvec2 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec3 permute(tvec3 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } + + template + GLM_FUNC_QUALIFIER tvec4 permute(tvec4 const & x) + { + return mod289(((x * static_cast(34)) + static_cast(1)) * x); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType permute(vecType const & x) + { + return mod289(((x * T(34)) + T(1)) * x); + } +*/ + template + GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec2 taylorInvSqrt(tvec2 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec3 taylorInvSqrt(tvec3 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } + + template + GLM_FUNC_QUALIFIER tvec4 taylorInvSqrt(tvec4 const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType taylorInvSqrt(vecType const & r) + { + return T(1.79284291400159) - T(0.85373472095314) * r; + } +*/ + + template + GLM_FUNC_QUALIFIER tvec2 fade(tvec2 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER tvec3 fade(tvec3 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } + + template + GLM_FUNC_QUALIFIER tvec4 fade(tvec4 const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +/* + template class vecType> + GLM_FUNC_QUALIFIER vecType fade(vecType const & t) + { + return (t * t * t) * (t * (t * T(6) - T(15)) + T(10)); + } +*/ +}//namespace detail +}//namespace glm + diff --git a/extensions/common/glm/detail/_swizzle.hpp b/extensions/common/glm/detail/_swizzle.hpp index 04ea55bcf2..43ca2c6154 100644 --- a/extensions/common/glm/detail/_swizzle.hpp +++ b/extensions/common/glm/detail/_swizzle.hpp @@ -1,833 +1,833 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_swizzle.hpp -/// @date 2006-04-20 / 2011-02-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -namespace glm{ -namespace detail -{ - // Internal class for implementing swizzle operators - template - struct _swizzle_base0 - { - typedef T value_type; - - protected: - GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } - - // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. - // The size 1 buffer is assumed to aligned to the actual members so that the - // elem() - char _buffer[1]; - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } - }; - - template - struct _swizzle_base1 : public _swizzle_base0 - { - GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } - }; - - // Internal class for implementing swizzle operators - /* - Template parameters: - - ValueType = type of scalar values (e.g. float, double) - VecType = class the swizzle is applies to (e.g. tvec3) - N = number of components in the vector (e.g. 3) - E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec - - DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles - containing duplicate elements so that they cannot be used as r-values). - */ - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) - { - for (int i = 0; i < N; ++i) - (*this)[i] = t; - return *this; - } - - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } - }; - _apply_op(that, op()); - return *this; - } - - GLM_FUNC_QUALIFIER void operator -= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator += (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator *= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER void operator /= (const VecType& that) - { - struct op { - GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } - }; - _apply_op(that, op()); - } - - GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - - protected: - template - GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) - { - // Make a copy of the data in this == &that. - // The copier should optimize out the copy in cases where the function is - // properly inlined and the copy is not necessary. - ValueType t[N]; - for (int i = 0; i < N; ++i) - t[i] = that[i]; - for (int i = 0; i < N; ++i) - op( (*this)[i], t[i] ); - } - }; - - // Specialization for swizzles containing duplicate elements. These cannot be modified. - template - struct _swizzle_base2 : public _swizzle_base1 - { - typedef VecType vec_type; - typedef ValueType value_type; - - struct Stub {}; - GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } - - GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const - { - const int offset_dst[4] = { E0, E1, E2, E3 }; - return this->elem(offset_dst[i]); - } - }; - - template - struct _swizzle : public _swizzle_base2 - { - typedef _swizzle_base2 base_type; - - using base_type::operator=; - - GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } - }; - -// -// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros -// -#define _GLM_SWIZZLE_TEMPLATE1 template -#define _GLM_SWIZZLE_TEMPLATE2 template -#define _GLM_SWIZZLE_TYPE1 _swizzle -#define _GLM_SWIZZLE_TYPE2 _swizzle - -// -// Wrapper for a binary operator (e.g. u.yy + v.zy) -// -#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return a() OPERAND b(); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) -// -#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ - { \ - return a() OPERAND b; \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return a OPERAND b(); \ - } - -// -// Macro for wrapping a function taking one argument (e.g. abs()) -// -#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ - { \ - return FUNCTION(a()); \ - } - -// -// Macro for wrapping a function taking two vector arguments (e.g. dot()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a(), b()); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ - { \ - return FUNCTION(a(), b); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ - { \ - return FUNCTION(a, b()); \ - } - -// -// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). -// -#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ - _GLM_SWIZZLE_TEMPLATE2 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a(), b(), c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ - { \ - return FUNCTION(a(), b, c); \ - } \ - _GLM_SWIZZLE_TEMPLATE1 \ - GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ - { \ - return FUNCTION(a, b(), c); \ - } - -}//namespace detail -}//namespace glm - -namespace glm -{ - namespace detail - { - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) - _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) - } - - // - // Swizzles are distinct types from the unswizzled type. The below macros will - // provide template specializations for the swizzle types for the given functions - // so that the compiler does not have any ambiguity to choosing how to handle - // the function. - // - // The alternative is to use the operator()() when calling the function in order - // to explicitly convert the swizzled type to the unswizzled type. - // - - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); - //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); - - //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); - //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); - //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); -} - -#define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; - -#define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0,E1) \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; - -#define _GLM_SWIZZLE3_2_MEMBERS(T, P, V, E0,E1,E2) \ - struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; - -#define _GLM_SWIZZLE3_3_MEMBERS(T, P, V ,E0,E1,E2) \ - struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE3_4_MEMBERS(T, P, V, E0,E1,E2) \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; - -#define _GLM_SWIZZLE4_2_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ - struct { detail::_swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ - struct { detail::_swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ - struct { detail::_swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ - struct { detail::_swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; - -#define _GLM_SWIZZLE4_3_MEMBERS(T,P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; - -#define _GLM_SWIZZLE4_4_MEMBERS(T, P, V, E0,E1,E2,E3) \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ - struct { detail::_swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_swizzle.hpp +/// @date 2006-04-20 / 2011-02-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +namespace glm{ +namespace detail +{ + // Internal class for implementing swizzle operators + template + struct _swizzle_base0 + { + typedef T value_type; + + protected: + GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } + + // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. + // The size 1 buffer is assumed to aligned to the actual members so that the + // elem() + char _buffer[1]; + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } + }; + + template + struct _swizzle_base1 : public _swizzle_base0 + { + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + }; + + // Internal class for implementing swizzle operators + /* + Template parameters: + + ValueType = type of scalar values (e.g. float, double) + VecType = class the swizzle is applies to (e.g. tvec3) + N = number of components in the vector (e.g. 3) + E0...3 = what index the n-th element of this swizzle refers to in the unswizzled vec + + DUPLICATE_ELEMENTS = 1 if there is a repeated element, 0 otherwise (used to specialize swizzles + containing duplicate elements so that they cannot be used as r-values). + */ + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; + + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) + { + for (int i = 0; i < N; ++i) + (*this)[i] = t; + return *this; + } + + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } + }; + _apply_op(that, op()); + return *this; + } + + GLM_FUNC_QUALIFIER void operator -= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator += (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator *= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER void operator /= (const VecType& that) + { + struct op { + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } + }; + _apply_op(that, op()); + } + + GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + + protected: + template + GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) + { + // Make a copy of the data in this == &that. + // The copier should optimize out the copy in cases where the function is + // properly inlined and the copy is not necessary. + ValueType t[N]; + for (int i = 0; i < N; ++i) + t[i] = that[i]; + for (int i = 0; i < N; ++i) + op( (*this)[i], t[i] ); + } + }; + + // Specialization for swizzles containing duplicate elements. These cannot be modified. + template + struct _swizzle_base2 : public _swizzle_base1 + { + typedef VecType vec_type; + typedef ValueType value_type; + + struct Stub {}; + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } + + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const + { + const int offset_dst[4] = { E0, E1, E2, E3 }; + return this->elem(offset_dst[i]); + } + }; + + template + struct _swizzle : public _swizzle_base2 + { + typedef _swizzle_base2 base_type; + + using base_type::operator=; + + GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } + }; + +// +// To prevent the C++ syntax from getting entirely overwhelming, define some alias macros +// +#define _GLM_SWIZZLE_TEMPLATE1 template +#define _GLM_SWIZZLE_TEMPLATE2 template +#define _GLM_SWIZZLE_TYPE1 _swizzle +#define _GLM_SWIZZLE_TYPE2 _swizzle + +// +// Wrapper for a binary operator (e.g. u.yy + v.zy) +// +#define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return a() OPERAND b(); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } + +// +// Wrapper for a operand between a swizzle and a binary (e.g. 1.0f - u.xyz) +// +#define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ + { \ + return a() OPERAND b; \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return a OPERAND b(); \ + } + +// +// Macro for wrapping a function taking one argument (e.g. abs()) +// +#define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ + { \ + return FUNCTION(a()); \ + } + +// +// Macro for wrapping a function taking two vector arguments (e.g. dot()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a(), b()); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ + { \ + return FUNCTION(a(), b); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + { \ + return FUNCTION(a, b()); \ + } + +// +// Macro for wrapping a function take 2 vec arguments followed by a scalar (e.g. mix()). +// +#define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ + _GLM_SWIZZLE_TEMPLATE2 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a(), b(), c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ + { \ + return FUNCTION(a(), b, c); \ + } \ + _GLM_SWIZZLE_TEMPLATE1 \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + { \ + return FUNCTION(a, b(), c); \ + } + +}//namespace detail +}//namespace glm + +namespace glm +{ + namespace detail + { + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(+) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(-) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(*) + _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(/) + } + + // + // Swizzles are distinct types from the unswizzled type. The below macros will + // provide template specializations for the swizzle types for the given functions + // so that the compiler does not have any ambiguity to choosing how to handle + // the function. + // + // The alternative is to use the operator()() when calling the function in order + // to explicitly convert the swizzled type to the unswizzled type. + // + + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, abs); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acos); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, acosh); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, all); + //_GLM_SWIZZLE_FUNCTION_1_ARGS(vec_type, any); + + //_GLM_SWIZZLE_FUNCTION_2_ARGS(value_type, dot); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, cross); + //_GLM_SWIZZLE_FUNCTION_2_ARGS(vec_type, step); + //_GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(vec_type, mix); +} + +#define _GLM_SWIZZLE2_2_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<2, T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2, T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2, T, P, V, 1,1,-1,-2> E1 ## E1; }; + +#define _GLM_SWIZZLE2_3_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<3,T, P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T, P, V, 1,1,1,-1> E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE2_4_MEMBERS(T, P, V, E0,E1) \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; + +#define _GLM_SWIZZLE3_2_MEMBERS(T, P, V, E0,E1,E2) \ + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; + +#define _GLM_SWIZZLE3_3_MEMBERS(T, P, V ,E0,E1,E2) \ + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE3_4_MEMBERS(T, P, V, E0,E1,E2) \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4,T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; + +#define _GLM_SWIZZLE4_2_MEMBERS(T, P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<2,T, P, V, 0,0,-1,-2> E0 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 0,1,-1,-2> E0 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 0,2,-1,-2> E0 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 0,3,-1,-2> E0 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 1,0,-1,-2> E1 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 1,1,-1,-2> E1 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 1,2,-1,-2> E1 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 1,3,-1,-2> E1 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 2,0,-1,-2> E2 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 2,1,-1,-2> E2 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 2,2,-1,-2> E2 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 2,3,-1,-2> E2 ## E3; }; \ + struct { detail::_swizzle<2,T, P, V, 3,0,-1,-2> E3 ## E0; }; \ + struct { detail::_swizzle<2,T, P, V, 3,1,-1,-2> E3 ## E1; }; \ + struct { detail::_swizzle<2,T, P, V, 3,2,-1,-2> E3 ## E2; }; \ + struct { detail::_swizzle<2,T, P, V, 3,3,-1,-2> E3 ## E3; }; + +#define _GLM_SWIZZLE4_3_MEMBERS(T,P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<3,T,P, V, 0,0,0,-1> E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,1,-1> E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,2,-1> E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,0,3,-1> E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,0,-1> E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,1,-1> E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,2,-1> E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,1,3,-1> E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,0,-1> E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,1,-1> E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,2,-1> E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,2,3,-1> E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,0,-1> E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,1,-1> E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,2,-1> E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 0,3,3,-1> E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,0,-1> E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,1,-1> E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,2,-1> E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,0,3,-1> E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,0,-1> E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,1,-1> E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,2,-1> E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,1,3,-1> E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,0,-1> E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,1,-1> E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,2,-1> E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,2,3,-1> E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,0,-1> E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,1,-1> E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,2,-1> E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 1,3,3,-1> E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,0,-1> E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,1,-1> E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,2,-1> E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,0,3,-1> E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,0,-1> E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,1,-1> E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,2,-1> E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,1,3,-1> E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,0,-1> E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,1,-1> E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,2,-1> E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,2,3,-1> E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,0,-1> E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,1,-1> E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,2,-1> E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 2,3,3,-1> E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,0,-1> E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,1,-1> E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,2,-1> E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,0,3,-1> E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,0,-1> E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,1,-1> E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,2,-1> E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,1,3,-1> E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,0,-1> E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,1,-1> E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,2,-1> E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,2,3,-1> E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,0,-1> E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,1,-1> E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,2,-1> E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<3,T,P, V, 3,3,3,-1> E3 ## E3 ## E3; }; + +#define _GLM_SWIZZLE4_4_MEMBERS(T, P, V, E0,E1,E2,E3) \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,0> E0 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,1> E0 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,2> E0 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,0,3> E0 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,0> E0 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,1> E0 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,2> E0 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,1,3> E0 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,0> E0 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,1> E0 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,2> E0 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,2,3> E0 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,0> E0 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,1> E0 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,2> E0 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,0,3,3> E0 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,0> E0 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,1> E0 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,2> E0 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,0,3> E0 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,0> E0 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,1> E0 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,2> E0 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,1,3> E0 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,0> E0 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,1> E0 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,2> E0 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,2,3> E0 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,0> E0 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,1> E0 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,2> E0 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,1,3,3> E0 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,0> E0 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,1> E0 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,2> E0 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,0,3> E0 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,0> E0 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,1> E0 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,2> E0 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,1,3> E0 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,0> E0 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,1> E0 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,2> E0 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,2,3> E0 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,0> E0 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,1> E0 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,2> E0 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,2,3,3> E0 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,0> E0 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,1> E0 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,2> E0 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,0,3> E0 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,0> E0 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,1> E0 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,2> E0 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,1,3> E0 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,0> E0 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,1> E0 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,2> E0 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,2,3> E0 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,0> E0 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,1> E0 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,2> E0 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 0,3,3,3> E0 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,0> E1 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,1> E1 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,2> E1 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,0,3> E1 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,0> E1 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,1> E1 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,2> E1 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,1,3> E1 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,0> E1 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,1> E1 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,2> E1 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,2,3> E1 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,0> E1 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,1> E1 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,2> E1 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,0,3,3> E1 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,0> E1 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,1> E1 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,2> E1 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,0,3> E1 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,0> E1 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,1> E1 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,2> E1 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,1,3> E1 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,0> E1 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,1> E1 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,2> E1 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,2,3> E1 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,0> E1 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,1> E1 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,2> E1 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,1,3,3> E1 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,0> E1 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,1> E1 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,2> E1 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,0,3> E1 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,0> E1 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,1> E1 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,2> E1 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,1,3> E1 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,0> E1 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,1> E1 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,2> E1 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,2,3> E1 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,0> E1 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,1> E1 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,2> E1 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,2,3,3> E1 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,0> E1 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,1> E1 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,2> E1 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,0,3> E1 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,0> E1 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,1> E1 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,2> E1 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,1,3> E1 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,0> E1 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,1> E1 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,2> E1 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,2,3> E1 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,0> E1 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,1> E1 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,2> E1 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 1,3,3,3> E1 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,0> E2 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,1> E2 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,2> E2 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,0,3> E2 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,0> E2 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,1> E2 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,2> E2 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,1,3> E2 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,0> E2 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,1> E2 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,2> E2 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,2,3> E2 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,0> E2 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,1> E2 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,2> E2 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,0,3,3> E2 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,0> E2 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,1> E2 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,2> E2 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,0,3> E2 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,0> E2 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,1> E2 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,2> E2 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,1,3> E2 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,0> E2 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,1> E2 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,2> E2 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,2,3> E2 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,0> E2 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,1> E2 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,2> E2 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,1,3,3> E2 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,0> E2 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,1> E2 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,2> E2 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,0,3> E2 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,0> E2 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,1> E2 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,2> E2 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,1,3> E2 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,0> E2 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,1> E2 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,2> E2 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,2,3> E2 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,0> E2 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,1> E2 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,2> E2 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,2,3,3> E2 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,0> E2 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,1> E2 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,2> E2 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,0,3> E2 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,0> E2 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,1> E2 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,2> E2 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,1,3> E2 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,0> E2 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,1> E2 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,2> E2 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,2,3> E2 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,0> E2 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,1> E2 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,2> E2 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 2,3,3,3> E2 ## E3 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,0> E3 ## E0 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,1> E3 ## E0 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,2> E3 ## E0 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,0,3> E3 ## E0 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,0> E3 ## E0 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,1> E3 ## E0 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,2> E3 ## E0 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,1,3> E3 ## E0 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,0> E3 ## E0 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,1> E3 ## E0 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,2> E3 ## E0 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,2,3> E3 ## E0 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,0> E3 ## E0 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,1> E3 ## E0 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,2> E3 ## E0 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,0,3,3> E3 ## E0 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,0> E3 ## E1 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,1> E3 ## E1 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,2> E3 ## E1 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,0,3> E3 ## E1 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,0> E3 ## E1 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,1> E3 ## E1 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,2> E3 ## E1 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,1,3> E3 ## E1 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,0> E3 ## E1 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,1> E3 ## E1 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,2> E3 ## E1 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,2,3> E3 ## E1 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,0> E3 ## E1 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,1> E3 ## E1 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,2> E3 ## E1 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,1,3,3> E3 ## E1 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,0> E3 ## E2 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,1> E3 ## E2 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,2> E3 ## E2 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,0,3> E3 ## E2 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,0> E3 ## E2 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,1> E3 ## E2 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,2> E3 ## E2 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,1,3> E3 ## E2 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,0> E3 ## E2 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,1> E3 ## E2 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,2> E3 ## E2 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,2,3> E3 ## E2 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,0> E3 ## E2 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,1> E3 ## E2 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,2> E3 ## E2 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,2,3,3> E3 ## E2 ## E3 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,0> E3 ## E3 ## E0 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,1> E3 ## E3 ## E0 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,2> E3 ## E3 ## E0 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,0,3> E3 ## E3 ## E0 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,0> E3 ## E3 ## E1 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,1> E3 ## E3 ## E1 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,2> E3 ## E3 ## E1 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,1,3> E3 ## E3 ## E1 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,0> E3 ## E3 ## E2 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,1> E3 ## E3 ## E2 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,2> E3 ## E3 ## E2 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,2,3> E3 ## E3 ## E2 ## E3; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,0> E3 ## E3 ## E3 ## E0; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,1> E3 ## E3 ## E3 ## E1; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,2> E3 ## E3 ## E3 ## E2; }; \ + struct { detail::_swizzle<4, T, P, V, 3,3,3,3> E3 ## E3 ## E3 ## E3; }; diff --git a/extensions/common/glm/detail/_swizzle_func.hpp b/extensions/common/glm/detail/_swizzle_func.hpp index 4dbb783c5b..5601d910fe 100644 --- a/extensions/common/glm/detail/_swizzle_func.hpp +++ b/extensions/common/glm/detail/_swizzle_func.hpp @@ -1,725 +1,725 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_swizzle_func.hpp -/// @date 2011-10-16 / 2011-10-16 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - SWIZZLED_TYPE A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - SWIZZLED_TYPE A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - SWIZZLED_TYPE A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B); \ - } - -#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C); \ - } - -#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ - template \ - SWIZZLED_TYPE CLASS_TYPE::A ## B ## C ## D() CONST \ - { \ - return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ - } - -#define GLM_MUTABLE - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, x, y) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, r, g) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, s, t) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC2(valType, detail::vec2, detail::ref2) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, p) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) - -#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, C) - -#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B) - -#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C, A) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) - -//GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC2(valType, detail::vec2, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) - -#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C) \ - GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D) - -#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C) \ - GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, D) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, A) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, B) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, C) \ - GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ - GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) - -#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ - GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) - -//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_swizzle_func.hpp +/// @date 2011-10-16 / 2011-10-16 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ + SWIZZLED_TYPE A ## B() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B); \ + } + +#define GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ + SWIZZLED_TYPE A ## B ## C() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C); \ + } + +#define GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ + SWIZZLED_TYPE A ## B ## C ## D() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ + } + +#define GLM_SWIZZLE_GEN_VEC2_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B); \ + } + +#define GLM_SWIZZLE_GEN_VEC3_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B ## C() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C); \ + } + +#define GLM_SWIZZLE_GEN_VEC4_ENTRY_DEF(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B, C, D) \ + template \ + SWIZZLED_TYPE CLASS_TYPE::A ## B ## C ## D() CONST \ + { \ + return SWIZZLED_TYPE(this->A, this->B, this->C, this->D); \ + } + +#define GLM_MUTABLE + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, x, y) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, r, g) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, s, t) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC2(valType, detail::vec2, detail::ref2) + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) + +#define GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_REF3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, x, y, z) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, r, g, b) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, s, t, p) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC3(valType, detail::vec3, detail::ref2, detail::ref3) + +#define GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, A, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, B, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, GLM_MUTABLE, D, C) + +#define GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B) + +#define GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , B, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , C, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, , D, B, C, A) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_REF4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) + +#define GLM_SWIZZLE_GEN_REF_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ + GLM_SWIZZLE_GEN_REF_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) + +//GLM_SWIZZLE_GEN_REF_FROM_VEC4(valType, detail::vec4, detail::ref2, detail::ref3, detail::ref4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC2_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC2(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC2_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC2(valType, detail::vec2, detail::vec2, detail::vec3, detail::vec4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC3_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC3(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC3_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC3(valType, detail::vec3, detail::vec2, detail::vec3, detail::vec4) + +#define GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C) \ + GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D) + +#define GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C) \ + GLM_SWIZZLE_GEN_VEC3_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D) + +#define GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, A, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, B, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, C, D, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, A, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, B, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, C, D, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, A, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, B, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, C, D) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, A) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, B) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, C) \ + GLM_SWIZZLE_GEN_VEC4_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, const, D, D, D, D) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC2_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC3_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC3_TYPE, A, B, C, D) \ + GLM_SWIZZLE_GEN_VEC4_FROM_VEC4_SWIZZLE(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC4_TYPE, A, B, C, D) + +#define GLM_SWIZZLE_GEN_VEC_FROM_VEC4(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, x, y, z, w) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, r, g, b, a) \ + GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q) + +//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4) diff --git a/extensions/common/glm/detail/_vectorize.hpp b/extensions/common/glm/detail/_vectorize.hpp index 1deff1e080..3a8a466689 100644 --- a/extensions/common/glm/detail/_vectorize.hpp +++ b/extensions/common/glm/detail/_vectorize.hpp @@ -1,160 +1,160 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/_vectorize.hpp -/// @date 2011-10-14 / 2011-10-14 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "type_vec1.hpp" -#include "type_vec2.hpp" -#include "type_vec3.hpp" -#include "type_vec4.hpp" - -namespace glm{ -namespace detail -{ - template class vecType> - struct functor1{}; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec1 call(R (*Func) (T x), tvec1 const & v) - { - return tvec1(Func(v.x)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec2 call(R (*Func) (T x), tvec2 const & v) - { - return tvec2(Func(v.x), Func(v.y)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec3 call(R (*Func) (T x), tvec3 const & v) - { - return tvec3(Func(v.x), Func(v.y), Func(v.z)); - } - }; - - template - struct functor1 - { - GLM_FUNC_QUALIFIER static tvec4 call(R (*Func) (T x), tvec4 const & v) - { - return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); - } - }; - - template class vecType> - struct functor2{}; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, tvec1 const & b) - { - return tvec1(Func(a.x, b.x)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, tvec2 const & b) - { - return tvec2(Func(a.x, b.x), Func(a.y, b.y)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, tvec3 const & b) - { - return tvec3(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); - } - }; - - template - struct functor2 - { - GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, tvec4 const & b) - { - return tvec4(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); - } - }; - - template class vecType> - struct functor2_vec_sca{}; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, T b) - { - return tvec1(Func(a.x, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, T b) - { - return tvec2(Func(a.x, b), Func(a.y, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, T b) - { - return tvec3(Func(a.x, b), Func(a.y, b), Func(a.z, b)); - } - }; - - template - struct functor2_vec_sca - { - GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, T b) - { - return tvec4(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); - } - }; -}//namespace detail -}//namespace glm +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/detail/_vectorize.hpp +/// @date 2011-10-14 / 2011-10-14 +/// @author Christophe Riccio +/////////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "type_vec1.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + +namespace glm{ +namespace detail +{ + template class vecType> + struct functor1{}; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec1 call(R (*Func) (T x), tvec1 const & v) + { + return tvec1(Func(v.x)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec2 call(R (*Func) (T x), tvec2 const & v) + { + return tvec2(Func(v.x), Func(v.y)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec3 call(R (*Func) (T x), tvec3 const & v) + { + return tvec3(Func(v.x), Func(v.y), Func(v.z)); + } + }; + + template + struct functor1 + { + GLM_FUNC_QUALIFIER static tvec4 call(R (*Func) (T x), tvec4 const & v) + { + return tvec4(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); + } + }; + + template class vecType> + struct functor2{}; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, tvec1 const & b) + { + return tvec1(Func(a.x, b.x)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, tvec2 const & b) + { + return tvec2(Func(a.x, b.x), Func(a.y, b.y)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, tvec3 const & b) + { + return tvec3(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); + } + }; + + template + struct functor2 + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, tvec4 const & b) + { + return tvec4(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); + } + }; + + template class vecType> + struct functor2_vec_sca{}; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec1 call(T (*Func) (T x, T y), tvec1 const & a, T b) + { + return tvec1(Func(a.x, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec2 call(T (*Func) (T x, T y), tvec2 const & a, T b) + { + return tvec2(Func(a.x, b), Func(a.y, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec3 call(T (*Func) (T x, T y), tvec3 const & a, T b) + { + return tvec3(Func(a.x, b), Func(a.y, b), Func(a.z, b)); + } + }; + + template + struct functor2_vec_sca + { + GLM_FUNC_QUALIFIER static tvec4 call(T (*Func) (T x, T y), tvec4 const & a, T b) + { + return tvec4(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); + } + }; +}//namespace detail +}//namespace glm diff --git a/extensions/common/glm/detail/dummy.cpp b/extensions/common/glm/detail/dummy.cpp index 88d8f3b807..a64ce33075 100644 --- a/extensions/common/glm/detail/dummy.cpp +++ b/extensions/common/glm/detail/dummy.cpp @@ -1,232 +1,232 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/core/dummy.cpp -/// @date 2011-01-19 / 2011-06-15 -/// @author Christophe Riccio -/// -/// GLM is a header only library. There is nothing to compile. -/// dummy.cpp exist only a wordaround for CMake file. -/////////////////////////////////////////////////////////////////////////////////// - -#define GLM_MESSAGES -#include -#include -#include - -struct material -{ - glm::vec4 emission; // Ecm - glm::vec4 ambient; // Acm - glm::vec4 diffuse; // Dcm - glm::vec4 specular; // Scm - float shininess; // Srm -}; - -struct light -{ - glm::vec4 ambient; // Acli - glm::vec4 diffuse; // Dcli - glm::vec4 specular; // Scli - glm::vec4 position; // Ppli - glm::vec4 halfVector; // Derived: Hi - glm::vec3 spotDirection; // Sdli - float spotExponent; // Srli - float spotCutoff; // Crli - // (range: [0.0,90.0], 180.0) - float spotCosCutoff; // Derived: cos(Crli) - // (range: [1.0,0.0],-1.0) - float constantAttenuation; // K0 - float linearAttenuation; // K1 - float quadraticAttenuation;// K2 -}; - - -// Sample 1 -#include // glm::vec3 -#include // glm::cross, glm::normalize - -glm::vec3 computeNormal -( - glm::vec3 const & a, - glm::vec3 const & b, - glm::vec3 const & c -) -{ - return glm::normalize(glm::cross(c - a, b - a)); -} - -typedef unsigned int GLuint; -#define GL_FALSE 0 -void glUniformMatrix4fv(GLuint, int, int, float*){} - -// Sample 2 -#include // glm::vec3 -#include // glm::vec4, glm::ivec4 -#include // glm::mat4 -#include // glm::translate, glm::rotate, glm::scale, glm::perspective -#include // glm::value_ptr -void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate) -{ - glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); - glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); - glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); - glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); - glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); - glm::mat4 MVP = Projection * View * Model; - glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); -} - -// Sample 3 -#include // glm::vec2 -#include // glm::packUnorm2x16 -#include // glm::uint -#include // glm::i8vec2, glm::i32vec2 -std::size_t const VertexCount = 4; -// Float quad geometry -std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2); -glm::vec2 const PositionDataF32[VertexCount] = -{ - glm::vec2(-1.0f,-1.0f), - glm::vec2( 1.0f,-1.0f), - glm::vec2( 1.0f, 1.0f), - glm::vec2(-1.0f, 1.0f) - }; -// Half-float quad geometry -std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint); -glm::uint const PositionDataF16[VertexCount] = -{ - glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))), - glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f))) -}; -// 8 bits signed integer quad geometry -std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2); -glm::i8vec2 const PositionDataI8[VertexCount] = -{ - glm::i8vec2(-1,-1), - glm::i8vec2( 1,-1), - glm::i8vec2( 1, 1), - glm::i8vec2(-1, 1) -}; -// 32 bits signed integer quad geometry -std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2); -glm::i32vec2 const PositionDataI32[VertexCount] = -{ - glm::i32vec2 (-1,-1), - glm::i32vec2 ( 1,-1), - glm::i32vec2 ( 1, 1), - glm::i32vec2 (-1, 1) -}; - -struct intersection -{ - glm::vec4 position; - glm::vec3 normal; -}; - -/* -// Sample 4 -#include // glm::vec3 -#include // glm::normalize, glm::dot, glm::reflect -#include // glm::pow -#include // glm::vecRand3 -glm::vec3 lighting -( - intersection const & Intersection, - material const & Material, - light const & Light, - glm::vec3 const & View -) -{ - glm::vec3 Color(0.0f); - glm::vec3 LightVertor(glm::normalize( - Light.position - Intersection.position + - glm::vecRand3(0.0f, Light.inaccuracy)); - - if(!shadow(Intersection.position, Light.position, LightVertor)) - { - float Diffuse = glm::dot(Intersection.normal, LightVector); - if(Diffuse <= 0.0f) - return Color; - if(Material.isDiffuse()) - Color += Light.color() * Material.diffuse * Diffuse; - if(Material.isSpecular()) - { - glm::vec3 Reflect(glm::reflect( - glm::normalize(-LightVector), - glm::normalize(Intersection.normal))); - float Dot = glm::dot(Reflect, View); - float Base = Dot > 0.0f ? Dot : 0.0f; - float Specular = glm::pow(Base, Material.exponent); - Color += Material.specular * Specular; - } - } - return Color; -} -*/ - - -template class vecType> -T normalizeDotA(vecType const & x, vecType const & y) -{ - return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); -} - -#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class - -template -T normalizeDotB(vecType const & x, vecType const & y) -{ - return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); -} - -template -typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) -{ - return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); -} - -int main() -{ - glm::vec1 o(1); - glm::vec2 a(1); - glm::vec3 b(1); - glm::vec4 c(1); - - glm::quat q; - glm::dualquat p; - - glm::mat4 m(1); - - float a0 = normalizeDotA(a, a); - float b0 = normalizeDotB(b, b); - float c0 = normalizeDotC(c, c); - - return 0; -} +/////////////////////////////////////////////////////////////////////////////////// +/// OpenGL Mathematics (glm.g-truc.net) +/// +/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) +/// Permission is hereby granted, free of charge, to any person obtaining a copy +/// of this software and associated documentation files (the "Software"), to deal +/// in the Software without restriction, including without limitation the rights +/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +/// copies of the Software, and to permit persons to whom the Software is +/// furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included in +/// all copies or substantial portions of the Software. +/// +/// Restrictions: +/// By making use of the Software for military purposes, you choose to make +/// a Bunny unhappy. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +/// THE SOFTWARE. +/// +/// @ref core +/// @file glm/core/dummy.cpp +/// @date 2011-01-19 / 2011-06-15 +/// @author Christophe Riccio +/// +/// GLM is a header only library. There is nothing to compile. +/// dummy.cpp exist only a wordaround for CMake file. +/////////////////////////////////////////////////////////////////////////////////// + +#define GLM_MESSAGES +#include +#include +#include + +struct material +{ + glm::vec4 emission; // Ecm + glm::vec4 ambient; // Acm + glm::vec4 diffuse; // Dcm + glm::vec4 specular; // Scm + float shininess; // Srm +}; + +struct light +{ + glm::vec4 ambient; // Acli + glm::vec4 diffuse; // Dcli + glm::vec4 specular; // Scli + glm::vec4 position; // Ppli + glm::vec4 halfVector; // Derived: Hi + glm::vec3 spotDirection; // Sdli + float spotExponent; // Srli + float spotCutoff; // Crli + // (range: [0.0,90.0], 180.0) + float spotCosCutoff; // Derived: cos(Crli) + // (range: [1.0,0.0],-1.0) + float constantAttenuation; // K0 + float linearAttenuation; // K1 + float quadraticAttenuation;// K2 +}; + + +// Sample 1 +#include // glm::vec3 +#include // glm::cross, glm::normalize + +glm::vec3 computeNormal +( + glm::vec3 const & a, + glm::vec3 const & b, + glm::vec3 const & c +) +{ + return glm::normalize(glm::cross(c - a, b - a)); +} + +typedef unsigned int GLuint; +#define GL_FALSE 0 +void glUniformMatrix4fv(GLuint, int, int, float*){} + +// Sample 2 +#include // glm::vec3 +#include // glm::vec4, glm::ivec4 +#include // glm::mat4 +#include // glm::translate, glm::rotate, glm::scale, glm::perspective +#include // glm::value_ptr +void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate) +{ + glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); + glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate)); + glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); + glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); + glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f)); + glm::mat4 MVP = Projection * View * Model; + glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP)); +} + +// Sample 3 +#include // glm::vec2 +#include // glm::packUnorm2x16 +#include // glm::uint +#include // glm::i8vec2, glm::i32vec2 +std::size_t const VertexCount = 4; +// Float quad geometry +std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2); +glm::vec2 const PositionDataF32[VertexCount] = +{ + glm::vec2(-1.0f,-1.0f), + glm::vec2( 1.0f,-1.0f), + glm::vec2( 1.0f, 1.0f), + glm::vec2(-1.0f, 1.0f) + }; +// Half-float quad geometry +std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint); +glm::uint const PositionDataF16[VertexCount] = +{ + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))), + glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f))) +}; +// 8 bits signed integer quad geometry +std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2); +glm::i8vec2 const PositionDataI8[VertexCount] = +{ + glm::i8vec2(-1,-1), + glm::i8vec2( 1,-1), + glm::i8vec2( 1, 1), + glm::i8vec2(-1, 1) +}; +// 32 bits signed integer quad geometry +std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2); +glm::i32vec2 const PositionDataI32[VertexCount] = +{ + glm::i32vec2 (-1,-1), + glm::i32vec2 ( 1,-1), + glm::i32vec2 ( 1, 1), + glm::i32vec2 (-1, 1) +}; + +struct intersection +{ + glm::vec4 position; + glm::vec3 normal; +}; + +/* +// Sample 4 +#include // glm::vec3 +#include // glm::normalize, glm::dot, glm::reflect +#include // glm::pow +#include // glm::vecRand3 +glm::vec3 lighting +( + intersection const & Intersection, + material const & Material, + light const & Light, + glm::vec3 const & View +) +{ + glm::vec3 Color(0.0f); + glm::vec3 LightVertor(glm::normalize( + Light.position - Intersection.position + + glm::vecRand3(0.0f, Light.inaccuracy)); + + if(!shadow(Intersection.position, Light.position, LightVertor)) + { + float Diffuse = glm::dot(Intersection.normal, LightVector); + if(Diffuse <= 0.0f) + return Color; + if(Material.isDiffuse()) + Color += Light.color() * Material.diffuse * Diffuse; + if(Material.isSpecular()) + { + glm::vec3 Reflect(glm::reflect( + glm::normalize(-LightVector), + glm::normalize(Intersection.normal))); + float Dot = glm::dot(Reflect, View); + float Base = Dot > 0.0f ? Dot : 0.0f; + float Specular = glm::pow(Base, Material.exponent); + Color += Material.specular * Specular; + } + } + return Color; +} +*/ + + +template class vecType> +T normalizeDotA(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template class + +template +T normalizeDotB(vecType const & x, vecType const & y) +{ + return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y)); +} + +template +typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b) +{ + return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b)); +} + +int main() +{ + glm::vec1 o(1); + glm::vec2 a(1); + glm::vec3 b(1); + glm::vec4 c(1); + + glm::quat q; + glm::dualquat p; + + glm::mat4 m(1); + + float a0 = normalizeDotA(a, a); + float b0 = normalizeDotB(b, b); + float c0 = normalizeDotC(c, c); + + return 0; +} diff --git a/extensions/common/glm/detail/func_common.hpp b/extensions/common/glm/detail/func_common.hpp index da28007b05..a9d01bd042 100644 --- a/extensions/common/glm/detail/func_common.hpp +++ b/extensions/common/glm/detail/func_common.hpp @@ -1,456 +1,456 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// Restrictions: -/// By making use of the Software for military purposes, you choose to make -/// a Bunny unhappy. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref core -/// @file glm/detail/func_common.hpp -/// @date 2008-03-08 / 2010-01-26 -/// @author Christophe Riccio -/// -/// @see
GLSL 4.20.8 specification, section 8.3 Common Functions -/// -/// @defgroup core_func_common Common functions -/// @ingroup core -/// -/// These all operate component-wise. The description is per component. -/////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "setup.hpp" -#include "precision.hpp" -#include "type_int.hpp" -#include "_fixes.hpp" - -namespace glm -{ - /// @addtogroup core_func_common - /// @{ - - /// Returns x if x >= 0; otherwise, it returns -x. - /// - /// @tparam genType floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL abs man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType abs(genType x); - - template class vecType> - GLM_FUNC_DECL vecType abs(vecType const & x); - - /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. - /// - /// @tparam genType Floating-point or signed integer; scalar or vector types. - /// - /// @see GLSL sign man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType sign(vecType const & x); - - /// Returns a value equal to the nearest integer that is less then or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL floor man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType floor(vecType const & x); - - /// Returns a value equal to the nearest integer to x - /// whose absolute value is not larger than the absolute value of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL trunc man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType trunc(vecType const & x); - - /// Returns a value equal to the nearest integer to x. - /// The fraction 0.5 will round in a direction chosen by the - /// implementation, presumably the direction that is fastest. - /// This includes the possibility that round(x) returns the - /// same value as roundEven(x) for all values of x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL round man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType round(vecType const & x); - - /// Returns a value equal to the nearest integer to x. - /// A fractional part of 0.5 will round toward the nearest even - /// integer. (Both 3.5 and 4.5 for x will return 4.0.) - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL roundEven man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// @see New round to even technique - template class vecType> - GLM_FUNC_DECL vecType roundEven(vecType const & x); - - /// Returns a value equal to the nearest integer - /// that is greater than or equal to x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL ceil man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template class vecType> - GLM_FUNC_DECL vecType ceil(vecType const & x); - - /// Return x - floor(x). - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL fract man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType fract(genType x); - - template class vecType> - GLM_FUNC_DECL vecType fract(vecType const & x); - - /// Modulus. Returns x - y * floor(x / y) - /// for each component in x using the floating point value y. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL mod man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType mod(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType mod(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType mod(vecType const & x, vecType const & y); - - /// Returns the fractional part of x and sets i to the integer - /// part (as a whole number floating point value). Both the - /// return value and the output parameter will have the same - /// sign as x. - /// - /// @tparam genType Floating-point scalar or vector types. - /// - /// @see GLSL modf man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType modf(genType x, genType & i); - - /// Returns y if y < x; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL min man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType min(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType min(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType min(vecType const & x, vecType const & y); - - /// Returns y if x < y; otherwise, it returns x. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL max man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType max(genType x, genType y); - - template class vecType> - GLM_FUNC_DECL vecType max(vecType const & x, T y); - - template class vecType> - GLM_FUNC_DECL vecType max(vecType const & x, vecType const & y); - - /// Returns min(max(x, minVal), maxVal) for each component in x - /// using the floating-point values minVal and maxVal. - /// - /// @tparam genType Floating-point or integer; scalar or vector types. - /// - /// @see GLSL clamp man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal); - - template class vecType> - GLM_FUNC_DECL vecType clamp(vecType const & x, T minVal, T maxVal); - - template class vecType> - GLM_FUNC_DECL vecType clamp(vecType const & x, vecType const & minVal, vecType const & maxVal); - - /// If genTypeU is a floating scalar or vector: - /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of - /// x and y using the floating-point value a. - /// The value for a is not restricted to the range [0, 1]. - /// - /// If genTypeU is a boolean scalar or vector: - /// Selects which vector each returned component comes - /// from. For a component of that is false, the - /// corresponding component of x is returned. For a - /// component of a that is true, the corresponding - /// component of y is returned. Components of x and y that - /// are not selected are allowed to be invalid floating point - /// values and will have no effect on the results. Thus, this - /// provides different functionality than - /// genType mix(genType x, genType y, genType(a)) - /// where a is a Boolean vector. - /// - /// @see GLSL mix man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - /// - /// @param[in] x Value to interpolate. - /// @param[in] y Value to interpolate. - /// @param[in] a Interpolant. - /// - /// @tparam genTypeT Floating point scalar or vector. - /// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT. - /// - /// @code - /// #include - /// ... - /// float a; - /// bool b; - /// glm::dvec3 e; - /// glm::dvec3 f; - /// glm::vec4 g; - /// glm::vec4 h; - /// ... - /// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors. - /// glm::vec4 s = glm::mix(g, h, b); // Teturns g or h; - /// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second. - /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. - /// @endcode - template class vecType> - GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, vecType const & a); - - template class vecType> - GLM_FUNC_DECL vecType mix(vecType const & x, vecType const & y, U a); - - template - GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a); - - /// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType. - /// - /// @see GLSL step man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template - GLM_FUNC_DECL genType step(genType edge, genType x); - - /// Returns 0.0 if x < edge, otherwise it returns 1.0. - /// - /// @see GLSL step man page - /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template