diff --git a/addons/fcs/CfgOptics.hpp b/addons/fcs/CfgOptics.hpp index c9704081f9..91f83dd6f6 100644 --- a/addons/fcs/CfgOptics.hpp +++ b/addons/fcs/CfgOptics.hpp @@ -35,13 +35,6 @@ class RscInGameUI { }; }; }; - class RscOptics_LaserDesignator { - class CA_IGUI_elements_group: RscControlsGroup { - class controls { - MACRO_RANGEFINDER - }; - }; - }; class RscWeaponRangeFinderMAAWS { class CA_IGUI_elements_group: RscControlsGroup { class controls { diff --git a/addons/laser/CfgVehicles.hpp b/addons/laser/CfgVehicles.hpp index f4e2ed42ab..23eb00c37c 100644 --- a/addons/laser/CfgVehicles.hpp +++ b/addons/laser/CfgVehicles.hpp @@ -4,30 +4,17 @@ class CfgVehicles { class LaserTarget: All { // @TODO: Changing the model and simulation hides it, but THEN IT DOESNT SPAWN WTF!? model = "\A3\Weapons_F\empty.p3d"; - simulation = "nvmarker"; - nvTarget = 1; - //simulation = "laserTarget"; - //threat[] = {0,0,0}; + destrType = "DestructNo"; + simulation = "house"; + class EventHandlers { init = QUOTE(_this call FUNC(laser_init)); }; - - diffuse[] = {0,0,0}; - ambient[] = {0,0,0}; - brightness = 0; - name = "pozicni blik"; - drawLight = 0; - drawLightSize = 0; - drawLightCenterSize = 0; - activeLight = 0; - blinking = 0; - dayLight = 0; - onlyInNvg = 0; - useFlare = 0; }; // Visual laserTarget override class ACE_LaserTarget_Visual : LaserTarget { - //model = "\A3\Weapons_f\laserTgt.p3d"; + simulation = "LaserTarget"; + model = "\A3\Weapons_f\laserTgt.p3d"; }; }; \ No newline at end of file diff --git a/addons/laser/RscInGameUI.hpp b/addons/laser/RscInGameUI.hpp index 457d320520..d87136c960 100644 --- a/addons/laser/RscInGameUI.hpp +++ b/addons/laser/RscInGameUI.hpp @@ -1 +1,144 @@ -// TODO: RscOptics_LaserDesignator for laser code designation \ No newline at end of file +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)"; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/addons/laser/XEH_post_init.sqf b/addons/laser/XEH_post_init.sqf index fb189d5041..f868ef9895 100644 --- a/addons/laser/XEH_post_init.sqf +++ b/addons/laser/XEH_post_init.sqf @@ -2,3 +2,4 @@ ["laser_laserOn", {_this call DFUNC(handleLaserOn)}] call EFUNC(common,addEventHandler); ["laser_laserOff", {_this call DFUNC(handleLaserOff)}] call EFUNC(common,addEventHandler); + diff --git a/addons/laser/XEH_pre_init.sqf b/addons/laser/XEH_pre_init.sqf index e160a533f2..de56274759 100644 --- a/addons/laser/XEH_pre_init.sqf +++ b/addons/laser/XEH_pre_init.sqf @@ -11,6 +11,8 @@ PREP(findStrongestRay); PREP(translateToModelSpace); PREP(translateToWeaponSpace); +PREP(onLaserDesignatorDraw); + PREP(seekerFindLaserSpot); PREP(laserOn); PREP(laserOff); diff --git a/addons/laser/config.cpp b/addons/laser/config.cpp index 3f430619ef..ad368cdc2d 100644 --- a/addons/laser/config.cpp +++ b/addons/laser/config.cpp @@ -12,4 +12,5 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgVehicles.hpp" -#include "CfgWeapons.hpp" \ No newline at end of file +#include "CfgWeapons.hpp" +#include "RscInGameUI.hpp" \ No newline at end of file diff --git a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf index 161364c0f2..10d5f1e1b6 100644 --- a/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf +++ b/addons/laser/functions/fnc_drawVisibleLaserTargets.sqf @@ -1 +1,9 @@ -// @TODO: This is to draw the actual LaserTarget positions to utilize for laser shooting. \ No newline at end of file +// This is a debug function for displaying visible lasers for ourselves +#include "script_component.hpp" + +diag_log text format["[ACE]: Laser Emitter Dump"]; + +{ + diag_log text format[" %1", _x]; + diag_log text format[" %2", HASH_GET(GVAR(laserEmitters), _x)]; +} forEach GVAR(laserEmitters) select 0; \ No newline at end of file diff --git a/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf b/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf new file mode 100644 index 0000000000..7f8537ab9b --- /dev/null +++ b/addons/laser/functions/fnc_onLaserDesignatorDraw.sqf @@ -0,0 +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); +}; \ No newline at end of file diff --git a/addons/laser/script_component.hpp b/addons/laser/script_component.hpp index 2be1e9e14b..77369ead96 100644 --- a/addons/laser/script_component.hpp +++ b/addons/laser/script_component.hpp @@ -12,4 +12,11 @@ #include "\z\ace\Addons\main\script_macros.hpp" -#define FIREMODE_DIRECT_LOAL 1 \ No newline at end of file +#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 diff --git a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf index 400bf21756..e0c835814e 100644 --- a/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf +++ b/addons/laser_selfdesignate/functions/fnc_laserHudDesignateOn.sqf @@ -43,8 +43,8 @@ FUNC(laserHudDesignatePFH) = { _turretInfo = [_vehicle, _gunnerInfo select 1] call EFUNC(common,getTurretDirection); _povPos = _turretInfo select 0; - _laserCode = (vehicle ACE_player) getVariable[QGVAR(currentCode), ACE_DEFAULT_LASER_CODE]; - _waveLength = (vehicle ACE_player) getVariable[QGVAR(currentWaveLength), ACE_DEFAULT_LASER_WAVELENGTH]; + _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); @@ -73,9 +73,9 @@ if(!GVAR(active)) then { TRACE_1("Activating laser", ""); // Get the self-designation variables, or use defaults - _laserCode = (vehicle ACE_player) getVariable[QGVAR(currentCode), ACE_DEFAULT_LASER_CODE]; - _waveLength = (vehicle ACE_player) getVariable[QGVAR(currentWaveLength), ACE_DEFAULT_LASER_WAVELENGTH]; - _beamSpread = (vehicle ACE_player) getVariable[QGVAR(currentBeamSpread), ACE_DEFAULT_LASER_BEAMSPREAD]; + _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);