Browse Source

Merge branch 'master' into aghl

aghl
Night Owl 8 years ago
parent
commit
de37b3a66a
  1. 2
      cl_dll/MOTD.cpp
  2. 2
      cl_dll/cl_util.h
  3. 29
      cl_dll/hud_redraw.cpp
  4. 24
      cl_dll/scoreboard.cpp

2
cl_dll/MOTD.cpp

@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime ) @@ -103,7 +103,7 @@ int CHudMOTD::Draw( float fTime )
// find where to start drawing the line
if( ( ypos > ROW_RANGE_MIN ) && ( ypos + LINE_HEIGHT <= ypos_r + height ) )
gHUD.DrawHudString( xpos, ypos, xmax, ch, 255, 180, 0 );
DrawUtfString( xpos, ypos, xmax, ch, 255, 180, 0 );
ypos += LINE_HEIGHT;

2
cl_dll/cl_util.h

@ -140,6 +140,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height ) @@ -140,6 +140,8 @@ inline void GetConsoleStringSize( const char *string, int *width, int *height )
}
*/
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b );
inline int ConsoleStringLen( const char *string )
{
int _width = 0, _height = 0;

29
cl_dll/hud_redraw.cpp

@ -252,6 +252,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g @@ -252,6 +252,35 @@ int CHud::DrawHudString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g
//-- Martin Webrant
}
int DrawUtfString( int xpos, int ypos, int iMaxX, char *szIt, int r, int g, int b )
{
// xash3d: reset unicode state
gEngfuncs.pfnVGUI2DrawCharacterAdditive( 0, 0, 0, 0, 0, 0, 0 );
// draw the string until we hit the null character or a newline character
for( ; *szIt != 0 && *szIt != '\n'; szIt++ )
{
int w = gHUD.m_scrinfo.charWidths['M'];
if( xpos + w > iMaxX )
return xpos;
if( ( *szIt == '^' ) && ( *( szIt + 1 ) >= '0') && ( *( szIt + 1 ) <= '7') )
{
szIt++;
r = colors[*szIt - '0'][0];
g = colors[*szIt - '0'][1];
b = colors[*szIt - '0'][2];
if( !*(++szIt) )
return xpos;
}
int c = (unsigned int)(unsigned char)*szIt;
xpos += gEngfuncs.pfnVGUI2DrawCharacterAdditive( xpos, ypos, c, r, g, b, 0 );
}
return xpos;
}
int CHud::DrawHudStringLen( char *szIt )
{
int l = 0;

24
cl_dll/scoreboard.cpp

@ -155,18 +155,18 @@ int CHudScoreboard::Draw( float fTime ) @@ -155,18 +155,18 @@ int CHudScoreboard::Draw( float fTime )
FAR_RIGHT += 5;
//gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX );
if( !gHUD.m_Teamplay )
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Player", 255, 140, 0 );
else
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, "Teams", 255, 140, 0 );
gHUD.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 );
gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
gHUD.DrawHudString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 );
DrawUtfString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 );
DrawUtfString( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 );
if( can_show_packetloss )
{
gHUD.DrawHudString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
DrawUtfString( PL_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "pkt loss", 255, 140, 0 );
}
list_slot += 1.2;
@ -281,7 +281,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -281,7 +281,7 @@ int CHudScoreboard::Draw( float fTime )
}
// draw their name (left to right)
gHUD.DrawHudString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
DrawUtfString( xpos, ypos, NAME_RANGE_MAX + xpos_rel, team_info->name, r, g, b );
// draw kills (right to left)
xpos = KILLS_RANGE_MAX + xpos_rel;
@ -289,7 +289,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -289,7 +289,7 @@ int CHudScoreboard::Draw( float fTime )
// draw divider
xpos = DIVIDER_POS + xpos_rel;
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
// draw deaths
xpos = DEATHS_RANGE_MAX + xpos_rel;
@ -309,7 +309,7 @@ int CHudScoreboard::Draw( float fTime ) @@ -309,7 +309,7 @@ int CHudScoreboard::Draw( float fTime )
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25;
sprintf( buf, " %d", team_info->packetloss );
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
}
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
@ -420,7 +420,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -420,7 +420,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
else
sprintf( szName, "%s", AgGetRealName( best_player ).c_str() );
// draw their name (left to right)
gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, szName, r, g, b );
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, szName, r, g, b );
// draw kills (right to left)
xpos = KILLS_RANGE_MAX + xpos_rel;
@ -428,7 +428,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -428,7 +428,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
// draw divider
xpos = DIVIDER_POS + xpos_rel;
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b );
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b );
// draw deaths
xpos = DEATHS_RANGE_MAX + xpos_rel;
@ -455,7 +455,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, @@ -455,7 +455,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset,
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2 ) + PL_RANGE_MIN + xpos_rel + 25;
gHUD.DrawHudString( xpos, ypos, xpos+50, buf, r, g, b );
DrawUtfString( xpos, ypos, xpos+50, buf, r, g, b );
}
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again

Loading…
Cancel
Save