From 7077970c9c72a5890d460c95480b0f1ec413f7b0 Mon Sep 17 00:00:00 2001 From: Daniel Simoes Date: Fri, 2 Aug 2002 22:44:37 +0000 Subject: [PATCH] Added resetMatch command for MM --- reaction/ChangeLog | 1 + reaction/game/g_matchmode.c | 30 +++++++++++++++++++++++++++--- reaction/game/g_matchmode.h | 3 ++- reaction/game/g_svcmds.c | 11 +++++++++-- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/reaction/ChangeLog b/reaction/ChangeLog index e2c0eddf..006832c6 100644 --- a/reaction/ChangeLog +++ b/reaction/ChangeLog @@ -17,6 +17,7 @@ * UI model preview and selection now controls DM gametype models, not team models. * Added a radiosoundset selection dialog to the UI * Doors with health and the "wait" key set to a negative value should work as expected now +* MM: Added "resetMatch" for rcon and referee use, to reset the current server Match Stuff # List fixes here for the 2.1 release diff --git a/reaction/game/g_matchmode.c b/reaction/game/g_matchmode.c index 247d627c..e139ca45 100644 --- a/reaction/game/g_matchmode.c +++ b/reaction/game/g_matchmode.c @@ -348,7 +348,7 @@ void MM_Referee_f(gentity_t * ent) trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You need to be a captain to assign a referee\n\"")); } -void MM_ClearScores(void) +void MM_ClearScores(qboolean clearTeamFlags) { gentity_t *ent; int i; @@ -357,7 +357,10 @@ void MM_ClearScores(void) ent = &g_entities[i]; if (!ent->inuse) continue; - + if(clearTeamFlags) { + ent->client->sess.captain = TEAM_FREE; + ent->client->sess.sub = TEAM_FREE; + } // aasimon: Clear only PERS info. Lata clear all REC information. See if more info is needed to be clean ent->client->ps.persistant[PERS_SCORE] = 0; ent->client->ps.persistant[PERS_KILLED] = 0; @@ -430,6 +433,23 @@ qboolean Ref_Auth(gentity_t * ent) return qfalse; } +// MM_ResetMatch by Slicer +// Used by admin or rcon to reset Match settings, that is subs, captains, scores, teams's status and game status +// +void MM_ResetMatch() { + trap_SendServerCommand(-1, va("print \""MM_OK_COLOR" Reseting Server Match Status...\n\"")); + // CleanUp Scores and Team Status + MM_ClearScores(qtrue); + // Just in case + MakeAllLivePlayersObservers(); + level.team1ready = qfalse; + level.team2ready = qfalse; + level.inGame = qfalse; + level.team_game_going = 0; + level.team_round_going = 0; + level.team_round_countdown = 0; + level.matchTime = 0; +} // // aasimon: processes comands sent from the referee @@ -457,8 +477,12 @@ void Ref_Command(gentity_t * ent) trap_SendServerCommand(ent - g_entities, "print \"pause\n\""); trap_SendServerCommand(ent - g_entities, "print \"cyclemap\n\""); trap_SendServerCommand(ent - g_entities, "print\"lockSettings\n\""); + trap_SendServerCommand(ent - g_entities, "print \"resetMatch\n\""); trap_SendServerCommand(ent - g_entities, "print\"map \n\""); return; + } else if (Q_stricmp(com, "resetMatch") == 0) { + MM_ResetMatch(); + return; } else if (Q_stricmp(com, "lockSettings") == 0) { if(level.settingsLocked) { level.settingsLocked = qfalse; @@ -487,7 +511,7 @@ void Ref_Command(gentity_t * ent) } trap_DropClient(cn, "was kicked by the referee"); } else if (Q_stricmp(com, "clearscores") == 0) { - MM_ClearScores(); + MM_ClearScores(qfalse); return; } else if (Q_stricmp(com, "map_restart") == 0) { // this is having problems, namely diference from rcon map_restart or using this trap diff --git a/reaction/game/g_matchmode.h b/reaction/game/g_matchmode.h index 70bc9fa6..824e0499 100644 --- a/reaction/game/g_matchmode.h +++ b/reaction/game/g_matchmode.h @@ -14,12 +14,13 @@ void MM_RunFrame(void); void MM_Captain_f(gentity_t *); void MM_Sub_f(gentity_t *); void MM_Ready_f(gentity_t *); -void MM_ClearScores(void); +void MM_ClearScores(qboolean); void MM_TeamName_f(gentity_t *); void MM_TeamModel_f(gentity_t *); void MM_Referee_f(gentity_t *); void MM_Settings_f(gentity_t *); void SendEndMessage(); +void MM_ResetMatch(); // aasimon: Declarations for Ref system qboolean Ref_Exists(void); diff --git a/reaction/game/g_svcmds.c b/reaction/game/g_svcmds.c index 596c7091..e02951d2 100644 --- a/reaction/game/g_svcmds.c +++ b/reaction/game/g_svcmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.14 2002/08/02 22:44:37 slicer +// Added resetMatch command for MM +// // Revision 1.13 2002/06/19 18:13:57 jbravo // New TNG spawning system :) // @@ -473,8 +476,12 @@ qboolean ConsoleCommand(void) return qtrue; } //sLiCeR: adding a clearScores - if (Q_stricmp(cmd, "clearscores") == 0) { - MM_ClearScores(); + if (Q_stricmp(cmd, "clearscores") == 0 && g_RQ3_matchmode.integer) { + MM_ClearScores(qfalse); + return qtrue; + } + if (Q_stricmp(cmd, "resetmatch") == 0 && g_RQ3_matchmode.integer) { + MM_ResetMatch(); return qtrue; }