From a36f230d7aabf2ac2742565de1fa3d3533a9ce86 Mon Sep 17 00:00:00 2001 From: 3Mydlo3 Date: Wed, 24 Mar 2021 17:10:10 +0100 Subject: [PATCH] Add ACRE setting to change initial direct speech volume (#160) * Add ACRE setting to change initial direct speech volume * Add missing function description * Change slider settings to list --- addons/acre/README.md | 1 + addons/acre/XEH_PREP.hpp | 1 + addons/acre/XEH_postInit.sqf | 1 + .../acre/functions/fnc_adjustVoiceVolume.sqf | 35 ++++++++++++++++++ addons/acre/initSettings.sqf | 26 ++++++++++++++ addons/acre/script_component.hpp | 3 ++ addons/acre/stringtable.xml | 36 +++++++++++++++++++ 7 files changed, 103 insertions(+) create mode 100644 addons/acre/functions/fnc_adjustVoiceVolume.sqf diff --git a/addons/acre/README.md b/addons/acre/README.md index 8784c9ce..3785b4cd 100644 --- a/addons/acre/README.md +++ b/addons/acre/README.md @@ -7,6 +7,7 @@ Standard ArmaForces ACRE framework for missions. No more modules in mission. These things can now be set up through settings: - Babel +- Initial direct speech volume - Radios per side - Channel names - Channel names per side diff --git a/addons/acre/XEH_PREP.hpp b/addons/acre/XEH_PREP.hpp index ba964138..771b7794 100644 --- a/addons/acre/XEH_PREP.hpp +++ b/addons/acre/XEH_PREP.hpp @@ -1,4 +1,5 @@ PREP(acreModulesPresent); +PREP(adjustVoiceVolume); PREP(copyLeaderRadioChildrenActions); PREP(copyLeaderSingleRadioChildrenActions); PREP(getAllRadios); diff --git a/addons/acre/XEH_postInit.sqf b/addons/acre/XEH_postInit.sqf index da915e8c..ae683141 100644 --- a/addons/acre/XEH_postInit.sqf +++ b/addons/acre/XEH_postInit.sqf @@ -6,5 +6,6 @@ ERROR("Mission ACRE Modules detected! AFM ACRE module disabled."); }; call FUNC(init); + call FUNC(adjustVoiceVolume); }; }] call EFUNC(common,runAfterSettingsInit); diff --git a/addons/acre/functions/fnc_adjustVoiceVolume.sqf b/addons/acre/functions/fnc_adjustVoiceVolume.sqf new file mode 100644 index 00000000..efceb8fb --- /dev/null +++ b/addons/acre/functions/fnc_adjustVoiceVolume.sqf @@ -0,0 +1,35 @@ +#include "script_component.hpp" +/* + * Author: 3Mydlo3 + * Adjusts initial direct speech volume for local player based on CBA settings. + * Works also for players JIP. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ + +if (!hasInterface) exitWith { nil }; + +private _volumeLevel = [GVAR(startBppVolume), GVAR(startLeaderVolume)] select (player isEqualTo leader player); + +private _volume = switch (round _volumeLevel) do { + case 0: {0.1}; + case 1: {0.4}; + case 2: {0.7}; + case 3: {1}; + case 4: {1.3}; + default {0.7}; +}; + +[_volume] call acre_api_fnc_setSelectableVoiceCurve; + +[{ + acre_sys_gui_volumeLevel = _this; +}, round _volumeLevel / 4] call CBA_fnc_execNextFrame; + +nil diff --git a/addons/acre/initSettings.sqf b/addons/acre/initSettings.sqf index 29df68ff..e32e44e0 100644 --- a/addons/acre/initSettings.sqf +++ b/addons/acre/initSettings.sqf @@ -20,6 +20,32 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(startBppVolume), + "LIST", + [LSTRING(StartBppVolume), LSTRING(StartBppVolume_Description)], + LSTRING(DisplayName), + [ + [0, 1, 2, 3, 4], + [LSTRING(Whisper), LSTRING(Quiet), LSTRING(Normal), LSTRING(Loud), LSTRING(Shout)], + DEFAULT_BPP_VOLUME + ], + 1 +] call CBA_fnc_addSetting; + +[ + QGVAR(startLeaderVolume), + "LIST", + [LSTRING(StartLeaderVolume), LSTRING(StartLeaderVolume_Description)], + LSTRING(DisplayName), + [ + [0, 1, 2, 3, 4], + [LSTRING(Whisper), LSTRING(Quiet), LSTRING(Normal), LSTRING(Loud), LSTRING(Shout)], + DEFAULT_LEADER_VOLUME + ], + 1 +] call CBA_fnc_addSetting; + [ QGVAR(perSideRadios), "CHECKBOX", diff --git a/addons/acre/script_component.hpp b/addons/acre/script_component.hpp index c8862fb4..97f0e3e5 100644 --- a/addons/acre/script_component.hpp +++ b/addons/acre/script_component.hpp @@ -14,3 +14,6 @@ #include "\z\afm\addons\main\script_macros.hpp" #define ICON_RADIO_CALL "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\call_ca.paa" + +#define DEFAULT_BPP_VOLUME 1 +#define DEFAULT_LEADER_VOLUME 2 diff --git a/addons/acre/stringtable.xml b/addons/acre/stringtable.xml index aacdea06..a88bc949 100644 --- a/addons/acre/stringtable.xml +++ b/addons/acre/stringtable.xml @@ -13,6 +13,42 @@ Each side will have it's own babel language assigned and won't understand each other. Requires mission restart to change. Każda strona będzie miała swój język babel i nie będą się rozumieć. Zmiana wymaga restartu misji. + + Initial speech volume + Początkowa głośność mówienia + + + Controls initial direct speech volume. It is set at mission start and after JIP. + Kontroluje początkową głośność mówienia. Jest ustawiana na starcie misji oraz przy JIP. + + + Initial leader speech volume + Początkowa głośność mówienia dowódców + + + Controls initial direct speech volume for leaders. It is set at mission start and after JIP. + Kontroluje początkową głośność mówienia dowódców. Jest ustawiana na starcie misji oraz przy JIP. + + + Whisper + Szept + + + Quiet + Cicho + + + Normal + Normalnie + + + Loud + Głośno + + + Shout + Krzyk + Per Side Radios Kanały per strona