1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#include "BasePanel.h"
#include "OptionsDialog.h"
#include "vgui_controls/Button.h"
#include "vgui_controls/CheckButton.h"
#include "vgui_controls/PropertySheet.h"
#include "vgui_controls/Label.h"
#include "vgui_controls/QueryBox.h"
#include "vgui/ILocalize.h"
#include "vgui/ISurface.h"
#include "vgui/ISystem.h"
#include "vgui/IVGui.h"
#include "KeyValues.h"
#include "OptionsSubKeyboard.h"
#include "OptionsSubMouse.h"
#include "OptionsSubAudio.h"
#include "OptionsSubVideo.h"
#include "OptionsSubVoice.h"
#include "OptionsSubMultiplayer.h"
#include "OptionsSubDifficulty.h"
#include "OptionsSubPortal.h"
#ifdef WIN32
// NVNT haptic configuration dialog
#include "OptionsSubHaptics.h"
#endif
#include "ModInfo.h"
using namespace vgui;
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
//-----------------------------------------------------------------------------
// Purpose: Basic help dialog
//-----------------------------------------------------------------------------
COptionsDialog::COptionsDialog(vgui::Panel *parent) : PropertyDialog(parent, "OptionsDialog")
{
SetDeleteSelfOnClose(true);
SetBounds(0, 0, 512, 406);
SetSizeable( false );
SetTitle("#GameUI_Options", true);
// debug timing code, this function takes too long
// double s4 = system()->GetCurrentTime();
#if defined( WIN32 ) && !defined( _X360 )
// NVNT START see if the user has a haptic device via convar. if so create haptics dialog.
ConVarRef checkHap("hap_HasDevice");
checkHap.Init("hap_HasDevice",true);
if(checkHap.GetBool())
{
AddPage(new COptionsSubHaptics(this), "#GameUI_Haptics_TabTitle");
}
// NVNT END
#endif
if (ModInfo().IsSinglePlayerOnly() && !ModInfo().NoDifficulty())
{
AddPage(new COptionsSubDifficulty(this), "#GameUI_Difficulty");
}
if (ModInfo().HasPortals())
{
AddPage(new COptionsSubPortal(this), "#GameUI_Portal");
}
AddPage(new COptionsSubKeyboard(this), "#GameUI_Keyboard");
AddPage(new COptionsSubMouse(this), "#GameUI_Mouse");
m_pOptionsSubAudio = new COptionsSubAudio(this);
AddPage(m_pOptionsSubAudio, "#GameUI_Audio");
m_pOptionsSubVideo = new COptionsSubVideo(this);
AddPage(m_pOptionsSubVideo, "#GameUI_Video");
if ( !ModInfo().IsSinglePlayerOnly() )
{
AddPage(new COptionsSubVoice(this), "#GameUI_Voice");
}
// add the multiplay page last, if we're combo single/multi or just multi
if ( (ModInfo().IsMultiplayerOnly() && !ModInfo().IsSinglePlayerOnly()) ||
(!ModInfo().IsMultiplayerOnly() && !ModInfo().IsSinglePlayerOnly()) )
{
m_pOptionsSubMultiplayer = new COptionsSubMultiplayer(this);
AddPage(m_pOptionsSubMultiplayer, "#GameUI_Multiplayer");
}
// double s5 = system()->GetCurrentTime();
// Msg("COptionsDialog::COptionsDialog(): %.3fms\n", (float)(s5 - s4) * 1000.0f);
SetApplyButtonVisible(true);
GetPropertySheet()->SetTabWidth(84);
}
//-----------------------------------------------------------------------------
// Purpose: Destructor
//-----------------------------------------------------------------------------
COptionsDialog::~COptionsDialog()
{
}
//-----------------------------------------------------------------------------
// Purpose: Brings the dialog to the fore
//-----------------------------------------------------------------------------
void COptionsDialog::Activate()
{
BaseClass::Activate();
EnableApplyButton(false);
}
void COptionsDialog::OnKeyCodePressed( KeyCode code )
{
switch ( GetBaseButtonCode( code ) )
{
case KEY_XBUTTON_B:
OnCommand( "Cancel" );
return;
}
BaseClass::OnKeyCodePressed( code );
}
//-----------------------------------------------------------------------------
// Purpose: Opens the dialog
//-----------------------------------------------------------------------------
void COptionsDialog::Run()
{
SetTitle("#GameUI_Options", true);
Activate();
}
//-----------------------------------------------------------------------------
// Purpose: Called when the GameUI is hidden
//-----------------------------------------------------------------------------
void COptionsDialog::OnGameUIHidden()
{
// tell our children about it
for ( int i = 0 ; i < GetChildCount() ; i++ )
{
Panel *pChild = GetChild( i );
if ( pChild )
{
PostMessage( pChild, new KeyValues( "GameUIHidden" ) );
}
}
}
|