|
|
@ -26,6 +26,7 @@ |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cvar_t *cl_scoreboard_bg; |
|
|
|
cvar_t *cl_showpacketloss; |
|
|
|
cvar_t *cl_showpacketloss; |
|
|
|
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
|
|
|
|
hud_player_info_t g_PlayerInfoList[MAX_PLAYERS + 1]; // player info from the engine
|
|
|
|
extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll
|
|
|
|
extra_player_info_t g_PlayerExtraInfo[MAX_PLAYERS + 1]; // additional player info sent directly to the client dll
|
|
|
@ -59,6 +60,7 @@ int CHudScoreboard::Init( void ) |
|
|
|
|
|
|
|
|
|
|
|
InitHUDData(); |
|
|
|
InitHUDData(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cl_scoreboard_bg = CVAR_CREATE( "cl_scoreboard_bg", "1", FCVAR_ARCHIVE ); |
|
|
|
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE ); |
|
|
|
cl_showpacketloss = CVAR_CREATE( "cl_showpacketloss", "0", FCVAR_ARCHIVE ); |
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
return 1; |
|
|
@ -144,20 +146,21 @@ int CHudScoreboard::Draw( float fTime ) |
|
|
|
|
|
|
|
|
|
|
|
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; |
|
|
|
FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; |
|
|
|
FAR_RIGHT += 5; |
|
|
|
FAR_RIGHT += 5; |
|
|
|
|
|
|
|
if( cl_scoreboard_bg && cl_scoreboard_bg->value ) |
|
|
|
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); |
|
|
|
gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); |
|
|
|
if( !gHUD.m_Teamplay ) |
|
|
|
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 |
|
|
|
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.DrawHudStringReverse( KILLS_RANGE_MAX + xpos_rel, ypos, 0, "kills", 255, 140, 0 ); |
|
|
|
gHUD.DrawHudString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 ); |
|
|
|
DrawUtfString( DIVIDER_POS + xpos_rel, ypos, ScreenWidth, "/", 255, 140, 0 ); |
|
|
|
gHUD.DrawHudString( DEATHS_RANGE_MIN + xpos_rel + 5, ypos, ScreenWidth, "deaths", 255, 140, 0 ); |
|
|
|
DrawUtfString( 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( PING_RANGE_MAX + xpos_rel - 35, ypos, ScreenWidth, "latency", 255, 140, 0 ); |
|
|
|
|
|
|
|
|
|
|
|
if( can_show_packetloss ) |
|
|
|
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; |
|
|
|
list_slot += 1.2; |
|
|
@ -272,7 +275,7 @@ int CHudScoreboard::Draw( float fTime ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// draw their name (left to right)
|
|
|
|
// 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)
|
|
|
|
// draw kills (right to left)
|
|
|
|
xpos = KILLS_RANGE_MAX + xpos_rel; |
|
|
|
xpos = KILLS_RANGE_MAX + xpos_rel; |
|
|
@ -280,7 +283,7 @@ int CHudScoreboard::Draw( float fTime ) |
|
|
|
|
|
|
|
|
|
|
|
// draw divider
|
|
|
|
// draw divider
|
|
|
|
xpos = DIVIDER_POS + xpos_rel; |
|
|
|
xpos = DIVIDER_POS + xpos_rel; |
|
|
|
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); |
|
|
|
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
// draw deaths
|
|
|
|
// draw deaths
|
|
|
|
xpos = DEATHS_RANGE_MAX + xpos_rel; |
|
|
|
xpos = DEATHS_RANGE_MAX + xpos_rel; |
|
|
@ -300,7 +303,7 @@ int CHudScoreboard::Draw( float fTime ) |
|
|
|
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25; |
|
|
|
xpos = ( ( PL_RANGE_MAX - PL_RANGE_MIN ) / 2) + PL_RANGE_MIN + xpos_rel + 25; |
|
|
|
|
|
|
|
|
|
|
|
sprintf( buf, " %d", team_info->packetloss ); |
|
|
|
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
|
|
|
|
team_info->already_drawn = TRUE; // set the already_drawn to be TRUE, so this team won't get drawn again
|
|
|
@ -400,7 +403,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// draw their name (left to right)
|
|
|
|
// draw their name (left to right)
|
|
|
|
gHUD.DrawHudString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); |
|
|
|
DrawUtfString( xpos + nameoffset, ypos, NAME_RANGE_MAX + xpos_rel, pl_info->name, r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
// draw kills (right to left)
|
|
|
|
// draw kills (right to left)
|
|
|
|
xpos = KILLS_RANGE_MAX + xpos_rel; |
|
|
|
xpos = KILLS_RANGE_MAX + xpos_rel; |
|
|
@ -408,7 +411,7 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, |
|
|
|
|
|
|
|
|
|
|
|
// draw divider
|
|
|
|
// draw divider
|
|
|
|
xpos = DIVIDER_POS + xpos_rel; |
|
|
|
xpos = DIVIDER_POS + xpos_rel; |
|
|
|
gHUD.DrawHudString( xpos, ypos, xpos + 20, "/", r, g, b ); |
|
|
|
DrawUtfString( xpos, ypos, xpos + 20, "/", r, g, b ); |
|
|
|
|
|
|
|
|
|
|
|
// draw deaths
|
|
|
|
// draw deaths
|
|
|
|
xpos = DEATHS_RANGE_MAX + xpos_rel; |
|
|
|
xpos = DEATHS_RANGE_MAX + xpos_rel; |
|
|
@ -435,7 +438,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; |
|
|
|
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
|
|
|
|
pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again
|
|
|
|