MCPcopy Create free account
hub / github.com/assaultcube/AC / voicecom

Function voicecom

source/src/audiomanager.cpp:423–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423void voicecom(char *sound, char *text)
424{
425 if(!sound || !sound[0]) return;
426 if(!text || !text[0]) return;
427 static int last = 0;
428 if(!last || lastmillis-last > 2000)
429 {
430 defformatstring(soundpath)("voicecom/%s", sound);
431 int s = audiomgr.findsound(soundpath, 0, gamesounds);
432 if(!gamesound_isvoicecom(s)) return;
433 if(voicecomsounds>0) audiomgr.playsound(s, SP_HIGH);
434 if(gamesound_ispublicvoicecom(s)||(!m_teammode&&gamesound_ispublicwhenffa(s))) // public
435 {
436 addmsg(SV_VOICECOM, "ri", s);
437 toserver(text);
438 }
439 else // team
440 {
441 if(gamesound_isflagvoicecom(s)?!m_flags_:true)
442 {
443 addmsg(SV_VOICECOMTEAM, "ri", s);
444 defformatstring(teamtext)("%c%s", '%', text);
445 toserver(teamtext);
446 }
447 }
448 last = lastmillis;
449 }
450}
451
452COMMAND(voicecom, "ss");
453

Callers

nothing calls this directly

Calls 4

addmsgFunction · 0.85
toserverFunction · 0.85
findsoundMethod · 0.80
playsoundMethod · 0.80

Tested by

no test coverage detected