From d3e2fde905e22d4f31b4fbf21ba7942108d3b3ae Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Thu, 18 Apr 2002 16:13:23 +0000 Subject: [PATCH] Scoreboard now shows green for live players and white for dead. Time should not get reset on deaths any more. --- reaction/cgame/cg_local.h | 5 +++ reaction/cgame/cg_scoreboard.c | 17 ++++++++-- reaction/cgame/cg_servercmds.c | 8 ++++- reaction/game/g_client.c | 8 ++++- reaction/game/g_cmds.c | 57 +++++++++++----------------------- 5 files changed, 51 insertions(+), 44 deletions(-) diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index 2fdaa137..60f81f4c 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -5,6 +5,10 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.65 2002/04/18 16:13:23 jbravo +// Scoreboard now shows green for live players and white for dead. +// Time should not get reset on deaths any more. +// // Revision 1.64 2002/04/07 12:49:53 slicer // Added 'teamname' command for MM, and tweaked the cvar system. // @@ -418,6 +422,7 @@ typedef struct { int score; int deaths; // NiceAss: Added deaths int damage; // JBravo: Added damage + int alive; // JBravo: Added flag to tell if player is alive int ping; int time; int scoreFlags; diff --git a/reaction/cgame/cg_scoreboard.c b/reaction/cgame/cg_scoreboard.c index 6ad99513..27b0dc75 100644 --- a/reaction/cgame/cg_scoreboard.c +++ b/reaction/cgame/cg_scoreboard.c @@ -5,6 +5,10 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.22 2002/04/18 16:13:23 jbravo +// Scoreboard now shows green for live players and white for dead. +// Time should not get reset on deaths any more. +// // Revision 1.21 2002/03/31 03:31:24 jbravo // Compiler warning cleanups // @@ -192,7 +196,7 @@ static int CG_TeamplayScoreboard(void) char Tmp[128]; vec4_t White, Black, RedL, BlueL, GreyL, BlackL; - vec4_t RedD, BlueD, GreyD; + vec4_t RedD, BlueD, GreyD, Green; if (cg.time > cg.scoreStartTime+300) { Alpha = cos((cg.time-cg.scoreStartTime) / 400.0f) * 0.15f + 0.85f; @@ -205,6 +209,7 @@ static int CG_TeamplayScoreboard(void) MAKERGBA(White, 1.0f, 1.0f, 1.0f, 1.0f); MAKERGBA(Black, 0.0f, 0.0f, 0.0f, 1.0f); + MAKERGBA(Green, 0.0f, 1.0f, 0.0f, 1.0f); MAKERGBA(BlackL, 0.0f, 0.0f, 0.0f, 0.8f * Alpha); MAKERGBA(RedD, 0.8f, 0.0f,0.0f, 0.8f * Alpha); MAKERGBA(BlueD, 0.0f, 0.0f, 0.8f, 0.8f * Alpha); @@ -268,7 +273,10 @@ static int CG_TeamplayScoreboard(void) ci = &cgs.clientinfo[ Score->client ]; if (ci->team == TEAM_RED) { - CG_DrawTeamplayClientScore(y, Score, RedL, Black, White); + if(Score->alive) + CG_DrawTeamplayClientScore(y, Score, RedL, Black, Green); + else + CG_DrawTeamplayClientScore(y, Score, RedL, Black, White); if (First == 0) DrawStrip(y, SB_FONTSIZEH, qfalse, qtrue, qfalse, RedL, Black); y += SB_FONTSIZEH+SB_PADDING*2; Ping += Score->ping; @@ -313,7 +321,10 @@ static int CG_TeamplayScoreboard(void) ci = &cgs.clientinfo[ Score->client ]; if (ci->team == TEAM_BLUE) { - CG_DrawTeamplayClientScore(y, Score, BlueL, Black, White); + if(Score->alive) + CG_DrawTeamplayClientScore(y, Score, BlueL, Black, Green); + else + CG_DrawTeamplayClientScore(y, Score, BlueL, Black, White); if (First == 0) DrawStrip(y, SB_FONTSIZEH, qfalse, qtrue, qfalse, BlueL, Black); y += SB_FONTSIZEH+SB_PADDING*2; Ping += Score->ping; diff --git a/reaction/cgame/cg_servercmds.c b/reaction/cgame/cg_servercmds.c index f3a6c101..3c57bc36 100644 --- a/reaction/cgame/cg_servercmds.c +++ b/reaction/cgame/cg_servercmds.c @@ -5,6 +5,10 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.28 2002/04/18 16:13:23 jbravo +// Scoreboard now shows green for live players and white for dead. +// Time should not get reset on deaths any more. +// // Revision 1.27 2002/04/03 03:13:49 blaze // NEW BREAKABLE CODE - will break all old breakables(wont appear in maps) // @@ -131,10 +135,12 @@ static void CG_ParseScores( void ) { cg.scores[i].deaths = atoi(CG_Argv(i * 14 + 11)); // JBravo: Added damage, replaced the place of excellentCount cg.scores[i].damage = atoi(CG_Argv(i * 14 + 12)); + // JBravo: Added health, replaced the place of guantletCount + cg.scores[i].alive = atoi(CG_Argv(i * 14 + 13)); //Elder: these should be zero //cg.scores[i].impressiveCount = atoi(CG_Argv(i * 14 + 11)); //cg.scores[i].excellentCount = atoi(CG_Argv(i * 14 + 12)); - cg.scores[i].guantletCount = atoi(CG_Argv(i * 14 + 13)); + //cg.scores[i].guantletCount = atoi(CG_Argv(i * 14 + 13)); cg.scores[i].defendCount = atoi(CG_Argv(i * 14 + 14)); cg.scores[i].assistCount = atoi(CG_Argv(i * 14 + 15)); cg.scores[i].perfect = atoi(CG_Argv(i * 14 + 16)); diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 40f42fab..9444c343 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,10 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.66 2002/04/18 16:13:23 jbravo +// Scoreboard now shows green for live players and white for dead. +// Time should not get reset on deaths any more. +// // Revision 1.65 2002/04/09 14:30:10 jbravo // Made cg_thirdPerson a CVAR_ROM, Made bots understand team aliases (1 and 2) and // made TP spawns more random. @@ -1248,6 +1252,8 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot ) { camera_begin(ent); client->camera->mode = CAMERA_MODE_SWING; } +// JBravo: moved from ClientBegin + client->pers.enterTime = level.time; //Blaze: Send out the breakable names to the clients if (!isBot && G_SendBreakableInfo(clientNum)) @@ -1304,7 +1310,7 @@ void ClientBegin(int clientNum) { } client->pers.connected = CON_CONNECTED; - client->pers.enterTime = level.time; +// client->pers.enterTime = level.time; client->pers.teamState.state = TEAM_BEGIN; // save eflags around this, because changing teams will diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index 017ecd22..f49eba53 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,10 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.95 2002/04/18 16:13:23 jbravo +// Scoreboard now shows green for live players and white for dead. +// Time should not get reset on deaths any more. +// // Revision 1.94 2002/04/14 12:55:03 jbravo // Cleaned up cmd_reload while hunting for the m3 reload bug // @@ -199,13 +203,11 @@ DeathmatchScoreboardMessage ================== */ -void DeathmatchScoreboardMessage( gentity_t *ent ) { - char entry[1024]; - char string[1400]; - int stringlength; - int i, j; +void DeathmatchScoreboardMessage (gentity_t *ent) { + char entry[1024], string[1400]; + int stringlength, i, j, alive; gclient_t *cl; - int numSorted, scoreFlags, accuracy, perfect; + int numSorted, scoreFlags, accuracy; // send the latest information on all clients string[0] = 0; @@ -219,55 +221,32 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) { cl = &level.clients[level.sortedClients[i]]; - if ( cl->pers.connected == CON_CONNECTING ) { + if (cl->pers.connected == CON_CONNECTING) { ping = -1; } else { ping = cl->ps.ping < 999 ? cl->ps.ping : 999; } - if( cl->accuracy_shots ) { + if (cl->accuracy_shots) { accuracy = cl->accuracy_hits * 100 / cl->accuracy_shots; - } - else { + } else { accuracy = 0; } - perfect = ( cl->ps.persistant[PERS_RANK] == 0 && cl->ps.persistant[PERS_KILLED] == 0 ) ? 1 : 0; -//Blaze: Removed because it uses the persistant stats stuff -//Elder: played around with it... -// G_Printf("Clientnum: %s is %d\n", cl->pers.netname, cl->ps.persistant[PERS_KILLED]); + + alive = cl->sess.sessionTeam != TEAM_SPECTATOR ? 1 : 0; Com_sprintf (entry, sizeof(entry), " %i %i %i %i %i %i %i %i %i %i %i %i %i %i", level.sortedClients[i], cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000, scoreFlags, g_entities[level.sortedClients[i]].s.powerups, accuracy, - cl->ps.persistant[PERS_KILLED], // NiceAss: Added for TP scoreboard - cl->ps.persistant[PERS_DAMAGE_DELT], // JBravo: Added for TP scoreboard - 0, + cl->ps.persistant[PERS_KILLED], // NiceAss: Added for TP scoreboard + cl->ps.persistant[PERS_DAMAGE_DELT], // JBravo: Added for TP scoreboard + alive, // JBravo: Added for TP scoreboard 0, 0, 0, 0); - //cl->ps.persistant[PERS_IMPRESSIVE_COUNT], - //cl->ps.persistant[PERS_EXCELLENT_COUNT], - //cl->ps.persistant[PERS_GAUNTLET_FRAG_COUNT], - //cl->ps.persistant[PERS_DEFEND_COUNT], - //cl->ps.persistant[PERS_ASSIST_COUNT], - //perfect, - //cl->ps.persistant[PERS_CAPTURES]); - -/* Com_sprintf (entry, sizeof(entry), - " %i %i %i %i %i %i %i %i %i %i %i %i %i %i", level.sortedClients[i], - cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000, - scoreFlags, g_entities[level.sortedClients[i]].s.powerups, accuracy, - cl->ps.persistant[PERS_IMPRESSIVE_COUNT], - cl->ps.persistant[PERS_EXCELLENT_COUNT], - cl->ps.persistant[PERS_GAUNTLET_FRAG_COUNT], - cl->ps.persistant[PERS_DEFEND_COUNT], - cl->ps.persistant[PERS_ASSIST_COUNT], - perfect, - cl->ps.persistant[PERS_CAPTURES]); - */ j = strlen(entry); if (stringlength + j > 1024) break; @@ -275,9 +254,9 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) { stringlength += j; } - trap_SendServerCommand( ent-g_entities, va("scores %i %i %i%s", i, + trap_SendServerCommand(ent-g_entities, va("scores %i %i %i%s", i, level.teamScores[TEAM_RED], level.teamScores[TEAM_BLUE], - string ) ); + string)); }