Skip to content

Commit bdda76c

Browse files
committed
Remove Color::Named
1 parent 169d23f commit bdda76c

File tree

5 files changed

+31
-76
lines changed

5 files changed

+31
-76
lines changed

daemon/src/common/Color.cpp

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,6 @@ Maryland 20850 USA.
3737

3838
namespace Color {
3939

40-
namespace Named {
41-
Color Black = { 0, 0, 0, 255 };
42-
Color Red = { 255, 0, 0, 255 };
43-
Color Green = { 0, 255, 0, 255 };
44-
Color Blue = { 0, 0, 255, 255 };
45-
Color Yellow = { 255, 255, 0, 255 };
46-
Color Orange = { 255, 128, 0, 255 };
47-
Color Magenta = { 255, 0, 255, 255 };
48-
Color Cyan = { 0, 255, 255, 255 };
49-
Color White = { 255, 255, 255, 255 };
50-
Color LtGrey = { 191, 191, 191, 255 };
51-
Color MdGrey = { 128, 128, 128, 255 };
52-
Color DkGrey = { 64, 64, 64, 255 };
53-
Color MdRed = { 128, 0, 0, 255 };
54-
Color MdGreen = { 0, 128, 0, 255 };
55-
Color DkGreen = { 0, 51, 0, 255 };
56-
Color MdCyan = { 0, 128, 128, 255 };
57-
Color MdYellow= { 128, 128, 0, 255 };
58-
Color MdOrange= { 128, 64, 0, 255 };
59-
Color MdBlue = { 0, 0, 128, 255 };
60-
} // namespace Named
61-
62-
6340
namespace NamedString {
6441
const char* Black = "^0";
6542
const char* Red = "^1";
@@ -82,25 +59,25 @@ const char* Null = "^*";
8259
} // namespace Named
8360

8461
namespace NamedFloat {
85-
ColorFloat Black = { 0, 0, 0, 1 };
86-
ColorFloat Red = { 1, 0, 0, 1 };
87-
ColorFloat Green = { 0, 1, 0, 1 };
88-
ColorFloat Blue = { 0, 0, 1, 1 };
89-
ColorFloat Yellow = { 1, 1, 0, 1 };
90-
ColorFloat Orange = { 1, 0.5, 0, 1 };
91-
ColorFloat Magenta = { 1, 0, 1, 1 };
92-
ColorFloat Cyan = { 0, 1, 1, 1 };
93-
ColorFloat White = { 1, 1, 1, 1 };
94-
ColorFloat LtGrey = { 0.75, 0.75, 0.75, 1 };
95-
ColorFloat MdGrey = { 0.5, 0.5, 0.5, 1 };
96-
ColorFloat DkGrey = { 0.25, 0.25, 0.25, 1 };
97-
ColorFloat MdRed = { 0.5, 0, 0, 1 };
98-
ColorFloat MdGreen = { 0, 0.5, 0, 1 };
99-
ColorFloat DkGreen = { 0, 0.20, 0, 1 };
100-
ColorFloat MdCyan = { 0, 0.5, 0.5, 1 };
101-
ColorFloat MdYellow = { 0.5, 0.5, 0, 1 };
102-
ColorFloat MdOrange = { 0.5, 0.25, 0, 1 };
103-
ColorFloat MdBlue = { 0, 0, 0.5, 1 };
62+
ColorFloat Black = { 0.00, 0.00, 0.00, 1.00 };
63+
ColorFloat Red = { 1.00, 0.00, 0.00, 1.00 };
64+
ColorFloat Green = { 0.00, 1.00, 0.00, 1.00 };
65+
ColorFloat Blue = { 0.00, 0.00, 1.00, 1.00 };
66+
ColorFloat Yellow = { 1.00, 1.00, 0.00, 1.00 };
67+
ColorFloat Orange = { 1.00, 0.50, 0.00, 1.00 };
68+
ColorFloat Magenta = { 1.00, 0.00, 1.00, 1.00 };
69+
ColorFloat Cyan = { 0.00, 1.00, 1.00, 1.00 };
70+
ColorFloat White = { 1.00, 1.00, 1.00, 1.00 };
71+
ColorFloat LtGrey = { 0.75, 0.75, 0.75, 1.00 };
72+
ColorFloat MdGrey = { 0.50, 0.50, 0.50, 1.00 };
73+
ColorFloat DkGrey = { 0.25, 0.25, 0.25, 1.00 };
74+
ColorFloat MdRed = { 0.50, 0.00, 0.00, 1.00 };
75+
ColorFloat MdGreen = { 0.00, 0.50, 0.00, 1.00 };
76+
ColorFloat DkGreen = { 0.00, 0.20, 0.00, 1.00 };
77+
ColorFloat MdCyan = { 0.00, 0.50, 0.50, 1.00 };
78+
ColorFloat MdYellow = { 0.50, 0.50, 0.00, 1.00 };
79+
ColorFloat MdOrange = { 0.50, 0.25, 0.00, 1.00 };
80+
ColorFloat MdBlue = { 0.00, 0.00, 0.50, 1.00 };
10481
} // namespace NamedFloat
10582

10683
static Color g_color_table[ 32 ] =

daemon/src/common/Color.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -406,28 +406,6 @@ enum {
406406
}; // enum
407407
} // namespace Constants
408408

409-
namespace Named {
410-
extern Color Black;
411-
extern Color Red;
412-
extern Color Green;
413-
extern Color Blue;
414-
extern Color Yellow;
415-
extern Color Orange;
416-
extern Color Magenta;
417-
extern Color Cyan;
418-
extern Color White;
419-
extern Color LtGrey;
420-
extern Color MdGrey;
421-
extern Color DkGrey;
422-
extern Color MdRed;
423-
extern Color MdGreen;
424-
extern Color DkGreen;
425-
extern Color MdCyan;
426-
extern Color MdYellow;
427-
extern Color MdOrange;
428-
extern Color MdBlue;
429-
} // namespace Named
430-
431409
namespace NamedString {
432410
extern const char* Black;
433411
extern const char* Red;

daemon/src/engine/client/cl_console.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Maryland 20850 USA.
3939
#include "qcommon/q_unicode.h"
4040
#include "framework/LogSystem.h"
4141

42-
static const Color::Color console_color = Color::Named::White;
42+
static const Color::Color console_color = { 255, 255, 255, 255 };
4343
#define DEFAULT_CONSOLE_WIDTH 78
4444
#define MAX_CONSOLE_WIDTH 1024
4545

@@ -128,7 +128,7 @@ static std::string Con_LineToColouredString( int lineno, bool lf )
128128
const conChar_t *line = consoleState.text + CON_LINE( lineno );
129129
int s, d;
130130

131-
Color::Color color = Color::Named::White;
131+
Color::Color color = console_color;
132132
std::string lineString;
133133

134134
for ( int s = 0; line[ s ].ch && s < consoleState.textWidthInChars; ++s )
@@ -734,7 +734,7 @@ void Con_DrawInput( int linePosition, float overrideAlpha )
734734
Com_RealTime( &realtime );
735735
Com_sprintf( prompt, sizeof( prompt ), "^0[^3%02d%c%02d^0]^7 %s", realtime.tm_hour, ( realtime.tm_sec & 1 ) ? ':' : ' ', realtime.tm_min, con_prompt->string );
736736

737-
Color::Color color = Color::Named::White;
737+
Color::Color color = console_color;
738738
color.SetAlpha( Color::Color::component_max * consoleState.currentAlphaFactor * overrideAlpha );
739739

740740
SCR_DrawSmallStringExt( consoleState.margin.sides + consoleState.padding.sides, linePosition, prompt, color, false, false );
@@ -986,8 +986,8 @@ void Con_DrawConsoleContent()
986986
++row;
987987
}
988988

989-
Color::Color currentColor = Color::Named::White;
990-
Color::Color color = currentColor;
989+
Color::Color currentColor = console_color;
990+
Color::Color color = console_color;
991991

992992
for ( ; row >= 0 && lineDrawPosition > textDistanceToTop; lineDrawPosition -= charHeight, row-- )
993993
{

src/cgame/cg_buildable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,7 +2023,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
20232023
sepW = pad;
20242024
sepH = ( 0.5f * picH ) - pad;
20252025

2026-
trap_R_SetColor( Color::Named::Black );
2026+
trap_R_SetColor( Color::NamedFloat::Black );
20272027
CG_DrawPic( sepX, sepY, sepW, sepH, cgs.media.whiteShader );
20282028
trap_R_ClearColor();
20292029
}
@@ -2074,7 +2074,7 @@ static void CG_BuildableStatusDisplay( centity_t *cent )
20742074
markH = 0.5f * barH;
20752075
markW = ( bs->healthPadding * scale );
20762076

2077-
trap_R_SetColor( Color::Named::Black );
2077+
trap_R_SetColor( Color::NamedFloat::Black );
20782078
CG_DrawPic( markX, barY, markW, markH, cgs.media.whiteShader );
20792079

20802080
trap_R_ClearColor();

src/cgame/cg_rocket_draw.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ class LagometerElement : public TextHudElement
13501350
if ( color != 1 )
13511351
{
13521352
color = 1;
1353-
trap_R_SetColor( Color::Named::Yellow );
1353+
trap_R_SetColor( Color::NamedFloat::Yellow );
13541354
}
13551355

13561356
if ( v > range )
@@ -1366,7 +1366,7 @@ class LagometerElement : public TextHudElement
13661366
if ( color != 2 )
13671367
{
13681368
color = 2;
1369-
trap_R_SetColor( Color::Named::Blue );
1369+
trap_R_SetColor( Color::NamedFloat::Blue );
13701370
}
13711371

13721372
v = -v;
@@ -1396,7 +1396,7 @@ class LagometerElement : public TextHudElement
13961396
if ( color != 5 )
13971397
{
13981398
color = 5; // YELLOW for rate delay
1399-
trap_R_SetColor( Color::Named::Yellow );
1399+
trap_R_SetColor( Color::NamedFloat::Yellow );
14001400
}
14011401
}
14021402

@@ -1406,7 +1406,7 @@ class LagometerElement : public TextHudElement
14061406
{
14071407
color = 3;
14081408

1409-
trap_R_SetColor( Color::Named::Green );
1409+
trap_R_SetColor( Color::NamedFloat::Green );
14101410
}
14111411
}
14121412

@@ -1425,7 +1425,7 @@ class LagometerElement : public TextHudElement
14251425
if ( color != 4 )
14261426
{
14271427
color = 4; // RED for dropped snapshots
1428-
trap_R_SetColor( Color::Named::Red );
1428+
trap_R_SetColor( Color::NamedFloat::Red );
14291429
}
14301430

14311431
trap_R_DrawStretchPic( ax + aw - a, ay + ah - range, 1, range, 0, 0, 0, 0, cgs.media.whiteShader );

0 commit comments

Comments
 (0)