Added resetMatch command for MM

This commit is contained in:
Daniel Simoes 2002-08-02 22:44:37 +00:00
parent 757e032c08
commit 7077970c9c
4 changed files with 39 additions and 6 deletions

View file

@ -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

View file

@ -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 <map_to_go>\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

View file

@ -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);

View file

@ -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;
}