mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-11 15:52:30 +00:00
Captain and subs get saved on map_restarts ( moved to "sess" )
This commit is contained in:
parent
746b33120f
commit
c3f97d9235
7 changed files with 61 additions and 31 deletions
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.72 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.71 2002/05/03 18:09:20 makro
|
||||
// Bot stuff. Jump kicks
|
||||
//
|
||||
|
@ -1331,10 +1334,10 @@ void ClientBegin(int clientNum) {
|
|||
|
||||
//Slicer : Reseting matchmode vars
|
||||
//Note: Each time a player changes team, this will also be called..
|
||||
if(g_RQ3_matchmode.integer && g_gametype.integer == GT_TEAMPLAY) {
|
||||
client->pers.captain = TEAM_FREE;
|
||||
client->pers.sub = TEAM_FREE;
|
||||
}
|
||||
//if(g_RQ3_matchmode.integer && g_gametype.integer == GT_TEAMPLAY) {
|
||||
// client->sess.captain = TEAM_FREE;
|
||||
// client->sess.sub = TEAM_FREE;
|
||||
//}
|
||||
|
||||
//Slicer: Saving persistant and ping
|
||||
if (g_gametype.integer == GT_TEAMPLAY) {
|
||||
|
@ -1790,7 +1793,7 @@ void ClientDisconnect( int clientNum ) {
|
|||
|
||||
//Slicer: matchmode
|
||||
if(g_RQ3_matchmode.integer) {
|
||||
switch(ent->client->pers.captain ) {
|
||||
switch(ent->client->sess.captain ) {
|
||||
case TEAM_RED:
|
||||
trap_Cvar_Set("g_RQ3_team1ready", "0");
|
||||
break;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.103 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.102 2002/05/04 16:19:02 jbravo
|
||||
// Fixing the stuff cmd to work on dedicated servers.
|
||||
//
|
||||
|
@ -902,18 +905,18 @@ void SetTeam( gentity_t *ent, char *s )
|
|||
//Slicer : Matchmode - If a captain changes team , that team is no longer ready
|
||||
if(g_RQ3_matchmode.integer) {
|
||||
// client->sess.savedTeam = team;
|
||||
switch(ent->client->pers.captain) {
|
||||
switch(ent->client->sess.captain) {
|
||||
case TEAM_RED:
|
||||
trap_Cvar_Set("g_RQ3_team1ready", "0");
|
||||
ent->client->pers.captain = TEAM_FREE;
|
||||
break;
|
||||
case TEAM_BLUE:
|
||||
trap_Cvar_Set("g_RQ3_team2ready", "0");
|
||||
ent->client->pers.captain = TEAM_FREE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ent->client->sess.captain = TEAM_FREE;
|
||||
ent->client->sess.sub = TEAM_FREE;
|
||||
}
|
||||
|
||||
// they go to the end of the line for tournements
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.76 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.75 2002/05/05 04:23:00 jbravo
|
||||
// Some MM fixes and cleanups
|
||||
//
|
||||
|
@ -378,6 +381,9 @@ typedef struct {
|
|||
// time and reading them back at connection time. Anything added here
|
||||
// MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
|
||||
typedef struct {
|
||||
//Slicer Matchmode
|
||||
team_t captain;
|
||||
team_t sub;
|
||||
team_t sessionTeam;
|
||||
team_t savedTeam; // JBravo: Used to hold the real team status of a player.
|
||||
int spectatorTime; // for determining next-in-line to play
|
||||
|
@ -396,9 +402,6 @@ typedef struct {
|
|||
// client data that stays across multiple respawns, but is cleared
|
||||
// on each level change or team change at ClientBegin()
|
||||
typedef struct {
|
||||
//Slicer: Matchmode
|
||||
team_t captain;
|
||||
team_t sub;
|
||||
clientConnected_t connected;
|
||||
// aasimon: No Need for this here, using a cvar to record the clientnumber of referee, so that map_restarts dont change
|
||||
// the referee
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.53 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.52 2002/05/05 04:23:00 jbravo
|
||||
// Some MM fixes and cleanups
|
||||
//
|
||||
|
@ -564,8 +567,6 @@ void G_RegisterCvars( void ) {
|
|||
if (remapped) {
|
||||
G_RemapTeamShaders();
|
||||
}
|
||||
|
||||
G_Printf("Testing\n");
|
||||
// check some things
|
||||
if ( g_gametype.integer < 0 || g_gametype.integer >= GT_MAX_GAME_TYPE ) {
|
||||
G_Printf( "g_gametype %i is out of range, defaulting to 0\n", g_gametype.integer );
|
||||
|
|
|
@ -9,7 +9,7 @@ qboolean checkCaptain (team_t team) {
|
|||
ent = &g_entities[i];
|
||||
if (!ent->inuse)
|
||||
continue;
|
||||
if(ent->client->sess.savedTeam == team && ent->client->pers.captain == team)
|
||||
if(ent->client->sess.savedTeam == team && ent->client->sess.captain == team)
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -36,19 +36,19 @@ void MM_Sub_f (gentity_t *ent) {
|
|||
trap_SendServerCommand (ent-g_entities, "print \"You need to be on a team for that\n\"");
|
||||
return;
|
||||
}
|
||||
if (ent->client->pers.sub == TEAM_FREE) {
|
||||
if (ent->client->sess.sub == TEAM_FREE) {
|
||||
// if (ent->client->ps.pm_type == PM_NORMAL) {
|
||||
if (ent->client->sess.sessionTeam != TEAM_SPECTATOR) {
|
||||
ent->flags &= ~FL_GODMODE;
|
||||
ent->client->ps.stats[STAT_HEALTH] = ent->health = 0;
|
||||
player_die (ent, ent, ent, 100000, MOD_SUICIDE);
|
||||
}
|
||||
ent->client->pers.sub = ent->client->sess.savedTeam;
|
||||
ent->client->sess.sub = ent->client->sess.savedTeam;
|
||||
trap_SendServerCommand( -1, va("print \"%s is now a Substitute for %s.\n\"",
|
||||
ent->client->pers.netname,
|
||||
ent->client->sess.savedTeam==TEAM_BLUE ? g_RQ3_team2name.string: g_RQ3_team1name.string));
|
||||
} else {
|
||||
ent->client->pers.sub = TEAM_FREE;
|
||||
ent->client->sess.sub = TEAM_FREE;
|
||||
trap_SendServerCommand( -1, va("print \"%s is no longer a Substitute for %s.\n\"",
|
||||
ent->client->pers.netname,
|
||||
ent->client->sess.savedTeam==TEAM_BLUE ? g_RQ3_team2name.string: g_RQ3_team1name.string));
|
||||
|
@ -62,19 +62,19 @@ void MM_Captain_f (gentity_t *ent) {
|
|||
trap_SendServerCommand (ent-g_entities, "print \"You need to be on a team for that\n\"");
|
||||
return;
|
||||
}
|
||||
if (ent->client->pers.captain == TEAM_RED) {
|
||||
if (ent->client->sess.captain == TEAM_RED) {
|
||||
trap_Cvar_Set("g_RQ3_team1ready", "0");
|
||||
trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain.\n\"",
|
||||
ent->client->pers.netname, g_RQ3_team1name.string));
|
||||
ent->client->pers.captain = TEAM_FREE;
|
||||
} else if (ent->client->pers.captain == TEAM_BLUE) {
|
||||
ent->client->sess.captain = TEAM_FREE;
|
||||
} else if (ent->client->sess.captain == TEAM_BLUE) {
|
||||
trap_Cvar_Set("g_RQ3_team2ready", "0");
|
||||
trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain.\n\"",
|
||||
ent->client->pers.netname, g_RQ3_team2name.string));
|
||||
ent->client->pers.captain = TEAM_FREE;
|
||||
ent->client->sess.captain = TEAM_FREE;
|
||||
} else {
|
||||
if (!checkCaptain(ent->client->sess.savedTeam)) {
|
||||
ent->client->pers.captain = ent->client->sess.savedTeam;
|
||||
ent->client->sess.captain = ent->client->sess.savedTeam;
|
||||
trap_SendServerCommand( -1, va("print \"%s is now %s's Captain.\n\"",
|
||||
ent->client->pers.netname,
|
||||
ent->client->sess.savedTeam==TEAM_BLUE ? g_RQ3_team2name.string: g_RQ3_team1name.string));
|
||||
|
@ -87,7 +87,7 @@ void MM_Ready_f (gentity_t *ent) {
|
|||
if (!g_RQ3_matchmode.integer)
|
||||
return;
|
||||
|
||||
if (ent->client->pers.captain != TEAM_FREE) {
|
||||
if (ent->client->sess.captain != TEAM_FREE) {
|
||||
if (ent->client->sess.savedTeam == TEAM_RED) {
|
||||
trap_SendServerCommand( -1, va("cp \"%s is%s Ready.\n\"",
|
||||
g_RQ3_team1name.string, g_RQ3_team1ready.integer == 0 ? "": " no longer"));
|
||||
|
@ -128,7 +128,7 @@ void MM_TeamModel_f (gentity_t *ent) {
|
|||
ent->client->sess.savedTeam == TEAM_RED ? g_RQ3_team1model.string : g_RQ3_team2model.string));
|
||||
return;
|
||||
} else {
|
||||
if (ent->client->pers.captain == TEAM_FREE) {
|
||||
if (ent->client->sess.captain == TEAM_FREE) {
|
||||
trap_SendServerCommand(ent-g_entities, "print \"You need to be a captain for that\n\"");
|
||||
return;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void MM_TeamName_f (gentity_t *ent) {
|
|||
ent->client->sess.savedTeam == TEAM_RED ? g_RQ3_team1name.string : g_RQ3_team2name.string));
|
||||
return;
|
||||
} else {
|
||||
if (ent->client->pers.captain == TEAM_FREE) {
|
||||
if (ent->client->sess.captain == TEAM_FREE) {
|
||||
trap_SendServerCommand(ent-g_entities, "print \"You need to be a captain for that\n\"");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.14 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.13 2002/03/30 21:51:42 jbravo
|
||||
// Removed all those ifdefs for zcam.
|
||||
//
|
||||
|
@ -71,7 +74,7 @@ void G_WriteClientSessionData( gclient_t *client ) {
|
|||
//Reset teams on map changes / map_restarts, except on matchmode
|
||||
client->sess.savedTeam = TEAM_SPECTATOR;
|
||||
}
|
||||
s = va("%i %i %i %i %i %i %i %i",
|
||||
s = va("%i %i %i %i %i %i %i %i %i %i",
|
||||
client->sess.sessionTeam,
|
||||
client->sess.spectatorTime,
|
||||
client->sess.spectatorState,
|
||||
|
@ -80,7 +83,10 @@ void G_WriteClientSessionData( gclient_t *client ) {
|
|||
client->sess.losses,
|
||||
client->sess.teamLeader,
|
||||
//Adding saved Team
|
||||
client->sess.savedTeam
|
||||
client->sess.savedTeam,
|
||||
client->sess.captain,
|
||||
client->sess.sub
|
||||
//Captain and sub
|
||||
);
|
||||
|
||||
|
||||
|
@ -108,11 +114,13 @@ void G_ReadSessionData( gclient_t *client ) {
|
|||
int sessionTeam;
|
||||
//Slicer
|
||||
int savedTeam;
|
||||
int captain;
|
||||
int sub;
|
||||
|
||||
var = va( "session%i", client - level.clients );
|
||||
trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );
|
||||
//Slicer: Reading savedTeam also.
|
||||
sscanf( s, "%i %i %i %i %i %i %i %i",
|
||||
sscanf( s, "%i %i %i %i %i %i %i %i %i %i",
|
||||
&sessionTeam, // bk010221 - format
|
||||
&client->sess.spectatorTime,
|
||||
&spectatorState, // bk010221 - format
|
||||
|
@ -120,7 +128,9 @@ void G_ReadSessionData( gclient_t *client ) {
|
|||
&client->sess.wins,
|
||||
&client->sess.losses,
|
||||
&teamLeader, // bk010221 - format
|
||||
&savedTeam
|
||||
&savedTeam,
|
||||
&captain,
|
||||
&sub
|
||||
);
|
||||
|
||||
// bk001205 - format issues
|
||||
|
@ -129,6 +139,8 @@ void G_ReadSessionData( gclient_t *client ) {
|
|||
client->sess.teamLeader = (qboolean)teamLeader;
|
||||
|
||||
client->sess.savedTeam = (team_t)savedTeam;
|
||||
client->sess.captain = (team_t)captain;
|
||||
client->sess.sub = (team_t)sub;
|
||||
|
||||
camera_state_load (client);
|
||||
}
|
||||
|
@ -151,6 +163,11 @@ void G_InitSessionData( gclient_t *client, char *userinfo ) {
|
|||
|
||||
sess->savedTeam = TEAM_SPECTATOR;
|
||||
|
||||
//Slicer: init Matchmode stuff
|
||||
|
||||
sess->captain = TEAM_FREE;
|
||||
sess->sub = TEAM_FREE;
|
||||
|
||||
// JBravo: adding PERS_SAVEDTEAM
|
||||
client->ps.persistant[PERS_SAVEDTEAM] = TEAM_SPECTATOR;
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.79 2002/05/05 15:51:16 slicer
|
||||
// Captain and subs get saved on map_restarts ( moved to "sess" )
|
||||
//
|
||||
// Revision 1.78 2002/05/05 04:23:00 jbravo
|
||||
// Some MM fixes and cleanups
|
||||
//
|
||||
|
@ -671,7 +674,7 @@ team_t RQ3TeamCount( int ignoreClientNum, int team )
|
|||
continue;
|
||||
}
|
||||
//Slicer: Matchmode - Subs don't count
|
||||
if (g_RQ3_matchmode.integer && level.clients[i].pers.sub != TEAM_FREE)
|
||||
if (g_RQ3_matchmode.integer && level.clients[i].sess.sub != TEAM_FREE)
|
||||
continue;
|
||||
if (level.clients[i].sess.savedTeam == team) {
|
||||
count++;
|
||||
|
@ -731,7 +734,7 @@ void SpawnPlayers()
|
|||
continue;
|
||||
//Slicer: Matchmode - Subs don't spawn
|
||||
|
||||
if (g_RQ3_matchmode.integer && player->client->pers.sub != TEAM_FREE)
|
||||
if (g_RQ3_matchmode.integer && player->client->sess.sub != TEAM_FREE)
|
||||
continue;
|
||||
// JBravo: lets not respawn spectators in free floating mode
|
||||
if (player->client->sess.savedTeam == TEAM_SPECTATOR &&
|
||||
|
|
Loading…
Reference in a new issue