Skip to content

Commit

Permalink
Watch - Add KATMIN Exercise Watch (#578)
Browse files Browse the repository at this point in the history
**When merged this pull request will:**
- Adds watch which can monitor temperature, barometric pressure, heart
rate, and SpO2

- [x] Add ability to switch between mmHg/hPA and F/C

### IMPORTANT

- [Development Guidelines](https://ace3.acemod.org/wiki/development/)
are read, understood and applied.
- Title of this PR uses our standard template `Component -
Add|Fix|Improve|Change|Make|Remove {changes}`.

---------

Co-authored-by: MiszczuZPolski <[email protected]>
  • Loading branch information
mazinskihenry and MiszczuZPolski authored Aug 29, 2024
1 parent e35ecb2 commit df80908
Show file tree
Hide file tree
Showing 18 changed files with 520 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/watch/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x\kat\addons\watch

11 changes: 11 additions & 0 deletions addons/watch/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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));
};
};
10 changes: 10 additions & 0 deletions addons/watch/CfgWeapons.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CfgWeapons {
class ItemWatch;
class KAT_Katmin: ItemWatch {
ACE_hideItemType = "Watch";
author = "Mazinski";
descriptionShort = CSTRING(KatminDescription);
displayName = CSTRING(KatminDisplayName);
picture = QPATHTOF(UI\watch_katmin.paa);
};
};
194 changes: 194 additions & 0 deletions addons/watch/RscTitles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#define KAT_WATCH_GRID_WAbs (((safezoneW / safezoneH) min 0.7))
#define KAT_WATCH_GRID_HAbs ((((safezoneW / safezoneH) min 1.2) / 1.6))
#define KAT_WATCH_GRID_W ((((safeZoneW / safeZoneH) min 0.7) / 40))
#define KAT_WATCH_GRID_H (((((safeZoneW / safeZoneH) min 1.2) / 1.2) / 25))
#define KAT_WATCH_GRID_X ((safeZoneX + (safeZoneW - ((safeZoneW / safeZoneH) min 1.2)) / 11))
#define KAT_WATCH_GRID_Y ((safeZoneY + (safeZoneH - (((safeZoneW / safeZoneH) min 1.2) / 1.2)) / 0.8))

#define KAT_POS_H(N) ((N) * KAT_WATCH_GRID_H)

#define ST_LEFT 0
#define ST_CENTER 2
#define ST_RIGHT 1

class RscText;
class RscPicture;
class RscButton;
class RscTitles
{
class KAT_Katmin
{
idd = 19935;
enableSimulation = 1;
movingEnable = 0;
fadeIn=0;
fadeOut=1;
duration = 10e10;
onLoad = "uiNamespace setVariable ['KAT_Katmin', _this select 0];";
class controls
{
class KatminImage: RscPicture
{
idc = 19800;
text = "\x\kat\addons\watch\UI\watch_katmin.paa";
x = "0.0328437 * safezoneW + safezoneX";
y = "0.652 * safezoneH + safezoneY";
w = "0.225 * safezoneW";
h = "0.4 * safezoneH";
};
class KatminIcon: KatminImage
{
idc = 19802;
text = "\x\kat\addons\watch\UI\watch_icon.paa";
};
class KatminSun: KatminImage
{
idc = 19803;
text = "\x\kat\addons\watch\UI\watch_sun.paa";
show = 0;
};
class KatminOvercast: KatminImage
{
idc = 19804;
text = "\x\kat\addons\watch\UI\watch_overcast.paa";
show = 0;
};
class KatminRain: KatminImage
{
idc = 19805;
text = "\x\kat\addons\watch\UI\watch_rain.paa";
show = 0;
};
class KatminCompass: KatminImage
{
idc = 19806;
text = "\x\kat\addons\watch\UI\watch_katmin_direction.paa";
};
class KatminTime: RscText
{
idc = 22000;
style = ST_CENTER;
shadow = 0;
font = "PuristaBold";
text = "12:00"; //--- ToDo: Localize;
x = "0.104 * safezoneW + safezoneX";
y = "0.8328 * safezoneH + safezoneY";
w = "0.061875 * safezoneW";
h = "0.033 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(2));
};
class KatminMonth: RscText
{
idc = 22001;
style = ST_RIGHT;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "JAN"; //--- ToDo: Localize;
x = "0.157316 * safezoneW + safezoneX";
y = "0.8394 * safezoneH + safezoneY";
w = "0.0257812 * safezoneW";
h = "0.013 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(0.8));
};
class KatminDay: RscText
{
idc = 22002;
style = ST_RIGHT;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "01"; //--- ToDo: Localize;
x = "0.157316 * safezoneW + safezoneX";
y = "0.8525 * safezoneH + safezoneY";
w = "0.0257812 * safezoneW";
h = "0.013 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(0.8));
};
class KatminBaro: RscText
{
idc = 22003;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "760"; //--- ToDo: Localize;
x = "0.158625 * safezoneW + safezoneX";
y = "0.80844 * safezoneH + safezoneY";
w = "0.020625 * safezoneW";
h = "0.022 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(0.95));
};
class KatminHR: RscText
{
idc = 22004;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "80"; //--- ToDo: Localize;
x = "0.149375 * safezoneW + safezoneX";
y = "0.8732 * safezoneH + safezoneY";
w = "0.020625 * safezoneW";
h = "0.022 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(1.2));
};
class KatminO2: RscText
{
idc = 22005;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "97"; //--- ToDo: Localize;
x = "0.118469 * safezoneW + safezoneX";
y = "0.8732 * safezoneH + safezoneY";
w = "0.020625 * safezoneW";
h = "0.022 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(1.2));
};
class KatminTemp: RscText
{
idc = 22006;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "76F"; //--- ToDo: Localize;
x = "0.134937 * safezoneW + safezoneX";
y = "0.8094 * safezoneH + safezoneY";
w = "0.020625 * safezoneW";
h = "0.022 * safezoneH";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
sizeEx = QUOTE(KAT_POS_H(1));
};
class KatminAltitude: RscText
{
idc = 22007;
style = ST_CENTER;
valign = "middle";
shadow = 0;
font = "PuristaBold";
text = "1000";
x = "0.111219 * safezoneW + safezoneX";
y = "0.80844 * safezoneH + safezoneY";
w = "0.020625 * safezoneW";
h = "0.022 * safezoneH";
sizeEx = QUOTE(KAT_POS_H(0.95));
};
};
};
};
Binary file added addons/watch/UI/watch_icon.paa
Binary file not shown.
Binary file added addons/watch/UI/watch_katmin.paa
Binary file not shown.
Binary file added addons/watch/UI/watch_katmin_direction.paa
Binary file not shown.
Binary file added addons/watch/UI/watch_overcast.paa
Binary file not shown.
Binary file added addons/watch/UI/watch_rain.paa
Binary file not shown.
Binary file added addons/watch/UI/watch_sun.paa
Binary file not shown.
2 changes: 2 additions & 0 deletions addons/watch/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PREP(hideKWatch);
PREP(showKWatch);
16 changes: 16 additions & 0 deletions addons/watch/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "script_component.hpp"

if (!hasInterface) exitWith {};

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

if !(GETMVAR(GVAR(KatminActive),false)) then {
[ACE_player] call FUNC(showKWatch);
} else {
call FUNC(hideKWatch);
};

true
}, { false }, [24, [false, false, false]], false] call CBA_fnc_addKeybind;
38 changes: 38 additions & 0 deletions addons/watch/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

ADDON = true;

#define CBA_SETTINGS_CAT "KAT - ADV Medical: Watch"

[
QGVAR(temperatureUnit),
"LIST",
[LLSTRING(SETTING_TemperatureForm), LLSTRING(SETTING_TemperatureForm_Desc)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1], [LLSTRING(SETTING_TemperatureForm_Celcius), LLSTRING(SETTING_TemperatureForm_Fahrenheit)], 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(pressureUnit),
"LIST",
[LLSTRING(SETTING_PressureForm), LLSTRING(SETTING_PressureForm_Desc)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1], [LLSTRING(SETTING_PressureForm_mmHg), LLSTRING(SETTING_PressureForm_hPa)], 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(altitudeUnit),
"LIST",
[LLSTRING(SETTING_AltitudeForm), LLSTRING(SETTING_AltitudeForm_Desc)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1], [LLSTRING(SETTING_AltitudeForm_meters), LLSTRING(SETTING_AltitudeForm_feet)], 0],
true
] call CBA_Settings_fnc_init;
37 changes: 37 additions & 0 deletions addons/watch/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
requiredVersion = REQUIRED_VERSION;
units[] = { };
weapons[] = {
"KAT_Katmin"
};
magazines[] = { };
requiredAddons[] = {
"kat_main",
"ace_medical",
"ace_medical_ai",
"ace_medical_blood",
"ace_medical_damage",
"ace_medical_engine",
"ace_medical_feedback",
"ace_medical_gui",
"ace_medical_statemachine",
"ace_medical_status",
"ace_medical_treatment",
"ace_medical_vitals",
"ace_dogtags",
"cba_settings"
};
author = "Mazinski";
authors[] = {"Mazinski"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgWeapons.hpp"
#include "RscTitles.hpp"
19 changes: 19 additions & 0 deletions addons/watch/functions/fnc_hideKWatch.sqf
Original file line number Diff line number Diff line change
@@ -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(KatminActive) = false;
"KAT_Katmin" cutText ["","PLAIN",0,true];
Loading

0 comments on commit df80908

Please sign in to comment.