mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-13 20:21:06 +00:00
add source-sdk-2013
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
#include <vgui/IScheme.h>
|
||||
#include <vgui/ILocalize.h>
|
||||
#include "tier0/vprof.h"
|
||||
#include "tier0/cpumonitoring.h"
|
||||
#include "cdll_bounded_cvars.h"
|
||||
|
||||
#include "materialsystem/imaterialsystem.h"
|
||||
@@ -42,7 +41,7 @@ static ConVar net_graphshowinterp ( "net_graphshowinterp", "1", FCVAR_ARCHIVE, "
|
||||
|
||||
void NetgraphFontChangeCallback( IConVar *var, const char *pOldValue, float flOldValue );
|
||||
|
||||
static ConVar net_graph ( "net_graph","0", 0, "Draw the network usage graph, = 2 draws data on payload, = 3 draws payload legend.", NetgraphFontChangeCallback );
|
||||
static ConVar net_graph ( "net_graph","0", FCVAR_ARCHIVE, "Draw the network usage graph, = 2 draws data on payload, = 3 draws payload legend.", NetgraphFontChangeCallback );
|
||||
static ConVar net_graphheight ( "net_graphheight", "64", FCVAR_ARCHIVE, "Height of netgraph panel", NetgraphFontChangeCallback );
|
||||
static ConVar net_graphproportionalfont( "net_graphproportionalfont", "1", FCVAR_ARCHIVE, "Determines whether netgraph font is proportional or not", NetgraphFontChangeCallback );
|
||||
|
||||
@@ -492,10 +491,6 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
|
||||
{
|
||||
i = ( m_OutgoingSequence - a ) & ( TIMINGS - 1 );
|
||||
h = MIN( ( cmdinfo[i].cmd_lerp / 3.0 ) * LERP_HEIGHT, LERP_HEIGHT );
|
||||
if ( h < 0 )
|
||||
{
|
||||
h = LERP_HEIGHT;
|
||||
}
|
||||
|
||||
rcFill.x = x + w -a - 1;
|
||||
rcFill.width = 1;
|
||||
@@ -518,9 +513,7 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
|
||||
|
||||
for ( j = start; j < h; j++ )
|
||||
{
|
||||
int index = j + extrap_point;
|
||||
Assert( (size_t)index < Q_ARRAYSIZE( colors ) );
|
||||
DrawLine(&rcFill, colors[ index ], 255 );
|
||||
DrawLine(&rcFill, colors[j + extrap_point], 255 );
|
||||
rcFill.y--;
|
||||
}
|
||||
}
|
||||
@@ -538,9 +531,7 @@ void CNetGraphPanel::DrawTimes( vrect_t vrect, cmdinfo_t *cmdinfo, int x, int w,
|
||||
|
||||
for ( j = 0; j < h; j++ )
|
||||
{
|
||||
int index = j + oldh;
|
||||
Assert( (size_t)index < Q_ARRAYSIZE( colors ) );
|
||||
DrawLine(&rcFill, colors[ index ], 255 );
|
||||
DrawLine(&rcFill, colors[j + oldh], 255 );
|
||||
rcFill.y--;
|
||||
}
|
||||
}
|
||||
@@ -743,7 +734,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
|
||||
Q_snprintf( sz, sizeof( sz ), "fps:%4i ping: %i ms", (int)(1.0f / m_Framerate), (int)(m_AvgLatency*1000.0f) );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
// Draw update rate
|
||||
DrawUpdateRate( x + w, y );
|
||||
@@ -766,7 +757,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
|
||||
int textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
Q_snprintf( sz, sizeof( sz ), "lerp: %5.1f ms", GetClientInterpAmount() * 1000.0f );
|
||||
|
||||
@@ -790,23 +781,23 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
}
|
||||
}
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + textWidth, y, interpcolor[ 0 ], interpcolor[ 1 ], interpcolor[ 2 ], 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + textWidth, y, interpcolor[ 0 ], interpcolor[ 1 ], interpcolor[ 2 ], 255, sz );
|
||||
|
||||
Q_snprintf( sz, sizeof( sz ), "%3.1f/s", m_AvgPacketIn );
|
||||
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
y += textTall;
|
||||
|
||||
Q_snprintf( sz, sizeof( sz ), "out:%4i %2.2f k/s", out, m_OutgoingData );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
Q_snprintf( sz, sizeof( sz ), "%3.1f/s", m_AvgPacketOut );
|
||||
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x + w - textWidth - 1, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
y += textTall;
|
||||
|
||||
@@ -818,7 +809,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
|
||||
textWidth = g_pMatSystemSurface->DrawTextLen( font, "%s", sz );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, GRAPH_RED, GRAPH_GREEN, GRAPH_BLUE, 255, sz );
|
||||
|
||||
y += textTall;
|
||||
|
||||
@@ -841,7 +832,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
servercolor[ 2 ] = 0;
|
||||
}
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, servercolor[ 0 ], servercolor[ 1 ], servercolor[ 2 ], 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, servercolor[ 0 ], servercolor[ 1 ], servercolor[ 2 ], 255, sz );
|
||||
|
||||
y += textTall;
|
||||
}
|
||||
@@ -850,7 +841,7 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
// Draw legend
|
||||
if ( graphvalue >= 3 )
|
||||
{
|
||||
textTall = g_pMatSystemSurface->GetFontTall( m_hFontSmall );
|
||||
int textTall = g_pMatSystemSurface->GetFontTall( m_hFontSmall );
|
||||
|
||||
y = saveY - textTall - 5;
|
||||
int cw, ch;
|
||||
@@ -885,35 +876,6 @@ void CNetGraphPanel::DrawTextFields( int graphvalue, int x, int y, int w, netban
|
||||
g_pMatSystemSurface->DrawColoredText( m_hFontSmall, x, y, 0, 0, 128, 255, "voice" );
|
||||
y -= textTall;
|
||||
}
|
||||
else
|
||||
{
|
||||
const CPUFrequencyResults frequency = GetCPUFrequencyResults();
|
||||
double currentTime = Plat_FloatTime();
|
||||
const double displayTime = 5.0f; // Display frequency results for this long.
|
||||
if ( frequency.m_GHz > 0 && frequency.m_timeStamp + displayTime > currentTime )
|
||||
{
|
||||
// Optionally print out the CPU frequency monitoring data.
|
||||
uint8 cpuColor[4] = { (uint8)GRAPH_RED, (uint8)GRAPH_GREEN, (uint8)GRAPH_BLUE, 255 };
|
||||
|
||||
if ( frequency.m_percentage < kCPUMonitoringWarning2 )
|
||||
{
|
||||
cpuColor[0] = 255;
|
||||
cpuColor[1] = 31;
|
||||
cpuColor[2] = 31;
|
||||
}
|
||||
else if ( frequency.m_percentage < kCPUMonitoringWarning1 )
|
||||
{
|
||||
cpuColor[0] = 255;
|
||||
cpuColor[1] = 125;
|
||||
cpuColor[2] = 31;
|
||||
}
|
||||
// Experimental fading out as data becomes stale. Probably too distracting.
|
||||
//float age = currentTime - frequency.m_timeStamp;
|
||||
//cpuColor.a *= ( displayTime - age ) / displayTime;
|
||||
g_pMatSystemSurface->DrawColoredText( font, x, y, cpuColor[0], cpuColor[1], cpuColor[2], cpuColor[3],
|
||||
"CPU freq: %3.1f%% Min: %3.1f%%", frequency.m_percentage, frequency.m_lowestPercentage );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1157,14 +1119,14 @@ void CNetGraphPanel::DrawLargePacketSizes( int x, int w, int graphtype, float wa
|
||||
char sz[ 32 ];
|
||||
Q_snprintf( sz, sizeof( sz ), "%i", nTotalBytes );
|
||||
|
||||
int len = g_pMatSystemSurface->DrawTextLen( m_hFont, "%s", sz );
|
||||
int len = g_pMatSystemSurface->DrawTextLen( m_hFont, sz );
|
||||
|
||||
int textx, texty;
|
||||
|
||||
textx = rcFill.x - len / 2;
|
||||
texty = MAX( 0, rcFill.y - 11 );
|
||||
|
||||
g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, "%s", sz );
|
||||
g_pMatSystemSurface->DrawColoredText( m_hFont, textx, texty, 255, 255, 255, 255, sz );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1541,7 +1503,7 @@ public:
|
||||
if ( netGraphPanel )
|
||||
{
|
||||
netGraphPanel->SetParent( (Panel *)NULL );
|
||||
netGraphPanel->MarkForDeletion();
|
||||
delete netGraphPanel;
|
||||
netGraphPanel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user