================ idMultiplayerGame::ProcessVoiceChat ================ */
| 4029 | ================ |
| 4030 | */ |
| 4031 | void 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 | ================ |
no test coverage detected