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.

598 lines
17 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "client_pch.h"
  8. #include <vgui/ISystem.h>
  9. #include <vgui/ISurface.h>
  10. #include <vgui/IVGui.h>
  11. #include <keyvalues.h>
  12. #include <vgui_controls/BuildGroup.h>
  13. #include <vgui_controls/Tooltip.h>
  14. #include <vgui_controls/TextImage.h>
  15. #include <vgui_controls/CheckButton.h>
  16. #include <vgui_controls/Label.h>
  17. #include <vgui_controls/PropertySheet.h>
  18. #include <vgui_controls/ProgressBar.h>
  19. #include <vgui_controls/Slider.h>
  20. #include <vgui_controls/Controls.h>
  21. #include <vgui_controls/TextEntry.h>
  22. #include <vgui/IInput.h>
  23. #include "cl_foguipanel.h"
  24. // memdbgon must be the last include file in a .cpp file!!!
  25. #include "tier0/memdbgon.h"
  26. using namespace vgui;
  27. //-----------------------------------------------------------------------------
  28. // CFogUIPanel
  29. //-----------------------------------------------------------------------------
  30. CFogUIPanel *g_pFogUI = NULL;
  31. void CFogUIPanel::InstallFogUI( vgui::Panel *parent )
  32. {
  33. if ( g_pFogUI )
  34. return;
  35. g_pFogUI = new CFogUIPanel( parent );
  36. Assert( g_pFogUI );
  37. }
  38. //-----------------------------------------------------------------------------
  39. // Purpose: Constructor
  40. //-----------------------------------------------------------------------------
  41. CFogUIPanel::CFogUIPanel( vgui::Panel *parent ) : vgui::Frame( parent, "FogUIPanel" )
  42. {
  43. SetTitle( "FogUI", true );
  44. m_bControlsInitialized = false;
  45. m_pFogOverride = new vgui::CheckButton( this, "FogOverride", "FogOverride" );
  46. //
  47. // World
  48. //
  49. m_pFogEnable = new vgui::CheckButton( this, "FogEnable", "FogEnable" );
  50. // FogStart
  51. m_pFogStart = new vgui::Slider( this, "FogStart" );
  52. m_pFogStartText = new vgui::TextEntry( this, "FogStartText" );
  53. // FogEnd
  54. m_pFogEnd = new vgui::Slider( this, "FogEnd" );
  55. m_pFogEndText = new vgui::TextEntry( this, "FogEndText" );
  56. // Red
  57. m_pFogColorRed = new vgui::Slider( this, "FogColorRed" );
  58. m_pFogColorRedText = new vgui::TextEntry( this, "FogColorRedText" );
  59. // Green
  60. m_pFogColorGreen = new vgui::Slider( this, "FogColorGreen" );
  61. m_pFogColorGreenText = new vgui::TextEntry( this, "FogColorGreenText" );
  62. // Blue
  63. m_pFogColorBlue = new vgui::Slider( this, "FogColorBlue" );
  64. m_pFogColorBlueText = new vgui::TextEntry( this, "FogColorBlueText" );
  65. //
  66. // Skybox
  67. //
  68. m_pFogEnableSky = new vgui::CheckButton( this, "FogEnableSky", "FogEnableSky" );
  69. // Start
  70. m_pFogStartSky = new vgui::Slider( this, "FogStartSky" );
  71. m_pFogStartTextSky = new vgui::TextEntry( this, "FogStartTextSky" );
  72. // End
  73. m_pFogEndSky = new vgui::Slider( this, "FogEndSky" );
  74. m_pFogEndTextSky = new vgui::TextEntry( this, "FogEndTextSky" );
  75. // Red
  76. m_pFogColorRedSky = new vgui::Slider( this, "FogColorRedSky" );
  77. m_pFogColorRedTextSky = new vgui::TextEntry( this, "FogColorRedTextSky" );
  78. // Green
  79. m_pFogColorGreenSky = new vgui::Slider( this, "FogColorGreenSky" );
  80. m_pFogColorGreenTextSky = new vgui::TextEntry( this, "FogColorGreenTextSky" );
  81. // Blue
  82. m_pFogColorBlueSky = new vgui::Slider( this, "FogColorBlueSky" );
  83. m_pFogColorBlueTextSky = new vgui::TextEntry( this, "FogColorBlueTextSky" );
  84. //
  85. // Far Z
  86. //
  87. m_pFarZOverride = new vgui::CheckButton( this, "FarZOverride", "FarZOverride" );
  88. m_pFarZ = new vgui::Slider( this, "FarZ" );
  89. m_pFarZText = new vgui::TextEntry( this, "FarZText" );
  90. // TODO:
  91. // - fog_maxdensity
  92. // - fog_maxdensityskybox
  93. // - fog_fogvolue
  94. // - r_pixelfog?
  95. vgui::ivgui()->AddTickSignal( GetVPanel(), 0 );
  96. LoadControlSettings("Resource\\FogUIPanel.res");
  97. SetVisible( false );
  98. SetSizeable( false );
  99. SetMoveable( true );
  100. }
  101. //-----------------------------------------------------------------------------
  102. // Purpose:
  103. //-----------------------------------------------------------------------------
  104. CFogUIPanel::~CFogUIPanel()
  105. {
  106. }
  107. //-----------------------------------------------------------------------------
  108. // Purpose:
  109. //-----------------------------------------------------------------------------
  110. void CFogUIPanel::OnTick()
  111. {
  112. BaseClass::OnTick();
  113. if ( !IsVisible() )
  114. return;
  115. InitControls();
  116. bool bEnabled = m_pFogOverride->IsSelected();
  117. bool bFogEnabled = ( m_pFogEnable->IsSelected() && m_pFogOverride->IsSelected() );
  118. m_pFogEnable->SetEnabled( bEnabled );
  119. m_pFogStart->SetEnabled( bFogEnabled );
  120. m_pFogEnd->SetEnabled( bFogEnabled);
  121. m_pFogStartText->SetEnabled( bFogEnabled );
  122. m_pFogEndText->SetEnabled( bFogEnabled );
  123. m_pFogColorRed->SetEnabled( bFogEnabled );
  124. m_pFogColorRedText->SetEnabled( bFogEnabled );
  125. m_pFogColorGreen->SetEnabled( bFogEnabled );
  126. m_pFogColorGreenText->SetEnabled( bFogEnabled );
  127. m_pFogColorBlue->SetEnabled( bFogEnabled );
  128. m_pFogColorBlueText->SetEnabled( bFogEnabled );
  129. bool bFogSkyEnabled = ( m_pFogEnableSky->IsSelected() && m_pFogOverride->IsSelected() );
  130. m_pFogEnableSky->SetEnabled( bEnabled );
  131. m_pFogStartSky->SetEnabled( bFogSkyEnabled );
  132. m_pFogEndSky->SetEnabled( bFogSkyEnabled);
  133. m_pFogStartTextSky->SetEnabled( bFogSkyEnabled );
  134. m_pFogEndTextSky->SetEnabled( bFogSkyEnabled );
  135. m_pFogColorRedSky->SetEnabled( bFogSkyEnabled);
  136. m_pFogColorRedTextSky->SetEnabled( bFogSkyEnabled);
  137. m_pFogColorGreenSky->SetEnabled( bFogSkyEnabled );
  138. m_pFogColorGreenTextSky->SetEnabled( bFogSkyEnabled );
  139. m_pFogColorBlueSky->SetEnabled( bFogSkyEnabled );
  140. m_pFogColorBlueTextSky->SetEnabled( bFogSkyEnabled );
  141. bool bFarZEnabled = ( m_pFarZOverride->IsSelected() && m_pFogOverride->IsSelected() );
  142. m_pFarZOverride->SetEnabled( bEnabled );
  143. m_pFarZ->SetEnabled( bFarZEnabled );
  144. m_pFarZText->SetEnabled( bFarZEnabled );
  145. }
  146. //-----------------------------------------------------------------------------
  147. // Purpose: Commands
  148. //-----------------------------------------------------------------------------
  149. void CFogUIPanel::OnCommand( const char *command )
  150. {
  151. if ( !Q_strcasecmp( command, "FogOverride" ) )
  152. {
  153. if ( m_pFogOverride->IsSelected() == true )
  154. {
  155. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_override 1\n" );
  156. }
  157. else
  158. {
  159. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_override 0\n" );
  160. }
  161. }
  162. else if ( !Q_strcasecmp( command, "FogEnable" ) )
  163. {
  164. if ( m_pFogEnable->IsSelected() == true )
  165. {
  166. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_enable 1\n" );
  167. }
  168. else
  169. {
  170. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_enable 0\n" );
  171. }
  172. }
  173. else if ( !Q_strcasecmp( command, "FogEnableSky" ) )
  174. {
  175. if ( m_pFogEnableSky->IsSelected() == true )
  176. {
  177. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_enableskybox 1\n" );
  178. }
  179. else
  180. {
  181. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "fog_enableskybox 0\n" );
  182. }
  183. }
  184. else if ( !Q_strcasecmp( command, "FarZOverride" ) )
  185. {
  186. if ( m_pFarZOverride->IsSelected() == true )
  187. {
  188. //m_pFarZText->SetText( va( "%i", m_pFarZ->GetValue() ) );
  189. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "r_farz %i\n", m_pFarZ->GetValue() ) );
  190. }
  191. else
  192. {
  193. Cbuf_AddText( Cbuf_GetCurrentPlayer(), "r_farz -1\n" );
  194. }
  195. }
  196. else
  197. {
  198. BaseClass::OnCommand( command );
  199. }
  200. }
  201. //-----------------------------------------------------------------------------
  202. // Purpose: Text
  203. //-----------------------------------------------------------------------------
  204. void CFogUIPanel::OnTextNewLine( KeyValues *data )
  205. {
  206. Panel *pPanel = reinterpret_cast<vgui::Panel *>( data->GetPtr("panel") );
  207. if ( !pPanel )
  208. {
  209. return;
  210. }
  211. vgui::TextEntry *pTextEntry = dynamic_cast<vgui::TextEntry *>( pPanel );
  212. if ( !pTextEntry )
  213. {
  214. return;
  215. }
  216. // World
  217. if ( pTextEntry == m_pFogStartText || pTextEntry == m_pFogStartTextSky )
  218. {
  219. UpdateFogStartSlider();
  220. return;
  221. }
  222. if ( pTextEntry == m_pFogEndText || pTextEntry == m_pFogEndTextSky )
  223. {
  224. UpdateFogEndSlider();
  225. return;
  226. }
  227. if ( pTextEntry == m_pFogColorRedText || pTextEntry == m_pFogColorRedTextSky )
  228. {
  229. UpdateFogColorRedSlider();
  230. return;
  231. }
  232. if ( pTextEntry == m_pFogColorGreenText || pTextEntry == m_pFogColorGreenTextSky )
  233. {
  234. UpdateFogColorGreenSlider();
  235. return;
  236. }
  237. if ( pTextEntry == m_pFogColorBlueText || pTextEntry == m_pFogColorBlueTextSky )
  238. {
  239. UpdateFogColorBlueSlider();
  240. return;
  241. }
  242. if ( pTextEntry == m_pFarZText )
  243. {
  244. UpdateFarZSlider();
  245. return;
  246. }
  247. }
  248. //-----------------------------------------------------------------------------
  249. // Purpose: Text
  250. //-----------------------------------------------------------------------------
  251. void CFogUIPanel::OnTextKillFocus( KeyValues *data )
  252. {
  253. Panel *pPanel = reinterpret_cast<vgui::Panel *>( data->GetPtr("panel") );
  254. if ( !pPanel )
  255. {
  256. return;
  257. }
  258. vgui::TextEntry *pTextEntry = dynamic_cast<vgui::TextEntry *>( pPanel );
  259. if ( !pTextEntry )
  260. {
  261. return;
  262. }
  263. // World
  264. if ( pTextEntry == m_pFogStartText || pTextEntry == m_pFogStartTextSky )
  265. {
  266. UpdateFogStartSlider();
  267. return;
  268. }
  269. if ( pTextEntry == m_pFogEndText || pTextEntry == m_pFogEndTextSky )
  270. {
  271. UpdateFogEndSlider();
  272. return;
  273. }
  274. if ( pTextEntry == m_pFogColorRedText || pTextEntry == m_pFogColorRedTextSky )
  275. {
  276. UpdateFogColorRedSlider();
  277. return;
  278. }
  279. if ( pTextEntry == m_pFogColorGreenText || pTextEntry == m_pFogColorGreenTextSky )
  280. {
  281. UpdateFogColorGreenSlider();
  282. return;
  283. }
  284. if ( pTextEntry == m_pFogColorBlueText || pTextEntry == m_pFogColorBlueTextSky )
  285. {
  286. UpdateFogColorBlueSlider();
  287. return;
  288. }
  289. if ( pTextEntry == m_pFarZText )
  290. {
  291. UpdateFarZSlider();
  292. return;
  293. }
  294. }
  295. //-----------------------------------------------------------------------------
  296. // Purpose: Messages
  297. //-----------------------------------------------------------------------------
  298. void CFogUIPanel::OnMessage( const KeyValues *params, VPANEL fromPanel )
  299. {
  300. BaseClass::OnMessage( params, fromPanel );
  301. if ( !Q_strcmp( "SliderMoved", params->GetName() ) )
  302. {
  303. // World
  304. if ( fromPanel == m_pFogStart->GetVPanel() )
  305. {
  306. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_start %i\n", m_pFogStart->GetValue() ) );
  307. m_pFogStartText->SetText( va( "%i", m_pFogStart->GetValue() ) );
  308. }
  309. if ( fromPanel == m_pFogEnd->GetVPanel() )
  310. {
  311. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_end %i\n", m_pFogEnd->GetValue() ) );
  312. m_pFogEndText->SetText( va( "%i", m_pFogEnd->GetValue() ) );
  313. }
  314. if ( fromPanel == m_pFogColorRed->GetVPanel() )
  315. {
  316. m_pFogColorRedText->SetText( va( "%i", m_pFogColorRed->GetValue() ) );
  317. UpdateFogColors();
  318. }
  319. if ( fromPanel == m_pFogColorGreen->GetVPanel() )
  320. {
  321. m_pFogColorGreenText->SetText( va( "%i", m_pFogColorGreen->GetValue() ) );
  322. UpdateFogColors();
  323. }
  324. if ( fromPanel == m_pFogColorBlue->GetVPanel() )
  325. {
  326. m_pFogColorBlueText->SetText( va( "%i", m_pFogColorBlue->GetValue() ) );
  327. UpdateFogColors();
  328. }
  329. // Skybox
  330. if ( fromPanel == m_pFogStartSky->GetVPanel() )
  331. {
  332. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_startskybox %i\n", m_pFogStartSky->GetValue() ) );
  333. m_pFogStartTextSky->SetText( va( "%i", m_pFogStartSky->GetValue() ) );
  334. }
  335. if ( fromPanel == m_pFogEndSky->GetVPanel() )
  336. {
  337. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_endskybox %i\n", m_pFogEndSky->GetValue() ) );
  338. m_pFogEndTextSky->SetText( va( "%i", m_pFogEndSky->GetValue() ) );
  339. }
  340. if ( fromPanel == m_pFogColorRedSky->GetVPanel() )
  341. {
  342. m_pFogColorRedTextSky->SetText( va( "%i", m_pFogColorRedSky->GetValue() ) );
  343. UpdateFogColors();
  344. }
  345. if ( fromPanel == m_pFogColorGreenSky->GetVPanel() )
  346. {
  347. m_pFogColorGreenTextSky->SetText( va( "%i", m_pFogColorGreenSky->GetValue() ) );
  348. UpdateFogColors();
  349. }
  350. if ( fromPanel == m_pFogColorBlueSky->GetVPanel() )
  351. {
  352. m_pFogColorBlueTextSky->SetText( va( "%i", m_pFogColorBlueSky->GetValue() ) );
  353. UpdateFogColors();
  354. }
  355. // FarZ
  356. if ( fromPanel == m_pFarZ->GetVPanel() )
  357. {
  358. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "r_farz %i\n", m_pFarZ->GetValue() ) );
  359. m_pFarZText->SetText( va( "%i", m_pFarZ->GetValue() ) );
  360. }
  361. }
  362. }
  363. void CFogUIPanel::InitControls( void )
  364. {
  365. if ( m_bControlsInitialized )
  366. {
  367. return;
  368. }
  369. m_pFogEnable->SetSelected( true );
  370. // FogStart
  371. m_pFogStart->SetRange( -10000, 30000 );
  372. m_pFogStart->SetValue( 1 );
  373. m_pFogStart->AddActionSignalTarget( this );
  374. m_pFogStart->SetDragOnRepositionNob( true );
  375. m_pFogStartText->SendNewLine( true );
  376. m_pFogStartText->SetCatchEnterKey( true );
  377. // FogEnd
  378. m_pFogEnd->SetRange( -10000, 30000 );
  379. m_pFogEnd->SetValue( 1 );
  380. m_pFogEnd->AddActionSignalTarget( this );
  381. m_pFogEnd->SetDragOnRepositionNob( true );
  382. m_pFogEndText->SendNewLine( true );
  383. m_pFogEndText->SetCatchEnterKey( true );
  384. // Red
  385. m_pFogColorRed->SetRange( 1, 255 );
  386. m_pFogColorRed->SetValue( 1 );
  387. m_pFogColorRed->AddActionSignalTarget( this );
  388. m_pFogColorRed->SetDragOnRepositionNob( true );
  389. m_pFogColorRedText->SendNewLine( true );
  390. m_pFogColorRedText->SetCatchEnterKey( true );
  391. // Green
  392. m_pFogColorGreen->SetRange( 1, 255 );
  393. m_pFogColorGreen->SetValue( 1 );
  394. m_pFogColorGreen->AddActionSignalTarget( this );
  395. m_pFogColorGreen->SetDragOnRepositionNob( true );
  396. m_pFogColorGreenText->SendNewLine( true );
  397. m_pFogColorGreenText->SetCatchEnterKey( true );
  398. // Blue
  399. m_pFogColorBlue->SetRange( 1, 255 );
  400. m_pFogColorBlue->SetValue( 1 );
  401. m_pFogColorBlue->AddActionSignalTarget( this );
  402. m_pFogColorBlue->SetDragOnRepositionNob( true );
  403. m_pFogColorBlueText->SendNewLine( true );
  404. m_pFogColorBlueText->SetCatchEnterKey( true );
  405. //
  406. // Skybox
  407. //
  408. m_pFogEnableSky->SetSelected( true );
  409. // Start
  410. m_pFogStartSky->SetRange( -10000, 30000 );
  411. m_pFogStartSky->SetValue( 1 );
  412. m_pFogStartSky->AddActionSignalTarget( this );
  413. m_pFogStartSky->SetDragOnRepositionNob( true );
  414. m_pFogStartTextSky->SendNewLine( true );
  415. m_pFogStartTextSky->SetCatchEnterKey( true );
  416. // End
  417. m_pFogEndSky->SetRange( -10000, 30000 );
  418. m_pFogEndSky->SetValue( 1 );
  419. m_pFogEndSky->AddActionSignalTarget( this );
  420. m_pFogEndSky->SetDragOnRepositionNob( true );
  421. m_pFogEndTextSky->SendNewLine( true );
  422. m_pFogEndTextSky->SetCatchEnterKey( true );
  423. // Red
  424. m_pFogColorRedSky->SetRange( 1, 255 );
  425. m_pFogColorRedSky->SetValue( 1 );
  426. m_pFogColorRedSky->AddActionSignalTarget( this );
  427. m_pFogColorRedSky->SetDragOnRepositionNob( true );
  428. m_pFogColorRedTextSky->SendNewLine( true );
  429. m_pFogColorRedTextSky->SetCatchEnterKey( true );
  430. // Green
  431. m_pFogColorGreenSky->SetRange( 1, 255 );
  432. m_pFogColorGreenSky->SetValue( 1 );
  433. m_pFogColorGreenSky->AddActionSignalTarget( this );
  434. m_pFogColorGreenSky->SetDragOnRepositionNob( true );
  435. m_pFogColorGreenTextSky->SendNewLine( true );
  436. m_pFogColorGreenTextSky->SetCatchEnterKey( true );
  437. // Blue
  438. m_pFogColorBlueSky->SetRange( 1, 255 );
  439. m_pFogColorBlueSky->SetValue( 1 );
  440. m_pFogColorBlueSky->AddActionSignalTarget( this );
  441. m_pFogColorBlueSky->SetDragOnRepositionNob( true );
  442. m_pFogColorBlueTextSky->SendNewLine( true );
  443. m_pFogColorBlueTextSky->SetCatchEnterKey( true );
  444. //
  445. // Far Z
  446. //
  447. m_pFarZOverride->SetSelected( false );
  448. m_pFarZ->SetRange( 1, 30000 );
  449. m_pFarZ->SetValue( 30000 );
  450. m_pFarZ->AddActionSignalTarget( this );
  451. m_pFarZ->SetDragOnRepositionNob( true );
  452. m_pFarZText->SendNewLine( true );
  453. m_pFarZText->SetCatchEnterKey( true );
  454. m_pFarZText->SetText( va( "%i", m_pFarZ->GetValue() ) );
  455. m_bControlsInitialized = true;
  456. }
  457. //-----------------------------------------------------------------------------
  458. // Purpose: Update Sliders
  459. //-----------------------------------------------------------------------------
  460. void CFogUIPanel::UpdateFogStartSlider()
  461. {
  462. m_pFogStart->SetValue( m_pFogStartText->GetValueAsInt() );
  463. m_pFogStartSky->SetValue( m_pFogStartTextSky->GetValueAsInt() );
  464. }
  465. void CFogUIPanel::UpdateFogEndSlider()
  466. {
  467. m_pFogEnd->SetValue( m_pFogEndText->GetValueAsInt() );
  468. m_pFogEndSky->SetValue( m_pFogEndTextSky->GetValueAsInt() );
  469. }
  470. void CFogUIPanel::UpdateFogColorRedSlider()
  471. {
  472. m_pFogColorRed->SetValue( m_pFogColorRedText->GetValueAsInt() );
  473. m_pFogColorRedSky->SetValue( m_pFogColorRedTextSky->GetValueAsInt() );
  474. }
  475. void CFogUIPanel::UpdateFogColorGreenSlider()
  476. {
  477. m_pFogColorGreen->SetValue( m_pFogColorGreenText->GetValueAsInt() );
  478. m_pFogColorGreenSky->SetValue( m_pFogColorGreenTextSky->GetValueAsInt() );
  479. }
  480. void CFogUIPanel::UpdateFogColorBlueSlider()
  481. {
  482. m_pFogColorBlue->SetValue( m_pFogColorBlueText->GetValueAsInt() );
  483. m_pFogColorBlueSky->SetValue( m_pFogColorBlueTextSky->GetValueAsInt() );
  484. }
  485. void CFogUIPanel::UpdateFarZSlider()
  486. {
  487. m_pFarZ->SetValue( m_pFarZText->GetValueAsInt() );
  488. }
  489. //-----------------------------------------------------------------------------
  490. // Purpose: Update Colors
  491. //-----------------------------------------------------------------------------
  492. void CFogUIPanel::UpdateFogColors()
  493. {
  494. int iRed = m_pFogColorRed->GetValue();
  495. int iGreen = m_pFogColorGreen->GetValue();
  496. int iBlue = m_pFogColorBlue->GetValue();
  497. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_color %i %i %i\n", iRed, iGreen, iBlue ) );
  498. int iRedSky = m_pFogColorRedSky->GetValue();
  499. int iGreenSky = m_pFogColorGreenSky->GetValue();
  500. int iBlueSky = m_pFogColorBlueSky->GetValue();
  501. Cbuf_AddText( Cbuf_GetCurrentPlayer(), va( "fog_colorskybox %i %i %i\n", iRedSky, iGreenSky, iBlueSky ) );
  502. }
  503. //-----------------------------------------------------------------------------
  504. // Purpose:
  505. //-----------------------------------------------------------------------------
  506. void FogUI_f()
  507. {
  508. if ( !g_pFogUI )
  509. return;
  510. if ( g_pFogUI->IsVisible() )
  511. {
  512. g_pFogUI->Close();
  513. }
  514. else
  515. {
  516. g_pFogUI->Activate();
  517. }
  518. }
  519. static ConCommand fogui( "fogui", FogUI_f, "Show/hide fog control UI.", FCVAR_DONTRECORD );