[iortcw] 34/89: All: Make cg_teamChatsOnly only affect team gametypes

Simon McVittie smcv at debian.org
Fri Sep 8 10:44:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51b
in repository iortcw.

commit 51a04c3f048c464116d51bc0642eeb2b2a5383f5
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Tue Jul 18 08:30:22 2017 -0400

    All: Make cg_teamChatsOnly only affect team gametypes
---
 MP/code/cgame/cg_servercmds.c | 59 ++++++++++++++++++++++---------------------
 SP/code/cgame/cg_servercmds.c | 14 +++++-----
 2 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/MP/code/cgame/cg_servercmds.c b/MP/code/cgame/cg_servercmds.c
index 7b7c935..920b517 100644
--- a/MP/code/cgame/cg_servercmds.c
+++ b/MP/code/cgame/cg_servercmds.c
@@ -1245,6 +1245,10 @@ void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color,
 	}
 */
 
+	if ( mode == SAY_ALL && cgs.gametype >= GT_TEAM && cg_teamChatsOnly.integer ) {
+		return;
+	}
+
 	if ( clientNum < 0 || clientNum >= MAX_CLIENTS ) {
 		clientNum = 0;
 	}
@@ -1255,34 +1259,31 @@ void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color,
 	voiceChatList = CG_VoiceChatListForClient( clientNum );
 
 	if ( CG_GetVoiceChat( voiceChatList, cmd, &snd, &sprite, &chat ) ) {
-		//
-		if ( mode == SAY_TEAM || !cg_teamChatsOnly.integer ) {
-			vchat.clientNum = clientNum;
-			vchat.snd = snd;
-			vchat.sprite = sprite;
-			vchat.voiceOnly = voiceOnly;
-			VectorCopy( origin, vchat.origin );     // NERVE - SMF
-			Q_strncpyz( vchat.cmd, cmd, sizeof( vchat.cmd ) );
-
-			// NERVE - SMF - get location
-			loc = CG_ConfigString( CS_LOCATIONS + ci->location );
-			if ( !loc || !*loc ) {
-				loc = " ";
-			}
-			// -NERVE - SMF
-
-			if ( mode == SAY_TELL ) {
-				Com_sprintf( vchat.message, sizeof( vchat.message ), "[%s]%c%c[%s]: %c%c%s",
-							 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
-			} else if ( mode == SAY_TEAM )   {
-				Com_sprintf( vchat.message, sizeof( vchat.message ), "(%s)%c%c(%s): %c%c%s",
-							 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
-			} else {
-				Com_sprintf( vchat.message, sizeof( vchat.message ), "%s %c%c(%s): %c%c%s",
-							 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
-			}
-			CG_AddBufferedVoiceChat( &vchat );
+		vchat.clientNum = clientNum;
+		vchat.snd = snd;
+		vchat.sprite = sprite;
+		vchat.voiceOnly = voiceOnly;
+		VectorCopy( origin, vchat.origin );     // NERVE - SMF
+		Q_strncpyz( vchat.cmd, cmd, sizeof( vchat.cmd ) );
+
+		// NERVE - SMF - get location
+		loc = CG_ConfigString( CS_LOCATIONS + ci->location );
+		if ( !loc || !*loc ) {
+			loc = " ";
 		}
+		// -NERVE - SMF
+
+		if ( mode == SAY_TELL ) {
+			Com_sprintf( vchat.message, sizeof( vchat.message ), "[%s]%c%c[%s]: %c%c%s",
+						 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
+		} else if ( mode == SAY_TEAM )   {
+			Com_sprintf( vchat.message, sizeof( vchat.message ), "(%s)%c%c(%s): %c%c%s",
+						 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
+		} else {
+			Com_sprintf( vchat.message, sizeof( vchat.message ), "%s %c%c(%s): %c%c%s",
+						 ci->name, Q_COLOR_ESCAPE, COLOR_YELLOW, CG_TranslateString( loc ), Q_COLOR_ESCAPE, color, CG_TranslateString( chat ) );
+		}
+		CG_AddBufferedVoiceChat( &vchat );
 	}
 }
 
@@ -1486,9 +1487,9 @@ static void CG_ServerCommand( void ) {
 	if ( !strcmp( cmd, "chat" ) ) {
 		const char *s;
 
-		if ( cg_teamChatsOnly.integer ) {
+		if ( cgs.gametype >= GT_TEAM && cg_teamChatsOnly.integer ) {
 			return;
-		}
+ 		}
 
 		if ( atoi( CG_Argv( 2 ) ) ) {
 			s = CG_LocalizeServerCommand( CG_Argv( 1 ) );
diff --git a/SP/code/cgame/cg_servercmds.c b/SP/code/cgame/cg_servercmds.c
index c3f44d9..9c22c0f 100644
--- a/SP/code/cgame/cg_servercmds.c
+++ b/SP/code/cgame/cg_servercmds.c
@@ -846,12 +846,14 @@ static void CG_ServerCommand( void ) {
 	}
 
 	if ( !strcmp( cmd, "chat" ) ) {
-		if ( !cg_teamChatsOnly.integer ) {
-			trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
-			Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT );
-			CG_RemoveChatEscapeChar( text );
-			CG_Printf( "%s\n", text );
-		}
+		if ( cgs.gametype >= GT_TEAM && cg_teamChatsOnly.integer ) {
+			return;
+ 		}
+
+		trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
+		Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT );
+		CG_RemoveChatEscapeChar( text );
+		CG_Printf( "%s\n", text );
 		return;
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list