summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-04-14 20:31:27 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:22 +0200
commita8c4d597689cb8cd8c88290254ef0a5bb7757d24 (patch)
tree4535224f4ea63a0f325533d51b4a8ad49779469d
parente86e59bfe6c3a31ec76d6dd4de22457b1a8f821a (diff)
Apply the scrim mode patch.
-rw-r--r--src/game/g_admin.c46
-rw-r--r--src/game/g_admin.h4
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_cmds.c24
-rw-r--r--src/game/g_local.h2
-rw-r--r--src/game/g_main.c6
6 files changed, 85 insertions, 2 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 60779a7..9d5d90e 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -361,6 +361,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
"[^3name|slot^7] (damage)"
},
+ {"scrim", G_admin_scrim, "scrim",
+ "toggles scrim mode",
+ "[on|off]",
+ },
+
{"spec999", G_admin_spec999, "spec999",
"move 999 pingers to the spectator team",
""},
@@ -7074,6 +7079,7 @@ static AdminFlagListEntry_t adminFlagList[] =
{ ADMF_NOREPORTLIMIT, "does not have a report limit" },
{ ADMF_FULLRLIST, "removes self-restriction on report list" },
{ ADMF_SEESINCOGNITO, "sees registered name of players flagged with INCOGNITO" },
+ { ADMF_NOSCRIMRESTRICTION, "team joining, vote and chat restrictions during scrims do not apply" },
{ ADMF_NO_CHAT, "can not talk" },
{ ADMF_NO_VOTE, "can not call votes" }
};
@@ -9812,3 +9818,43 @@ qboolean G_admin_rnote( gentity_t *ent, int skiparg )
return qtrue;
}
+qboolean G_admin_scrim(gentity_t *ent, int skiparg )
+{
+ char state[5];
+
+ if( G_SayArgc() < 2 + skiparg )
+ {
+ ADMP( "^3!scrim: ^7usage: !scrim [on|off]\n" );
+ return qfalse;
+ }
+
+ G_SayArgv( 1 + skiparg, state, sizeof( state ) );
+
+ if( !Q_stricmp(state, "on") )
+ {
+ if( g_scrimMode.integer != 0 )
+ {
+ ADMP( "^3!scrim: ^7scrim mode is already enabled.\n" );
+ return qfalse;
+ }
+ AP( va( "print \"^3!scrim: ^7%s ^7turned scrim mode ^2on^7\n\"", ( ent ) ? G_admin_adminPrintName( ent ) : "console" ) );
+ trap_Cvar_Set( "g_scrimMode", "1" );
+ }
+ else if( !Q_stricmp(state, "off") )
+ {
+ if( g_scrimMode.integer == 0 )
+ {
+ ADMP( "^3!scrim: ^7scrim mode is already disabled.\n" );
+ return qfalse;
+ }
+ AP( va( "print \"^3!scrim: ^7%s ^7turned scrim mode ^1off^7\n\"", ( ent ) ? G_admin_adminPrintName( ent ) : "console" ) );
+ trap_Cvar_Set( "g_scrimMode", "0" );
+
+ } else {
+ ADMP( "^3!scrim: ^7usage: !scrim [on|off]\n" );
+ return qfalse;
+ }
+
+ return qtrue;
+}
+
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index d46b5fa..d211243 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -101,6 +101,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define ADMF_NOREPORTLIMIT "NOREPORTLIMIT"
#define ADMF_SEESINCOGNITO "SEESINCOGNITO"
+#define ADMF_NOSCRIMRESTRICTION "NOSCRIMRESTRICTION"
+
#define ADMF_NO_CHAT ".NOCHAT"
#define ADMF_NO_VOTE ".NOVOTE"
@@ -343,6 +345,8 @@ qboolean G_admin_rclose( gentity_t *ent, int skiparg );
qboolean G_admin_rpurge( gentity_t *ent, int skiparg );
qboolean G_admin_rnote( gentity_t *ent, int skiparg );
+qboolean G_admin_scrim( gentity_t *ent, int skiparg );
+
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
void G_admin_buffer_begin( void );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 985c03d..5c01d0b 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1620,6 +1620,11 @@ void ClientBegin( int clientNum )
// report confirmation
G_admin_report_check( clientNum );
+
+ if( g_scrimMode.integer == 1 )
+ {
+ ADMP( va("^5Scrim mode is enabled for levels < %i\n", g_minLevelToSpecMM1.integer) );
+ }
// request the clients PTR code
trap_SendServerCommand( ent - g_entities, "ptrcrequest" );
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 723a2a5..9b49010 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -777,6 +777,13 @@ void Cmd_Team_f( gentity_t *ent )
va( "print \"You cannot join a team while invisible\n\"" ) );
return;
}
+
+ if( g_scrimMode.integer != 0 && !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) )
+ {
+ trap_SendServerCommand( ent-g_entities,
+ va( "print \"You can't join a team when scrim mode is enabled\n\"" ) );
+ return;
+ }
if( oldteam == PTE_ALIENS )
aliens--;
@@ -1017,7 +1024,8 @@ static void G_SayTo( gentity_t *ent, gentity_t *other, int mode, int color, cons
}
if( mode == SAY_ADMINS &&
- (!G_admin_permission( other, ADMF_ADMINCHAT) || other->client->pers.ignoreAdminWarnings ) )
+ (!G_admin_permission( other, ADMF_ADMINCHAT) || other->client->pers.ignoreAdminWarnings ||
+ ( g_scrimMode.integer != 0 && !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) ) ) )
return;
if( BG_ClientListTest( &other->client->sess.ignoreList, ent-g_entities ) )
@@ -1054,6 +1062,12 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
trap_SendServerCommand( ent-g_entities, "print \"You cannot chat while invisible\n\"" );
return;
}
+
+ if( ent && ent->client->pers.teamSelection == PTE_NONE && g_scrimMode.integer != 0 && !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) && mode != SAY_TEAM )
+ {
+ trap_SendServerCommand( ent-g_entities, "print \"You can't chat when scrim mode is enabled.\n\"" );
+ return;
+ }
// Flood limit. If they're talking too fast, determine that and return.
if( g_floodMinTime.integer )
@@ -1811,6 +1825,14 @@ void Cmd_CallVote_f( gentity_t *ent )
return;
}
+ if( !G_admin_permission( ent, ADMF_NOSCRIMRESTRICTION ) && g_scrimMode.integer != 0 &&
+ ent->client->pers.teamSelection == PTE_NONE )
+ {
+ trap_SendServerCommand( ent - g_entities,
+ "print \"You can't call votes when scrim mode is enabled\n\"" );
+ return;
+ }
+
// make sure it is a valid command to vote on
trap_Argv( 1, arg1, sizeof( arg1 ) );
trap_Argv( 2, arg2, sizeof( arg2 ) );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 09cce52..46c53ba 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -1539,6 +1539,8 @@ extern vmCvar_t g_maxUnregReports;
extern vmCvar_t g_reportWelcomeComment;
+extern vmCvar_t g_scrimMode;
+
void trap_Printf( const char *fmt );
void trap_Error( const char *fmt );
int trap_Milliseconds( void );
diff --git a/src/game/g_main.c b/src/game/g_main.c
index b535e73..a8677eb 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -280,6 +280,8 @@ vmCvar_t g_maxUnregReports;
vmCvar_t g_reportWelcomeComment;
+vmCvar_t g_scrimMode;
+
static cvarTable_t gameCvarTable[ ] =
{
// don't override the cheat state set by the system
@@ -537,7 +539,9 @@ static cvarTable_t gameCvarTable[ ] =
{ &g_maxReports, "g_maxReports", "3", CVAR_ARCHIVE, 0, qfalse },
{ &g_maxUnregReports, "g_maxUnregReports", "1", CVAR_ARCHIVE, 0, qfalse },
- { &g_reportWelcomeComment, "g_reportWelcomeComment", "", CVAR_ARCHIVE, 0, qfalse }
+ { &g_reportWelcomeComment, "g_reportWelcomeComment", "", CVAR_ARCHIVE, 0, qfalse },
+
+ { &g_scrimMode, "g_scrimMode", "0", CVAR_ARCHIVE, 0, qfalse }
};
static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] );