From: havoc Date: Sat, 17 Mar 2007 13:08:52 +0000 (+0000) Subject: play a different sound (sound/misc/talk2.wav) for team chat messages (only if the... X-Git-Tag: xonotic-v0.1.0preview~3424 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ae8d14752b76039d87a4a5dc2709e30e922df028;p=xonotic%2Fdarkplaces.git play a different sound (sound/misc/talk2.wav) for team chat messages (only if the file exists of course), to accomplish this the team chat messages now have () around the player name, which is compatible with other engines with this feature git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6993 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index 986defbd..76654627 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -505,6 +505,8 @@ static void QW_CL_RequestNextDownload(void) CL_Locs_Reload_f(); R_Modules_NewMap(); + cl.foundtalk2wav = FS_FileExists("sound/misc/talk2.wav"); + // add pmodel/emodel CRCs to userinfo CL_SetInfo("pmodel", va("%i", FS_CRCFile("progs/player.mdl", NULL)), true, true, true, true); CL_SetInfo("emodel", va("%i", FS_CRCFile("progs/eyes.mdl", NULL)), true, true, true, true); @@ -949,6 +951,7 @@ void CL_BeginDownloads(qboolean aborteddownload) CL_UpdateRenderEntity(&cl.entities[0].render); CL_Locs_Reload_f(); R_Modules_NewMap(); + cl.foundtalk2wav = FS_FileExists("sound/misc/talk2.wav"); // check memory integrity Mem_CheckSentinelsGlobal(); if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer) @@ -999,6 +1002,7 @@ void CL_BeginDownloads(qboolean aborteddownload) CL_UpdateRenderEntity(&cl.entities[0].render); CL_Locs_Reload_f(); R_Modules_NewMap(); + cl.foundtalk2wav = FS_FileExists("sound/misc/talk2.wav"); // check memory integrity Mem_CheckSentinelsGlobal(); if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer) @@ -1038,6 +1042,7 @@ void CL_BeginDownloads(qboolean aborteddownload) CL_UpdateRenderEntity(&cl.entities[0].render); CL_Locs_Reload_f(); R_Modules_NewMap(); + cl.foundtalk2wav = FS_FileExists("sound/misc/talk2.wav"); // check memory integrity Mem_CheckSentinelsGlobal(); if (!cl.loadfinished && cl_joinbeforedownloadsfinish.integer) @@ -3199,7 +3204,7 @@ void CL_ParseServerMessage(void) { model_t *model = Mod_ForName(s, false, false, i == 1); if (!model) - Con_Printf("svc_precache: Mod_ForName(\"%s\") failed\n", s); + Con_DPrintf("svc_precache: Mod_ForName(\"%s\") failed\n", s); cl.model_precache[i] = model; } else @@ -3212,7 +3217,7 @@ void CL_ParseServerMessage(void) { sfx_t *sfx = S_PrecacheSound (s, true, false); if (!sfx && snd_initialized.integer) - Con_Printf("svc_precache: S_PrecacheSound(\"%s\") failed\n", s); + Con_DPrintf("svc_precache: S_PrecacheSound(\"%s\") failed\n", s); cl.sound_precache[i] = sfx; } else diff --git a/client.h b/client.h index 7141da00..de267c06 100644 --- a/client.h +++ b/client.h @@ -823,6 +823,8 @@ typedef struct client_state_s sfx_t *sfx_ric2; sfx_t *sfx_ric3; sfx_t *sfx_r_exp3; + // indicates that the file "sound/misc/talk2.wav" was found (for use by team chat messages) + qboolean foundtalk2wav; // refresh related state diff --git a/console.c b/console.c index 1581aab2..97f6526b 100644 --- a/console.c +++ b/console.c @@ -636,7 +636,12 @@ void Con_Print(const char *msg) { // play talk wav if (*msg == 1) - S_LocalSound ("sound/misc/talk.wav"); + { + if (msg[1] == '(' && cl.foundtalk2wav) + S_LocalSound ("sound/misc/talk2.wav"); + else + S_LocalSound ("sound/misc/talk.wav"); + } line[index++] = STRING_COLOR_TAG; line[index++] = '3'; msg++; diff --git a/host_cmd.c b/host_cmd.c index 4dcc0e5d..5c4dfa59 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -944,8 +944,10 @@ void Host_Say(qboolean teamonly) p1++; } // note this uses the chat prefix \001 - if (!fromServer) + if (!fromServer && !teamonly) dpsnprintf (text, sizeof(text), "\001%s" STRING_COLOR_DEFAULT_STR ": %s", host_client->name, p1); + else if (!fromServer && teamonly) + dpsnprintf (text, sizeof(text), "\001(%s" STRING_COLOR_DEFAULT_STR "): %s", host_client->name, p1); else if(*(sv_adminnick.string)) dpsnprintf (text, sizeof(text), "\001<%s" STRING_COLOR_DEFAULT_STR "> %s", sv_adminnick.string, p1); else