Make ScreenTitleMenu a ScreenSelect.

This commit is contained in:
Glenn Maynard
2003-09-27 01:55:04 +00:00
parent 010c04ea15
commit 8d351ab429
3 changed files with 78 additions and 147 deletions
+22 -1
View File
@@ -35,6 +35,27 @@ CurrentModeY=0
CurrentModeZoom=1 CurrentModeZoom=1
[ScreenTitleMenu] [ScreenTitleMenu]
# Note that we don't use the "name" parameter to Choices here. Name1 is
# the displayed text, which might be translated or otherwise changed. The "name,foo"
# parameter to ModeChoices is an asset name, which is used in filenames.
NumChoices=8
Choice1=screen,ScreenCaution
Name1=GAME START
Choice2=screen,ScreenSelectGame
Name2=SELECT GAME
Choice3=screen,ScreenOptionsMenu
Name3=OPTIONS
Choice4=screen,ScreenEditMenu
Name4=EDIT/SYNC SONGS
Choice5=screen,ScreenEditCoursesMenu
Name5=EDIT COURSES
Choice6=screen,ScreenJukeboxMenu
Name6=JUKEBOX
Choice7=screen,ScreenExit
Name7=EXIT
Choice8=screen,ScreenTest
Name8=SANDBOX
TimerSeconds=-1 // none
LogoHomeOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3 LogoHomeOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
LogoOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3 LogoOnCommand=x,320;y,240;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3
VersionOnCommand=horizalign,right;x,620;y,20;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2 VersionOnCommand=horizalign,right;x,620;y,20;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2
@@ -54,11 +75,11 @@ MenuCommandOnCreate=diffusealpha,0;sleep,0.1;linear,0.5;diffusealpha,1;
MenuCommandSelectDelay=0.5 MenuCommandSelectDelay=0.5
SecondsBetweenComments=12 SecondsBetweenComments=12
SecondsBeforeAttract=30 SecondsBeforeAttract=30
HelpText=
HelpTextHome=Use &UP; &DOWN; to select, then press START HelpTextHome=Use &UP; &DOWN; to select, then press START
HelpTextPay=Press START to begin HelpTextPay=Press START to begin
HelpTextFree=Press START to begin HelpTextFree=Press START to begin
HelpTextEvent=Press START to begin HelpTextEvent=Press START to begin
NextScreen=ScreenCaution
[ScreenCaution] [ScreenCaution]
NextScreen=ScreenSelectStyle NextScreen=ScreenSelectStyle
+47 -101
View File
@@ -24,7 +24,6 @@
#include "GameManager.h" #include "GameManager.h"
#include "InputMapper.h" #include "InputMapper.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "SDL_utils.h"
#include "RageSounds.h" #include "RageSounds.h"
#include "CodeDetector.h" #include "CodeDetector.h"
#include "RageTextureManager.h" #include "RageTextureManager.h"
@@ -51,14 +50,16 @@
#define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenComments") #define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenComments")
#define SECONDS_BEFORE_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeAttract") #define SECONDS_BEFORE_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeAttract")
#define HELP_TEXT( coin_mode ) THEME->GetMetric("ScreenTitleMenu","HelpText"+Capitalize(CoinModeToString(coin_mode))) #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_CREATE THEME->GetMetric("ScreenTitleMenu","MenuCommandOnCreate")
#define MENU_ITEM_SELECT_DELAY THEME->GetMetricF("ScreenTitleMenu","MenuCommandSelectDelay") #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_PlayComment = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13); const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13);
ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu") ScreenTitleMenu::ScreenTitleMenu() : ScreenSelect("ScreenTitleMenu")
{ {
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" ); LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
@@ -73,10 +74,6 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
this->AddChild( &m_JointPremium ); 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.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 ); m_sprLogo.Command( PREFSMAN->m_iCoinMode==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND );
this->AddChild( &m_sprLogo ); this->AddChild( &m_sprLogo );
@@ -112,12 +109,11 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
switch( PREFSMAN->m_iCoinMode ) switch( PREFSMAN->m_iCoinMode )
{ {
case COIN_HOME: case COIN_HOME:
int i; for( unsigned i=0; i<m_aModeChoices.size(); i++ )
for( i=0; i<NUM_CHOICES; i++ )
{ {
m_textChoice[i].LoadFromFont( THEME->GetPathToF("ScreenTitleMenu choices") ); m_textChoice[i].LoadFromFont( THEME->GetPathToF("ScreenTitleMenu choices") );
m_textChoice[i].SetHorizAlign( (enum Actor::HorizAlign)MENU_TEXT_ALIGN ); 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].SetXY( CHOICES_X, CHOICES_START_Y + i*CHOICES_SPACING_Y );
m_textChoice[i].SetShadowLength( CHOICES_SHADOW_LENGTH ); m_textChoice[i].SetShadowLength( CHOICES_SHADOW_LENGTH );
m_textChoice[i].EnableShadow( true ); m_textChoice[i].EnableShadow( true );
@@ -132,29 +128,24 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
} }
m_In.Load( THEME->GetPathToB("ScreenTitleMenu in") ); // m_AttractOut.Load( THEME->GetPathToB("ScreenTitleMenu out") );
m_In.StartTransitioning(); // this->AddChild( &m_AttractOut );
this->AddChild( &m_In );
m_Out.Load( THEME->GetPathToB("ScreenTitleMenu out") ); // m_BeginOut.Load( THEME->GetPathToB("ScreenTitleMenu begin out") );
this->AddChild( &m_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") ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu game name") );
m_soundAttract.Load( ANNOUNCER->GetPathTo("title menu attract") );
m_soundChange.Load( THEME->GetPathToS("ScreenTitleMenu change") ); m_soundChange.Load( THEME->GetPathToS("ScreenTitleMenu change") );
m_soundSelect.Load( THEME->GetPathToS("Common start") ); m_soundSelect.Load( THEME->GetPathToS("Common start") );
m_soundInvalid.Load( THEME->GetPathToS("Common invalid") ); m_soundInvalid.Load( THEME->GetPathToS("Common invalid") );
m_Choice = CHOICE_GAME_START; m_Choice = 0;
for( int i=0; i<NUM_CHOICES; i++ ) for( unsigned i=0; i<m_aModeChoices.size(); i++ )
if (i != m_Choice) if( i != m_Choice )
{ {
m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED ); m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED );
m_textChoice[i].Command( MENU_ITEM_CREATE ); m_textChoice[i].Command( MENU_ITEM_CREATE );
@@ -166,9 +157,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS); 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_AttractOut ); // 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
} }
ScreenTitleMenu::~ScreenTitleMenu() ScreenTitleMenu::~ScreenTitleMenu()
@@ -176,18 +165,22 @@ ScreenTitleMenu::~ScreenTitleMenu()
LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" ); LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" );
} }
void ScreenTitleMenu::UpdateSelectableChoices()
{
}
void ScreenTitleMenu::MoveCursor( bool up ) void ScreenTitleMenu::MoveCursor( bool up )
{ {
if( PREFSMAN->m_iCoinMode != COIN_HOME ) if( PREFSMAN->m_iCoinMode != COIN_HOME )
return; return;
if( m_BeginOut.IsTransitioning() ) // if( m_BeginOut.IsTransitioning() )
return; // return;
TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */
LoseFocus( m_Choice ); LoseFocus( m_Choice );
m_Choice = Choice( m_Choice + (up? -1:+1) ); m_Choice += (up? -1:+1);
wrap( (int&)m_Choice, (int)NUM_CHOICES ); wrap( (int&)m_Choice, m_aModeChoices.size() );
m_soundChange.Play(); m_soundChange.Play();
GainFocus( m_Choice ); GainFocus( m_Choice );
} }
@@ -200,16 +193,17 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
return; return;
/* If the CoinMode was changed, we need to reload this screen /* 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 ) ) if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) )
{ {
SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
return;
} }
if( !MenuI.IsValid() ) if( !MenuI.IsValid() )
return; 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; return;
switch( MenuI.button ) switch( MenuI.button )
@@ -221,45 +215,24 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
MoveCursor( false ); MoveCursor( false );
break; break;
case MENU_BUTTON_BACK: case MENU_BUTTON_BACK:
if( m_BeginOut.IsTransitioning() ) if( m_Menu.m_Out.IsTransitioning() )
break; break;
m_Out.StartTransitioning( SM_GoToAttractLoop ); m_Menu.Back( SM_GoToAttractLoop );
break; break;
case MENU_BUTTON_START: case MENU_BUTTON_START:
/* break if the choice is invalid */ /* return if the choice is invalid */
if( m_Choice == CHOICE_JUKEBOX || const ModeChoice &mc = m_aModeChoices[m_Choice];
m_Choice == CHOICE_EDIT || if( mc.m_bInvalid )
m_Choice == CHOICE_EDIT_COURSES )
{ {
if( SONGMAN->GetNumSongs() == 0 ) m_soundInvalid.Play();
{ if( mc.m_sInvalidReason != "" )
m_soundInvalid.Play(); SCREENMAN->SystemMessage( mc.m_sInvalidReason );
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();
return; return;
} }
if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) ) if( Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) )
if( !m_BeginOut.IsTransitioning() ) if( !m_Menu.m_Out.IsTransitioning() )
m_BeginOut.StartTransitioning( SM_GoToNextScreen ); m_Menu.StartTransitioning( SM_GoToNextScreen );
} }
// detect codes // detect codes
@@ -318,50 +291,23 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM )
switch( SM ) switch( SM )
{ {
case SM_PlayComment: case SM_PlayComment:
m_soundAttract.PlayRandom(); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("title menu attract") );
this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS ); this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS );
break; break;
case SM_GoToNextScreen: 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++ )
// apply default options GAMESTATE->m_PlayerOptions[p].FromString( PREFSMAN->m_sDefaultModifiers );
for( int p=0; p<NUM_PLAYERS; p++ ) GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers );
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;
} }
m_aModeChoices[m_Choice].ApplyToAllPlayers();
break; break;
case SM_GoToAttractLoop: case SM_GoToAttractLoop:
SCREENMAN->SetNewScreen( "ScreenCompany" ); SCREENMAN->SetNewScreen( "ScreenCompany" );
+9 -45
View File
@@ -14,12 +14,12 @@
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RageSound.h" #include "RageSound.h"
#include "BGAnimation.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "RandomSample.h" #include "ScreenSelect.h"
#define MAX_MODE_CHOICES 30
class ScreenTitleMenu : public Screen class ScreenTitleMenu : public ScreenSelect
{ {
public: public:
ScreenTitleMenu(); ScreenTitleMenu();
@@ -29,56 +29,22 @@ public:
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
enum Choice
{
CHOICE_GAME_START = 0,
CHOICE_SELECT_GAME,
CHOICE_OPTIONS,
CHOICE_EDIT,
CHOICE_EDIT_COURSES,
CHOICE_JUKEBOX,
#ifdef DEBUG
// CHOICE_NETWORKPLAY,
CHOICE_SANDBOX,
#endif
CHOICE_EXIT,
NUM_CHOICES // leave this at the end!
};
CString ChoiceToString( Choice c )
{
const CString s[NUM_CHOICES] = {
"GAME START",
"SELECT GAME",
"OPTIONS",
"EDIT/SYNC SONGS",
"EDIT COURSES",
"JUKEBOX",
#ifdef DEBUG
// "NETWORK PLAY",
"SANDBOX",
#endif
"EXIT"
};
return s[c];
}
private: private:
int GetSelectionIndex( PlayerNumber pn ) { return m_Choice; }
void UpdateSelectableChoices();
void GainFocus( int iChoiceIndex ); void GainFocus( int iChoiceIndex );
void LoseFocus( int iChoiceIndex ); void LoseFocus( int iChoiceIndex );
void MoveCursor( bool up ); void MoveCursor( bool up );
Choice m_Choice; unsigned m_Choice;
BGAnimation m_Background;
Sprite m_sprLogo; Sprite m_sprLogo;
BitmapText m_textVersion; BitmapText m_textVersion;
BitmapText m_textSongs; BitmapText m_textSongs;
BitmapText m_textHelp; BitmapText m_textHelp;
BitmapText m_textChoice[NUM_CHOICES]; BitmapText m_textChoice[MAX_MODE_CHOICES];
RandomSample m_soundAttract;
RageSound m_soundChange; RageSound m_soundChange;
RageSound m_soundSelect; RageSound m_soundSelect;
RageSound m_soundInvalid; RageSound m_soundInvalid;
@@ -88,9 +54,7 @@ private:
BGAnimation m_CoinMode; BGAnimation m_CoinMode;
BGAnimation m_JointPremium; BGAnimation m_JointPremium;
Transition m_In; Transition m_AttractOut;
Transition m_Out;
Transition m_BeginOut;
}; };