diff --git a/addons/watch/CfgWeapons.hpp b/addons/watch/CfgWeapons.hpp index dec68cac0..88d16c14b 100644 --- a/addons/watch/CfgWeapons.hpp +++ b/addons/watch/CfgWeapons.hpp @@ -7,4 +7,18 @@ class CfgWeapons { displayName = CSTRING(KatminDisplayName); picture = QPATHTOF(UI\watch_katmin.paa); }; + class KAT_Cavmin: ItemWatch { + ACE_hideItemType = "Watch"; + author = "Mazinski"; + descriptionShort = CSTRING(CavminDescription); + displayName = CSTRING(CavminDisplayName); + picture = QPATHTOF(UI\watch_cavmin.paa); + }; + class KAT_STS: ItemWatch { + ACE_hideItemType = "Watch"; + author = "Mazinski"; + descriptionShort = CSTRING(STSDescription); + displayName = CSTRING(STSDisplayName); + picture = QPATHTOF(UI\watch_sts.paa); + }; }; diff --git a/addons/watch/RscTitles.hpp b/addons/watch/RscTitles.hpp index 9d9806197..f2a7b6626 100644 --- a/addons/watch/RscTitles.hpp +++ b/addons/watch/RscTitles.hpp @@ -208,4 +208,214 @@ class RscTitles }; }; }; + class KAT_Cavmin + { + idd = 20935; + enableSimulation = 1; + movingEnable = 0; + fadeIn=0; + fadeOut=1; + duration = 10e10; + onLoad = "uiNamespace setVariable ['KAT_Cavmin', _this select 0];"; + class controls + { + class CavminImage: RscPicture + { + idc = 20800; + text = "\x\kat\addons\watch\UI\watch_cavmin.paa"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(18.5)); + w = QUOTE(FRAME_W(25)); + h = QUOTE(FRAME_H(25)); + }; + class CavminCompass: CavminImage + { + idc = 20802; + text = "\x\kat\addons\watch\UI\watch_cavmin_compass.paa"; + }; + class CavminOverlay: CavminImage + { + idc = 20803; + text = "\x\kat\addons\watch\UI\watch_cavmin_face.paa"; + }; + class CavminTime: RscText + { + idc = 20804; + style = ST_CENTER; + shadow = 0; + font = "EtelkaMonospacePro"; + text = "12:00"; //--- ToDo: Localize; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(6.2)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(5.7)); + w = QUOTE(FRAME_W(7.5)); + h = QUOTE(FRAME_H(4)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + sizeEx = QUOTE(FRAME_H(3)); + }; + class CavminHR: RscText + { + idc = 20805; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "EtelkaMonospaceProBold"; + text = "80"; //--- ToDo: Localize; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(7.2)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(9.1)); + w = QUOTE(FRAME_W(2.5)); + h = QUOTE(FRAME_H(1.5)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + sizeEx = QUOTE(FRAME_H(2)); + }; + class CavminAltitude: RscText + { + idc = 20806; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "EtelkaMonospaceProBold"; + text = "1000"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(0.3)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(9.1)); + w = QUOTE(FRAME_W(2.5)); + h = QUOTE(FRAME_H(1.5)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + sizeEx = QUOTE(FRAME_H(2)); + }; + class CavminBearing: RscText + { + idc = 20807; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "EtelkaMonospaceProBold"; + text = "1000"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(6.2)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(8.8)); + w = QUOTE(FRAME_W(7.5)); + h = QUOTE(FRAME_H(4)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,1}; + sizeEx = QUOTE(FRAME_H(2.5)); + }; + }; + }; + class KAT_sts + { + idd = 21935; + enableSimulation = 1; + movingEnable = 0; + fadeIn=0; + fadeOut=1; + duration = 10e10; + onLoad = "uiNamespace setVariable ['KAT_STS', _this select 0];"; + class controls + { + class STSImage: RscPicture + { + idc = 21800; + text = "\x\kat\addons\watch\UI\watch_sts.paa"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(18.5)); + w = QUOTE(FRAME_W(25)); + h = QUOTE(FRAME_H(25)); + }; + class StsBigAlt: STSImage + { + idc = 21802; + text = "\x\kat\addons\watch\UI\watch_sts_bigAlt.paa"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20.65)); + w = QUOTE(FRAME_W(25)); + h = QUOTE(FRAME_H(25)); + }; + class StsSmallAlt: StsBigAlt + { + idc = 21803; + text = "\x\kat\addons\watch\UI\watch_sts_smallAlt.paa"; + }; + class STSTime: RscText + { + idc = 21804; + style = ST_CENTER; + shadow = 0; + font = "PuristaSemibold"; + text = "12:00"; //--- ToDo: Localize; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(6.2)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(3.6)); + w = QUOTE(FRAME_W(7.5)); + h = QUOTE(FRAME_H(4)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,0.9}; + sizeEx = QUOTE(FRAME_H(2.5)); + }; + class STSHR: RscText + { + idc = 21805; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "PuristaMedium"; + text = "80"; //--- ToDo: Localize; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(8.2)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(6)); + w = QUOTE(FRAME_W(2.5)); + h = QUOTE(FRAME_H(1.5)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,0.9}; + sizeEx = QUOTE(FRAME_H(2)); + }; + class STSO2: RscText + { + idc = 21806; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "PuristaMedium"; + text = "1000"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(-0.6)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(6)); + w = QUOTE(FRAME_W(2.5)); + h = QUOTE(FRAME_H(1.5)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,0.9}; + sizeEx = QUOTE(FRAME_H(2)); + }; + class STSAltitude: RscText + { + idc = 21807; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "PuristaSemibold"; + text = "1000"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(6.3)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(13.4)); + w = QUOTE(FRAME_W(7.5)); + h = QUOTE(FRAME_H(4)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,0.9}; + sizeEx = QUOTE(FRAME_H(2.2)); + }; + class STSDescent: RscText + { + idc = 21808; + style = ST_CENTER; + valign = "middle"; + shadow = 0; + font = "PuristaSemibold"; + text = "0"; + x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(1)); + y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(11.1)); + w = QUOTE(FRAME_W(2.5)); + h = QUOTE(FRAME_H(1.7)); + colorBackground[] = {0,0,0,0}; + colorText[] = {1,1,1,0.9}; + sizeEx = QUOTE(FRAME_H(1)); + }; + }; + }; }; \ No newline at end of file diff --git a/addons/watch/UI/watch_cavmin.paa b/addons/watch/UI/watch_cavmin.paa new file mode 100644 index 000000000..000a84ad4 Binary files /dev/null and b/addons/watch/UI/watch_cavmin.paa differ diff --git a/addons/watch/UI/watch_cavmin_compass.paa b/addons/watch/UI/watch_cavmin_compass.paa new file mode 100644 index 000000000..0830e9e8a Binary files /dev/null and b/addons/watch/UI/watch_cavmin_compass.paa differ diff --git a/addons/watch/UI/watch_cavmin_face.paa b/addons/watch/UI/watch_cavmin_face.paa new file mode 100644 index 000000000..729324dde Binary files /dev/null and b/addons/watch/UI/watch_cavmin_face.paa differ diff --git a/addons/watch/UI/watch_sts.paa b/addons/watch/UI/watch_sts.paa new file mode 100644 index 000000000..62359c504 Binary files /dev/null and b/addons/watch/UI/watch_sts.paa differ diff --git a/addons/watch/UI/watch_sts_bigAlt.paa b/addons/watch/UI/watch_sts_bigAlt.paa new file mode 100644 index 000000000..cd01a0246 Binary files /dev/null and b/addons/watch/UI/watch_sts_bigAlt.paa differ diff --git a/addons/watch/UI/watch_sts_smallAlt.paa b/addons/watch/UI/watch_sts_smallAlt.paa new file mode 100644 index 000000000..f12fe67a1 Binary files /dev/null and b/addons/watch/UI/watch_sts_smallAlt.paa differ diff --git a/addons/watch/XEH_PREP.hpp b/addons/watch/XEH_PREP.hpp index 9ac1eb16d..7335c72c5 100644 --- a/addons/watch/XEH_PREP.hpp +++ b/addons/watch/XEH_PREP.hpp @@ -1,2 +1,6 @@ PREP(hideKWatch); -PREP(showKWatch); \ No newline at end of file +PREP(hideCWatch); +PREP(hideSWatch); +PREP(showKWatch); +PREP(showCWatch); +PREP(showSWatch); \ No newline at end of file diff --git a/addons/watch/XEH_postInit.sqf b/addons/watch/XEH_postInit.sqf index cfc39f94d..e065b019c 100644 --- a/addons/watch/XEH_postInit.sqf +++ b/addons/watch/XEH_postInit.sqf @@ -14,3 +14,29 @@ if (!hasInterface) exitWith {}; true }, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind; + +["KAT Cav Watch", QGVAR(showCavmin), "Show Cavmin", { + // Conditions: canInteract + if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_Cavmin' in assignedItems ACE_player)}) exitWith { false }; + + if !(GETMVAR(GVAR(CavminActive),false)) then { + [ACE_player] call FUNC(showCWatch); + } else { + call FUNC(hideCWatch); + }; + + true +}, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind; + +["KAT STS Watch", QGVAR(showSTS), "Show STS", { + // Conditions: canInteract + if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_STS' in assignedItems ACE_player)}) exitWith { false }; + + if !(GETMVAR(GVAR(STSActive),false)) then { + [ACE_player] call FUNC(showSWatch); + } else { + call FUNC(hideSWatch); + }; + + true +}, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind; diff --git a/addons/watch/config.cpp b/addons/watch/config.cpp index 630a14c34..8d171b1e6 100644 --- a/addons/watch/config.cpp +++ b/addons/watch/config.cpp @@ -6,7 +6,9 @@ class CfgPatches { requiredVersion = REQUIRED_VERSION; units[] = { }; weapons[] = { - "KAT_Katmin" + "KAT_Katmin", + "KAT_Cavmin", + "KAT_STS" }; magazines[] = { }; requiredAddons[] = { diff --git a/addons/watch/functions/fnc_hideCWatch.sqf b/addons/watch/functions/fnc_hideCWatch.sqf new file mode 100644 index 000000000..d111f2805 --- /dev/null +++ b/addons/watch/functions/fnc_hideCWatch.sqf @@ -0,0 +1,19 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet + * Modified: Mazinski + * Removes the KWatch from the screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call kat_watch_fnc_hideKWatch + * + * Public: No + */ +GVAR(CavminActive) = false; +"KAT_Cavmin" cutText ["","PLAIN",0,true]; \ No newline at end of file diff --git a/addons/watch/functions/fnc_hideSWatch.sqf b/addons/watch/functions/fnc_hideSWatch.sqf new file mode 100644 index 000000000..59a1faae6 --- /dev/null +++ b/addons/watch/functions/fnc_hideSWatch.sqf @@ -0,0 +1,19 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet + * Modified: Mazinski + * Removes the KWatch from the screen. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call kat_watch_fnc_hideKWatch + * + * Public: No + */ +GVAR(STSActive) = false; +"KAT_STS" cutText ["","PLAIN",0,true]; \ No newline at end of file diff --git a/addons/watch/functions/fnc_showCWatch.sqf b/addons/watch/functions/fnc_showCWatch.sqf new file mode 100644 index 000000000..9139a0b40 --- /dev/null +++ b/addons/watch/functions/fnc_showCWatch.sqf @@ -0,0 +1,94 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet + * Modified: Mazinski + * Displays the KWatch on screen. + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call kat_watch_fnc_showKWatch + * + * Public: Yes + */ + +params ["_unit"]; + +"KAT_Cavmin" cutRsc ["KAT_Cavmin", "PLAIN", 0, true]; + +if (isNull (uiNamespace getVariable ["KAT_Cavmin", displayNull])) exitWith {}; + +GVAR(CavminActive) = true; + +private _display = uiNamespace getVariable ["KAT_Cavmin", displayNull]; +private _background = _display displayCtrl 20800; +private _compass = _display displayCtrl 20802; +private _overlay = _display displayCtrl 20803; +private _time = _display displayCtrl 20804; +private _hr = _display displayCtrl 20805; +private _altitude = _display displayCtrl 20806; +private _bearing = _display displayCtrl 20807; + + +// We seperate this into two PFHs because the compass PFH needs to be run much faster in order to rotate smoothly, but vitals only need an update every second because thats how fast handleUnitVitals runs. +[{ + _this params ["_args", "_pfhID"]; + _args params ["_unit", "_compass", "_bearing"]; + + if !(GVAR(CavminActive)) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + _compass ctrlSetAngle [(linearConversion[0,360,(getDirVisual _unit),360,0]), 0.5, 0.5, true]; + _compass ctrlCommit 0.1; + + _bearing ctrlSetText (str(round(getDirVisual _unit))); +}, 0.05, [ + _unit, + _compass, + _bearing +]] call CBA_fnc_addPerFrameHandler; + +[{ + _this params ["_args", "_pfhID"]; + _args params ["_unit", "_time", "_hr", "_altitude"]; + + if !(GVAR(CavminActive)) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !(alive _unit) exitWith { + call FUNC(hideCWatch); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !("KAT_Cavmin" in assignedItems _unit) exitWith { + call FUNC(hideCWatch); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + private _hour = floor dayTime; + private _minute = floor ((dayTime - _hour) * 60); + + _time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); + + private _altitudeValue = (getPosASL _unit) select 2; + + if (GVAR(altitudeUnit) == 1) then { + _altitude ctrlSetText ([(_altitudeValue * 3.281), 1, 0] call CBA_fnc_formatNumber); + } else { + _altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber); + }; + + _hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber); + +}, 1, [ + _unit, + _time, + _hr, + _altitude +]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/watch/functions/fnc_showKWatch.sqf b/addons/watch/functions/fnc_showKWatch.sqf index 8312da2d8..5e45ff6f9 100644 --- a/addons/watch/functions/fnc_showKWatch.sqf +++ b/addons/watch/functions/fnc_showKWatch.sqf @@ -85,9 +85,9 @@ private _altitude = _display displayCtrl 22007; private _altitudeValue = (getPosASL _unit) select 2; if (GVAR(altitudeUnit) == 1) then { - _altitude ctrlSetText ([(_altitudeValue * 3.281), 1, 0] call CBA_fnc_formatNumber) + _altitude ctrlSetText ([(_altitudeValue * 3.281), 1, 0] call CBA_fnc_formatNumber); } else { - _altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber) + _altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber); }; if (GVAR(pressureUnit) == 1) then { diff --git a/addons/watch/functions/fnc_showSWatch.sqf b/addons/watch/functions/fnc_showSWatch.sqf new file mode 100644 index 000000000..073d06136 --- /dev/null +++ b/addons/watch/functions/fnc_showSWatch.sqf @@ -0,0 +1,125 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet + * Modified: Mazinski + * Displays the KWatch on screen. + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [player] call kat_watch_fnc_showKWatch + * + * Public: Yes + */ + +params ["_unit"]; + +"KAT_STS" cutRsc ["KAT_STS", "PLAIN", 0, true]; + +if (isNull (uiNamespace getVariable ["KAT_STS", displayNull])) exitWith {}; + +GVAR(STSActive) = true; + +private _display = uiNamespace getVariable ["KAT_STS", displayNull]; +private _background = _display displayCtrl 21800; +private _bigAlt = _display displayCtrl 21802; +private _smallAlt = _display displayCtrl 21803; +private _time = _display displayCtrl 21804; +private _hr = _display displayCtrl 21805; +private _o2 = _display displayCtrl 21806; +private _altitude = _display displayCtrl 21807; +private _descent = _display displayCtrl 21808; + +private _altitudeUnit = GVAR(altitudeUnit); + +// We seperate this into two PFHs because the compass PFH needs to be run much faster in order to rotate smoothly, but vitals only need an update every second because thats how fast handleUnitVitals runs. +[{ + _this params ["_args", "_pfhID"]; + _args params ["_unit", "_bigAlt", "_smallAlt", "_altitude", "_altitudeUnit"]; + + if !(GVAR(STSActive)) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + private _altitudeValue = round((getPosASL _unit) select 2); + + if (_altitudeUnit == 1) then { + _altitudeValue = _altitudeValue * 3.281; + _altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber); + } else { + _altitude ctrlSetText ([_altitudeValue, 1, 0] call CBA_fnc_formatNumber); + }; + + _smallAlt ctrlSetAngle [(linearConversion [0, 100, (_altitudeValue % 100), 0, 360, true]), 0.5, 0.5, true]; + _smallAlt ctrlCommit 0.1; + + _bigAlt ctrlSetAngle [(linearConversion [0, 10000, _altitudeValue, 0, 360, true]), 0.5, 0.5, true]; + _bigAlt ctrlCommit 0.1; + +}, 0.1, [ + _unit, + _bigAlt, + _smallAlt, + _altitude, + _altitudeUnit +]] call CBA_fnc_addPerFrameHandler; + +[{ + _this params ["_args", "_pfhID"]; + _args params ["_unit", "_oldHeight", "_prevTime", "_time", "_hr", "_o2", "_descent", "_altitudeUnit"]; + + if !(GVAR(STSActive)) exitWith { + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !(alive _unit) exitWith { + call FUNC(hideSWatch); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + if !("KAT_STS" in assignedItems _unit) exitWith { + call FUNC(hideSWatch); + _pfhID call CBA_fnc_removePerFrameHandler; + }; + + private _hour = floor dayTime; + private _minute = floor ((dayTime - _hour) * 60); + + _time ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); + + _hr ctrlSetText ([GET_HEART_RATE(_unit), 1, 0] call CBA_fnc_formatNumber); + _o2 ctrlSetText ([GET_SPO2(_unit), 1, 0] call CBA_fnc_formatNumber); + + private _curTime = CBA_missionTime; + private _timeDiff = _curTime - _prevTime; + + private _height = ((getPosASL _unit) select 2); + private _descentRate = if (_timeDiff > 0) then { + abs(floor((_height - _oldHeight) / _timeDiff)) + } else { + 0 + }; + + if (_altitudeUnit == 1) then { + _descentRate = _descentRate * 3.281; + _descent ctrlSetText format[LLSTRING(descentFt), _descentRate]; + } else { + _descent ctrlSetText format[LLSTRING(descentM), _descentRate]; + }; + + (_this select 0) set [1, _height]; + (_this select 0) set [2, _curTime]; +}, 0.5, [ + _unit, + floor ((getPosASL _unit) select 2), + CBA_missionTime, + _time, + _hr, + _o2, + _descent, + _altitudeUnit +]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/watch/stringtable.xml b/addons/watch/stringtable.xml index d2cf017dd..62ff6e530 100644 --- a/addons/watch/stringtable.xml +++ b/addons/watch/stringtable.xml @@ -85,5 +85,23 @@ Katmin K500 Katmin K500 + + Watch with Vital Monitoring Capabilities. Garry Owen! + + + Katmin Cavalry Limted + + + Watch with Vital Monitoring Capabilities. So Others May Live. + + + Katmin Jump Standard + + + %1ft/s + + + %1m/s +