DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

MenuScreen_Shell_Gamepad.cpp (17848B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
     10 it under the terms of the GNU General Public License as published by
     11 the Free Software Foundation, either version 3 of the License, or
     12 (at your option) any later version.
     13 
     14 Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
     15 but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17 GNU General Public License for more details.
     18 
     19 You should have received a copy of the GNU General Public License
     20 along with Doom 3 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code.  If not, please request a copy in writing from id Software at the address below.
     23 
     24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
     25 
     26 ===========================================================================
     27 */
     28 #pragma hdrstop
     29 #include "../../idLib/precompiled.h"
     30 #include "../Game_local.h"
     31 
     32 const static int NUM_CONTROLS_OPTIONS = 8;
     33 
     34 enum gamepadMenuCmds_t {
     35 #ifndef ID_PC
     36 	GAMEPAD_CMD_CONFIG,
     37 #endif
     38 	GAMEPAD_CMD_LEFTY,
     39 	GAMEPAD_CMD_INVERT,
     40 	GAMEPAD_CMD_VIBRATE,
     41 	GAMEPAD_CMD_HOR_SENS,
     42 	GAMEPAD_CMD_VERT_SENS,
     43 	GAMEPAD_CMD_ACCELERATION,
     44 	GAMEPAD_CMD_THRESHOLD,
     45 };
     46 
     47 /*
     48 ========================
     49 idMenuScreen_Shell_Gamepad::Initialize
     50 ========================
     51 */
     52 void idMenuScreen_Shell_Gamepad::Initialize( idMenuHandler * data ) {
     53 	idMenuScreen::Initialize( data );
     54 
     55 	if ( data != NULL ) {
     56 		menuGUI = data->GetGUI();
     57 	} 
     58 
     59 	SetSpritePath( "menuGamepad" );
     60 
     61 	options = new (TAG_SWF) idMenuWidget_DynamicList();
     62 	options->SetNumVisibleOptions( NUM_CONTROLS_OPTIONS );
     63 	options->SetSpritePath( GetSpritePath(), "info", "options" );
     64 	options->SetWrappingAllowed( true );
     65 	options->SetControlList( true );
     66 	options->Initialize( data );
     67 	AddChild( options );
     68 
     69 	idMenuWidget_Help * const helpWidget = new ( TAG_SWF ) idMenuWidget_Help();
     70 	helpWidget->SetSpritePath( GetSpritePath(), "info", "helpTooltip" );
     71 	AddChild( helpWidget );
     72 
     73 	btnBack = new (TAG_SWF) idMenuWidget_Button();
     74 	btnBack->Initialize( data );
     75 	idStr controls( idLocalization::GetString( "#str_04158" ) );
     76 	controls.ToUpper();
     77 	btnBack->SetLabel( controls );
     78 	btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" );
     79 	btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK );
     80 	AddChild( btnBack );
     81 
     82 	idMenuWidget_ControlButton * control;
     83 #ifndef ID_PC
     84 	control = new (TAG_SWF) idMenuWidget_ControlButton();
     85 	control->SetOptionType( OPTION_BUTTON_TEXT );
     86 	control->SetLabel( "#str_swf_gamepad_config" );	// Gamepad Configuration
     87 	control->SetDescription( "#str_swf_config_desc" );
     88 	control->RegisterEventObserver( helpWidget );
     89 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_CONFIG );	
     90 	options->AddChild( control );
     91 #endif
     92 
     93 	control = new (TAG_SWF) idMenuWidget_ControlButton();
     94 	control->SetOptionType( OPTION_SLIDER_TOGGLE );
     95 	control->SetLabel( "#str_swf_lefty_flip" );
     96 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_LEFTY );
     97 	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
     98 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_LEFTY );
     99 	control->RegisterEventObserver( helpWidget );
    100 	options->AddChild( control );
    101 
    102 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    103 	control->SetOptionType( OPTION_SLIDER_TOGGLE );
    104 	control->SetLabel( "#str_swf_invert_gamepad" );
    105 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_INVERT );
    106 	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
    107 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_INVERT );
    108 	control->RegisterEventObserver( helpWidget );
    109 	options->AddChild( control );
    110 
    111 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    112 	control->SetOptionType( OPTION_SLIDER_TOGGLE );
    113 	control->SetLabel( "#str_swf_vibration" );
    114 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VIBRATE );
    115 	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
    116 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_VIBRATE );
    117 	control->RegisterEventObserver( helpWidget );
    118 	options->AddChild( control );
    119 
    120 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    121 	control->SetOptionType( OPTION_SLIDER_BAR );
    122 	control->SetLabel( "#str_swf_hor_sens" );
    123 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_HOR_SENS );
    124 	control->SetupEvents( 2, options->GetChildren().Num() );
    125 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_HOR_SENS );
    126 	control->RegisterEventObserver( helpWidget );
    127 	options->AddChild( control );
    128 
    129 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    130 	control->SetOptionType( OPTION_SLIDER_BAR );
    131 	control->SetLabel( "#str_swf_vert_sens" );
    132 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VERT_SENS );
    133 	control->SetupEvents( 2, options->GetChildren().Num() );
    134 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_VERT_SENS );
    135 	control->RegisterEventObserver( helpWidget );
    136 	options->AddChild( control );
    137 
    138 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    139 	control->SetOptionType( OPTION_SLIDER_TOGGLE );
    140 	control->SetLabel( "#str_swf_joy_gammaLook" );
    141 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_ACCELERATION );
    142 	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
    143 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_ACCELERATION );
    144 	control->RegisterEventObserver( helpWidget );
    145 	options->AddChild( control );
    146 
    147 	control = new (TAG_SWF) idMenuWidget_ControlButton();
    148 	control->SetOptionType( OPTION_SLIDER_TOGGLE );
    149 	control->SetLabel( "#str_swf_joy_mergedThreshold" );
    150 	control->SetDataSource( &gamepadData, idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_THRESHOLD );
    151 	control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
    152 	control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, GAMEPAD_CMD_THRESHOLD );
    153 	control->RegisterEventObserver( helpWidget );
    154 	options->AddChild( control );
    155 
    156 	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) );
    157 	options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) );
    158 	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
    159 	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
    160 	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
    161 	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
    162 	options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
    163 	options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
    164 }
    165 
    166 /*
    167 ========================
    168 idMenuScreen_Shell_Gamepad::Update
    169 ========================
    170 */
    171 void idMenuScreen_Shell_Gamepad::Update() {
    172 
    173 	if ( menuData != NULL ) {
    174 		idMenuWidget_CommandBar * cmdBar = menuData->GetCmdBar();
    175 		if ( cmdBar != NULL ) {
    176 			cmdBar->ClearAllButtons();
    177 			idMenuWidget_CommandBar::buttonInfo_t * buttonInfo;			
    178 			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
    179 			if ( menuData->GetPlatform() != 2 ) {
    180 				buttonInfo->label = "#str_00395";
    181 			}
    182 			buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
    183 
    184 			buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
    185 			if ( menuData->GetPlatform() != 2 ) {
    186 				buttonInfo->label = "#str_SWF_SELECT";
    187 			}
    188 			buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
    189 		}		
    190 	}
    191 
    192 	idSWFScriptObject & root = GetSWFObject()->GetRootObject();
    193 	if ( BindSprite( root ) ) {
    194 		idSWFTextInstance * heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
    195 		if ( heading != NULL ) {
    196 			heading->SetText( "#str_swf_gamepad_heading" );	// CONTROLS
    197 			heading->SetStrokeInfo( true, 0.75f, 1.75f );
    198 		}
    199 
    200 		idSWFSpriteInstance * gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
    201 		if ( gradient != NULL && heading != NULL ) {
    202 			gradient->SetXPos( heading->GetTextLength() );
    203 		}
    204 	}
    205 
    206 	if ( btnBack != NULL ) {
    207 		btnBack->BindSprite( root );
    208 	}
    209 
    210 	idMenuScreen::Update();
    211 }
    212 
    213 /*
    214 ========================
    215 idMenuScreen_Shell_Gamepad::ShowScreen
    216 ========================
    217 */
    218 void idMenuScreen_Shell_Gamepad::ShowScreen( const mainMenuTransition_t transitionType ) {
    219 	gamepadData.LoadData();
    220 	idMenuScreen::ShowScreen( transitionType );
    221 }
    222 
    223 /*
    224 ========================
    225 idMenuScreen_Shell_Gamepad::HideScreen
    226 ========================
    227 */
    228 void idMenuScreen_Shell_Gamepad::HideScreen( const mainMenuTransition_t transitionType ) {
    229 
    230 	if ( gamepadData.IsDataChanged() ) {
    231 		gamepadData.CommitData();
    232 	}
    233 
    234 	if ( menuData != NULL ) {
    235 		idMenuHandler_Shell * handler = dynamic_cast< idMenuHandler_Shell * >( menuData );
    236 		if ( handler != NULL ) {
    237 			handler->SetupPCOptions();
    238 		}
    239 	}
    240 
    241 	idMenuScreen::HideScreen( transitionType );
    242 }
    243 
    244 /*
    245 ========================
    246 idMenuScreen_Shell_Gamepad::HandleAction
    247 ========================
    248 */
    249 bool idMenuScreen_Shell_Gamepad::HandleAction( idWidgetAction & action, const idWidgetEvent & event, idMenuWidget * widget, bool forceHandled ) {
    250 
    251 	if ( menuData == NULL ) {
    252 		return true;
    253 	}
    254 
    255 	if ( menuData->ActiveScreen() != SHELL_AREA_GAMEPAD ) {
    256 		return false;
    257 	}
    258 
    259 	widgetAction_t actionType = action.GetType();
    260 	const idSWFParmList & parms = action.GetParms();
    261 
    262 	switch ( actionType ) {
    263 		case WIDGET_ACTION_GO_BACK: {
    264 			menuData->SetNextScreen( SHELL_AREA_CONTROLS, MENU_TRANSITION_SIMPLE );
    265 			return true;
    266 		}
    267 		case WIDGET_ACTION_COMMAND: {
    268 
    269 			if ( options == NULL ) {
    270 				return true;
    271 			}
    272 
    273 			int selectionIndex = options->GetFocusIndex();
    274 			if ( parms.Num() > 0 ) {
    275 				selectionIndex = parms[0].ToInteger();
    276 			}
    277 
    278 			if ( selectionIndex != options->GetFocusIndex() ) {
    279 				options->SetViewIndex( options->GetViewOffset() + selectionIndex );
    280 				options->SetFocusIndex( selectionIndex );
    281 			}
    282 
    283 			switch ( parms[0].ToInteger() ) {
    284 #ifndef ID_PC
    285 				case GAMEPAD_CMD_CONFIG: {
    286 					menuData->SetNextScreen( SHELL_AREA_CONTROLLER_LAYOUT, MENU_TRANSITION_SIMPLE );
    287 					break;
    288 				}
    289 #endif
    290 				case GAMEPAD_CMD_INVERT: {
    291 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_INVERT, 1 );
    292 					options->Update();
    293 					break;
    294 				}
    295 				case GAMEPAD_CMD_LEFTY: {
    296 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_LEFTY, 1 );
    297 					options->Update();
    298 					break;
    299 				}
    300 				case GAMEPAD_CMD_VIBRATE: {
    301 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VIBRATE, 1 );
    302 					options->Update();
    303 					break;
    304 				}
    305 				case GAMEPAD_CMD_HOR_SENS: {
    306 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_HOR_SENS, 1 );
    307 					options->Update();
    308 					break;
    309 				}
    310 				case GAMEPAD_CMD_VERT_SENS: {
    311 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_VERT_SENS, 1 );
    312 					options->Update();
    313 					break;
    314 				}
    315 				case GAMEPAD_CMD_ACCELERATION: {
    316 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_ACCELERATION, 1 );
    317 					options->Update();
    318 					break;
    319 				}
    320 				case GAMEPAD_CMD_THRESHOLD: {
    321 					gamepadData.AdjustField( idMenuDataSource_GamepadSettings::GAMEPAD_FIELD_THRESHOLD, 1 );
    322 					options->Update();
    323 					break;
    324 				}
    325 			}
    326 
    327 			return true;
    328 		}
    329 		case WIDGET_ACTION_START_REPEATER: {
    330 
    331 			if ( options == NULL ) {
    332 				return true;
    333 			}
    334 
    335 			if ( parms.Num() == 4 ) {
    336 				int selectionIndex = parms[3].ToInteger();
    337 				if ( selectionIndex != options->GetFocusIndex() ) {
    338 					options->SetViewIndex( options->GetViewOffset() + selectionIndex );
    339 					options->SetFocusIndex( selectionIndex );
    340 				}
    341 			}
    342 			break;
    343 		}
    344 	}
    345 
    346 	return idMenuWidget::HandleAction( action, event, widget, forceHandled );
    347 }
    348 
    349 /////////////////////////////////
    350 // SCREEN SETTINGS
    351 /////////////////////////////////
    352 
    353 extern idCVar in_invertLook;
    354 extern idCVar in_joystickRumble;
    355 extern idCVar joy_pitchSpeed;
    356 extern idCVar joy_yawSpeed;
    357 extern idCVar joy_gammaLook;
    358 extern idCVar joy_mergedThreshold;
    359 
    360 /*
    361 ========================
    362 idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::idMenuDataSource_AudioSettings
    363 ========================
    364 */
    365 idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::idMenuDataSource_GamepadSettings() {
    366 	fields.SetNum( MAX_GAMEPAD_FIELDS );
    367 	originalFields.SetNum( MAX_GAMEPAD_FIELDS );
    368 }
    369 
    370 /*
    371 ========================
    372 idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::LoadData
    373 ========================
    374 */
    375 void idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::LoadData() {	
    376 	idPlayerProfile * profile = session->GetProfileFromMasterLocalUser();
    377 
    378 	fields[ GAMEPAD_FIELD_INVERT ].SetBool( in_invertLook.GetBool() );
    379 	fields[ GAMEPAD_FIELD_LEFTY ].SetBool( profile ? profile->GetLeftyFlip() : false );
    380 	fields[ GAMEPAD_FIELD_VIBRATE ].SetBool( in_joystickRumble.GetBool() );
    381 	fields[ GAMEPAD_FIELD_HOR_SENS ].SetFloat( 100.0f * ( ( joy_yawSpeed.GetFloat() - 100.0f ) / 300.0f ) );	
    382 	fields[ GAMEPAD_FIELD_VERT_SENS ].SetFloat( 100.0f * ( ( joy_pitchSpeed.GetFloat() - 60.0f ) / 200.0f ) );
    383 	fields[ GAMEPAD_FIELD_ACCELERATION ].SetBool( joy_gammaLook.GetBool() );
    384 	fields[ GAMEPAD_FIELD_THRESHOLD ].SetBool( joy_mergedThreshold.GetBool() );
    385 
    386 	originalFields = fields;
    387 }
    388 
    389 /*
    390 ========================
    391 idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::CommitData
    392 ========================
    393 */
    394 void idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::CommitData() {
    395 
    396 	in_invertLook.SetBool( fields[ GAMEPAD_FIELD_INVERT ].ToBool() );
    397 	in_joystickRumble.SetBool( fields[ GAMEPAD_FIELD_VIBRATE ].ToBool() );
    398 	joy_yawSpeed.SetFloat( ( ( fields[ GAMEPAD_FIELD_HOR_SENS ].ToFloat() / 100.0f ) * 300.0f ) + 100.0f );
    399 	joy_pitchSpeed.SetFloat( ( ( fields[ GAMEPAD_FIELD_VERT_SENS ].ToFloat() / 100.0f ) * 200.0f ) + 60.0f );
    400 	joy_gammaLook.SetBool( fields[ GAMEPAD_FIELD_ACCELERATION ].ToBool() );
    401 	joy_mergedThreshold.SetBool( fields[ GAMEPAD_FIELD_THRESHOLD ].ToBool() );
    402 
    403 	idPlayerProfile * profile = session->GetProfileFromMasterLocalUser();
    404 	if ( profile != NULL ) {
    405 		profile->SetLeftyFlip( fields[ GAMEPAD_FIELD_LEFTY ].ToBool() );
    406 	}
    407 	cvarSystem->SetModifiedFlags( CVAR_ARCHIVE );
    408 
    409 	// make the committed fields into the backup fields
    410 	originalFields = fields;
    411 }
    412 
    413 /*
    414 ========================
    415 idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::AdjustField
    416 ========================
    417 */
    418 void idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::AdjustField( const int fieldIndex, const int adjustAmount ) {
    419 
    420 	if ( fieldIndex == GAMEPAD_FIELD_INVERT || fieldIndex == GAMEPAD_FIELD_LEFTY || fieldIndex == GAMEPAD_FIELD_VIBRATE || fieldIndex == GAMEPAD_FIELD_ACCELERATION || fieldIndex == GAMEPAD_FIELD_THRESHOLD ) {
    421 		fields[ fieldIndex ].SetBool( !fields[ fieldIndex ].ToBool() );
    422 	} else {
    423 		float newValue = idMath::ClampFloat( 0.0f, 100.0f, fields[ fieldIndex ].ToFloat() + adjustAmount );
    424 		fields[ fieldIndex ].SetFloat( newValue );
    425 	}
    426 }
    427 
    428 /*
    429 ========================
    430 idMenuScreen_Shell_Gamepad::idMenuDataSource_AudioSettings::IsDataChanged
    431 ========================
    432 */
    433 bool idMenuScreen_Shell_Gamepad::idMenuDataSource_GamepadSettings::IsDataChanged() const {
    434 
    435 	if ( fields[ GAMEPAD_FIELD_INVERT ].ToBool() != originalFields[ GAMEPAD_FIELD_INVERT ].ToBool() ) {
    436 		return true;
    437 	}
    438 
    439 	if ( fields[ GAMEPAD_FIELD_LEFTY ].ToBool() != originalFields[ GAMEPAD_FIELD_LEFTY ].ToBool() ) {
    440 		return true;
    441 	}
    442 
    443 	if ( fields[ GAMEPAD_FIELD_VIBRATE ].ToBool() != originalFields[ GAMEPAD_FIELD_VIBRATE ].ToBool() ) {
    444 		return true;
    445 	}
    446 
    447 	if ( fields[ GAMEPAD_FIELD_HOR_SENS ].ToFloat() != originalFields[ GAMEPAD_FIELD_HOR_SENS ].ToFloat() ) {
    448 		return true;
    449 	}
    450 
    451 	if ( fields[ GAMEPAD_FIELD_VERT_SENS ].ToFloat() != originalFields[ GAMEPAD_FIELD_VERT_SENS ].ToFloat() ) {
    452 		return true;
    453 	}
    454 	
    455 	if ( fields[ GAMEPAD_FIELD_ACCELERATION ].ToBool() != originalFields[ GAMEPAD_FIELD_ACCELERATION ].ToBool() ) {
    456 		return true;
    457 	}
    458 
    459 	if ( fields[ GAMEPAD_FIELD_THRESHOLD ].ToBool() != originalFields[ GAMEPAD_FIELD_THRESHOLD ].ToBool() ) {
    460 		return true;
    461 	}
    462 
    463 	return false;
    464 }