MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ProcessVoiceChat

Method ProcessVoiceChat

neo/d3xp/MultiplayerGame.cpp:4031–4068  ·  view source on GitHub ↗

================ idMultiplayerGame::ProcessVoiceChat ================ */

Source from the content-addressed store, hash-verified

4029================
4030*/
4031void idMultiplayerGame::ProcessVoiceChat( int clientNum, bool team, int index ) {
4032 const idDict *spawnArgs;
4033 const idKeyValue *keyval;
4034 idStr name;
4035 idStr snd_key;
4036 idStr text_key;
4037 idPlayer *p;
4038
4039 p = static_cast< idPlayer * >( gameLocal.entities[ clientNum ] );
4040 if ( !( p && p->IsType( idPlayer::Type ) ) ) {
4041 return;
4042 }
4043
4044 if ( p->spectating ) {
4045 return;
4046 }
4047
4048 // lookup the sound def
4049 spawnArgs = gameLocal.FindEntityDefDict( "player_doommarine", false );
4050 keyval = spawnArgs->MatchPrefix( "snd_voc_", NULL );
4051 while ( index > 0 && keyval ) {
4052 keyval = spawnArgs->MatchPrefix( "snd_voc_", keyval );
4053 index--;
4054 }
4055 if ( !keyval ) {
4056 common->DPrintf( "ProcessVoiceChat: unknown chat index %d\n", index );
4057 return;
4058 }
4059 snd_key = keyval->GetKey();
4060 name = gameLocal.userInfo[ clientNum ].GetString( "ui_name" );
4061 sprintf( text_key, "txt_%s", snd_key.Right( snd_key.Length() - 4 ).c_str() );
4062 if ( team || gameState == COUNTDOWN || gameState == GAMEREVIEW ) {
4063 ProcessChatMessage( clientNum, team, name, spawnArgs->GetString( text_key ), spawnArgs->GetString( snd_key ) );
4064 } else {
4065 p->StartSound( snd_key, SND_CHANNEL_ANY, 0, true, NULL );
4066 ProcessChatMessage( clientNum, team, name, spawnArgs->GetString( text_key ), NULL );
4067 }
4068}
4069
4070/*
4071================

Callers 1

Calls 10

sprintfFunction · 0.85
MatchPrefixMethod · 0.80
IsTypeMethod · 0.45
FindEntityDefDictMethod · 0.45
DPrintfMethod · 0.45
GetStringMethod · 0.45
c_strMethod · 0.45
RightMethod · 0.45
LengthMethod · 0.45
StartSoundMethod · 0.45

Tested by

no test coverage detected