Skip to content

Commit

Permalink
Add missing includes, Set version in files, Update HEMTT config
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpas committed May 16, 2023
1 parent d72d8ac commit 7a58021
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .hemtt/hooks/pre_build/01_set_version.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ HEMTT_VFS.join("addons").join("main_a3").join("CfgMods.hpp").create_file().write
print("addons/main_a3/CfgMods.hpp version set");

let scriptversion = HEMTT_VFS.join("addons").join("main").join("script_version.hpp").open_file().read();
scriptversion.replace("000000", HEMTT.project().version().build()); // TODO date %y%m%d (eg. 220912)
scriptversion.replace("000000", HEMTT.project().version().build().to_string()); // TODO date %y%m%d (eg. 220912)
HEMTT_VFS.join("addons").join("main").join("script_version.hpp").create_file().write(scriptversion);
print("addons/main/script_version.hpp build set");
8 changes: 4 additions & 4 deletions .hemtt/project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include = [
"LICENSE.md",
"logo_cba_ca.paa",
"meta.cpp",
"userconfig",
"userconfig/**",
]

[version]
git_hash = 0

[asc]
enabled = true
enabled = false
exclude = [
"/initsettings.sqf",
"/initkeybinds.sqf",
Expand All @@ -32,5 +32,5 @@ exclude = [
[hemtt.config]
preset = "Hemtt"

#[hemtt.release]
#folder = "CBA_A3"
[hemtt.release]
folder = "CBA_A3"
2 changes: 1 addition & 1 deletion addons/diagnostic/fnc_isDebugConsoleAllowed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if (str missionConfigFile == "A3\Missions_F_Bootcamp\Scenarios\Arsenal.VR\descri
if (!isMultiplayer && {getNumber (missionConfigFile >> "enableDebugConsoleSP") == 1}) exitWith {true};

call {
#include "\a3\functions_f\Debug\fn_isDebugConsoleAllowed.sqf";
#include "\a3\functions_f\debug\fn_isDebugConsoleAllowed.sqf";
};
2 changes: 1 addition & 1 deletion addons/ui/RscDisplayOptionsLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class RscDisplayOptionsLayout {
onMouseButtonUp = "with uiNamespace do {['mouseButtonUp',_this,''] call RscDisplayOptionsLayout_script;};";
};
#define ADD_ELEMENT(var1) class Element##var1: Element022 {\
idc = QUOTE(12##var1);\
idc = 12##var1;\
}
ADD_ELEMENT(023);
ADD_ELEMENT(024);
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_endLoadingScreen.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"

private _return = call {
#include "\a3\functions_f\Misc\fn_endLoadingScreen.sqf"
#include "\a3\functions_f\misc\fn_endLoadingScreen.sqf"
};

isNil {
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_initDisplay.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"

call {
#include "\a3\functions_f\GUI\fn_initDisplay.sqf"
#include "\a3\functions_f\gui\fn_initDisplay.sqf"
};

params [["_event", "", [""]], ["_args", []], ["_className", "", [""]]];
Expand Down
2 changes: 1 addition & 1 deletion addons/xeh/fnc_startLoadingScreen.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"

private _return = call {
#include "\a3\functions_f\Misc\fn_startLoadingScreen.sqf"
#include "\a3\functions_f\misc\fn_startLoadingScreen.sqf"
};

isNil {
Expand Down
151 changes: 151 additions & 0 deletions include/a3/functions_f/gui/fn_initDisplay.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/*
Author:
Karel Moricky, improved by Killzone_Kid
Description:
Initialize displays during preStart or init GUI display and run its script
The config class of the display is available in "BIS_fnc_initDisplay_configClass" stored on display
Example: _display getVariable "BIS_fnc_initDisplay_configClass";
Display is also stored in uiNamespace variable with config class name
Example: uiNamespace getVariable "RscAvCamera";
Parameter(s):
ARRAY - [] init displays during preStart
or
0: STRING - mode, can be "onLoad" or "onUnload"
1: ARRAY - params passed from "onLoad" or "onUnload" event handler, contains only DISPLAY
2: STRING - display class
3: STRING - script path from CfgScriptPaths
Returns:
NOTHING
*/

#define CONFIG_CLASS_VAR "BIS_fnc_initDisplay_configClass"
#define INIT_GAME_VAR "BIS_initGame"

// init displays during preStart (moved from BIS_fnc_initDisplays)
if (_this isEqualTo []) exitWith
{
{
{
if (getNumber (_x >> "scriptIsInternal") isEqualTo 0) then //--- Ignore internal scripts, they're recompiled first time they're opened
{
_scriptName = getText (_x >> "scriptName");
_scriptPath = getText (_x >> "scriptPath");

if (_scriptName isEqualTo "" || _scriptPath isEqualTo "") exitWith
{
[
'Undefined param(s) [scriptPath: "%2", scriptName: "%3"] while trying to init display "%1"',
configName _x,
_scriptPath,
_scriptName
]
call BIS_fnc_logFormat;
};

_script = _scriptName + "_script";

if (uiNamespace getVariable [_script, 0] isEqualType {}) exitWith {}; //--- already compiled

uiNamespace setVariable
[
_script,
compileScript [
format ["%1%2.sqf", getText (configFile >> "CfgScriptPaths" >> _scriptPath), _scriptName],
true, // final
format ["scriptName '%1'; _fnc_scriptName = '%1'; ", _scriptName] // prefix
]
];
};
}
forEach ("isText (_x >> 'scriptPath')" configClasses _x);
}
forEach
[
configFile,
configFile >> "RscTitles",
configFile >> "RscInGameUI",
configFile >> "Cfg3DEN" >> "Attributes"
];

nil
};

//--- Register/unregister display
with uiNamespace do
{
params
[
["_mode", "", [""]],
["_params", []],
["_class", "", [""]],
["_path", "default", [""]],
["_register", true, [true, 0]]
];

_display = _params param [0, displayNull];
if (isNull _display) exitWith {nil};

if (_register isEqualType true) then {_register = parseNumber _register};
if (_register > 0) then
{
_varDisplays = _path + "_displays";
_displays = (uiNamespace getVariable [_varDisplays, []]) - [displayNull];

if (_mode == "onLoad") exitWith
{
//--- Register current display
_display setVariable [CONFIG_CLASS_VAR, _class];
uiNamespace setVariable [_class, _display];

_displays pushBackUnique _display;
uiNamespace setVariable [_varDisplays, _displays];

if !(uiNamespace getVariable [INIT_GAME_VAR, false]) then
{
//--- tell loading screen it can stop using ARMA 3 logo which is shown only before main menu
//--- and start using the classic terrain picture
uiNamespace setVariable [INIT_GAME_VAR, _path == "GUI" && {ctrlIdd _x >= 0} count _displays > 1];
};

[missionNamespace, "OnDisplayRegistered", [_display, _class]] call BIS_fnc_callScriptedEventHandler;
};

if (_mode == "onUnload") exitWith
{
//--- Unregister current display
_displays = _displays - [_display];
uiNamespace setVariable [_varDisplays, _displays];

[missionNamespace, "OnDisplayUnregistered", [_display, _class]] call BIS_fnc_callScriptedEventHandler;
};

};

//--- Call script in public version
if (!cheatsEnabled) exitWith
{
[_mode, _params, _class] call (uiNamespace getVariable (_class + "_script"));
nil
};

//--- Recompile in the internal version
uinamespace setvariable
[
_class + "_script",
compileScript [
format ["%1%2.sqf", getText (configFile >> "CfgScriptPaths" >> _path), _class],
true, // final
format ["scriptName '%1'; _fnc_scriptName = '%1'; ", _class] // prefix
]
];

//--- Call script in internal version
if !(uiNamespace getVariable ["BIS_disableUIscripts", false]) then
{
[_mode, _params, _class] call (uiNamespace getVariable (_class + "_script"));
nil
};
};
33 changes: 33 additions & 0 deletions include/a3/functions_f/misc/fn_endLoadingScreen.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Author: Karel Moricky
Description:
Unregister a loading screen. When none other remains, end the loading.
Parameter(s):
0: STRING - screen ID, used in BIS_fnc_endLoadingScreen
Returns:
BOOL - true when unregistered
*/

with uinamespace do {
private ["_id","_ids"];

_id = _this param [0,"",[""]];
_ids = missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]];

if (_id in _ids) then {
_ids = _ids - [_id];
missionnamespace setvariable ["BIS_fnc_startLoadingScreen_ids",_ids];
if (count _ids == 0) then {
endloadingscreen;
-1 call bis_fnc_progressloadingscreen;
};
//["End '%1' loading screen for %2",_id,profilename] call bis_fnc_logFormat;
true
} else {
["Loading screen '%1' did not start yet.",_id] call bis_fnc_error;
false
};
};
34 changes: 34 additions & 0 deletions include/a3/functions_f/misc/fn_startLoadingScreen.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Author: Karel Moricky
Description:
Register a loading screen. Start the loading when it's the first one registered.
Parameter(s):
0: STRING - screen ID, will be used in BIS_fnc_endLoadingScreen
1 (Optional): STRING - loading screen layout
Returns:
BOOL - true when registered
*/
disableserialization;
with uinamespace do {
private ["_id","_rsc","_ids"];
_id = _this param [0,"",[""]];
_text = _this param [1,"",[""]];
_rsc = _this param [2,"",[""]];
_ids = missionnamespace getvariable ["BIS_fnc_startLoadingScreen_ids",[]];

if !(_id in _ids) then {
//--- Array has to be adjusted before loading screen starts, otherwise the rest of the script can be delayed
_ids set [count _ids,_id];
missionnamespace setvariable ["BIS_fnc_startLoadingScreen_ids",_ids];
startloadingscreen [_text,_rsc];
progressloadingscreen (uinamespace getvariable ["BIS_fnc_progressloadingscreen_progress",0]);
//["Start '%1' loading screen for %2",_id,profilename] call bis_fnc_logFormat;
true
} else {
//["Loading screen '%1' already started.",_id] call bis_fnc_error;
false
};
};

0 comments on commit 7a58021

Please sign in to comment.