Changed cg_RQ3_<team count> cvars to ui_RQ3_ and added a synch system for these

This commit is contained in:
Daniel Simoes 2002-05-11 15:40:41 +00:00
parent d4ea8e455e
commit 9e623cc6ff
4 changed files with 57 additions and 16 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.71 2002/05/11 15:40:41 slicer
// Changed cg_RQ3_<team count> cvars to ui_RQ3_ and added a synch system for these
//
// Revision 1.70 2002/05/09 06:45:14 niceass
// New tracers
//
@ -1624,9 +1627,9 @@ extern vmCvar_t cg_RQ3_lca;
extern vmCvar_t cg_RQ3_team_round_going;
extern vmCvar_t cg_RQ3_team1name;
extern vmCvar_t cg_RQ3_team2name;
extern vmCvar_t cg_RQ3_teamCount1;
extern vmCvar_t cg_RQ3_teamCount2;
extern vmCvar_t cg_RQ3_numSpectators;
extern vmCvar_t ui_RQ3_teamCount1;
extern vmCvar_t ui_RQ3_teamCount2;
extern vmCvar_t ui_RQ3_numSpectators;
//Slicer: matchmode team status cvars
extern vmCvar_t cg_RQ3_RefID;
extern vmCvar_t cg_RQ3_matchmode;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.61 2002/05/11 15:40:41 slicer
// Changed cg_RQ3_<team count> cvars to ui_RQ3_ and added a synch system for these
//
// Revision 1.60 2002/05/09 06:41:10 niceass
// New tracers
//
@ -313,9 +316,9 @@ vmCvar_t cg_RQ3_lca;
vmCvar_t cg_RQ3_team_round_going;
vmCvar_t cg_RQ3_team1name;
vmCvar_t cg_RQ3_team2name;
vmCvar_t cg_RQ3_teamCount1;
vmCvar_t cg_RQ3_teamCount2;
vmCvar_t cg_RQ3_numSpectators;
vmCvar_t ui_RQ3_teamCount1;
vmCvar_t ui_RQ3_teamCount2;
vmCvar_t ui_RQ3_numSpectators;
//Slicer: matchmode team status cvars
vmCvar_t cg_RQ3_RefID;
@ -482,9 +485,9 @@ static cvarTable_t cvarTable[] = { // bk001129
{ &cg_RQ3_team_round_going, "cg_RQ3_team_round_going", "0", CVAR_ROM},
{ &cg_RQ3_team1name, "g_RQ3_team1name", "0", 0},
{ &cg_RQ3_team2name, "g_RQ3_team2name", "0", 0},
{ &cg_RQ3_teamCount1, "cg_RQ3_teamCount1", "0", CVAR_ROM},
{ &cg_RQ3_teamCount2, "cg_RQ3_teamCount2", "0", CVAR_ROM},
{ &cg_RQ3_numSpectators, "cg_RQ3_numSpectators", "0", CVAR_ROM},
{ &ui_RQ3_teamCount1, "ui_RQ3_teamCount1", "0", CVAR_ROM},
{ &ui_RQ3_teamCount2, "ui_RQ3_teamCount2", "0", CVAR_ROM},
{ &ui_RQ3_numSpectators, "ui_RQ3_numSpectators", "0", CVAR_ROM},
{ &cg_gravity, "g_gravity", "0", 0},
//Slicer: Team Status Cvars for MM
{ &cg_RQ3_matchmode, "g_RQ3_matchmode", "0", 0},

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.26 2002/05/11 15:40:41 slicer
// Changed cg_RQ3_<team count> cvars to ui_RQ3_ and added a synch system for these
//
// Revision 1.25 2002/05/01 18:56:02 makro
// Small fix
//
@ -908,8 +911,35 @@ static void CG_SetDeferredClientInfo( clientInfo_t *ci ) {
CG_LoadClientInfo( ci );
}
/* CG_UpdateTeamVars() by Slicer
This is one attempt to update the team count cvars for the UI, each time
a player changes it's userinfo ( team, name, etc )
*/
void CG_UpdateTeamVars() {
clientInfo_t *ci;
int i;
int Reds, Blues, Spectators;
char v[2];
Reds = Blues = Spectators = 0;
for ( i = 0, ci = cgs.clientinfo ; i < cgs.maxclients ; i++, ci++ ) {
if(!ci->infoValid)
continue;
if (ci->team == TEAM_RED) Reds++;
if (ci->team == TEAM_BLUE) Blues++;
if (ci->team == TEAM_SPECTATOR || ci->team == TEAM_FREE ) Spectators++;
}
//CG_Printf("Reds: %i, Blues: %i, Spectators: %i\n",Reds, Blues, Spectators);
Com_sprintf(v,sizeof(v),"%i",Reds);
trap_Cvar_Set("ui_RQ3_teamCount1",v);
Com_sprintf(v,sizeof(v),"%i",Blues);
trap_Cvar_Set("ui_RQ3_teamCount2",v);
Com_sprintf(v,sizeof(v),"%i",Spectators);
trap_Cvar_Set("ui_RQ3_numSpectators",v);
}
/*
======================
CG_NewClientInfo
@ -934,6 +964,7 @@ void CG_NewClientInfo( int clientNum ) {
// the old value
memset( &newInfo, 0, sizeof( newInfo ) );
// isolate the player's name
v = Info_ValueForKey(configstring, "n");
Q_strncpyz( newInfo.name, v, sizeof( newInfo.name ) );
@ -1091,6 +1122,7 @@ void CG_NewClientInfo( int clientNum ) {
// replace whatever was there with the new one
newInfo.infoValid = qtrue;
*ci = newInfo;
CG_UpdateTeamVars();
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.35 2002/05/11 15:40:41 slicer
// Changed cg_RQ3_<team count> cvars to ui_RQ3_ and added a synch system for these
//
// Revision 1.34 2002/05/09 02:43:12 jbravo
// Fixing stuff and use cmd's
//
@ -1148,7 +1151,7 @@ void CG_Stuffcmd(void) {
cmd = CG_ConcatArgs (1);
trap_SendConsoleCommand (cmd);
}
void CG_SetTeamPlayers(void) {
/*void CG_SetTeamPlayers(void) {
int team, number;
char teamz[64];
@ -1157,13 +1160,13 @@ void CG_SetTeamPlayers(void) {
Com_sprintf (teamz, sizeof(teamz), "%i", number);
if (team == TEAM_RED)
trap_Cvar_Set("cg_RQ3_teamCount1", teamz);
trap_Cvar_Set("ui_RQ3_teamCount1", teamz);
else if (team == TEAM_BLUE)
trap_Cvar_Set("cg_RQ3_teamCount2", teamz);
trap_Cvar_Set("ui_RQ3_teamCount2", teamz);
else if (team == TEAM_SPECTATOR || team == TEAM_FREE)
trap_Cvar_Set("cg_RQ3_numSpectators", teamz);
trap_Cvar_Set("ui_RQ3_numSpectators", teamz);
return;
}
}*/
void CG_Radio(void) {
int sound, gender;
@ -1209,9 +1212,9 @@ void CG_RQ3_Cmd () {
trap_Cvar_Set("cg_RQ3_lca", "0");
CG_AddBufferedSound(cgs.media.actionSound);
break;
case SETTEAMPLAYERS:
/*case SETTEAMPLAYERS:
CG_SetTeamPlayers();
break;
break;*/
case SELECTPISTOL:
// CG_Printf("Selecting pistol\n");
if (cg.snap) {