Skip to content

Commit

Permalink
Merge pull request #20 from tuntematonjr/Development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tuntematonjr authored Oct 13, 2024
2 parents a70ab7d + d1e8bcc commit 557fa66
Show file tree
Hide file tree
Showing 56 changed files with 1,334 additions and 1,154 deletions.
6 changes: 3 additions & 3 deletions addons/briefingtime/XEH_postInit_client.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ if (isMultiplayer) then {

[{ !isNull findDisplay 53 || !isNull findDisplay 52 }, {
private _display = TUNUTI_FIND_MAPDISPLAY;
private _control = findDisplay _display ctrlCreate [QGVAR(timeText), 320001];
private _control = findDisplay _display ctrlCreate [QGVAR(timeText), TIME_TEXT_IDC];
uiNamespace setVariable [QGVAR(timeText), _control ];

_handle = [{
private _time = [GVAR(value), "M:SS"] call CBA_fnc_formatElapsedTime;
private _realTime = ((systemTime select 3) * 60 * 60) + ((systemTime select 4) * 60) + (systemTime select 5) + GVAR(value);
private _time = [GVAR(briefingTime), "M:SS"] call CBA_fnc_formatElapsedTime;
private _realTime = ((systemTime select 3) * 60 * 60) + ((systemTime select 4) * 60) + (systemTime select 5) + GVAR(briefingTime);
if (_realTime > 86400) then {
_realTime = _realTime - 86400;
};
Expand Down
6 changes: 3 additions & 3 deletions addons/briefingtime/XEH_postInit_server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ if (isMultiplayer) then {
if (GVAR(enable)) then {

_handle = [{
if (GVAR(value) > 0) then {
DEC(GVAR(value));
publicVariable QGVAR(value);
if (GVAR(briefingTime) > 0) then {
DEC(GVAR(briefingTime));
publicVariable QGVAR(briefingTime);
};

if (cba_missiontime > 0) then {
Expand Down
6 changes: 3 additions & 3 deletions addons/briefingtime/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ PREP_RECOMPILE_END;

[
QGVAR(valueSettings),
"SLIDER",
"TIME",
["Briefingtime", "How much there is briefing time at start"],
"Tun Utilities - Briefingtime",
[0, 30, 17, 0],
[0, 60, 17*60, 0],
1,
{
params ["_value"];
GVAR(value) = round _value * 60;
GVAR(briefingTime) = round _value;
},
true
] call CBA_fnc_addSetting;
Expand Down
27 changes: 15 additions & 12 deletions addons/briefingtime/briafingTime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class GVAR(timeText) : RscText
{
type = 0;
idc = 320001;
idc = TIME_TEXT_IDC;
x = "safeZoneX + safeZoneW * 0.403125";
y = "safeZoneY + safeZoneH * 0.00462963";
w = "safeZoneW * 0.2625";
Expand All @@ -14,7 +14,7 @@ class GVAR(timeText) : RscText
class GVAR(notificationBox) : GVAR(timeText)
{
type = 0;
idc = 320006;
idc = NOTIFICATION_BOX_IDC;
y = "safeZoneY + safeZoneH * 0.10462963";
h = "safeZoneH * 0.125";
style = 2+16;
Expand All @@ -23,13 +23,13 @@ class GVAR(notificationBox) : GVAR(timeText)

class GVAR(Time)
{
idd = 320000;
idd = TIME_IDD;
class ControlsBackground
{
class GVAR(background) : RscText
{
type = 0;
idc = 320000;
idc = BACKGROUND_IDC;
x = "safeZoneX + safeZoneW * 0.4140625";
y = "safeZoneY + safeZoneH * 0.43425926";
w = "safeZoneW * 0.171875";
Expand All @@ -45,32 +45,34 @@ class GVAR(Time)
class GVAR(timeSlider) : RscXSliderH
{
type = 43;
idc = 320003;
idc = SLIDER_IDC;
x = "safeZoneX + safeZoneW * 0.41875";
y = "safeZoneY + safeZoneH * 0.475";
w = "safeZoneW * 0.1625";
h = "safeZoneH * 0.02962963";
style = 1024;
onSliderPosChanged = QUOTE(LINKFUNC(SliderPosUpdated));

onSliderPosChanged = QUOTE(_this call FUNC(SliderPosUpdated));
sliderStep = 1;
sliderRange[] = {0, 30};
};

class GVAR(sliderTimeText) : RscText
{
type = 0;
idc = 320002;
idc = SLIDER_TEXT_IDC;
x = "safeZoneX + safeZoneW * 0.41875";
y = "safeZoneY + safeZoneH * 0.44351852";
w = "safeZoneW * 0.1625";
h = "safeZoneH * 0.025";
style = 2;
text = "test";
colorBackground[] = GUI_BCG_COLOR;

colorBackground[] = GUI_BCG_COLOR;
};

class GVAR(sliderOk) : RscButton
{
type = 1;
idc = 320004;
idc = SLIDER_OK_IDC;
x = "safeZoneX + safeZoneW * 0.54375";
y = "safeZoneY + safeZoneH * 0.525";
w = "safeZoneW * 0.0375";
Expand All @@ -79,9 +81,10 @@ class GVAR(Time)
text = "Ok";
onMouseButtonClick = QUOTE((uiNamespace getVariable QQGVAR(Time)) closeDisplay 1; [] call FUNC(onCloseDisplay));
};

class GVAR(sliderCancel) : GVAR(sliderOk)
{
idc = 320005;
idc = SLIDER_CANCEL_IDC;
x = "safeZoneX + safeZoneW * 0.41875";
text = "Cancel";
onMouseButtonClick = QUOTE(ctrlParent (_this select 0) closeDisplay 1);
Expand Down
6 changes: 3 additions & 3 deletions addons/briefingtime/functions/fnc_SliderPosUpdated.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* [slider, 15] call tunuti_briefingtime_fnc_SliderPosUpdated
*/
#include "script_component.hpp"

params ["_control", "_newValue"];

private _text = ["Requesting additional time:", "Set briefing time to:"] select IS_ADMIN;
private _textControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl 320002;
private _textControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl SLIDER_TEXT_IDC;
private _roundValue = round _newValue;
_control sliderSetPosition _roundValue;
//_control sliderSetPosition _roundValue;
_textControl ctrlSetText (format ["%1 %2min", _text, _roundValue]);
2 changes: 1 addition & 1 deletion addons/briefingtime/functions/fnc_notification.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (!isNull (uiNamespace getVariable QGVAR(notificationBox))) exitWith {
};
private _display = TUNUTI_FIND_MAPDISPLAY;

private _control = findDisplay _display ctrlCreate [QGVAR(notificationBox), 320006];
private _control = findDisplay _display ctrlCreate [QGVAR(notificationBox), NOTIFICATION_BOX_IDC];
uiNamespace setVariable [QGVAR(notificationBox), _control ];
LOG("create display");

Expand Down
8 changes: 4 additions & 4 deletions addons/briefingtime/functions/fnc_onCloseDisplay.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
*/
#include "script_component.hpp"

private _newTime = sliderPosition ((uiNamespace getVariable QGVAR(Time)) displayCtrl 320003);
private _newTime = sliderPosition ((uiNamespace getVariable QGVAR(Time)) displayCtrl SLIDER_IDC);

//Create notification and admin will modify
if (IS_ADMIN) then {
//Update time
_newTime = _newTime * 60;
GVAR(value) = _newTime;
publicVariable QGVAR(value);
GVAR(briefingTime) = _newTime;
publicVariable QGVAR(briefingTime);
private _debugText = format ["set new time: %1", _newTime];
LOG(_debugText);
["Briefing time has been modified"] remoteExecCall [QFUNC(notification), [0,-2] select isDedicated, false];
} else {
private _text = format ["%2 (%1) has requestend additional %3min briefing time", playerSide, profileName, _newTime];
private _text = format ["%2 (%1) Has requested an additional %3 minutes of briefing time.", playerSide, profileName, _newTime];
private _debugText = format ["ask new time: %1", _text];
LOG(_debugText);
[_text] remoteExecCall [QFUNC(notification), [0,-2] select isDedicated, false];
Expand Down
14 changes: 6 additions & 8 deletions addons/briefingtime/functions/fnc_openTimeDialog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
private _display = TUNUTI_FIND_MAPDISPLAY;
private _control = findDisplay _display createDisplay QGVAR(Time);
uiNamespace setVariable [QGVAR(Time), _control ];
[{!isNull findDisplay 320000}, {
_sliderControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl 320003;
_sliderControl sliderSetRange [0, 30];
_sliderControl sliderSetSpeed [1, 1];
[{!isNull findDisplay TUNUTI_FIND_MAPDISPLAY}, {
privateAll;
_sliderControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl SLIDER_IDC;

private _text = ["Requesting additional time:", "Set briefing time to:"] select IS_ADMIN;
private _value = [0, round(GVAR(value) / 60)] select IS_ADMIN;
_text = ["Requesting additional time:", "Set briefing time to:"] select IS_ADMIN;
_value = [0, round(GVAR(briefingTime) / 60)] select IS_ADMIN;
_sliderControl sliderSetPosition _value;
_textControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl 320002;
_textControl = (uiNamespace getVariable QGVAR(Time)) displayCtrl SLIDER_TEXT_IDC;
_textControl ctrlSetText (format ["%1 %2min", _text, _value]);

}] call CBA_fnc_waitUntilAndExecute;
36 changes: 11 additions & 25 deletions addons/briefingtime/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,20 @@
#define COMPONENT_BEAUTIFIED BriefingTime
#include "\x\tunuti\addons\main\script_mod.hpp"

//#define DEBUG_MODE_FULL
//#define DISABLE_COMPILE_CACHE
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE

#ifdef DEBUG_ENABLED_BRIEFINGTIME
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_BRIEFINGTIME
#define DEBUG_SETTINGS DEBUG_SETTINGS_BRIEFINGTIME
#endif

#include "\x\tunuti\addons\main\script_macros.hpp"

//#include "\a3\3DEN\UI\macros.inc"
//#include "\a3\ui_f\hpp\definecommon.inc"
//#include "\a3\ui_f\hpp\definedikcodes.inc"
#include "\a3\ui_f\hpp\definecommoncolors.inc"
//#include "\a3\ui_f\hpp\definecommongrids.inc"
//#include "\a3\ui_f\hpp\defineresincl.inc"

// Default grid
#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2)
#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2)
#define GUI_GRID_W (GUI_GRID_WAbs / 40)
#define GUI_GRID_H (GUI_GRID_HAbs / 25)
#define GUI_GRID_X (safezoneX)
#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs)

// Default text sizes
#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)
#define TIME_IDD 1701951
#define TIME_TEXT_IDC 1701952
#define NOTIFICATION_BOX_IDC 1701953
#define BACKGROUND_IDC 1701954
#define SLIDER_IDC 1701955
#define SLIDER_TEXT_IDC 1701956
#define SLIDER_OK_IDC -1
#define SLIDER_CANCEL_IDC -1
3 changes: 0 additions & 3 deletions addons/main/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif

#include "\x\tunuti\addons\main\script_macros.hpp"
29 changes: 24 additions & 5 deletions addons/main/script_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@

#ifdef DISABLE_COMPILE_CACHE
#undef PREP
#define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf)
#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
#define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction
#endif

#define TUNUTI_FIND_MAPDISPLAY ([53, 52, 37, 12, nil] select ([53, 52, 37, 12] findIf {!isNull findDisplay _x}))
#define TUNUTI_FIND_MAPDISPLAY ([53, 52, 37, 12, nil] select ([53, 52, 37, 12] findIf {!isNull findDisplay _x}))

#define GITHUBLINK "https://github.com/tuntematonjr/Tun-Utilities"
#define MAIN_ADDON_STR QUOTE(MAIN_ADDON)
#define GITHUBLINK "https://github.com/tuntematonjr/Tun-Utilities"
#define MAIN_ADDON_STR QUOTE(MAIN_ADDON)

//This forces debug on everything.
//#define DEBUG_ENABLED_MAIN


#include "\a3\ui_f\hpp\definecommoncolors.inc"

// Default grid
#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2)
#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2)
#define GUI_GRID_W (GUI_GRID_WAbs / 40)
#define GUI_GRID_H (GUI_GRID_HAbs / 25)
#define GUI_GRID_X (safezoneX)
#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs)

// Default text sizes
#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)
2 changes: 1 addition & 1 deletion addons/main/script_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define VERSION MAJOR.MINOR
#define VERSION_AR MAJOR,MINOR,PATCH,BUILD

#define REQUIRED_VERSION 2.14
#define REQUIRED_VERSION 2.18

#ifdef COMPONENT_BEAUTIFIED
#define COMPONENT_NAME QUOTE(tunuti - COMPONENT_BEAUTIFIED)
Expand Down
2 changes: 1 addition & 1 deletion addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 1
#define MINOR 4
#define PATCH 2
#define PATCH 3
#define BUILD 0
5 changes: 1 addition & 4 deletions addons/planningmode/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
//#define DEBUG_MODE_FULL
//#define DISABLE_COMPILE_CACHE

#ifdef DEBUG_ENABLED_PLANNINGMODE
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_PLANNINGMODE
#define DEBUG_SETTINGS DEBUG_ENABLED_PLANNINGMODE
#endif

#include "\x\tunuti\addons\main\script_macros.hpp"
Loading

0 comments on commit 557fa66

Please sign in to comment.