Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch - Add New Watch #661

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions addons/watch/CfgSounds.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class CfgSounds {
class GVAR(watchAlarm) {
name = QGVAR(watchAlarm);
sound[] =
{
QPATHTOF(audio\watchAlarm.ogg),
5,
1,
10
};
titles[] = {};
};
class GVAR(watchVibrate) {
name = QGVAR(watchVibrate);
sound[] =
{
QPATHTOF(audio\watchVibrate.ogg),
5,
1,
10
};
titles[] = {};
};
};
7 changes: 7 additions & 0 deletions addons/watch/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@ class CfgWeapons {
displayName = CSTRING(STSDisplayName);
picture = QPATHTOF(UI\watch_sts.paa);
};
class KAT_Ranger: ItemWatch {
ACE_hideItemType = "Watch";
author = "Mazinski";
descriptionShort = CSTRING(RangerDescription);
displayName = CSTRING(RangerDisplayName);
picture = QPATHTOF(UI\RangerWatchFace.paa);
};
};
137 changes: 137 additions & 0 deletions addons/watch/RscTitles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,141 @@ class RscTitles
};
};
};
class KAT_Ranger
{
idd = 22935;
enableSimulation = 1;
movingEnable = 0;
fadeIn=0;
fadeOut=1;
duration = 10e10;
onLoad = "uiNamespace setVariable ['KAT_Ranger', _this select 0];";
class controls
{
class RangerImage: RscPicture
{
idc = 22800;
text = "\x\kat\addons\watch\UI\RangerWatchFace.paa";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15.07));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20));
w = QUOTE(FRAME_W(28));
h = QUOTE(FRAME_H(28));
};
class RangerTime: RscText
{
idc = 22806;
style = ST_RIGHT;
shadow = 0;
font = "EtelkaMonospacePro";
text = "22:22:22"; //--- ToDo: Localize;
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(4.7));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(5.9));
w = QUOTE(FRAME_W(7.5));
h = QUOTE(FRAME_H(4));
colorBackground[] = {0,0,0,0};
colorText[] = {0.8,0.8,0.8,0.9};
sizeEx = QUOTE(FRAME_H(1.9));
};
class RangerTimer: RscText
{
idc = 22807;
style = ST_RIGHT;
valign = "middle";
shadow = 0;
font = "EtelkaMonospacePro";
text = ""; //--- ToDo: Localize;
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(24.6));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(7.5));
w = QUOTE(FRAME_W(3));
h = QUOTE(FRAME_H(1.5));
colorBackground[] = {0,0,0,0};
colorText[] = {0.8,0.8,0.8,0.9};
sizeEx = QUOTE(FRAME_H(1.8));
};
class RangerAltitude: RscText
{
idc = 22808;
style = ST_RIGHT;
valign = "middle";
shadow = 0;
font = "EtelkaMonospacePro";
text = "1000";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(5.5));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(7.5));
w = QUOTE(FRAME_W(4));
h = QUOTE(FRAME_H(1.5));
colorBackground[] = {0,0,0,0};
colorText[] = {0.8,0.8,0.8,0.9};
sizeEx = QUOTE(FRAME_H(1.8));
};
class RangerHR: RscText
{
idc = 22809;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "EtelkaMonospacePro";
text = "111";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(4.3));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(10.1));
w = QUOTE(FRAME_W(4));
h = QUOTE(FRAME_H(1.5));
colorBackground[] = {0,0,0,0};
colorText[] = {0.8,0.8,0.8,0.9};
sizeEx = QUOTE(FRAME_H(1.4));
};
class RangerO2: RscText
{
idc = 22810;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "EtelkaMonospacePro";
text = "97";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(1.2));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(10.1));
w = QUOTE(FRAME_W(3));
h = QUOTE(FRAME_H(1.5));
colorBackground[] = {0,0,0,0};
colorText[] = {0.8,0.8,0.8,0.9};
sizeEx = QUOTE(FRAME_H(1.4));
};
class RangerWatchMinute: RscPicture
{
idc = 22802;
text = "\x\kat\addons\watch\UI\RangerWatchMinute.paa";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20));
w = QUOTE(FRAME_W(28));
h = QUOTE(FRAME_H(28));
};
class RangerWatchHour: RangerWatchMinute
{
idc = 22803;
text = "\x\kat\addons\watch\UI\RangerWatchHour.paa";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20));
w = QUOTE(FRAME_W(28));
h = QUOTE(FRAME_H(28));
};
class RangerWatchSecond: RangerWatchMinute
{
idc = 22804;
text = "\x\kat\addons\watch\UI\RangerWatchSecond.paa";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20));
w = QUOTE(FRAME_W(28));
h = QUOTE(FRAME_H(28));
};
class RangerWatchCaps: RangerImage
{
idc = 22805;
text = "\x\kat\addons\watch\UI\RangerWatchCaps.paa";
x = QUOTE(SAFEZONE_X_RIGHTEDGE - FRAME_W(25) - FRAME_W(15.07));
y = QUOTE(SAFEZONE_Y_LOWEDGE - FRAME_H(20));
w = QUOTE(FRAME_W(28));
h = QUOTE(FRAME_H(28));
};
};
};
};
Binary file added addons/watch/UI/RangerWatchCaps.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchCompass.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchDarkSheet.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchFace.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchHour.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchMinute.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchNVGSheet.paa
Binary file not shown.
Binary file added addons/watch/UI/RangerWatchSecond.paa
Binary file not shown.
7 changes: 6 additions & 1 deletion addons/watch/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
PREP(closeWatchTimer);
PREP(handleRespawn);
PREP(hideKWatch);
PREP(hideCWatch);
PREP(hideSWatch);
PREP(hideRWatch);
PREP(init);
PREP(showKWatch);
PREP(showCWatch);
PREP(showSWatch);
PREP(showSWatch);
PREP(showRWatch);
112 changes: 89 additions & 23 deletions addons/watch/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,107 @@

if (!hasInterface) exitWith {};

["KAT Watch", QGVAR(showKatmin), "Show Katmin", {
[QGVAR(closeWatchTimer), LINKFUNC(closeWatchTimer)] call CBA_fnc_addEventHandler;
[QEGVAR(misc,handleRespawn), LINKFUNC(handleRespawn)] call CBA_fnc_addEventHandler;

[QGVAR(playWatchTone), {
params ["_unit", "_tone"];
_unit say3D [_tone, 5];
}] call CBA_fnc_addEventHandler;

["KAT Watch", QGVAR(showKatmin), CSTRING(ShowKATWatch_Setting), {
// Conditions: canInteract
if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_Katmin' in assignedItems ACE_player)}) exitWith { false };
if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith))) exitWith { false };

private _return = false;

switch true do{
case (('KAT_Katmin' in assignedItems ACE_player)): {
_return = true;

if !(GETMVAR(GVAR(KatminActive),false)) then {
[ACE_player] call FUNC(showKWatch);
} else {
call FUNC(hideKWatch);
};
};
case (('KAT_Cavmin' in assignedItems ACE_player)): {
_return = true;

if !(GETMVAR(GVAR(CavminActive),false)) then {
[ACE_player] call FUNC(showCWatch);
} else {
call FUNC(hideCWatch);
};
};
case (('KAT_STS' in assignedItems ACE_player)): {
_return = true;

if !(GETMVAR(GVAR(KatminActive),false)) then {
[ACE_player] call FUNC(showKWatch);
} else {
call FUNC(hideKWatch);
if !(GETMVAR(GVAR(STSActive),false)) then {
[ACE_player] call FUNC(showSWatch);
} else {
call FUNC(hideSWatch);
};
};
case (('KAT_Ranger' in assignedItems ACE_player)): {
_return = true;

if !(GETMVAR(GVAR(RangerActive),false)) then {
[ACE_player] call FUNC(showRWatch);
} else {
call FUNC(hideRWatch);
};
};
};

true
_return
}, { 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 };
["KAT Watch", QGVAR(increaseTimer), CSTRING(AddTimer_Setting), {
if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_Ranger' in assignedItems ACE_player)}) exitWith { false };

if !(GETMVAR(GVAR(CavminActive),false)) then {
[ACE_player] call FUNC(showCWatch);
} else {
call FUNC(hideCWatch);
if !(GETMVAR(GVAR(RangerActive),false)) exitWith { false };

private _timerLength = ACE_player getVariable [QGVAR(rangerTimer), 0];

if (_timerLength < 999) then {
ACE_player setVariable [QGVAR(rangerTimer), ((_timerLength + 15) min 999), false];
};

true
}, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind;
}, { false }, [38, [false, false, true]], 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 };
["KAT Watch", QGVAR(decreaseTimer), CSTRING(SubtractTimer_Setting), {
if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_Ranger' in assignedItems ACE_player)}) exitWith { false };

if !(GETMVAR(GVAR(RangerActive),false)) exitWith { false };

private _timerLength = ACE_player getVariable [QGVAR(rangerTimer), 0];

if !(GETMVAR(GVAR(STSActive),false)) then {
[ACE_player] call FUNC(showSWatch);
} else {
call FUNC(hideSWatch);
if (_timerLength > 0) then {
ACE_player setVariable [QGVAR(rangerTimer), ((_timerLength - 15) max 0), false];
};

true
}, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind;
}, { false }, [36, [false, false, true]], false] call CBA_fnc_addKeybind;

["KAT Watch", QGVAR(startTimer), CSTRING(StartStopTimer_Setting), {
if (!([ACE_player, objNull, ["isNotEscorting", "isNotInside"]] call ACEFUNC(common,canInteractWith)) || {!('KAT_Ranger' in assignedItems ACE_player)}) exitWith { false };

private _timerLength = ACE_player getVariable [QGVAR(rangerTimer), 0];
private _timerActive = ACE_player getVariable [QGVAR(rangerStart), false];

if (_timerLength > 0) then {
if (_timerActive) then {
ACE_player setVariable [QGVAR(rangerStart), false, false];
} else {
if !(GETMVAR(GVAR(RangerActive),false)) then {
[QGVAR(closeWatchTimer), [ACE_player], ACE_player] call CBA_fnc_targetEvent;
};

ACE_player setVariable [QGVAR(rangerStart), true, false];
};
};

true
}, { false }, [37, [false, false, true]], false] call CBA_fnc_addKeybind;
Binary file added addons/watch/audio/watchAlarm.ogg
Binary file not shown.
Loading
Loading