mirror of
https://github.com/celisej567/source-engine.git
synced 2026-01-03 05:49:41 +03:00
1
This commit is contained in:
74
engine/r_linefile.cpp
Normal file
74
engine/r_linefile.cpp
Normal file
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user