From 588065ab162693a30569d07089b46d7d17ca66d9 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 15 Feb 2018 17:27:02 +0500 Subject: [PATCH 1/3] Do not show long nicknames on low resolution. --- cl_dll/scoreboard.cpp | 65 ++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/cl_dll/scoreboard.cpp b/cl_dll/scoreboard.cpp index 908d00f3..0f26c6f2 100644 --- a/cl_dll/scoreboard.cpp +++ b/cl_dll/scoreboard.cpp @@ -92,17 +92,18 @@ We have a minimum width of 1-320 - we could have the field widths scale with it? // X positions // relative to the side of the scoreboard -#define NAME_RANGE_MIN -65 -#define NAME_RANGE_MAX 180 -#define KILLS_RANGE_MIN 165 -#define KILLS_RANGE_MAX 205 -#define DIVIDER_POS 215 -#define DEATHS_RANGE_MIN 220 -#define DEATHS_RANGE_MAX 245 -#define PING_RANGE_MIN 280 -#define PING_RANGE_MAX 330 -#define PL_RANGE_MIN 350 -#define PL_RANGE_MAX 410 +#define NAME_RANGE_MIN 20 +#define NAME_RANGE_MAX 145 +#define NAME_RANGE_MODIFIER 120 +#define KILLS_RANGE_MIN 130 +#define KILLS_RANGE_MAX 170 +#define DIVIDER_POS 180 +#define DEATHS_RANGE_MIN 185 +#define DEATHS_RANGE_MAX 210 +#define PING_RANGE_MIN 245 +#define PING_RANGE_MAX 295 +#define PL_RANGE_MIN 315 +#define PL_RANGE_MAX 375 int SCOREBOARD_WIDTH = 320; @@ -128,11 +129,11 @@ int CHudScoreboard::Draw( float fTime ) if( cl_showpacketloss && cl_showpacketloss->value && ( ScreenWidth >= 400 ) ) { can_show_packetloss = 1; - SCOREBOARD_WIDTH = 400; + SCOREBOARD_WIDTH = ( ScreenWidth >= 520 ) ? ( 400 - NAME_RANGE_MODIFIER ) : 400; } else { - SCOREBOARD_WIDTH = 320; + SCOREBOARD_WIDTH = ( ScreenWidth >= 440 ) ? ( 320 - NAME_RANGE_MODIFIER ) : 320; } // just sort the list on the fly @@ -145,7 +146,14 @@ int CHudScoreboard::Draw( float fTime ) int xpos = NAME_RANGE_MIN + xpos_rel; FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; - FAR_RIGHT += 125; + FAR_RIGHT += 5; + + if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) ) + { + xpos -= NAME_RANGE_MODIFIER; + FAR_RIGHT += NAME_RANGE_MODIFIER; + } + if( cl_scoreboard_bg && cl_scoreboard_bg->value ) gHUD.DrawDarkRectangle( xpos - 5, ypos - 5, FAR_RIGHT, ROW_RANGE_MAX ); if( !gHUD.m_Teamplay ) @@ -165,7 +173,7 @@ int CHudScoreboard::Draw( float fTime ) list_slot += 1.2; ypos = ROW_RANGE_MIN + ( list_slot * ROW_GAP ); - xpos = NAME_RANGE_MIN + xpos_rel; + // xpos = NAME_RANGE_MIN + xpos_rel; FillRGBA( xpos - 4, ypos, FAR_RIGHT -2, 1, 255, 140, 0, 255 ); // draw the seperator line list_slot += 0.8; @@ -266,12 +274,18 @@ int CHudScoreboard::Draw( float fTime ) break; xpos = NAME_RANGE_MIN + xpos_rel; + + if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) ) + { + xpos -= NAME_RANGE_MODIFIER; + } + int r = 255, g = 225, b = 55; // draw the stuff kinda yellowish if( team_info->ownteam ) // if it is their team, draw the background different color { // overlay the background in blue, then draw the score text over it - FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); + FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); } // draw their name (left to right) @@ -340,7 +354,12 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, } FAR_RIGHT = can_show_packetloss ? PL_RANGE_MAX : PING_RANGE_MAX; - FAR_RIGHT += 125; + FAR_RIGHT += 5; + + if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) ) + { + FAR_RIGHT += NAME_RANGE_MODIFIER; + } // draw the players, in order, and restricted to team if set while( 1 ) @@ -380,6 +399,12 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, break; int xpos = NAME_RANGE_MIN + xpos_rel; + + if( ( ScreenWidth >= 440 && !can_show_packetloss ) || ( ScreenWidth >= 520 && can_show_packetloss ) ) + { + xpos -= NAME_RANGE_MODIFIER; + } + int r = 255, g = 255, b = 255; float *colors = GetClientColor( best_player ); r *= colors[0], g *= colors[1], b *= colors[2]; @@ -388,18 +413,18 @@ int CHudScoreboard::DrawPlayers( int xpos_rel, float list_slot, int nameoffset, if( pl_info->thisplayer ) { // green is the suicide color? i wish this could do grey... - FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 ); + FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 80, 155, 0, 70 ); } else { // Highlight the killers name - overlay the background in red, then draw the score text over it - FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) ); + FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 255, 0, 0, ( (float)15 * (float)( m_fLastKillTime - gHUD.m_flTime ) ) ); } } else if( pl_info->thisplayer ) // if it is their name, draw it a different color { // overlay the background in blue, then draw the score text over it - FillRGBA( NAME_RANGE_MIN + xpos_rel - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); + FillRGBA( xpos - 5, ypos, FAR_RIGHT, ROW_GAP, 0, 0, 255, 70 ); } // draw their name (left to right) From f13adcfb8b7dc11d365389bc01ee3290f1d4ff26 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 15 Feb 2018 17:52:07 +0500 Subject: [PATCH 2/3] Fix infinite slide in multiplayer. --- pm_shared/pm_shared.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pm_shared/pm_shared.c b/pm_shared/pm_shared.c index 9aed8093..abe7b317 100644 --- a/pm_shared/pm_shared.c +++ b/pm_shared/pm_shared.c @@ -3312,8 +3312,8 @@ void PM_Move( struct playermove_s *ppmove, int server ) pmove->flags &= ~FL_ONGROUND; } - // In single player, reset friction after each movement to FrictionModifier Triggers work still. - if( !pmove->multiplayer && ( pmove->movetype == MOVETYPE_WALK ) ) + // Reset friction after each movement to FrictionModifier Triggers work still. + if( pmove->movetype == MOVETYPE_WALK ) { pmove->friction = 1.0f; } From 556e2647fe0ba801c75bf810e41ef58c5eb90c34 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Thu, 15 Feb 2018 18:15:02 +0500 Subject: [PATCH 3/3] Do not show train controls after player death. --- dlls/player.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/player.cpp b/dlls/player.cpp index 52f5f546..99d4c7f6 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -782,6 +782,9 @@ void CBasePlayer::PackDeadPlayerItems( void ) void CBasePlayer::RemoveAllItems( BOOL removeSuit ) { + int i; + CBasePlayerItem *pPendingItem; + if( m_pActiveItem ) { ResetAutoaim(); @@ -794,8 +797,8 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit ) if( m_pTank != 0 ) m_pTank->Use( this, this, USE_OFF, 0 ); - int i; - CBasePlayerItem *pPendingItem; + m_iTrain = TRAIN_NEW; // turn off train + for( i = 0; i < MAX_ITEM_TYPES; i++ ) { m_pActiveItem = m_rgpPlayerItems[i];