Skip to content

Commit

Permalink
Added PTT enable on pressing volume modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
dedmen committed Sep 30, 2016
1 parent 7ff4b54 commit 7259e62
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
1 change: 1 addition & 0 deletions addons/core/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
["TF_same_dd_frequencies_for_side", "CHECKBOX", localize "STR_radio_same_dd_frequencies_for_side", "Task Force Arrowhead Radio", false, true] call CBA_Settings_fnc_init;
// client
["TF_default_radioVolume", "SLIDER", localize "STR_radio_default_radioVolume", "Task Force Arrowhead Radio", [1, 9, 9, 0]] call CBA_Settings_fnc_init;
["TF_volumeModifier_forceSpeech", "CHECKBOX", "Activate directSpeech when pressing volume modifier.", "Task Force Arrowhead Radio", false] call CBA_Settings_fnc_init;//#Stringtable
27 changes: 15 additions & 12 deletions addons/core/functions/fnc_onSpeakVolumeModifierPressed.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

/*
Name: TFAR_fnc_onSpeakVolumeModifierPressed
Author(s):
ACyprus
Description:
Transiently changes the volume for the player's voice in game to either Yelling or Whisper
Parameters:
Parameters:
0: STRING - Volume level : VALUES ("yelling" or "whispering")
Returns:
BOOLEAN - Whether or not the event was handled
Example:
["yelling"] call TFAR_fnc_onSpeakVolumeModifierPressed;
*/
Expand All @@ -31,15 +31,18 @@ TF_last_speak_volume_meters = TF_speak_volume_meters;

TF_speak_volume_level = _modifierMode;
if(_modifierMode == "yelling") then {
TF_speak_volume_meters = TF_max_voice_volume;
TF_speak_volume_meters = TF_max_voice_volume;
} else {
TF_speak_volume_meters = TF_min_voice_volume;
TF_speak_volume_meters = TF_min_voice_volume;
};

_localName = localize format["STR_voice_%1", _modifierMode];
_hintText = format[localize "STR_voice_volume", _localName];
[parseText (_hintText), -1] call TFAR_fnc_showHint;

if (TF_volumeModifier_forceSpeech) then {
[_hintText,format["TANGENT PRESSED %1 %2 %3","directSpeechFreq", 0, "directSpeech"],-1] call TFAR_fnc_ProcessTangent;
} else {
[parseText (_hintText), -1] call TFAR_fnc_showHint;
};
["OnSpeakVolumeModifierPressed", TFAR_currentUnit, [TFAR_currentUnit, TF_speak_volume_level, TF_speak_volume_meters]] call TFAR_fnc_fireEventHandlers;
true

true
21 changes: 13 additions & 8 deletions addons/core/functions/fnc_onSpeakVolumeModifierReleased.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@

/*
Name: TFAR_fnc_onSpeakVolumeModifierReleased
Author(s):
ACyprus
Description:
Restores any transient volume changes for the player's voice in game
Parameters:
Parameters:
NONE
Returns:
BOOLEAN - Whether or not the event was handled
Example:
call TFAR_fnc_onSpeakVolumeModifierReleased;
*/
TF_speak_volume_level = TF_last_speak_volume_level;
TF_speak_volume_meters = TF_last_speak_volume_meters;

call TFAR_fnc_HideHint;

if (TF_volumeModifier_forceSpeech) then {
["",format["TANGENT RELEASED %1 %2 %3","directSpeechFreq", 0, "directSpeech"],0] call TFAR_fnc_ProcessTangent;
} else {
call TFAR_fnc_HideHint;
};

["OnSpeakVolumeModifierReleased", TFAR_currentUnit, [TFAR_currentUnit, TF_speak_volume_level, TF_speak_volume_meters]] call TFAR_fnc_fireEventHandlers;

true
true

0 comments on commit 7259e62

Please sign in to comment.