From d90bef91b6b6cd2b3d9a76922d3be3a53a9cae64 Mon Sep 17 00:00:00 2001 From: a1batross Date: Thu, 17 Nov 2016 16:15:22 +0300 Subject: [PATCH] Draw BOT in ping for bots. --- cl_dll/CMakeLists.txt | 2 +- cl_dll/hud/scoreboard.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cl_dll/CMakeLists.txt b/cl_dll/CMakeLists.txt index bc68b2f..87a1478 100644 --- a/cl_dll/CMakeLists.txt +++ b/cl_dll/CMakeLists.txt @@ -54,7 +54,7 @@ if(CMAKE_SIZEOF_VOID_P MATCHES "8") endif() endif() -find_package(SDL2 REQUIRED) +#find_package(SDL2 REQUIRED) set (CLDLL_LIBRARY client) diff --git a/cl_dll/hud/scoreboard.cpp b/cl_dll/hud/scoreboard.cpp index 3cdc452..549b4d8 100644 --- a/cl_dll/hud/scoreboard.cpp +++ b/cl_dll/hud/scoreboard.cpp @@ -173,7 +173,7 @@ int CHudScoreboard :: DrawScoreboard( float fTime ) DrawUtils::DrawHudString( NAME_POS_START(), ypos, NAME_POS_END(), ServerName, 255, 140, 0 ); DrawUtils::DrawHudStringReverse( KILLS_POS_END(), ypos, 0, "KILLS", 255, 140, 0 ); - DrawUtils::DrawHudString( DEATHS_POS_START(), ypos, DEATHS_POS_END(), "DEATHS", 255, 140, 0 ); + DrawUtils::DrawHudString( DEATHS_POS_START(), ypos, DEATHS_POS_END(), "DEATHS", 255, 140, 0 ); DrawUtils::DrawHudStringReverse( PING_POS_END(), ypos, PING_POS_START(), "PING", 255, 140, 0 ); list_slot += 2; @@ -404,9 +404,19 @@ int CHudScoreboard :: DrawPlayers( float list_slot, int nameoffset, const char * DrawUtils::DrawHudNumberString( DEATHS_POS_END(), ypos, DEATHS_POS_START(), g_PlayerExtraInfo[best_player].deaths, r, g, b ); // draw ping & packetloss - static char buf[64]; - sprintf( buf, "%d", g_PlayerInfoList[best_player].ping ); - DrawUtils::DrawHudStringReverse( PING_POS_END(), ypos, PING_POS_START(), buf, r, g, b ); + const char *value; + if( pl_info->ping <= 5 // must be 0, until Xash's bug not fixed + && ( value = gEngfuncs.PlayerInfo_ValueForKey( best_player, "*bot" ) ) + && atoi( value ) > 0 ) + { + DrawUtils::DrawHudStringReverse( PING_POS_END(), ypos, PING_POS_START(), "BOT", r, g, b ); + } + else + { + static char buf[64]; + sprintf( buf, "%d", pl_info->ping ); + DrawUtils::DrawHudStringReverse( PING_POS_END(), ypos, PING_POS_START(), buf, r, g, b ); + } pl_info->name = NULL; // set the name to be NULL, so this client won't get drawn again list_slot++;