Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "render_pch.h"
  8. #include "draw.h"
  9. #include "server.h"
  10. #include "filesystem.h"
  11. #include "filesystem_engine.h"
  12. #include "tier1/utlbuffer.h"
  13. #include "tier1/utlvector.h"
  14. #include "tier2/renderutils.h"
  15. // memdbgon must be the last include file in a .cpp file!!!
  16. #include "tier0/memdbgon.h"
  17. CUtlVector< Vector > g_Points;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Draw the currently loaded line file
  20. // Input : g_Points - list of points
  21. //-----------------------------------------------------------------------------
  22. void Linefile_Draw( void )
  23. {
  24. Vector *points = g_Points.Base();
  25. int pointCount = g_Points.Size();
  26. for ( int i = 0; i < pointCount-1; i++ )
  27. {
  28. RenderLine( points[i], points[i+1], Color( 255, 255, 0, 255 ), true );
  29. }
  30. }
  31. //-----------------------------------------------------------------------------
  32. // Purpose: parse the map.lin file from disk
  33. // this file contains a list of line segments illustrating a leak in
  34. // the map
  35. //-----------------------------------------------------------------------------
  36. void Linefile_Read_f( void )
  37. {
  38. Vector org;
  39. int r;
  40. int c;
  41. char name[MAX_OSPATH];
  42. g_Points.Purge();
  43. Q_snprintf( name, sizeof( name ), "maps/%s.lin", sv.GetMapName() );
  44. CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER );
  45. if ( !g_pFileSystem->ReadFile( name, NULL, buf ) )
  46. {
  47. ConMsg ("couldn't open %s\n", name);
  48. return;
  49. }
  50. ConMsg ("Reading %s...\n", name);
  51. c = 0;
  52. for ( ;; )
  53. {
  54. r = buf.Scanf ("%f %f %f\n", &org[0], &org[1], &org[2]);
  55. if (r != 3)
  56. break;
  57. c++;
  58. g_Points.AddToTail( org );
  59. }
  60. ConMsg ("%i lines read\n", c);
  61. }