Counter Strike : Global Offensive Source Code
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.

64 lines
1.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "convar.h"
  9. #include "tier0/dbg.h"
  10. #include "player.h"
  11. #include "world.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. #if 0
  15. void Test_CreateEntity( const CCommand &args )
  16. {
  17. if ( args.ArgC() < 2 )
  18. {
  19. Error( "Test_CreateEntity: requires entity classname argument." );
  20. }
  21. const char *pClassName = args[ 1 ];
  22. if ( !CreateEntityByName( pClassName ) )
  23. {
  24. Error( "Test_CreateEntity( %s ) failed.", pClassName );
  25. }
  26. }
  27. void Test_RandomPlayerPosition()
  28. {
  29. CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
  30. CWorld *pWorld = GetWorldEntity();
  31. if ( !pPlayer )
  32. {
  33. Error( "Test_RandomPlayerPosition: no local player entity." );
  34. }
  35. else if ( !pWorld )
  36. {
  37. Error( "Test_RandomPlayerPosition: no world entity." );
  38. }
  39. Vector vMin, vMax;
  40. pWorld->GetWorldBounds( vMin, vMax );
  41. Vector vecOrigin;
  42. vecOrigin.x = RandomFloat( vMin.x, vMax.x );
  43. vecOrigin.y = RandomFloat( vMin.y, vMax.y );
  44. vecOrigin.z = RandomFloat( vMin.z, vMax.z );
  45. pPlayer->ForceOrigin( vecOrigin );
  46. }
  47. ConCommand cc_Test_CreateEntity( "Test_CreateEntity", Test_CreateEntity, 0, FCVAR_CHEAT );
  48. ConCommand cc_Test_RandomPlayerPosition( "Test_RandomPlayerPosition", Test_RandomPlayerPosition, 0, FCVAR_CHEAT );
  49. #endif