Added a new Referee System with multiple ref support

This commit is contained in:
Daniel Simoes 2002-08-23 14:25:05 +00:00
parent 10d91a465f
commit 59f1e6ee62
8 changed files with 124 additions and 62 deletions

View file

@ -40,6 +40,7 @@
* Added spawnflag 8 to breakables to allow them to be unkickable * Added spawnflag 8 to breakables to allow them to be unkickable
* Created a CTB respawn Queue. * Created a CTB respawn Queue.
* Added propper handling of players waiting for a respawn in CTB * Added propper handling of players waiting for a respawn in CTB
* New Referee System to allow multiple admins, determined by g_RQ3_maxRefs
# List fixes here for the 2.1 release # List fixes here for the 2.1 release

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.112 2002/08/23 14:25:05 slicer
// Added a new Referee System with multiple ref support
//
// Revision 1.111 2002/08/21 07:00:07 jbravo // Revision 1.111 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB // Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
// //
@ -1471,10 +1474,10 @@ char *ClientConnect(int clientNum, qboolean firstTime, qboolean isBot)
} }
// JBravo: moved from ClientBegin // JBravo: moved from ClientBegin
client->pers.enterTime = level.time; client->pers.enterTime = level.time;
/* Slicer - no no !! this can't be here !
// JBravo: cleaning up stuff // JBravo: cleaning up stuff
client->sess.sub = TEAM_FREE; client->sess.sub = TEAM_FREE;
client->sess.captain = TEAM_FREE; client->sess.captain = TEAM_FREE;*/
return NULL; return NULL;
} }
@ -2026,8 +2029,8 @@ void ClientDisconnect(int clientNum)
} }
} }
// aasimon: Referee. If player is referee, clean ref // aasimon: Referee. If player is referee, clean ref
if (clientNum == g_RQ3_RefID.integer) /*if (clientNum == g_RQ3_RefID.integer)
trap_Cvar_Set("g_RQ3_RefID", "-1"); trap_Cvar_Set("g_RQ3_RefID", "-1");*/
// JBravo: if the client had a laser, turn it off so it doesnt stay there forever. // JBravo: if the client had a laser, turn it off so it doesnt stay there forever.
if (ent->client->lasersight) { if (ent->client->lasersight) {

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.161 2002/08/23 14:25:05 slicer
// Added a new Referee System with multiple ref support
//
// Revision 1.160 2002/08/21 07:00:07 jbravo // Revision 1.160 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB // Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
// //
@ -445,8 +448,8 @@ void DeathmatchScoreboardMessage(gentity_t * ent)
ent->client->sess.savedTeam != cl->sess.savedTeam) ent->client->sess.savedTeam != cl->sess.savedTeam)
alive = qtrue; alive = qtrue;
} }
//MUDANCA ADICIONEI UM INTEIRO
Com_sprintf(entry, sizeof(entry), " %i %i %i %i %i %i %i %i %i %i %i", Com_sprintf(entry, sizeof(entry), " %i %i %i %i %i %i %i %i %i %i %i %i",
level.sortedClients[i], level.sortedClients[i],
cl->ps.persistant[PERS_SCORE], cl->ps.persistant[PERS_SCORE],
ping, ping,
@ -457,7 +460,8 @@ void DeathmatchScoreboardMessage(gentity_t * ent)
cl->ps.persistant[PERS_DAMAGE_DELT], // JBravo: Added for scoreboard cl->ps.persistant[PERS_DAMAGE_DELT], // JBravo: Added for scoreboard
alive, // JBravo: Added for TP scoreboard alive, // JBravo: Added for TP scoreboard
cl->sess.captain, // Slicer: Added for Matchmode Scoreboard cl->sess.captain, // Slicer: Added for Matchmode Scoreboard
cl->sess.sub // Slicer: Added for Matchmode Scoreboard cl->sess.sub, // Slicer: Added for Matchmode Scoreboard
cl->sess.referee
); );
j = strlen(entry); j = strlen(entry);
@ -466,11 +470,11 @@ void DeathmatchScoreboardMessage(gentity_t * ent)
strcpy(string + stringlength, entry); strcpy(string + stringlength, entry);
stringlength += j; stringlength += j;
} }
//MUDANCA !!! REMOVI O ULTIMO INTEIRO
trap_SendServerCommand(ent - g_entities, va("scores %i %i %i %i %i %i %i%s", i, trap_SendServerCommand(ent - g_entities, va("scores %i %i %i %i %i %i%s", i,
level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE], level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE],
level.team1ready, level.team2ready, level.team1ready, level.team2ready,
(int) level.matchTime, g_RQ3_RefID.integer, string)); (int) level.matchTime, string));
} }
/* /*
@ -1558,7 +1562,7 @@ static void Cmd_Say_f(gentity_t * ent, int mode, qboolean arg0)
//Slicer Matchmode //Slicer Matchmode
if (g_RQ3_matchmode.integer) { if (g_RQ3_matchmode.integer) {
normaluser = (ent->client->sess.captain == TEAM_FREE && ent - g_entities != g_RQ3_RefID.integer); normaluser = (ent->client->sess.captain == TEAM_FREE && !ent->client->sess.referee);
switch (g_RQ3_forceteamtalk.integer) { switch (g_RQ3_forceteamtalk.integer) {
case 1: //Only allow say_team when the game hasn't started case 1: //Only allow say_team when the game hasn't started
if (level.inGame && normaluser) if (level.inGame && normaluser)

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.117 2002/08/23 14:25:05 slicer
// Added a new Referee System with multiple ref support
//
// Revision 1.116 2002/08/21 07:00:07 jbravo // Revision 1.116 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB // Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
// //
@ -510,6 +513,7 @@ typedef gentity_t *ignorelist_t[MAXIGNORE];
// MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData() // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
typedef struct { typedef struct {
//Slicer Matchmode //Slicer Matchmode
int referee;
team_t captain; team_t captain;
team_t sub; team_t sub;
team_t sessionTeam; team_t sessionTeam;
@ -1331,7 +1335,8 @@ extern vmCvar_t g_RQ3_ctb_respawndelay; // JBravo: delay in seconds for ctb resp
//aasimon: Ref System for MM //aasimon: Ref System for MM
extern vmCvar_t g_RQ3_AllowRef; extern vmCvar_t g_RQ3_AllowRef;
extern vmCvar_t g_RQ3_RefPass; extern vmCvar_t g_RQ3_RefPass;
extern vmCvar_t g_RQ3_RefID; //extern vmCvar_t g_RQ3_RefID;
extern vmCvar_t g_RQ3_maxRefs;
// aasimon: ini stuff // aasimon: ini stuff
extern vmCvar_t g_RQ3_IniFile; extern vmCvar_t g_RQ3_IniFile;

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.109 2002/08/23 14:25:05 slicer
// Added a new Referee System with multiple ref support
//
// Revision 1.108 2002/08/21 07:00:07 jbravo // Revision 1.108 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB // Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
// //
@ -408,7 +411,8 @@ vmCvar_t g_RQ3_ctb_respawndelay;
// aasimon: Ref System for MM // aasimon: Ref System for MM
vmCvar_t g_RQ3_AllowRef; vmCvar_t g_RQ3_AllowRef;
vmCvar_t g_RQ3_RefPass; vmCvar_t g_RQ3_RefPass;
vmCvar_t g_RQ3_RefID; //vmCvar_t g_RQ3_RefID;
vmCvar_t g_RQ3_maxRefs;
// aasimon: ini stuff // aasimon: ini stuff
vmCvar_t g_RQ3_IniFile; vmCvar_t g_RQ3_IniFile;
@ -564,8 +568,9 @@ static cvarTable_t gameCvarTable[] = {
//{ &g_RQ3_team2ready, "g_RQ3_team2ready", "0", 0, 0, qfalse}, //{ &g_RQ3_team2ready, "g_RQ3_team2ready", "0", 0, 0, qfalse},
// aasimon: Ref system for MM,added infor for referee id (clientnumber) // aasimon: Ref system for MM,added infor for referee id (clientnumber)
{&g_RQ3_AllowRef, "g_RQ3_AllowRef", "0", CVAR_SERVERINFO, 0, qtrue}, {&g_RQ3_AllowRef, "g_RQ3_AllowRef", "0", CVAR_SERVERINFO, 0, qtrue},
{&g_RQ3_RefPass, "g_RQ3_RefPassword", "", CVAR_USERINFO, 0, qfalse}, {&g_RQ3_RefPass, "g_RQ3_RefPassword", "", CVAR_ARCHIVE, 0, qfalse},
{&g_RQ3_RefID, "g_RQ3_RefID", "-1", CVAR_SYSTEMINFO | CVAR_ROM, 0, qfalse}, //{&g_RQ3_RefID, "g_RQ3_RefID", "-1", CVAR_SYSTEMINFO | CVAR_ROM, 0, qfalse},
{&g_RQ3_maxRefs, " g_RQ3_maxRefs", "1", CVAR_SERVERINFO, 0, qtrue},
// aasimon: stuff for da ini file // aasimon: stuff for da ini file
{&g_RQ3_IniFile, "g_RQ3_IniFile", "", CVAR_SERVERINFO, 0, qfalse}, {&g_RQ3_IniFile, "g_RQ3_IniFile", "", CVAR_SERVERINFO, 0, qfalse},
{&g_RQ3_ValidIniFile, "g_RQ3_ValidIniFile", "1", CVAR_SYSTEMINFO | CVAR_ROM, 0, qfalse}, {&g_RQ3_ValidIniFile, "g_RQ3_ValidIniFile", "1", CVAR_SYSTEMINFO | CVAR_ROM, 0, qfalse},
@ -1073,7 +1078,7 @@ void G_InitGame(int levelTime, int randomSeed, int restart)
level.team2ready = qfalse; level.team2ready = qfalse;
level.paused = qfalse; level.paused = qfalse;
level.settingsLocked = qfalse; level.settingsLocked = qfalse;
refVotes[0] = refVotes[1] = -1; refVotes[0] = refVotes[1] = NULL;
} }
if (trap_Cvar_VariableIntegerValue("bot_enable")) { if (trap_Cvar_VariableIntegerValue("bot_enable")) {

View file

@ -2,7 +2,7 @@
// JBravo: for warnings // JBravo: for warnings
int ClientNumberFromString(gentity_t * to, char *s); int ClientNumberFromString(gentity_t * to, char *s);
int refVotes[2]; // refVotes[0] is the clientnumber red team voted gentity_t *refVotes[2]; // refVotes[0] is the clientnumber red team voted
// refVotes[1] is the clientnumber blue team voted // refVotes[1] is the clientnumber blue team voted
@ -20,6 +20,21 @@ void SendEndMessage()
level.teamScores[TEAM_BLUE])); level.teamScores[TEAM_BLUE]));
trap_SendServerCommand(-1, va("print \"Total Match Time: %d:%02d \n\"", mins, secs)); trap_SendServerCommand(-1, va("print \"Total Match Time: %d:%02d \n\"", mins, secs));
} }
int getNumberOfRefs() {
gentity_t *ent;
int i,count;
count = 0;
for (i = 0; i < level.maxclients; i++) {
ent = &g_entities[i];
if (!ent->inuse)
continue;
if(ent->client->sess.referee)
++count;
}
return count;
}
gentity_t *getEntByName(char *name) gentity_t *getEntByName(char *name)
{ {
gentity_t *ent; gentity_t *ent;
@ -288,16 +303,15 @@ void MM_TeamName_f(gentity_t * ent)
void checkRefVotes() void checkRefVotes()
{ {
gentity_t *ent; // gentity_t *ent;
char nr[4]; // char nr[4];
G_Printf("Vote Red: %i Vote Blue %i \n", refVotes[0], refVotes[1]); //G_Printf("Vote Red: %i Vote Blue %i \n", refVotes[0], refVotes[1]);
if (refVotes[0] == refVotes[1]) { if (refVotes[0] == refVotes[1]) {
ent = g_entities + refVotes[0]; // ent = g_entities + refVotes[0];
Com_sprintf(nr, sizeof(nr), "%i", refVotes[0]); refVotes[0]->client->sess.referee = 1;
trap_Cvar_Set("g_RQ3_RefID", nr); trap_SendServerCommand(-1, va("cp \"%s is now a Referee.\n\"", refVotes[0]->client->pers.netname));
trap_SendServerCommand(-1, va("cp \"%s is the new Referee.\n\"", ent->client->pers.netname)); refVotes[0] = refVotes[1] = NULL;
refVotes[0] = refVotes[1] = -1;
} }
} }
@ -318,34 +332,42 @@ void MM_Referee_f(gentity_t * ent)
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\""));
return; return;
} }
if (captain == TEAM_FREE) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Only captains can vote a referee\n\""));
return;
}
if (trap_Argc() < 2) { if (trap_Argc() < 2) {
if (Ref_Exists()) { /*if (Ref_Exists()) {
ref = g_entities + g_RQ3_RefID.integer; ref = g_entities + g_RQ3_RefID.integer;
trap_SendServerCommand(ent - g_entities, trap_SendServerCommand(ent - g_entities,
va("print \"Current Referee: %s\n\"", ref->client->pers.netname)); va("print \"Current Referee: %s\n\"", ref->client->pers.netname));
} else } else
trap_SendServerCommand(ent - g_entities, trap_SendServerCommand(ent - g_entities,
va("print \""MM_DENY_COLOR"No Referee currently assigned, use referee <name>"MM_DENY_COLOR" to assign\n\"")); va("print \""MM_DENY_COLOR"No Referee currently assigned, use referee <name>"MM_DENY_COLOR" to assign\n\""));*/
trap_SendServerCommand(ent - g_entities,
va("print \""MM_DENY_COLOR"Use referee <name> to vote a referee\n\""));
return; return;
} }
if((g_RQ3_mmflags.integer & MMF_VOTEREF) != MMF_VOTEREF) { if((g_RQ3_mmflags.integer & MMF_VOTEREF) != MMF_VOTEREF) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow captains to vote for a Referee\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow captains to vote for a Referee\n\""));
return; return;
} }
if (captain != TEAM_FREE) { if(getNumberOfRefs() == g_RQ3_maxRefs.integer) {
buff = ConcatArgs(1); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
if ((ref = getEntByName(buff)) != NULL) { return;
refVotes[captain - 1] = ref - g_entities; }
trap_SendServerCommand(-1, buff = ConcatArgs(1);
va("print \""MM_OK_COLOR"%s has voted %s"MM_OK_COLOR" for referee\n\"", if ((ref = getEntByName(buff)) != NULL) {
ent->client->pers.netname, ref->client->pers.netname)); refVotes[captain - 1] = ref;
checkRefVotes(); trap_SendServerCommand(-1,
} else { va("print \""MM_OK_COLOR"%s has voted %s"MM_OK_COLOR" for referee\n\"",
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Name\n\"")); ent->client->pers.netname, ref->client->pers.netname));
return; checkRefVotes();
} } else {
} else trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Player Name\n\""));
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You need to be a captain to assign a referee\n\"")); return;
}
} }
void MM_ClearScores(qboolean clearTeamFlags) void MM_ClearScores(qboolean clearTeamFlags)
@ -373,7 +395,7 @@ void MM_ClearScores(qboolean clearTeamFlags)
} }
// aasimon: checks for a ref // aasimon: checks for a ref
qboolean Ref_Exists(void) /*qboolean Ref_Exists(void)
{ {
if (g_RQ3_RefID.integer == -1) if (g_RQ3_RefID.integer == -1)
@ -381,28 +403,32 @@ qboolean Ref_Exists(void)
else else
return qtrue; return qtrue;
} }
*/
// //
// aasimon: Ref Auth. Do some kind of logging (ip's etc) // aasimon: Ref Auth. Do some kind of logging (ip's etc)
// //
qboolean Ref_Auth(gentity_t * ent) qboolean Ref_Auth(gentity_t * ent)
{ {
char pass[MAX_TOKEN_CHARS]; char pass[MAX_TOKEN_CHARS];
int cn; // int cn;
char teste[2]; // char teste[2];
if (!g_RQ3_AllowRef.integer) { if (!g_RQ3_AllowRef.integer) {
// No ref allowed on the server - HELLO!!!!! FIREMAN CARS???? // No ref allowed on the server - HELLO!!!!! FIREMAN CARS????
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Allowed on this server\n\""));
return qfalse; return qfalse;
} }
if(!g_RQ3_matchmode.integer) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"This server is not running match mode\n\""));
return qfalse;
}
if (Q_stricmp(g_RQ3_RefPass.string, "") == 0) { if (Q_stricmp(g_RQ3_RefPass.string, "") == 0) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Password Set on this server\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"No Referee Password Set on this server\n\""));
return qfalse; return qfalse;
} }
if (Ref_Exists()) { /* if (Ref_Exists()) {
// One ref per match // One ref per match
cn = ent - g_entities; cn = ent - g_entities;
@ -413,13 +439,28 @@ qboolean Ref_Auth(gentity_t * ent)
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Referee already set on this server\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Referee already set on this server\n\""));
return qfalse; return qfalse;
}*/
if(getNumberOfRefs() == g_RQ3_maxRefs.integer) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Too many referees already on the server\n\""));
return qfalse;
}
if (ent->client->sess.referee) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are already the referee\n\""));
return qfalse;
} }
trap_Argv(1, pass, sizeof(pass)); trap_Argv(1, pass, sizeof(pass));
// Does a simple plain text auth // Does a simple plain text auth
if (Q_stricmp(pass, g_RQ3_RefPass.string) == 0) { if (Q_stricmp(pass, g_RQ3_RefPass.string) == 0) {
ent->client->sess.referee = 1;
trap_SendServerCommand(-1,
va("print \"%s "MM_OK_COLOR"is now a Referee\n\"",
ent->client->pers.netname));
return qtrue;
}
/* if (Q_stricmp(pass, g_RQ3_RefPass.string) == 0) {
cn = ent - g_entities; cn = ent - g_entities;
Com_sprintf(teste, 3, "%i", cn); Com_sprintf(teste, 3, "%i", cn);
trap_Cvar_Set("g_RQ3_RefID", teste); trap_Cvar_Set("g_RQ3_RefID", teste);
@ -428,7 +469,7 @@ qboolean Ref_Auth(gentity_t * ent)
ent->client->pers.netname)); ent->client->pers.netname));
return qtrue; return qtrue;
} }
*/
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Referee Password\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Invalid Referee Password\n\""));
return qfalse; return qfalse;
@ -460,8 +501,8 @@ void Ref_Command(gentity_t * ent)
char param[MAX_TOKEN_CHARS]; char param[MAX_TOKEN_CHARS];
int cn; int cn;
cn = ent - g_entities; //cn = ent - g_entities;
if (cn != g_RQ3_RefID.integer) { if (!ent->client->sess.referee) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are not a referee\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are not a referee\n\""));
return; return;
} }
@ -561,13 +602,10 @@ void Ref_Command(gentity_t * ent)
void Ref_Resign(gentity_t * ent) void Ref_Resign(gentity_t * ent)
{ {
if (ent - g_entities != g_RQ3_RefID.integer) { if (ent->client->sess.referee) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"You are not a referee\n\"")); ent->client->sess.referee = 0;
return; trap_SendServerCommand(ent - g_entities, va("print \""MM_OK_COLOR"You resign from your referee status\n\""));
} }
trap_Cvar_Set("g_RQ3_RefID", "-1");
trap_SendServerCommand(ent - g_entities, va("print \""MM_OK_COLOR"You resign from your referee status\n\""));
} }
/* /*
@ -606,7 +644,7 @@ void MM_Settings_f(gentity_t * ent) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to change settings\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR "This server does not allow you to change settings\n\""));
return; return;
} }
if (ent->client->sess.captain == TEAM_FREE && ent - g_entities != g_RQ3_RefID.integer) { if (ent->client->sess.captain == TEAM_FREE && !ent->client->sess.referee) {
trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Only Captains and Referees can change match Settings\n\"")); trap_SendServerCommand(ent - g_entities, va("print \""MM_DENY_COLOR"Only Captains and Referees can change match Settings\n\""));
return; return;
} }

View file

@ -27,4 +27,4 @@ qboolean Ref_Exists(void);
qboolean Ref_Auth(gentity_t *); // No need to return a boolean in this context qboolean Ref_Auth(gentity_t *); // No need to return a boolean in this context
void Ref_Command(gentity_t *); void Ref_Command(gentity_t *);
void Ref_Resign(gentity_t *); void Ref_Resign(gentity_t *);
extern int refVotes[2]; extern gentity_t* refVotes[2];

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.20 2002/08/23 14:25:05 slicer
// Added a new Referee System with multiple ref support
//
// Revision 1.19 2002/08/21 07:00:07 jbravo // Revision 1.19 2002/08/21 07:00:07 jbravo
// Added CTB respawn queue and fixed game <-> cgame synch problem in CTB // Added CTB respawn queue and fixed game <-> cgame synch problem in CTB
// //
@ -89,13 +92,13 @@ void G_WriteClientSessionData(gclient_t * client)
//Reset teams on map changes / map_restarts, except on matchmode //Reset teams on map changes / map_restarts, except on matchmode
client->sess.savedTeam = TEAM_SPECTATOR; client->sess.savedTeam = TEAM_SPECTATOR;
} }
s = va("%i %i %i %i %i %i %i %i %i %i", s = va("%i %i %i %i %i %i %i %i %i %i %i",
client->sess.sessionTeam, client->sess.sessionTeam,
client->sess.spectatorTime, client->sess.spectatorTime,
client->sess.spectatorState, client->sess.spectatorState,
client->sess.spectatorClient, client->sess.wins, client->sess.losses, client->sess.teamLeader, client->sess.spectatorClient, client->sess.wins, client->sess.losses, client->sess.teamLeader,
//Adding saved Team //Adding saved Team
client->sess.savedTeam, client->sess.captain, client->sess.sub client->sess.savedTeam, client->sess.captain, client->sess.sub,client->sess.referee
//Captain and sub //Captain and sub
); );
@ -127,14 +130,15 @@ void G_ReadSessionData(gclient_t * client)
int savedTeam; int savedTeam;
int captain; int captain;
int sub; int sub;
int ref;
var = va("session%i", client - level.clients); var = va("session%i", client - level.clients);
trap_Cvar_VariableStringBuffer(var, s, sizeof(s)); trap_Cvar_VariableStringBuffer(var, s, sizeof(s));
//Slicer: Reading savedTeam also. //Slicer: Reading savedTeam also.
sscanf(s, "%i %i %i %i %i %i %i %i %i %i", &sessionTeam, // bk010221 - format sscanf(s, "%i %i %i %i %i %i %i %i %i %i %i", &sessionTeam, // bk010221 - format
&client->sess.spectatorTime, &spectatorState, // bk010221 - format &client->sess.spectatorTime, &spectatorState, // bk010221 - format
&client->sess.spectatorClient, &client->sess.wins, &client->sess.losses, &teamLeader, // bk010221 - format &client->sess.spectatorClient, &client->sess.wins, &client->sess.losses, &teamLeader, // bk010221 - format
&savedTeam, &captain, &sub); &savedTeam, &captain, &sub, &ref);
// bk001205 - format issues // bk001205 - format issues
@ -147,6 +151,7 @@ void G_ReadSessionData(gclient_t * client)
client->sess.savedTeam = (team_t) savedTeam; client->sess.savedTeam = (team_t) savedTeam;
client->sess.captain = (team_t) captain; client->sess.captain = (team_t) captain;
client->sess.sub = (team_t) sub; client->sess.sub = (team_t) sub;
client->sess.referee = ref;
if (g_gametype.integer == GT_CTF) { if (g_gametype.integer == GT_CTF) {
client->sess.sessionTeam = TEAM_SPECTATOR; client->sess.sessionTeam = TEAM_SPECTATOR;
@ -180,6 +185,7 @@ void G_InitSessionData(gclient_t * client, char *userinfo)
sess->captain = TEAM_FREE; sess->captain = TEAM_FREE;
sess->sub = TEAM_FREE; sess->sub = TEAM_FREE;
sess->referee = 0;
// JBravo: adding PERS_SAVEDTEAM // JBravo: adding PERS_SAVEDTEAM
client->ps.persistant[PERS_SAVEDTEAM] = TEAM_SPECTATOR; client->ps.persistant[PERS_SAVEDTEAM] = TEAM_SPECTATOR;