From 5ba05f73f6c52db748b8a12306c0641ad20565ec Mon Sep 17 00:00:00 2001 From: Bryce Hutchings Date: Wed, 7 Aug 2002 04:46:20 +0000 Subject: [PATCH] ctb changes --- reaction/cgame/cg_draw.c | 55 ++++++++++++++++------------------ reaction/cgame/cg_drawtools.c | 45 ++++++++++++++++++---------- reaction/cgame/cg_local.h | 5 +++- reaction/cgame/cg_scoreboard.c | 37 +++++++++++++++++++---- 4 files changed, 91 insertions(+), 51 deletions(-) diff --git a/reaction/cgame/cg_draw.c b/reaction/cgame/cg_draw.c index eb848e0f..512e3e11 100644 --- a/reaction/cgame/cg_draw.c +++ b/reaction/cgame/cg_draw.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.61 2002/08/07 04:46:20 niceass +// ctb changes +// // Revision 1.60 2002/07/22 06:31:32 niceass // cleaned up the powerup code // @@ -647,12 +650,15 @@ static float CG_DrawScore(float y) // The other team: if (team == TEAM_RED) { s = va("%i", cgs.scores2); // Blue - MAKERGBA(BColor, 0.0f, 0.0f, 1.0f, 0.4f); + CG_TeamColor(TEAM_BLUE, BColor); } else { s = va("%i", cgs.scores1); // Red - MAKERGBA(BColor, 1.0f, 0.0f, 0.0f, 0.4f); + CG_TeamColor(TEAM_RED, BColor); } + BColor[3] = 0.4f; + + //MAKERGBA(BColor, 0.0f, 0.0f, 1.0f, 0.4f); w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; x = w; @@ -664,12 +670,13 @@ static float CG_DrawScore(float y) // Your team: if (team == TEAM_RED) { s = va("%i", cgs.scores1); // Red - MAKERGBA(BColor, 1.0f, 0.0f, 0.0f, 0.4f); + CG_TeamColor(TEAM_RED, BColor); } else { s = va("%i", cgs.scores2); // Blue - MAKERGBA(BColor, 0.0f, 0.0f, 1.0f, 0.4f); + CG_TeamColor(TEAM_BLUE, BColor); } + BColor[3] = 0.4f; w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; x += w + 9; @@ -690,12 +697,14 @@ static float CG_DrawScore(float y) else x = w; - MAKERGBA(BColor, 0.0f, 0.0f, 0.0f, 0.4f); + MAKERGBA(BColor, 1.0f, 1.0f, 1.0f, 1.0f); CG_FillRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, BColor); CG_DrawCleanRect(631 - x - 3, y - 1, w + 6, SMALLCHAR_HEIGHT + 6, 1, FColor); - CG_DrawSmallString(631 - x, y + 2, s, 1.0F); + MAKERGBA(FColor, 0.0f, 0.0f, 0.0f, 1.0f); + CG_DrawStringExt(631 - x, y + 2, s, FColor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0); + //CG_DrawSmallString(631 - x, y + 2, s, 1.0F); return y + SMALLCHAR_HEIGHT + 4; @@ -927,17 +936,9 @@ static float CG_DrawTeamOverlay(float y, qboolean right, qboolean upper) ret_y = y; } - if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED) { - hcolor[0] = 1.0f; - hcolor[1] = 0.0f; - hcolor[2] = 0.0f; - hcolor[3] = 0.33f; - } else { // if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) - hcolor[0] = 0.0f; - hcolor[1] = 0.0f; - hcolor[2] = 1.0f; - hcolor[3] = 0.33f; - } + CG_TeamColor(cg.snap->ps.persistant[PERS_TEAM], hcolor); + hcolor[3] = 0.33f; + trap_R_SetColor(hcolor); CG_DrawPic(x, y, w, h, cgs.media.teamStatusBar); trap_R_SetColor(NULL); @@ -1267,14 +1268,10 @@ static void CG_DrawTeamInfo(void) w += TINYCHAR_WIDTH * 2; if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_RED) { - hcolor[0] = 1.0f; - hcolor[1] = 0.0f; - hcolor[2] = 0.0f; + CG_TeamColor(TEAM_RED, hcolor); hcolor[3] = 0.33f; } else if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE) { - hcolor[0] = 0.0f; - hcolor[1] = 0.0f; - hcolor[2] = 1.0f; + CG_TeamColor(TEAM_RED, hcolor); hcolor[3] = 0.33f; } else { hcolor[0] = 0.0f; @@ -1933,13 +1930,11 @@ static void CG_DrawSpectator(void) MAKERGBA(Color, 0.0f, 0.0f, 0.0f, 0.4f); if (cgs.gametype == GT_TEAMPLAY) { - if (cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_RED) { - MAKERGBA(Color, 0.7f, 0.0f, 0.0f, 0.3f); - } - - if (cg.snap->ps.persistant[PERS_SAVEDTEAM] == TEAM_BLUE) { - MAKERGBA(Color, 0.0f, 0.0f, 0.7f, 0.3f); - } + CG_TeamColor(cg.snap->ps.persistant[PERS_SAVEDTEAM], Color); + Color[0] *= 0.7f; + Color[1] *= 0.7f; + Color[2] *= 0.7f; + Color[3] = 0.3f; } CG_FillRect(0, 420, 640, 60, Color); diff --git a/reaction/cgame/cg_drawtools.c b/reaction/cgame/cg_drawtools.c index e4a6c8e6..b340c9dc 100644 --- a/reaction/cgame/cg_drawtools.c +++ b/reaction/cgame/cg_drawtools.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.11 2002/08/07 04:45:46 niceass +// ctb changes +// // Revision 1.10 2002/06/16 20:06:13 jbravo // Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap" // @@ -407,22 +410,34 @@ float *CG_FadeColor(int startMsec, int totalMsec) CG_TeamColor ================ */ -float *CG_TeamColor(int team) +void CG_TeamColor(int team, float *color) { - static vec4_t red = { 1, 0.2f, 0.2f, 1 }; - static vec4_t blue = { 0.2f, 0.2f, 1, 1 }; - static vec4_t other = { 1, 1, 1, 1 }; - static vec4_t spectator = { 0.7f, 0.7f, 0.7f, 1 }; - - switch (team) { - case TEAM_RED: - return red; - case TEAM_BLUE: - return blue; - case TEAM_SPECTATOR: - return spectator; - default: - return other; + if ( cgs.gametype == GT_CTF ) { + switch (team) { + case TEAM_RED: + MAKERGBA(color, 0.5f, 0.5f, 0.5f, 1); + break; + case TEAM_BLUE: + MAKERGBA(color, 0, 0, 0, 1); + break; + default: + MAKERGBA(color, 1, 1, 1, 1); + break; + } + } + else + { + switch (team) { + case TEAM_RED: + MAKERGBA(color, 1, 0, 0, 1); + break; + case TEAM_BLUE: + MAKERGBA(color, 0, 0, 1, 1); + break; + default: + MAKERGBA(color, 1, 1, 1, 1); + break; + } } } diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index 9b37292f..f124e3de 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.115 2002/08/07 04:45:07 niceass +// ctb changes +// // Revision 1.114 2002/08/07 03:35:57 jbravo // Added dynamic radio and stopped all radio usage during lca // @@ -1815,7 +1818,7 @@ void CG_DrawSmallStringColor(int x, int y, const char *s, vec4_t color); int CG_DrawStrlen(const char *str); float *CG_FadeColor(int startMsec, int totalMsec); -float *CG_TeamColor(int team); +void CG_TeamColor(int team, float *color); void CG_TileClear(void); void CG_ColorForHealth(vec4_t hcolor); void CG_GetColorForHealth(int health, int armor, vec4_t hcolor); diff --git a/reaction/cgame/cg_scoreboard.c b/reaction/cgame/cg_scoreboard.c index 97a59f81..9f394bed 100644 --- a/reaction/cgame/cg_scoreboard.c +++ b/reaction/cgame/cg_scoreboard.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.44 2002/08/07 04:44:23 niceass +// ctb changes +// // Revision 1.43 2002/07/22 01:27:38 niceass // spectator coloring fix // @@ -371,11 +374,32 @@ static int CG_TeamplayScoreboard(void) } 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); + + CG_TeamColor(TEAM_RED, RedD); + RedD[0] *= 0.8f; + RedD[1] *= 0.8f; + RedD[2] *= 0.8f; + RedD[3] *= (0.8f * Alpha); + //MAKERGBA(RedD, 0.8f, 0.0f, 0.0f, 0.8f * Alpha); + CG_TeamColor(TEAM_BLUE, BlueD); + BlueD[0] *= 0.8f; + BlueD[1] *= 0.8f; + BlueD[2] *= 0.8f; + BlueD[3] *= (0.8f * Alpha); + //MAKERGBA(BlueD, 0.0f, 0.0f, 0.8f, 0.8f * Alpha); MAKERGBA(GreyD, 0.3f, 0.3f, 0.3f, 0.84f * Alpha); - MAKERGBA(RedL, 0.8f, 0.0f, 0.0f, 0.4f * Alpha); - MAKERGBA(BlueL, 0.0f, 0.0f, 0.8f, 0.4f * Alpha); + CG_TeamColor(TEAM_RED, RedL); + RedL[0] *= 0.8f; + RedL[1] *= 0.8f; + RedL[2] *= 0.8f; + RedL[3] *= (0.8f * Alpha); + //MAKERGBA(RedL, 0.8f, 0.0f, 0.0f, 0.4f * Alpha); + CG_TeamColor(TEAM_BLUE, BlueL); + BlueL[0] *= 0.8f; + BlueL[1] *= 0.8f; + BlueL[2] *= 0.8f; + BlueL[3] *= (0.8f * Alpha); + //MAKERGBA(BlueL, 0.0f, 0.0f, 0.8f, 0.4f * Alpha); MAKERGBA(GreyL, 0.3f, 0.3f, 0.3f, 0.4f * Alpha); Reds = Blues = Spectators = Refs = RedSubs = BlueSubs = 0; @@ -550,7 +574,10 @@ static int CG_TeamplayScoreboard(void) // *************** BLUE TEAM ************ y += SB_FONTSIZEH * 2; DrawStrip(y, SB_FONTSIZEH, qtrue, qtrue, qtrue, BlueD, colorBlack); - DrawLeftStripText(y, SB_FONTSIZEH, cg_RQ3_team2name.string, 100, colorBlack); + if (cgs.gametype == GT_CTF) + DrawLeftStripText(y, SB_FONTSIZEH, cg_RQ3_team2name.string, 100, colorWhite); + else + DrawLeftStripText(y, SB_FONTSIZEH, cg_RQ3_team2name.string, 100, colorBlack); if (cg_RQ3_matchmode.integer) DrawRightStripText(y, SB_FONTSIZEH, va("%d/%d - %s - Wins: %d", Blues, BlueSubs,