2012-11-26 18:58:24 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Doom 3 BFG Edition GPL Source Code
|
2012-11-28 15:47:07 +00:00
|
|
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
#pragma hdrstop
|
2012-12-22 15:18:19 +00:00
|
|
|
#include "precompiled.h"
|
2012-11-26 18:58:24 +00:00
|
|
|
#include "../Game_local.h"
|
|
|
|
|
|
|
|
const static int NUM_SYSTEM_OPTIONS_OPTIONS = 8;
|
|
|
|
|
|
|
|
extern idCVar r_multiSamples;
|
|
|
|
extern idCVar r_motionBlur;
|
|
|
|
extern idCVar r_swapInterval;
|
|
|
|
extern idCVar s_volume_dB;
|
|
|
|
extern idCVar r_lightScale;
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::Initialize( idMenuHandler* data )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( data != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuGUI = data->GetGUI();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
SetSpritePath( "menuSystemOptions" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
options = new( TAG_SWF ) idMenuWidget_DynamicList();
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetNumVisibleOptions( NUM_SYSTEM_OPTIONS_OPTIONS );
|
|
|
|
options->SetSpritePath( GetSpritePath(), "info", "options" );
|
|
|
|
options->SetWrappingAllowed( true );
|
|
|
|
options->SetControlList( true );
|
|
|
|
options->Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
btnBack = new( TAG_SWF ) idMenuWidget_Button();
|
2012-11-26 18:58:24 +00:00
|
|
|
btnBack->Initialize( data );
|
|
|
|
btnBack->SetLabel( "#str_swf_settings" );
|
|
|
|
btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" );
|
|
|
|
btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
AddChild( options );
|
|
|
|
AddChild( btnBack );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuWidget_ControlButton* control;
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "#str_02154" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "#str_swf_framerate" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FRAMERATE );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_FRAMERATE );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "#str_04126" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VSYNC );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VSYNC );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "#str_04128" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_ANTIALIASING );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_ANTIALIASING );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "#str_swf_motionblur" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_MOTIONBLUR );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB begin
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
|
|
|
control->SetOptionType( OPTION_SLIDER_TEXT );
|
|
|
|
control->SetLabel( "Soft Shadows" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SHADOWMAPPING );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_SHADOWMAPPING );
|
|
|
|
options->AddChild( control );
|
|
|
|
|
2014-05-15 21:46:53 +00:00
|
|
|
/*control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_BAR );
|
|
|
|
control->SetLabel( "#str_swf_lodbias" );
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_LODBIAS );
|
|
|
|
control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_LODBIAS );
|
2014-05-15 21:46:53 +00:00
|
|
|
options->AddChild( control );*/
|
|
|
|
// RB end
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_BAR );
|
|
|
|
control->SetLabel( "#str_02155" ); // Brightness
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_BRIGHTNESS );
|
|
|
|
control->SetupEvents( 2, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_BRIGHTNESS );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
control = new( TAG_SWF ) idMenuWidget_ControlButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
control->SetOptionType( OPTION_SLIDER_BAR );
|
|
|
|
control->SetLabel( "#str_02163" ); // Volume
|
|
|
|
control->SetDataSource( &systemData, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VOLUME );
|
|
|
|
control->SetupEvents( 2, options->GetChildren().Num() );
|
|
|
|
control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_COMMAND, idMenuDataSource_SystemSettings::SYSTEM_FIELD_VOLUME );
|
|
|
|
options->AddChild( control );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
|
|
|
|
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 ) );
|
|
|
|
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 ) );
|
|
|
|
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 ) );
|
|
|
|
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 ) );
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::Update
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
if( menuData != NULL )
|
|
|
|
{
|
|
|
|
idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
|
|
|
|
if( cmdBar != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
cmdBar->ClearAllButtons();
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData->GetPlatform() != 2 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo->label = "#str_00395";
|
|
|
|
}
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
|
|
|
|
if( heading != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
heading->SetText( "#str_00183" ); // FULLSCREEN
|
|
|
|
heading->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
|
|
|
|
if( gradient != NULL && heading != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
gradient->SetXPos( heading->GetTextLength() );
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( btnBack != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
btnBack->BindSprite( root );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::ShowScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::ShowScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
systemData.LoadData();
|
|
|
|
|
|
|
|
idMenuScreen::ShowScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::HideScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::HideScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( systemData.IsRestartRequired() )
|
|
|
|
{
|
|
|
|
class idSWFScriptFunction_Restart : public idSWFScriptFunction_RefCounted
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFScriptFunction_Restart( gameDialogMessages_t _msg, bool _restart )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
msg = _msg;
|
|
|
|
restart = _restart;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFScriptVar Call( idSWFScriptObject* thisObject, const idSWFParmList& parms )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
common->Dialog().ClearDialog( msg );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( restart )
|
|
|
|
{
|
2013-01-20 02:41:09 +00:00
|
|
|
// DG: Sys_ReLaunch() doesn't need any options anymore
|
|
|
|
// (the old way would have been unnecessarily painful on POSIX systems)
|
|
|
|
Sys_ReLaunch();
|
|
|
|
// DG end
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
return idSWFScriptVar();
|
|
|
|
}
|
|
|
|
private:
|
|
|
|
gameDialogMessages_t msg;
|
|
|
|
bool restart;
|
|
|
|
};
|
2012-11-28 15:47:07 +00:00
|
|
|
idStaticList<idSWFScriptFunction*, 4> callbacks;
|
2012-11-26 18:58:24 +00:00
|
|
|
idStaticList<idStrId, 4> optionText;
|
|
|
|
callbacks.Append( new idSWFScriptFunction_Restart( GDM_GAME_RESTART_REQUIRED, false ) );
|
|
|
|
callbacks.Append( new idSWFScriptFunction_Restart( GDM_GAME_RESTART_REQUIRED, true ) );
|
|
|
|
optionText.Append( idStrId( "#str_00100113" ) ); // Continue
|
|
|
|
optionText.Append( idStrId( "#str_02487" ) ); // Restart Now
|
|
|
|
common->Dialog().AddDynamicDialog( GDM_GAME_RESTART_REQUIRED, callbacks, optionText, true, idStr() );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( systemData.IsDataChanged() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
systemData.CommitData();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::HideScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::HandleAction h
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_Shell_SystemOptions::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData->ActiveScreen() != SHELL_AREA_SYSTEM_OPTIONS )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetAction_t actionType = action.GetType();
|
2012-11-28 15:47:07 +00:00
|
|
|
const idSWFParmList& parms = action.GetParms();
|
|
|
|
|
|
|
|
switch( actionType )
|
|
|
|
{
|
|
|
|
case WIDGET_ACTION_GO_BACK:
|
|
|
|
{
|
|
|
|
if( menuData != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->SetNextScreen( SHELL_AREA_SETTINGS, MENU_TRANSITION_SIMPLE );
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case WIDGET_ACTION_ADJUST_FIELD:
|
2012-11-28 15:47:07 +00:00
|
|
|
if( widget->GetDataSourceFieldIndex() == idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->SetNextScreen( SHELL_AREA_RESOLUTION, MENU_TRANSITION_SIMPLE );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_COMMAND:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( options == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int selectionIndex = options->GetFocusIndex();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( parms.Num() > 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
selectionIndex = parms[0].ToInteger();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( options && selectionIndex != options->GetFocusIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetViewIndex( options->GetViewOffset() + selectionIndex );
|
|
|
|
options->SetFocusIndex( selectionIndex );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
switch( parms[0].ToInteger() )
|
|
|
|
{
|
|
|
|
case idMenuDataSource_SystemSettings::SYSTEM_FIELD_FULLSCREEN:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->SetNextScreen( SHELL_AREA_RESOLUTION, MENU_TRANSITION_SIMPLE );
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
default:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
systemData.AdjustField( parms[0].ToInteger(), 1 );
|
|
|
|
options->Update();
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_START_REPEATER:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( options == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( parms.Num() == 4 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
int selectionIndex = parms[3].ToInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( selectionIndex != options->GetFocusIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetViewIndex( options->GetViewOffset() + selectionIndex );
|
|
|
|
options->SetFocusIndex( selectionIndex );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return idMenuWidget::HandleAction( action, event, widget, forceHandled );
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////
|
|
|
|
// SCREEN SETTINGS
|
|
|
|
/////////////////////////////////
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::idMenuDataSource_SystemSettings
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::idMenuDataSource_SystemSettings()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::LoadData()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
originalFramerate = com_engineHz.GetInteger();
|
|
|
|
originalAntialias = r_multiSamples.GetInteger();
|
|
|
|
originalMotionBlur = r_motionBlur.GetInteger();
|
|
|
|
originalVsync = r_swapInterval.GetInteger();
|
|
|
|
originalBrightness = r_lightScale.GetFloat();
|
|
|
|
originalVolume = s_volume_dB.GetFloat();
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB begin
|
|
|
|
originalShadowMapping = r_useShadowMapping.GetInteger();
|
|
|
|
// RB end
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
const int fullscreen = r_fullscreen.GetInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( fullscreen > 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
R_GetModeListForDisplay( fullscreen - 1, modeList );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
modeList.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsRestartRequired
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsRestartRequired() const
|
|
|
|
{
|
|
|
|
if( originalAntialias != r_multiSamples.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalFramerate != com_engineHz.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::CommitData
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::CommitData()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
cvarSystem->SetModifiedFlags( CVAR_ARCHIVE );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
AdjustOption
|
|
|
|
Given a current value in an array of possible values, returns the next n value
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
int AdjustOption( int currentValue, const int values[], int numValues, int adjustment )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
int index = 0;
|
2012-11-28 15:47:07 +00:00
|
|
|
for( int i = 0; i < numValues; i++ )
|
|
|
|
{
|
|
|
|
if( currentValue == values[i] )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
index = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
index += adjustment;
|
2012-11-28 15:47:07 +00:00
|
|
|
while( index < 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
index += numValues;
|
|
|
|
}
|
|
|
|
index %= numValues;
|
|
|
|
return values[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
LinearAdjust
|
|
|
|
Linearly converts a float from one scale to another
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
float LinearAdjust( float input, float currentMin, float currentMax, float desiredMin, float desiredMax )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return ( ( input - currentMin ) / ( currentMax - currentMin ) ) * ( desiredMax - desiredMin ) + desiredMin;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::AdjustField( const int fieldIndex, const int adjustAmount )
|
|
|
|
{
|
|
|
|
switch( fieldIndex )
|
|
|
|
{
|
|
|
|
case SYSTEM_FIELD_FRAMERATE:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
static const int numValues = 2;
|
|
|
|
static const int values[numValues] = { 60, 120 };
|
|
|
|
com_engineHz.SetInteger( AdjustOption( com_engineHz.GetInteger(), values, numValues, adjustAmount ) );
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_VSYNC:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
static const int numValues = 3;
|
|
|
|
static const int values[numValues] = { 0, 1, 2 };
|
|
|
|
r_swapInterval.SetInteger( AdjustOption( r_swapInterval.GetInteger(), values, numValues, adjustAmount ) );
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_ANTIALIASING:
|
|
|
|
{
|
2014-05-16 21:57:17 +00:00
|
|
|
// RB: disabled 16x MSAA
|
|
|
|
static const int numValues = 4;
|
|
|
|
static const int values[numValues] = { 0, 2, 4, 8 };
|
|
|
|
// RB end
|
2012-11-26 18:58:24 +00:00
|
|
|
r_multiSamples.SetInteger( AdjustOption( r_multiSamples.GetInteger(), values, numValues, adjustAmount ) );
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_MOTIONBLUR:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
static const int numValues = 5;
|
|
|
|
static const int values[numValues] = { 0, 2, 3, 4, 5 };
|
|
|
|
r_motionBlur.SetInteger( AdjustOption( r_motionBlur.GetInteger(), values, numValues, adjustAmount ) );
|
|
|
|
break;
|
|
|
|
}
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB begin
|
|
|
|
case SYSTEM_FIELD_SHADOWMAPPING:
|
|
|
|
{
|
2014-05-16 19:50:49 +00:00
|
|
|
static const int numValues = 2;
|
|
|
|
static const int values[numValues] = { 0, 1 };
|
2014-05-15 10:14:37 +00:00
|
|
|
r_useShadowMapping.SetInteger( AdjustOption( r_useShadowMapping.GetInteger(), values, numValues, adjustAmount ) );
|
|
|
|
break;
|
|
|
|
}
|
2014-05-15 21:46:53 +00:00
|
|
|
/*case SYSTEM_FIELD_LODBIAS:
|
2012-11-28 15:47:07 +00:00
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
const float percent = LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
|
2012-11-28 15:47:07 +00:00
|
|
|
const float adjusted = percent + ( float )adjustAmount * 5.0f;
|
2012-11-26 18:58:24 +00:00
|
|
|
const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
|
|
|
|
r_lodBias.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, -1.0f, 1.0f ) );
|
|
|
|
break;
|
2014-05-15 21:46:53 +00:00
|
|
|
}*/
|
|
|
|
// RB end
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_BRIGHTNESS:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
const float percent = LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f );
|
2012-11-28 15:47:07 +00:00
|
|
|
const float adjusted = percent + ( float )adjustAmount;
|
2012-11-26 18:58:24 +00:00
|
|
|
const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
|
|
|
|
r_lightScale.SetFloat( LinearAdjust( clamped, 0.0f, 100.0f, 2.0f, 4.0f ) );
|
|
|
|
break;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_VOLUME:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
const float percent = 100.0f * Square( 1.0f - ( s_volume_dB.GetFloat() / DB_SILENCE ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
const float adjusted = percent + ( float )adjustAmount;
|
2012-11-26 18:58:24 +00:00
|
|
|
const float clamped = idMath::ClampFloat( 0.0f, 100.0f, adjusted );
|
|
|
|
s_volume_dB.SetFloat( DB_SILENCE - ( idMath::Sqrt( clamped / 100.0f ) * DB_SILENCE ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cvarSystem->ClearModifiedFlags( CVAR_ARCHIVE );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::GetField
|
2012-11-26 18:58:24 +00:00
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
idSWFScriptVar idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::GetField( const int fieldIndex ) const
|
|
|
|
{
|
|
|
|
switch( fieldIndex )
|
|
|
|
{
|
|
|
|
case SYSTEM_FIELD_FULLSCREEN:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
const int fullscreen = r_fullscreen.GetInteger();
|
|
|
|
const int vidmode = r_vidMode.GetInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( fullscreen == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_disabled";
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( fullscreen < 0 || vidmode < 0 || vidmode >= modeList.Num() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "???";
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( modeList[vidmode].displayHz == 60 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return va( "%4i x %4i", modeList[vidmode].width, modeList[vidmode].height );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return va( "%4i x %4i @ %dhz", modeList[vidmode].width, modeList[vidmode].height, modeList[vidmode].displayHz );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case SYSTEM_FIELD_FRAMERATE:
|
|
|
|
return va( "%d FPS", com_engineHz.GetInteger() );
|
|
|
|
case SYSTEM_FIELD_VSYNC:
|
2012-11-28 15:47:07 +00:00
|
|
|
if( r_swapInterval.GetInteger() == 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_smart";
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( r_swapInterval.GetInteger() == 2 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_enabled";
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_disabled";
|
|
|
|
}
|
|
|
|
case SYSTEM_FIELD_ANTIALIASING:
|
2012-11-28 15:47:07 +00:00
|
|
|
if( r_multiSamples.GetInteger() == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_disabled";
|
|
|
|
}
|
|
|
|
return va( "%dx", r_multiSamples.GetInteger() );
|
|
|
|
case SYSTEM_FIELD_MOTIONBLUR:
|
2012-11-28 15:47:07 +00:00
|
|
|
if( r_motionBlur.GetInteger() == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return "#str_swf_disabled";
|
|
|
|
}
|
|
|
|
return va( "%dx", idMath::IPow( 2, r_motionBlur.GetInteger() ) );
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB begin
|
|
|
|
case SYSTEM_FIELD_SHADOWMAPPING:
|
|
|
|
if( r_useShadowMapping.GetInteger() == 1 )
|
|
|
|
{
|
2014-05-16 19:50:49 +00:00
|
|
|
return "#str_swf_enabled";
|
2014-05-15 10:14:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return "#str_swf_disabled";
|
|
|
|
}
|
2014-05-15 21:46:53 +00:00
|
|
|
//case SYSTEM_FIELD_LODBIAS:
|
|
|
|
// return LinearAdjust( r_lodBias.GetFloat(), -1.0f, 1.0f, 0.0f, 100.0f );
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB end
|
2012-11-26 18:58:24 +00:00
|
|
|
case SYSTEM_FIELD_BRIGHTNESS:
|
|
|
|
return LinearAdjust( r_lightScale.GetFloat(), 2.0f, 4.0f, 0.0f, 100.0f );
|
2012-11-28 15:47:07 +00:00
|
|
|
case SYSTEM_FIELD_VOLUME:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return 100.0f * Square( 1.0f - ( s_volume_dB.GetFloat() / DB_SILENCE ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataChanged
|
2012-11-26 18:58:24 +00:00
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_Shell_SystemOptions::idMenuDataSource_SystemSettings::IsDataChanged() const
|
|
|
|
{
|
|
|
|
if( originalFramerate != com_engineHz.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalAntialias != r_multiSamples.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalMotionBlur != r_motionBlur.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalVsync != r_swapInterval.GetInteger() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalBrightness != r_lightScale.GetFloat() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
if( originalVolume != s_volume_dB.GetFloat() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-05-15 10:14:37 +00:00
|
|
|
// RB begin
|
|
|
|
if( originalShadowMapping != r_useShadowMapping.GetInteger() )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// RB end
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|