CSE Soundwaves

This commit is contained in:
PabstMirror 2015-02-12 21:53:15 -06:00
parent d0b0a0e066
commit 19f3154104
15 changed files with 108 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,8 @@
// by commy2 and CAA-Picard
#include "script_component.hpp"
[] call FUNC(initIsSpeaking);
if (!hasInterface) exitWith {};

View File

@ -41,7 +41,12 @@ class ACE_Settings {
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowNamesForAI";
};
class GVAR(showSoundWaves) {
value = 0;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_NameTags_ShowSoundWaves";
};
class GVAR(PlayerNamesViewDistance) {
value = 5;
typeName = "SCALAR";

View File

@ -13,7 +13,7 @@
*/
#include "script_component.hpp"
#define TEXTURES_RANKS [ \
"", \
"\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \
@ -46,11 +46,23 @@ _color = if !(group _target == group _player) then {
_name = [_target, true] call EFUNC(common,getName);
_rank = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find rank _target) + 1);
_size = [0, 1] select GVAR(showPlayerRanks);
_icon = "";
_size = 0;
if (GVAR(showSoundWaves) && {_target getVariable [QGVAR(isSpeaking), false]}) then {
_icon = QUOTE(PATHTOF(UI\soundwave));
_icon = _icon + str (floor (random 10)) + ".paa"; //random
// _icon = _icon + str (diag_frameno % 10) + ".paa"; //play in order??
_size = 2;
} else {
if (GVAR(showPlayerRanks)) then {
_icon = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find (rank _target)) + 1);
_size = 1;
};
};
drawIcon3D [
_rank,
_icon,
_color,
_position,
_size,

View File

@ -0,0 +1,77 @@
/*
* Author: Glowbal, PabstMirror
* Starts up a PFEH to monitor the when players are talking.
* Compatiblity with TFR/ACRE and Arma's VON
*
* Arguments:
* NONE
*
* Return Value:
* NONE
*
* Example:
* [] call ACE_nametags_fnc_initIsSpeaking
*
* Public: No
*/
#include "script_component.hpp"
if (isServer) then {
//If someone disconnects while speaking, reset their variable
addMissionEventHandler ["HandleDisconnect", {
PARAMS_1(_disconnectedPlayer);
if (_disconnectedPlayer getVariable [QGVAR(isSpeaking), false]) then {
_disconnectedPlayer setVariable [QGVAR(isSpeaking), false, true];
};
}];
};
if (!hasInterface) exitWith {};
["playerChanged", {
//When player changes, make sure to reset old unit's variable
PARAMS_2(_newUnit,_oldUnit);
if (_oldUnit getVariable [QGVAR(isSpeaking), false]) then {
_oldUnit setVariable [QGVAR(isSpeaking), false, true];
};
}] call EFUNC(common,addEventHandler);
//For performance, chose different code paths at mission start based on installed mods (once, instead of checking each time)
_pfEHCode = switch (true) do {
case (isClass (configFile >> "cfgPatches" >> "acre_api")): {
{
_oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false];
_newSetting = ([ACE_player] call ACRE_api_fnc_isBroadcasting) || {!(isNull findDisplay 55)};
if (!(_oldSetting isEqualTo _newSetting)) then {
ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true];
// ["IsTalking??", [ACE_player, _newSetting]] call localEvent //any use in ACE for a "speaking event"?
};
};
};
case (isClass (configFile >> "cfgPatches" >> "task_force_radio")): {
//Note: TFAR has a TFAR_fnc_isSpeaking function, but it has a fairly costly `callExtension`
//I think it's much faster to use the internal "tf_isSpeaking" variable
//If we don't care about the built-in VON, we could switch this to a pure event driven system
{
_oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false];
_newSetting = (ACE_player getVariable ["tf_isSpeaking", false]) || {!(isNull findDisplay 55)};
if (!(_oldSetting isEqualTo _newSetting)) then {
ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true];
};
};
};
default {
//Note: class RscDisplayVoiceChat {idd = 55}; //only present when talking
{
_oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false];
_newSetting = (!(isNull findDisplay 55));
if (!(_oldSetting isEqualTo _newSetting)) then {
ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true];
};
};
};
};
//Is 0.05sec precision enough??
[_pfEHCode, 0.05, []] call CBA_fnc_addPerFrameHandler;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-17 -->
<!-- Edited with tabler - 2015-02-12 -->
<Project name="ACE">
<Package name="NameTags">
<Key ID="STR_ACE_NameTags_ShowNames">
@ -69,5 +69,10 @@
<Key ID="STR_ACE_NameTags_ShowNamesForAI">
<English>Show name tags for AI units</English>
</Key>
<Key ID="STR_ACE_NameTags_ShowSoundWaves">
<English>Show SoundWaves when speaking</English>
<German>Zeigen Schallwelle im Gespräch</German>
<Spanish>Mostrar onda sonora cuando se habla</Spanish>
</Key>
</Package>
</Project>
</Project>