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.

131 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #include "cbase.h"
  9. #include "hud.h"
  10. #include "clientmode_sdk.h"
  11. #include "cdll_client_int.h"
  12. #include "iinput.h"
  13. #include "vgui/ISurface.h"
  14. #include "vgui/IPanel.h"
  15. #include <vgui_controls/AnimationController.h>
  16. #include "ivmodemanager.h"
  17. #include "buymenu.h"
  18. #include "filesystem.h"
  19. #include "vgui/IVGui.h"
  20. #include "hud_chat.h"
  21. #include "view_shared.h"
  22. #include "view.h"
  23. #include "ivrenderview.h"
  24. #include "model_types.h"
  25. #include "iefx.h"
  26. #include "dlight.h"
  27. #include <imapoverview.h>
  28. #include "c_playerresource.h"
  29. #include <KeyValues.h>
  30. #include "text_message.h"
  31. #include "panelmetaclassmgr.h"
  32. ConVar default_fov( "default_fov", "90", FCVAR_CHEAT );
  33. IClientMode *g_pClientMode = NULL;
  34. // --------------------------------------------------------------------------------- //
  35. // CSDKModeManager.
  36. // --------------------------------------------------------------------------------- //
  37. class CSDKModeManager : public IVModeManager
  38. {
  39. public:
  40. virtual void Init();
  41. virtual void SwitchMode( bool commander, bool force ) {}
  42. virtual void LevelInit( const char *newmap );
  43. virtual void LevelShutdown( void );
  44. virtual void ActivateMouse( bool isactive ) {}
  45. };
  46. static CSDKModeManager g_ModeManager;
  47. IVModeManager *modemanager = ( IVModeManager * )&g_ModeManager;
  48. // --------------------------------------------------------------------------------- //
  49. // CSDKModeManager implementation.
  50. // --------------------------------------------------------------------------------- //
  51. #define SCREEN_FILE "scripts/vgui_screens.txt"
  52. void CSDKModeManager::Init()
  53. {
  54. g_pClientMode = GetClientModeNormal();
  55. PanelMetaClassMgr()->LoadMetaClassDefinitionFile( SCREEN_FILE );
  56. }
  57. void CSDKModeManager::LevelInit( const char *newmap )
  58. {
  59. g_pClientMode->LevelInit( newmap );
  60. }
  61. void CSDKModeManager::LevelShutdown( void )
  62. {
  63. g_pClientMode->LevelShutdown();
  64. }
  65. //-----------------------------------------------------------------------------
  66. // Purpose:
  67. //-----------------------------------------------------------------------------
  68. ClientModeSDKNormal::ClientModeSDKNormal()
  69. {
  70. }
  71. //-----------------------------------------------------------------------------
  72. // Purpose: If you don't know what a destructor is by now, you are probably going to get fired
  73. //-----------------------------------------------------------------------------
  74. ClientModeSDKNormal::~ClientModeSDKNormal()
  75. {
  76. }
  77. void ClientModeSDKNormal::InitViewport()
  78. {
  79. m_pViewport = new SDKViewport();
  80. m_pViewport->Start( gameuifuncs, gameeventmanager );
  81. }
  82. ClientModeSDKNormal g_ClientModeNormal;
  83. IClientMode *GetClientModeNormal()
  84. {
  85. return &g_ClientModeNormal;
  86. }
  87. ClientModeSDKNormal* GetClientModeSDKNormal()
  88. {
  89. Assert( dynamic_cast< ClientModeSDKNormal* >( GetClientModeNormal() ) );
  90. return static_cast< ClientModeSDKNormal* >( GetClientModeNormal() );
  91. }
  92. float ClientModeSDKNormal::GetViewModelFOV( void )
  93. {
  94. return 74.0f;
  95. }
  96. int ClientModeSDKNormal::GetDeathMessageStartHeight( void )
  97. {
  98. return m_pViewport->GetDeathMessageStartHeight();
  99. }
  100. void ClientModeSDKNormal::PostRenderVGui()
  101. {
  102. }