diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/r_linefile.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'engine/r_linefile.cpp')
| -rw-r--r-- | engine/r_linefile.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engine/r_linefile.cpp b/engine/r_linefile.cpp new file mode 100644 index 0000000..8540e66 --- /dev/null +++ b/engine/r_linefile.cpp @@ -0,0 +1,74 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "render_pch.h" +#include "draw.h" +#include "server.h" +#include "filesystem.h" +#include "filesystem_engine.h" +#include "tier1/utlbuffer.h" +#include "tier1/utlvector.h" +#include "tier2/renderutils.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +CUtlVector< Vector > g_Points; +//----------------------------------------------------------------------------- +// Purpose: Draw the currently loaded line file +// Input : g_Points - list of points +//----------------------------------------------------------------------------- +void Linefile_Draw( void ) +{ + Vector *points = g_Points.Base(); + int pointCount = g_Points.Size(); + + for ( int i = 0; i < pointCount-1; i++ ) + { + RenderLine( points[i], points[i+1], Color( 255, 255, 0, 255 ), true ); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: parse the map.lin file from disk +// this file contains a list of line segments illustrating a leak in +// the map +//----------------------------------------------------------------------------- +void Linefile_Read_f( void ) +{ + Vector org; + int r; + int c; + char name[MAX_OSPATH]; + + g_Points.Purge(); + + Q_snprintf( name, sizeof( name ), "maps/%s.lin", sv.GetMapName() ); + + CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER ); + if ( !g_pFileSystem->ReadFile( name, NULL, buf ) ) + { + ConMsg ("couldn't open %s\n", name); + return; + } + + ConMsg ("Reading %s...\n", name); + c = 0; + + for ( ;; ) + { + r = buf.Scanf ("%f %f %f\n", &org[0], &org[1], &org[2]); + if (r != 3) + break; + c++; + + g_Points.AddToTail( org ); + } + + ConMsg ("%i lines read\n", c); +} |