Skip to content

Commit

Permalink
Add ACRE setting to change initial direct speech volume (#160)
Browse files Browse the repository at this point in the history
* Add ACRE setting to change initial direct speech volume

* Add missing function description

* Change slider settings to list
  • Loading branch information
3Mydlo3 authored Mar 24, 2021
1 parent f36ed04 commit a36f230
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/acre/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions addons/acre/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PREP(acreModulesPresent);
PREP(adjustVoiceVolume);
PREP(copyLeaderRadioChildrenActions);
PREP(copyLeaderSingleRadioChildrenActions);
PREP(getAllRadios);
Expand Down
1 change: 1 addition & 0 deletions addons/acre/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
ERROR("Mission ACRE Modules detected! AFM ACRE module disabled.");
};
call FUNC(init);
call FUNC(adjustVoiceVolume);
};
}] call EFUNC(common,runAfterSettingsInit);
35 changes: 35 additions & 0 deletions addons/acre/functions/fnc_adjustVoiceVolume.sqf
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions addons/acre/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions addons/acre/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
36 changes: 36 additions & 0 deletions addons/acre/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,42 @@
<English>Each side will have it's own babel language assigned and won't understand each other. Requires mission restart to change.</English>
<Polish>Każda strona będzie miała swój język babel i nie będą się rozumieć. Zmiana wymaga restartu misji.</Polish>
</Key>
<Key ID="STR_AFM_Acre_StartBppVolume">
<English>Initial speech volume</English>
<Polish>Początkowa głośność mówienia</Polish>
</Key>
<Key ID="STR_AFM_Acre_StartBppVolume_Description">
<English>Controls initial direct speech volume. It is set at mission start and after JIP.</English>
<Polish>Kontroluje początkową głośność mówienia. Jest ustawiana na starcie misji oraz przy JIP.</Polish>
</Key>
<Key ID="STR_AFM_Acre_StartLeaderVolume">
<English>Initial leader speech volume</English>
<Polish>Początkowa głośność mówienia dowódców</Polish>
</Key>
<Key ID="STR_AFM_Acre_StartLeaderVolume_Description">
<English>Controls initial direct speech volume for leaders. It is set at mission start and after JIP.</English>
<Polish>Kontroluje początkową głośność mówienia dowódców. Jest ustawiana na starcie misji oraz przy JIP.</Polish>
</Key>
<Key ID="STR_AFM_Acre_Whisper">
<English>Whisper</English>
<Polish>Szept</Polish>
</Key>
<Key ID="STR_AFM_Acre_Quiet">
<English>Quiet</English>
<Polish>Cicho</Polish>
</Key>
<Key ID="STR_AFM_Acre_Normal">
<English>Normal</English>
<Polish>Normalnie</Polish>
</Key>
<Key ID="STR_AFM_Acre_Loud">
<English>Loud</English>
<Polish>Głośno</Polish>
</Key>
<Key ID="STR_AFM_Acre_Shout">
<English>Shout</English>
<Polish>Krzyk</Polish>
</Key>
<Key ID="STR_AFM_Acre_PerSideRadios">
<English>Per Side Radios</English>
<Polish>Kanały per strona</Polish>
Expand Down

0 comments on commit a36f230

Please sign in to comment.