Make ScreenTitleMenu a ScreenSelect.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include "GameManager.h"
|
||||
#include "InputMapper.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "SDL_utils.h"
|
||||
#include "RageSounds.h"
|
||||
#include "CodeDetector.h"
|
||||
#include "RageTextureManager.h"
|
||||
@@ -51,14 +50,16 @@
|
||||
#define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenComments")
|
||||
#define SECONDS_BEFORE_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeAttract")
|
||||
#define HELP_TEXT( coin_mode ) THEME->GetMetric("ScreenTitleMenu","HelpText"+Capitalize(CoinModeToString(coin_mode)))
|
||||
#define NEXT_SCREEN THEME->GetMetric("ScreenTitleMenu","NextScreen")
|
||||
// #define NEXT_SCREEN THEME->GetMetric("ScreenTitleMenu","NextScreen")
|
||||
#define MENU_ITEM_CREATE THEME->GetMetric("ScreenTitleMenu","MenuCommandOnCreate")
|
||||
#define MENU_ITEM_SELECT_DELAY THEME->GetMetricF("ScreenTitleMenu","MenuCommandSelectDelay")
|
||||
|
||||
#define NAME( choice ) THEME->GetMetric (m_sName,ssprintf("Name%d",choice+1))
|
||||
|
||||
const ScreenMessage SM_PlayComment = ScreenMessage(SM_User+1);
|
||||
const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13);
|
||||
|
||||
ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
||||
ScreenTitleMenu::ScreenTitleMenu() : ScreenSelect("ScreenTitleMenu")
|
||||
{
|
||||
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
|
||||
|
||||
@@ -73,10 +74,6 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
||||
this->AddChild( &m_JointPremium );
|
||||
}
|
||||
|
||||
|
||||
m_Background.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu background") );
|
||||
this->AddChild( &m_Background );
|
||||
|
||||
m_sprLogo.Load( THEME->GetPathToG(ssprintf("ScreenLogo %s",GAMESTATE->GetCurrentGameDef()->m_szName)) );
|
||||
m_sprLogo.Command( PREFSMAN->m_iCoinMode==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND );
|
||||
this->AddChild( &m_sprLogo );
|
||||
@@ -112,12 +109,11 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
||||
switch( PREFSMAN->m_iCoinMode )
|
||||
{
|
||||
case COIN_HOME:
|
||||
int i;
|
||||
for( i=0; i<NUM_CHOICES; i++ )
|
||||
for( unsigned i=0; i<m_aModeChoices.size(); i++ )
|
||||
{
|
||||
m_textChoice[i].LoadFromFont( THEME->GetPathToF("ScreenTitleMenu choices") );
|
||||
m_textChoice[i].SetHorizAlign( (enum Actor::HorizAlign)MENU_TEXT_ALIGN );
|
||||
m_textChoice[i].SetText( ChoiceToString((Choice)i) );
|
||||
m_textChoice[i].SetText( NAME(i) );
|
||||
m_textChoice[i].SetXY( CHOICES_X, CHOICES_START_Y + i*CHOICES_SPACING_Y );
|
||||
m_textChoice[i].SetShadowLength( CHOICES_SHADOW_LENGTH );
|
||||
m_textChoice[i].EnableShadow( true );
|
||||
@@ -132,29 +128,24 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
||||
}
|
||||
|
||||
|
||||
m_In.Load( THEME->GetPathToB("ScreenTitleMenu in") );
|
||||
m_In.StartTransitioning();
|
||||
this->AddChild( &m_In );
|
||||
// m_AttractOut.Load( THEME->GetPathToB("ScreenTitleMenu out") );
|
||||
// this->AddChild( &m_AttractOut );
|
||||
|
||||
m_Out.Load( THEME->GetPathToB("ScreenTitleMenu out") );
|
||||
this->AddChild( &m_Out );
|
||||
|
||||
m_BeginOut.Load( THEME->GetPathToB("ScreenTitleMenu begin out") );
|
||||
this->AddChild( &m_BeginOut );
|
||||
// m_BeginOut.Load( THEME->GetPathToB("ScreenTitleMenu begin out") );
|
||||
// this->AddChild( &m_BeginOut );
|
||||
|
||||
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu game name") );
|
||||
|
||||
|
||||
m_soundAttract.Load( ANNOUNCER->GetPathTo("title menu attract") );
|
||||
m_soundChange.Load( THEME->GetPathToS("ScreenTitleMenu change") );
|
||||
m_soundSelect.Load( THEME->GetPathToS("Common start") );
|
||||
m_soundInvalid.Load( THEME->GetPathToS("Common invalid") );
|
||||
|
||||
m_Choice = CHOICE_GAME_START;
|
||||
m_Choice = 0;
|
||||
|
||||
for( int i=0; i<NUM_CHOICES; i++ )
|
||||
if (i != m_Choice)
|
||||
for( unsigned i=0; i<m_aModeChoices.size(); i++ )
|
||||
if( i != m_Choice )
|
||||
{
|
||||
m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED );
|
||||
m_textChoice[i].Command( MENU_ITEM_CREATE );
|
||||
@@ -166,9 +157,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
|
||||
|
||||
this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS);
|
||||
|
||||
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
|
||||
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
|
||||
this->MoveToTail( &m_BeginOut ); // put it in the back so it covers up the stuff we just added
|
||||
// this->MoveToTail( &m_AttractOut ); // put it in the back so it covers up the stuff we just added
|
||||
}
|
||||
|
||||
ScreenTitleMenu::~ScreenTitleMenu()
|
||||
@@ -176,18 +165,22 @@ ScreenTitleMenu::~ScreenTitleMenu()
|
||||
LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" );
|
||||
}
|
||||
|
||||
void ScreenTitleMenu::UpdateSelectableChoices()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ScreenTitleMenu::MoveCursor( bool up )
|
||||
{
|
||||
if( PREFSMAN->m_iCoinMode != COIN_HOME )
|
||||
return;
|
||||
if( m_BeginOut.IsTransitioning() )
|
||||
return;
|
||||
// if( m_BeginOut.IsTransitioning() )
|
||||
// return;
|
||||
|
||||
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
|
||||
LoseFocus( m_Choice );
|
||||
m_Choice = Choice( m_Choice + (up? -1:+1) );
|
||||
wrap( (int&)m_Choice, (int)NUM_CHOICES );
|
||||
m_Choice += (up? -1:+1);
|
||||
wrap( (int&)m_Choice, m_aModeChoices.size() );
|
||||
m_soundChange.Play();
|
||||
GainFocus( m_Choice );
|
||||
}
|
||||
@@ -200,16 +193,17 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
||||
return;
|
||||
|
||||
/* If the CoinMode was changed, we need to reload this screen
|
||||
* so that the right choices will show */
|
||||
* so that the right m_aModeChoices will show */
|
||||
if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
||||
{
|
||||
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !MenuI.IsValid() )
|
||||
return;
|
||||
|
||||
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
||||
if( m_Menu.m_In.IsTransitioning() || m_Menu.m_Back.IsTransitioning() ) /* not m_Menu.m_Out */
|
||||
return;
|
||||
|
||||
switch( MenuI.button )
|
||||
@@ -221,45 +215,24 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
||||
MoveCursor( false );
|
||||
break;
|
||||
case MENU_BUTTON_BACK:
|
||||
if( m_BeginOut.IsTransitioning() )
|
||||
if( m_Menu.m_Out.IsTransitioning() )
|
||||
break;
|
||||
m_Out.StartTransitioning( SM_GoToAttractLoop );
|
||||
m_Menu.Back( SM_GoToAttractLoop );
|
||||
break;
|
||||
case MENU_BUTTON_START:
|
||||
/* break if the choice is invalid */
|
||||
if( m_Choice == CHOICE_JUKEBOX ||
|
||||
m_Choice == CHOICE_EDIT ||
|
||||
m_Choice == CHOICE_EDIT_COURSES )
|
||||
/* return if the choice is invalid */
|
||||
const ModeChoice &mc = m_aModeChoices[m_Choice];
|
||||
if( mc.m_bInvalid )
|
||||
{
|
||||
if( SONGMAN->GetNumSongs() == 0 )
|
||||
{
|
||||
m_soundInvalid.Play();
|
||||
SCREENMAN->SystemMessage( "No songs are installed" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( m_Choice == CHOICE_EDIT_COURSES )
|
||||
{
|
||||
vector<Course*> vCourses;
|
||||
SONGMAN->GetAllCourses( vCourses, false );
|
||||
|
||||
if( vCourses.size() == 0 )
|
||||
{
|
||||
m_soundInvalid.Play();
|
||||
SCREENMAN->SystemMessage( "No courses are installed" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( m_Choice == CHOICE_EXIT )
|
||||
{
|
||||
LOG->Trace("CHOICE_EXIT: shutting down");
|
||||
ExitGame();
|
||||
m_soundInvalid.Play();
|
||||
if( mc.m_sInvalidReason != "" )
|
||||
SCREENMAN->SystemMessage( mc.m_sInvalidReason );
|
||||
return;
|
||||
}
|
||||
|
||||
if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
||||
if( !m_BeginOut.IsTransitioning() )
|
||||
m_BeginOut.StartTransitioning( SM_GoToNextScreen );
|
||||
if( !m_Menu.m_Out.IsTransitioning() )
|
||||
m_Menu.StartTransitioning( SM_GoToNextScreen );
|
||||
}
|
||||
|
||||
// detect codes
|
||||
@@ -318,50 +291,23 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
|
||||
switch( SM )
|
||||
{
|
||||
case SM_PlayComment:
|
||||
m_soundAttract.PlayRandom();
|
||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu attract") );
|
||||
this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS );
|
||||
break;
|
||||
case SM_GoToNextScreen:
|
||||
switch( m_Choice )
|
||||
/* XXX: Bad hack: we only want to set default options if we're actually
|
||||
* going into the game. We don't want to set it if we're going into the
|
||||
* editor menu, since that never resets options (so it'll maintain changes
|
||||
* when entering and exiting the editor), and the editor probably shouldn't
|
||||
* use default options. */
|
||||
if( m_Choice == 0 )
|
||||
{
|
||||
case CHOICE_GAME_START:
|
||||
{
|
||||
// apply default options
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
|
||||
SCREENMAN->SetNewScreen( NEXT_SCREEN );
|
||||
}
|
||||
break;
|
||||
case CHOICE_SELECT_GAME:
|
||||
SCREENMAN->SetNewScreen( "ScreenSelectGame" );
|
||||
break;
|
||||
case CHOICE_OPTIONS:
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||
break;
|
||||
case CHOICE_JUKEBOX:
|
||||
SCREENMAN->SetNewScreen( "ScreenJukeboxMenu" );
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
// case CHOICE_NETWORKPLAY:
|
||||
// NETWORKMAN->Connect();
|
||||
// break;
|
||||
case CHOICE_SANDBOX:
|
||||
SCREENMAN->SetNewScreen( "ScreenTest" );
|
||||
break;
|
||||
#endif
|
||||
case CHOICE_EDIT:
|
||||
SCREENMAN->SetNewScreen( "ScreenEditMenu" );
|
||||
break;
|
||||
case CHOICE_EDIT_COURSES:
|
||||
SCREENMAN->SetNewScreen( "ScreenEditCoursesMenu" );
|
||||
break;
|
||||
case CHOICE_EXIT:
|
||||
default:
|
||||
RAGE_ASSERT_M(0, "CHOICE_EXIT reached?"); // should never get here
|
||||
break;
|
||||
// apply default options
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||
}
|
||||
m_aModeChoices[m_Choice].ApplyToAllPlayers();
|
||||
break;
|
||||
case SM_GoToAttractLoop:
|
||||
SCREENMAN->SetNewScreen( "ScreenCompany" );
|
||||
|
||||
Reference in New Issue
Block a user