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.

98 lines
3.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "OptionsSubPortal.h"
  9. #include "CvarToggleCheckButton.h"
  10. #include "vgui_controls/ComboBox.h"
  11. #include "EngineInterface.h"
  12. #include <KeyValues.h>
  13. #include <vgui/IScheme.h>
  14. #include "tier1/convar.h"
  15. #include <stdio.h>
  16. #include <vgui_controls/TextEntry.h>
  17. // memdbgon must be the last include file in a .cpp file!!!
  18. #include <tier0/memdbgon.h>
  19. using namespace vgui;
  20. COptionsSubPortal::COptionsSubPortal(vgui::Panel *parent) : PropertyPage(parent, NULL)
  21. {
  22. m_pPortalFunnelCheckBox = new CCvarToggleCheckButton(
  23. this,
  24. "PortalFunnel",
  25. "#GameUI_PortalFunnel",
  26. "sv_player_funnel_into_portals" );
  27. m_pPortalDepthCombo = new ComboBox( this, "PortalDepth", 6, false );
  28. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth0", new KeyValues("PortalDepth", "depth", 0) );
  29. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth1", new KeyValues("PortalDepth", "depth", 1) );
  30. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth2", new KeyValues("PortalDepth", "depth", 2) );
  31. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth3", new KeyValues("PortalDepth", "depth", 3) );
  32. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth4", new KeyValues("PortalDepth", "depth", 4) );
  33. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth5", new KeyValues("PortalDepth", "depth", 5) );
  34. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth6", new KeyValues("PortalDepth", "depth", 6) );
  35. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth7", new KeyValues("PortalDepth", "depth", 7) );
  36. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth8", new KeyValues("PortalDepth", "depth", 8) );
  37. m_pPortalDepthCombo->AddItem( "#GameUI_PortalDepth9", new KeyValues("PortalDepth", "depth", 9) );
  38. LoadControlSettings("Resource\\OptionsSubPortal.res");
  39. }
  40. //-----------------------------------------------------------------------------
  41. // Purpose:
  42. //-----------------------------------------------------------------------------
  43. COptionsSubPortal::~COptionsSubPortal()
  44. {
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose:
  48. //-----------------------------------------------------------------------------
  49. void COptionsSubPortal::OnResetData()
  50. {
  51. m_pPortalFunnelCheckBox->Reset();
  52. // Portal render depth
  53. ConVarRef r_portal_stencil_depth("r_portal_stencil_depth");
  54. if ( r_portal_stencil_depth.IsValid() )
  55. {
  56. m_pPortalDepthCombo->ActivateItem(r_portal_stencil_depth.GetInt());
  57. }
  58. }
  59. //-----------------------------------------------------------------------------
  60. // Purpose:
  61. //-----------------------------------------------------------------------------
  62. void COptionsSubPortal::OnApplyChanges()
  63. {
  64. m_pPortalFunnelCheckBox->ApplyChanges();
  65. // Portal render depth
  66. if ( m_pPortalDepthCombo->IsEnabled() )
  67. {
  68. ConVarRef r_portal_stencil_depth( "r_portal_stencil_depth" );
  69. r_portal_stencil_depth.SetValue( m_pPortalDepthCombo->GetActiveItem() );
  70. }
  71. }
  72. //-----------------------------------------------------------------------------
  73. // Purpose: sets background color & border
  74. //-----------------------------------------------------------------------------
  75. void COptionsSubPortal::ApplySchemeSettings(IScheme *pScheme)
  76. {
  77. BaseClass::ApplySchemeSettings(pScheme);
  78. }
  79. //-----------------------------------------------------------------------------
  80. // Purpose:
  81. //-----------------------------------------------------------------------------
  82. void COptionsSubPortal::OnControlModified()
  83. {
  84. PostActionSignal(new KeyValues("ApplyButtonEnable"));
  85. }