-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,321 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
#include "script_component.hpp" | ||
|
||
// execute JIP events after post init to guarantee execution of events added during postInit | ||
{ | ||
[{ | ||
{ | ||
private _event = GVAR(eventNamespaceJIP) getVariable _x; | ||
|
||
if ((_event select 0) isEqualTo EVENT_PVAR_STR) then { | ||
(_event select 1) call CBA_fnc_localEvent; | ||
if (_event isEqualType []) then { | ||
if ((_event select 0) isEqualTo EVENT_PVAR_STR) then { | ||
(_event select 1) call CBA_fnc_localEvent; | ||
}; | ||
}; | ||
} forEach allVariables GVAR(eventNamespaceJIP); | ||
} call CBA_fnc_execNextFrame; | ||
}, []] call CBA_fnc_execNextFrame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
class Extended_PreInit_EventHandlers | ||
{ | ||
class ADDON | ||
{ | ||
clientInit = QUOTE(call COMPILE_FILE(XEH_preClientInit)); | ||
|
||
class Extended_PreInit_EventHandlers { | ||
class ADDON { | ||
init = QUOTE(call COMPILE_FILE(XEH_preInit)); | ||
}; | ||
}; | ||
|
||
class Extended_DisplayLoad_EventHandlers { | ||
class RscDisplayConfigure { | ||
ADDON = QUOTE(_this call COMPILE_FILE(XEH_configureDisplayLoad)); | ||
}; | ||
}; |
File renamed without changes.
2 changes: 2 additions & 0 deletions
2
addons/keybinding/XEH_preClientInit.sqf → addons/keybinding/XEH_preInit.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x\cba\addons\settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
class CBA_Setting_Boolean_base { | ||
type = "BOOLEAN"; | ||
displayName = ""; | ||
tooltip = ""; | ||
defaultValue = 0; | ||
}; | ||
|
||
class CBA_Setting_List_base { | ||
type = "LIST"; | ||
displayName = ""; | ||
tooltip = ""; | ||
values[] = {0,1}; | ||
//valueNames[] = {"disabled","enabled"}; | ||
defaultIndex = 0; | ||
}; | ||
|
||
class CBA_Setting_Slider_base { | ||
type = "SLIDER"; | ||
displayName = ""; | ||
tooltip = ""; | ||
min = 0; | ||
max = 100; | ||
defaultValue = 50; | ||
}; | ||
|
||
class CBA_Settings { | ||
class CBA {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
class Cfg3DEN { | ||
class Mission { | ||
class Scenario { | ||
class AttributeCategories { | ||
class Presentation { // any existing | ||
class Attributes { | ||
class BriefingName; | ||
class Author; // needed, to put blank space at the end. for looks | ||
class GVAR(missionSettings) { | ||
property = QGVAR(missionSettings); | ||
value = 0; | ||
control = "Default"; // blank space. not editable by hand | ||
displayName = ""; | ||
tooltip = ""; | ||
defaultValue = "[]"; | ||
expression = "missionNamespace setVariable ['%s',_value,true]"; | ||
wikiType = "[[Array]]"; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
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)); | ||
}; | ||
}; | ||
|
||
class Extended_DisplayLoad_EventHandlers { | ||
class RscDisplayGameOptions { | ||
ADDON = QUOTE(_this call COMPILE_FILE(init_display)); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
#define F_FILEPATH(func) class func {\ | ||
file = QUOTE(PATHTOF(DOUBLES(fnc,func).sqf));\ | ||
} | ||
|
||
class CfgFunctions { | ||
class CBA { | ||
class Settings { | ||
F_FILEPATH(setSetting); | ||
F_FILEPATH(setSettingProfile); | ||
F_FILEPATH(getSetting); | ||
F_FILEPATH(forceSetting); | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "script_component.hpp" | ||
SCRIPT(XEH_postInit); | ||
|
||
if (!isServer) then { | ||
#include "init_settings.sqf" | ||
}; | ||
|
||
// init mission settings | ||
GVAR(missionSettings) params [["_missionSettings", []], ["_missionValues", []]]; | ||
|
||
{ | ||
// values are set only locally, because GVAR(missionSettings) is already a global var | ||
missionNamespace setVariable [SETTING_KEY_MISSION(_x), _missionValues select _forEachIndex]; | ||
missionNamespace setVariable [SETTING_KEY_MISSION_FORCE(_x), true]; | ||
} forEach _missionSettings; | ||
|
||
// refresh all settings after postInit to guarantee that events are added | ||
{ | ||
GVAR(settingsInit) = true; | ||
|
||
{ | ||
[QGVAR(refreshSetting), _x] call CBA_fnc_localEvent; | ||
} forEach allVariables GVAR(settingsDefault); | ||
} call CBA_fnc_execNextFrame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "script_component.hpp" | ||
SCRIPT(XEH_preInit); | ||
|
||
ADDON = false; | ||
|
||
GVAR(settingsInit) = false; | ||
|
||
[QGVAR(refreshSetting), { | ||
params ["_setting"]; | ||
private _value = _setting call CBA_fnc_getSetting; | ||
|
||
missionNamespace setVariable [_setting, _value]; | ||
|
||
if (GVAR(settingsInit)) then { | ||
["CBA_SettingChanged", [_setting, _value]] call CBA_fnc_localEvent; | ||
}; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
if (isServer) then { | ||
[QGVAR(setSettingRemote), { | ||
_this call CBA_fnc_setSettingProfile; | ||
_this call CBA_fnc_setSetting; | ||
}] call CBA_fnc_addEventHandler; | ||
|
||
[QGVAR(forceSettingRemote), CBA_fnc_forceSetting] call CBA_fnc_addEventHandler; | ||
|
||
#include "init_settings.sqf" | ||
}; | ||
|
||
ADDON = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "script_component.hpp" | ||
|
||
class CfgPatches { | ||
class ADDON { | ||
units[] = {}; | ||
weapons[] = {}; | ||
requiredVersion = REQUIRED_VERSION; | ||
requiredAddons[] = {"CBA_common", "A3_UI_F"}; | ||
version = VERSION; | ||
author[] = {"commy2"}; | ||
authorUrl = "https://github.com/CBATeam/CBA_A3"; | ||
}; | ||
}; | ||
|
||
#include "CfgEventHandlers.hpp" | ||
#include "CfgFunctions.hpp" | ||
|
||
#include "CBA_Settings.hpp" | ||
#include "Cfg3DEN.hpp" | ||
|
||
#include "gui.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_forceSetting | ||
Description: | ||
Force a setting. Use "client" to set as not forced. Has to be executed on the server machine. | ||
Parameters: | ||
_setting - Name of the setting <STRING> | ||
_force - true: force, false: release <BOOLEAN> | ||
Returns: | ||
None | ||
Examples: | ||
(begin example) | ||
["CBA_TestSetting", "server"] call CBA_fnc_forceSetting | ||
(end) | ||
Author: | ||
commy2 | ||
---------------------------------------------------------------------------- */ | ||
#include "script_component.hpp" | ||
|
||
if (!isServer) exitWith {}; | ||
|
||
params [["_setting", "", [""]], ["_force", true, [false]]]; | ||
|
||
missionNamespace setVariable [SETTING_KEY_SERVER_FORCE(_setting), _force, true]; | ||
profileNamespace setVariable [SETTING_KEY_SERVER_FORCE(_setting), _force]; | ||
|
||
// send changed event, because the current active setting could have changed | ||
[QGVAR(refreshSetting), _setting] call CBA_fnc_globalEvent; | ||
|
||
nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* ---------------------------------------------------------------------------- | ||
Function: CBA_fnc_getSetting | ||
Description: | ||
Returns a setting. | ||
Parameters: | ||
_setting - Name of the setting <STRING> | ||
_source - Can be "current", "server", "mission", "client" or "default" (optional, default: "current") <STRING> | ||
Returns: | ||
Value of the setting <ANY> | ||
Examples: | ||
(begin example) | ||
_result = "CBA_TestSetting" call CBA_fnc_getSetting | ||
(end) | ||
Author: | ||
commy2 | ||
---------------------------------------------------------------------------- */ | ||
#include "script_component.hpp" | ||
|
||
params [["_setting", "", [""]], ["_source", "current", [""]]]; | ||
|
||
// change source to whatever should take precedence | ||
if (_source == "current") then { | ||
if (missionNamespace getVariable [SETTING_KEY_SERVER_FORCE(_setting), false]) exitWith { _source = "server" }; | ||
if (missionNamespace getVariable [SETTING_KEY_MISSION_FORCE(_setting), false]) exitWith { _source = "mission" }; | ||
_source = "client"; | ||
}; | ||
|
||
private "_return"; | ||
|
||
if (_source == "client") then { | ||
_return = profileNamespace getVariable SETTING_KEY_CLIENT(_setting); | ||
}; | ||
|
||
if (_source == "server") then { | ||
_return = missionNamespace getVariable SETTING_KEY_SERVER(_setting); | ||
}; | ||
|
||
if (_source == "mission") then { | ||
_return = missionNamespace getVariable SETTING_KEY_MISSION(_setting); | ||
|
||
if (isNil "_return") then { | ||
_source = "default"; | ||
}; // use default for undefined mission settings | ||
}; | ||
|
||
if (_source == "default") then { | ||
_return = (GVAR(settingsDefault) getVariable _setting) select 0; | ||
}; | ||
|
||
// copy array to prevent overwriting | ||
if (isNil "_return") exitWith { nil }; | ||
if (_return isEqualType []) then { +_return } else { _return } |
Oops, something went wrong.