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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
#include "OptionsSubHaptics.h"
//#include "CommandCheckButton.h"
#include "KeyToggleCheckButton.h"
#include "CvarNegateCheckButton.h"
#include "CvarToggleCheckButton.h"
#include "cvarslider.h"
#include "EngineInterface.h"
#include <KeyValues.h>
#include <vgui/IScheme.h>
#include "tier1/convar.h"
#include <stdio.h>
#include <vgui_controls/TextEntry.h>
// memdbgon must be the last include file in a .cpp file!!!
#include <tier0/memdbgon.h>
using namespace vgui;
bool HasFalcon() {
ConVarRef hap_hasDevice("hap_hasDevice");
return (hap_hasDevice.IsValid() && hap_hasDevice.GetBool());
}
void COptionsSubHaptics::OnCommand(const char *command)
{
if ( !stricmp( command, "DoDefaults" ) )
{
engine->ClientCmd_Unrestricted("exec haptics_default.cfg");
OnResetData();
}
}
COptionsSubHaptics::COptionsSubHaptics(vgui::Panel *parent) : PropertyPage(parent, NULL)
{
m_pForceMasterPreLabel = new Label(this, "ForceMasterPreLabel", "#GameUI_Haptics_ForceMasterScale" );
m_pForceMasterSlider = new CCvarSlider( this, "ForceMasterSlider", "#GameUI_Haptics_ForceMasterScale",
0.000001f, 3.0f, "hap_ForceMasterScale", true );
m_pForceRecoilPreLabel = new Label(this, "ForceRecoilPreLabel", "#GameUI_Haptics_RecoilScale" );
m_pForceRecoilSlider = new CCvarSlider( this, "ForceRecoilSlider", "#GameUI_Haptics_RecoilScale",
0.000001f, 3.0f, "hap_ForceRecoilScale", true );
m_pForceDamagePreLabel = new Label(this, "ForceDamagePreLabel", "#GameUI_Haptics_DamageScale" );
m_pForceDamageSlider = new CCvarSlider( this, "ForceDamageSlider", "#GameUI_Haptics_DamageScale",
0.000001f, 5.0f, "hap_ForceDamageScale" , true );
m_pForceMovementPreLabel = new Label(this, "ForceMovementPreLabel", "#GameUI_Haptics_MovementScale" );
m_pForceMovementSlider = new CCvarSlider( this, "ForceMovementSlider", "#GameUI_Haptics_MovementScale",
0.000001f, 3.0f, "hap_ForceMovementScale", true );
//Player scaling
m_pPlayerBoxPreLabel = new Label(this, "PlayerBoxPreLabel", "#GameUI_Haptics_PlayerBoxLabel" );
m_pPlayerBoxScalePreLabel = new Label(this, "PlayerScalePreLabel", "#GameUI_Haptics_Scale" );
m_pPlayerBoxScale = new CCvarSlider( this, "PlayerBoxScaleSlider", "#GameUI_Haptics_PlayerBoxScale",
0.1f, 0.9f, "hap_PlayerBoxScale", true );
m_pPlayerBoxVisual = new ControlBoxVisual(this, "PlayerBoxVisual", m_pPlayerBoxScale, m_pPlayerBoxScale, m_pPlayerBoxScale, m_pPlayerBoxScale, m_pPlayerBoxScale, m_pPlayerBoxScale);
m_pPlayerBoxStiffnessPreLabel = new Label(this, "PlayerStiffnessPreLabel", "#GameUI_Haptics_PlayerBoxStiffness" );
m_pPlayerBoxStiffnessSlider = new CCvarSlider( this, "PlayerStiffnessSlider", "#GameUI_Haptics_PlayerBoxScale",
0.0f, 3.0f, "hap_PlayerBoxStiffness", true );
m_pPlayerBoxTurnPreLabel = new Label(this, "PlayerTurnPreLabel", "#GameUI_Haptics_Turning" );
m_pPlayerBoxTurnSlider = new CCvarSlider( this, "PlayerTurnSlider", "#GameUI_Haptics_Turning",
0.0f, 2.0f, "hap_PlayerTurnScale", true );
m_pPlayerBoxAimPreLabel = new Label(this, "PlayerAimPreLabel", "#GameUI_Haptics_Aiming" );
m_pPlayerBoxAimSlider = new CCvarSlider( this, "PlayerAimSlider", "#GameUI_Haptics_Aiming",
0.0f, 2.0f, "hap_PlayerAimScale", true );
//Vehicle Scaling
m_pVehicleBoxPreLabel = new Label(this, "VehicleBoxPreLabel", "#GameUI_Haptics_VehicleBoxLabel" );
m_pVehicleBoxScalePreLabel = new Label(this, "VehicleScalePreLabel", "#GameUI_Haptics_Scale" );
m_pVehicleBoxScale = new CCvarSlider( this, "VehicleBoxScaleSlider", "#GameUI_Haptics_VehicleBoxScale",
0.1f, 0.6f, "hap_VehicleBoxScale", true );
m_pVehicleBoxVisual = new ControlBoxVisual(this, "VehicleBoxVisual", m_pVehicleBoxScale, m_pVehicleBoxScale, m_pVehicleBoxScale, m_pVehicleBoxScale, m_pVehicleBoxScale, m_pVehicleBoxScale);
m_pVehicleBoxStiffnessPreLabel = new Label(this, "VehicleStiffnessPreLabel", "#GameUI_Haptics_VehicleBoxStiffness" );
m_pVehicleBoxStiffnessSlider = new CCvarSlider( this, "VehicleStiffnessSlider", "#GameUI_Haptics_VehicleBoxScale",
0.0f, 3.0f, "hap_VehicleBoxStiffness", true );
m_pVehicleBoxTurnPreLabel = new Label(this, "VehicleTurnPreLabel", "#GameUI_Haptics_Turning" );
m_pVehicleBoxTurnSlider = new CCvarSlider( this, "VehicleTurnSlider", "#GameUI_Haptics_Turning",
0.0f, 2.0f, "hap_VehicleTurnScale", true );
m_pVehicleBoxAimPreLabel = new Label(this, "VehicleAimPreLabel", "#GameUI_Haptics_Aiming" );
m_pVehicleBoxAimSlider = new CCvarSlider( this, "VehicleAimSlider", "#GameUI_Haptics_Aiming",
0.0f, 2.0f, "hap_VehicleAimScale", true );
vgui::Button *defaults = new vgui::Button( this, "Defaults", "Use Defaults" );
defaults->SetCommand("DoDefaults");
LoadControlSettings("Resource\\OptionsSubHaptics.res");
UpdateVehicleEnabled();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
COptionsSubHaptics::~COptionsSubHaptics()
{
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void COptionsSubHaptics::OnResetData()
{
m_pForceMasterSlider->Reset();
m_pForceDamageSlider->Reset();
m_pForceRecoilSlider->Reset();
m_pForceMovementSlider->Reset();
m_pPlayerBoxScale->Reset();
m_pPlayerBoxStiffnessSlider->Reset();
m_pPlayerBoxTurnSlider->Reset();
m_pPlayerBoxAimSlider->Reset();
m_pVehicleBoxScale->Reset();
m_pVehicleBoxStiffnessSlider->Reset();
m_pVehicleBoxTurnSlider->Reset();
m_pVehicleBoxAimSlider->Reset();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void COptionsSubHaptics::OnApplyChanges()
{
m_pForceMasterSlider->ApplyChanges();
m_pForceDamageSlider->ApplyChanges();
m_pForceRecoilSlider->ApplyChanges();
m_pForceMovementSlider->ApplyChanges();
m_pPlayerBoxScale->ApplyChanges();
m_pPlayerBoxStiffnessSlider->ApplyChanges();
m_pPlayerBoxTurnSlider->ApplyChanges();
m_pPlayerBoxAimSlider->ApplyChanges();
m_pVehicleBoxScale->ApplyChanges();
m_pVehicleBoxStiffnessSlider->ApplyChanges();
m_pVehicleBoxTurnSlider->ApplyChanges();
m_pVehicleBoxAimSlider->ApplyChanges();
//Write out our config file
engine->ClientCmd_Unrestricted("writehapticconfig");
engine->ClientCmd_Unrestricted("reloadhaptics");
}
//-----------------------------------------------------------------------------
// Purpose: sets background color & border
//-----------------------------------------------------------------------------
void COptionsSubHaptics::ApplySchemeSettings(IScheme *pScheme)
{
BaseClass::ApplySchemeSettings(pScheme);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void COptionsSubHaptics::OnControlModified(Panel *panel)
{
PostActionSignal(new KeyValues("ApplyButtonEnable"));
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void COptionsSubHaptics::OnTextChanged(Panel *panel)
{
}
void COptionsSubHaptics::UpdateVehicleEnabled()
{
ConVarRef checkVehicle("hap_ui_vehicles");
checkVehicle.Init("hap_ui_vehicles",true);
bool bEnabled = checkVehicle.GetBool();
m_pVehicleBoxPreLabel->SetEnabled( bEnabled );
m_pVehicleBoxScalePreLabel->SetEnabled( bEnabled );
m_pVehicleBoxScale->SetEnabled( bEnabled );
m_pVehicleBoxStiffnessPreLabel->SetEnabled( bEnabled );
m_pVehicleBoxStiffnessSlider->SetEnabled( bEnabled );
m_pVehicleBoxTurnPreLabel->SetEnabled( bEnabled );
m_pVehicleBoxTurnSlider->SetEnabled( bEnabled );
m_pVehicleBoxAimPreLabel ->SetEnabled( bEnabled );
m_pVehicleBoxAimSlider ->SetEnabled( bEnabled );
}
|