2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenPlayerOptions.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "RageLog.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2004-07-08 00:10:34 +00:00
|
|
|
#include "GameSoundManager.h"
|
2003-04-21 22:36:45 +00:00
|
|
|
#include "ScreenSongOptions.h"
|
2003-09-29 09:08:02 +00:00
|
|
|
#include "PrefsManager.h"
|
2004-02-23 07:44:57 +00:00
|
|
|
#include "CodeDetector.h"
|
2004-09-21 06:07:12 +00:00
|
|
|
#include "ScreenDimensions.h"
|
2004-12-04 11:05:38 +00:00
|
|
|
#include "Style.h"
|
2004-12-20 06:25:59 +00:00
|
|
|
#include "PlayerState.h"
|
2003-09-29 09:08:02 +00:00
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-04-18 05:15:22 +00:00
|
|
|
#define PREV_SCREEN THEME->GetMetric ("ScreenPlayerOptions","PrevScreen")
|
|
|
|
|
#define NEXT_SCREEN THEME->GetMetric ("ScreenPlayerOptions","NextScreen")
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-11-26 17:28:47 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenPlayerOptions );
|
2003-09-27 22:30:51 +00:00
|
|
|
ScreenPlayerOptions::ScreenPlayerOptions( CString sClassName ) :
|
2003-09-29 09:08:02 +00:00
|
|
|
ScreenOptionsMaster( sClassName )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenPlayerOptions::ScreenPlayerOptions()" );
|
2005-02-23 06:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::Init()
|
|
|
|
|
{
|
|
|
|
|
ScreenOptionsMaster::Init();
|
2003-09-30 05:25:22 +00:00
|
|
|
|
|
|
|
|
m_bAskOptionsMessage =
|
|
|
|
|
!GAMESTATE->m_bEditing && PREFSMAN->m_ShowSongOptions == PrefsManager::ASK;
|
|
|
|
|
|
2003-06-16 03:44:15 +00:00
|
|
|
/* If we're going to "press start for more options" or skipping options
|
|
|
|
|
* entirely, we need a different fade out. XXX: this is a hack */
|
2003-09-30 05:25:22 +00:00
|
|
|
if( PREFSMAN->m_ShowSongOptions == PrefsManager::NO || GAMESTATE->m_bEditing )
|
2005-02-06 03:32:53 +00:00
|
|
|
{
|
|
|
|
|
m_Out.Load( THEME->GetPathB("ScreenPlayerOptions","direct out") ); /* direct to stage */
|
|
|
|
|
}
|
2003-09-30 05:25:22 +00:00
|
|
|
else if( m_bAskOptionsMessage )
|
|
|
|
|
{
|
2005-02-06 03:32:53 +00:00
|
|
|
m_Out.Load( THEME->GetPathB("ScreenPlayerOptions","option out") ); /* optional song options */
|
2003-09-05 07:34:13 +00:00
|
|
|
|
2005-02-06 03:32:53 +00:00
|
|
|
m_sprOptionsMessage.Load( THEME->GetPathG("ScreenPlayerOptions","options") );
|
2003-09-30 05:25:22 +00:00
|
|
|
m_sprOptionsMessage.StopAnimating();
|
2004-11-05 06:35:10 +00:00
|
|
|
m_sprOptionsMessage.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y );
|
2003-09-30 05:25:22 +00:00
|
|
|
m_sprOptionsMessage.SetZoom( 1 );
|
|
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
//this->AddChild( &m_sprOptionsMessage ); // we have to draw this manually over the top of transitions
|
|
|
|
|
}
|
2003-06-16 03:44:15 +00:00
|
|
|
|
|
|
|
|
m_bAcceptedChoices = false;
|
2003-09-05 07:34:13 +00:00
|
|
|
m_bGoToOptions = ( PREFSMAN->m_ShowSongOptions == PrefsManager::YES );
|
2003-06-16 03:44:15 +00:00
|
|
|
|
2005-02-07 23:31:55 +00:00
|
|
|
CString sPath = THEME->GetPathS( m_sName,"cancel all", true );
|
|
|
|
|
if( sPath != "" )
|
|
|
|
|
m_CancelAll.Load( sPath, true );
|
|
|
|
|
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("player options intro") );
|
2004-03-08 07:49:01 +00:00
|
|
|
|
2005-03-13 00:59:03 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2004-03-13 18:15:50 +00:00
|
|
|
{
|
2005-03-13 00:59:03 +00:00
|
|
|
m_sprCancelAll[p].LoadAndSetName( "ScreenPlayerOptions", ssprintf("CancelAllP%d",p+1) );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_sprCancelAll[p] );
|
|
|
|
|
this->AddChild( m_sprCancelAll[p] );
|
2004-03-13 18:15:50 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-13 00:59:03 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
UpdateDisqualified( p );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-05 11:59:39 +00:00
|
|
|
void ScreenPlayerOptions::GoToPrevScreen()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-02-19 05:46:09 +00:00
|
|
|
if( GAMESTATE->m_bEditing )
|
2004-12-09 09:41:06 +00:00
|
|
|
{
|
2003-02-19 05:46:09 +00:00
|
|
|
SCREENMAN->PopTopScreen();
|
2004-12-09 09:41:06 +00:00
|
|
|
}
|
2002-08-24 02:46:09 +00:00
|
|
|
else
|
2004-12-09 09:41:06 +00:00
|
|
|
{
|
|
|
|
|
SCREENMAN->DeletePreparedScreens();
|
2004-04-18 05:15:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( PREV_SCREEN );
|
2004-12-09 09:41:06 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-12-05 11:59:39 +00:00
|
|
|
void ScreenPlayerOptions::GoToNextScreen()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-02-19 05:46:09 +00:00
|
|
|
if( GAMESTATE->m_bEditing )
|
|
|
|
|
SCREENMAN->PopTopScreen();
|
2003-06-16 03:44:15 +00:00
|
|
|
else
|
2003-08-11 06:09:57 +00:00
|
|
|
{
|
|
|
|
|
GAMESTATE->AdjustFailType();
|
|
|
|
|
|
2003-09-05 07:34:13 +00:00
|
|
|
if( m_bGoToOptions )
|
2004-04-18 05:15:22 +00:00
|
|
|
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
2003-09-05 07:34:13 +00:00
|
|
|
else
|
|
|
|
|
SCREENMAN->SetNewScreen( ScreenSongOptions::GetNextScreen() );
|
2003-08-11 06:09:57 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-11 08:52:45 +00:00
|
|
|
void ScreenPlayerOptions::Update( float fDelta )
|
|
|
|
|
{
|
2003-09-29 09:08:02 +00:00
|
|
|
ScreenOptionsMaster::Update( fDelta );
|
2003-09-30 05:25:22 +00:00
|
|
|
if( m_bAskOptionsMessage )
|
|
|
|
|
m_sprOptionsMessage.Update( fDelta );
|
2003-03-11 08:52:45 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-03-11 08:52:45 +00:00
|
|
|
void ScreenPlayerOptions::DrawPrimitives()
|
|
|
|
|
{
|
2003-09-29 09:08:02 +00:00
|
|
|
ScreenOptionsMaster::DrawPrimitives();
|
2003-09-30 05:25:22 +00:00
|
|
|
if( m_bAskOptionsMessage )
|
|
|
|
|
m_sprOptionsMessage.Draw();
|
2003-03-11 08:52:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2003-09-30 05:25:22 +00:00
|
|
|
if( m_bAskOptionsMessage &&
|
2003-06-16 03:44:15 +00:00
|
|
|
type == IET_FIRST_PRESS &&
|
2004-05-01 23:19:33 +00:00
|
|
|
!m_In.IsTransitioning() &&
|
2003-06-16 03:44:15 +00:00
|
|
|
MenuI.IsValid() &&
|
2003-09-30 05:25:22 +00:00
|
|
|
MenuI.button == MENU_BUTTON_START )
|
2003-06-16 03:44:15 +00:00
|
|
|
{
|
|
|
|
|
if( m_bAcceptedChoices && !m_bGoToOptions )
|
|
|
|
|
{
|
|
|
|
|
m_bGoToOptions = true;
|
|
|
|
|
m_sprOptionsMessage.SetState( 1 );
|
2004-03-23 23:56:38 +00:00
|
|
|
SCREENMAN->PlayStartSound();
|
2003-06-16 03:44:15 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-09-05 07:34:13 +00:00
|
|
|
|
2004-12-04 11:05:38 +00:00
|
|
|
PlayerNumber pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber( GameI.controller );
|
|
|
|
|
if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_CANCEL_ALL_PLAYER_OPTIONS) )
|
2004-02-23 07:44:57 +00:00
|
|
|
{
|
2005-02-07 23:31:55 +00:00
|
|
|
if( m_CancelAll.IsLoaded() )
|
|
|
|
|
m_CancelAll.Play();
|
2004-03-13 17:38:26 +00:00
|
|
|
|
|
|
|
|
// apply the game default mods, but not the Profile saved mods
|
2004-12-20 06:25:59 +00:00
|
|
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init();
|
|
|
|
|
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
2004-03-13 17:38:26 +00:00
|
|
|
|
2005-01-17 22:42:57 +00:00
|
|
|
COMMAND( m_sprCancelAll[pn], "Show" );
|
2004-03-13 18:15:50 +00:00
|
|
|
|
2005-03-13 00:59:03 +00:00
|
|
|
for( unsigned r=0; r<m_Rows.size(); r++ )
|
|
|
|
|
this->ImportOptions( r, pn );
|
2004-02-23 07:44:57 +00:00
|
|
|
this->PositionUnderlines();
|
2005-03-13 00:59:03 +00:00
|
|
|
this->UpdateDisqualified( pn );
|
2004-02-23 07:44:57 +00:00
|
|
|
}
|
|
|
|
|
|
2003-09-29 09:08:02 +00:00
|
|
|
ScreenOptionsMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
|
2004-03-08 07:49:01 +00:00
|
|
|
|
|
|
|
|
// UGLY: Update m_Disqualified whenever Start is pressed
|
|
|
|
|
if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_START )
|
2005-03-13 01:03:22 +00:00
|
|
|
UpdateDisqualified( pn );
|
2003-03-11 08:52:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
2003-09-30 05:25:22 +00:00
|
|
|
if( m_bAskOptionsMessage )
|
2003-09-05 07:34:13 +00:00
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
|
|
|
|
case SM_BeginFadingOut: // when the user accepts the page of options
|
|
|
|
|
{
|
|
|
|
|
m_bAcceptedChoices = true;
|
|
|
|
|
|
2004-05-01 23:19:33 +00:00
|
|
|
float fShowSeconds = m_Out.GetLengthSeconds();
|
2003-09-05 07:34:13 +00:00
|
|
|
|
|
|
|
|
// show "hold START for options"
|
|
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade in
|
|
|
|
|
m_sprOptionsMessage.SetZoomY( 1 );
|
|
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
m_sprOptionsMessage.BeginTweening( fShowSeconds-0.3f ); // sleep
|
|
|
|
|
m_sprOptionsMessage.BeginTweening( 0.15f ); // fade out
|
|
|
|
|
m_sprOptionsMessage.SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
m_sprOptionsMessage.SetZoomY( 0 );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-29 09:08:02 +00:00
|
|
|
ScreenOptionsMaster::HandleScreenMessage( SM );
|
2003-09-19 01:11:32 +00:00
|
|
|
}
|
2004-03-08 07:49:01 +00:00
|
|
|
|
2005-03-13 00:59:03 +00:00
|
|
|
void ScreenPlayerOptions::UpdateDisqualified( PlayerNumber pn )
|
2004-03-08 07:49:01 +00:00
|
|
|
{
|
|
|
|
|
// save current player options
|
2005-03-13 00:59:03 +00:00
|
|
|
PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions;
|
2004-03-08 07:49:01 +00:00
|
|
|
|
|
|
|
|
// export the currently selection options, which will fill GAMESTATE->m_PlayerOptions
|
2005-02-24 01:17:39 +00:00
|
|
|
for( unsigned r=0; r<OptionRowHandlers.size(); r++ )
|
2005-03-13 00:59:03 +00:00
|
|
|
ScreenOptionsMaster::ExportOptions( r, pn );
|
2004-03-08 07:49:01 +00:00
|
|
|
|
2004-06-03 08:22:02 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2004-03-08 07:49:01 +00:00
|
|
|
{
|
2004-06-03 08:22:02 +00:00
|
|
|
bool bIsHandicap = GAMESTATE->IsDisqualified(p);
|
|
|
|
|
|
|
|
|
|
m_sprDisqualify[p]->SetHidden( !bIsHandicap );
|
2004-03-08 07:49:01 +00:00
|
|
|
|
2004-06-03 08:22:02 +00:00
|
|
|
// restore previous player options in case the user escapes back after this
|
2005-03-13 00:59:03 +00:00
|
|
|
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = po;
|
2004-03-08 07:49:01 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-06-08 05:22:33 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|