2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenTitleMenu.h"
|
2003-04-13 04:50:08 +00:00
|
|
|
#include "ScreenAttract.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "StepMania.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2002-05-28 20:01:22 +00:00
|
|
|
#include "GameManager.h"
|
2002-08-27 03:59:22 +00:00
|
|
|
#include "InputMapper.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2004-07-08 00:10:34 +00:00
|
|
|
#include "GameSoundManager.h"
|
2003-04-13 04:50:08 +00:00
|
|
|
#include "CodeDetector.h"
|
2003-04-18 23:55:20 +00:00
|
|
|
#include "RageTextureManager.h"
|
2005-02-21 06:22:46 +00:00
|
|
|
#include "UnlockManager.h"
|
2003-08-10 03:19:16 +00:00
|
|
|
#include "ProductInfo.h"
|
2003-11-16 04:45:12 +00:00
|
|
|
#include "LightsManager.h"
|
2004-06-13 09:42:14 +00:00
|
|
|
#include "CodeDetector.h"
|
2004-07-17 22:15:39 +00:00
|
|
|
#include "CommonMetrics.h"
|
2004-07-25 17:07:32 +00:00
|
|
|
#include "Game.h"
|
2004-08-21 03:39:28 +00:00
|
|
|
#include "ScreenOptionsMasterPrefs.h"
|
2004-12-20 06:25:59 +00:00
|
|
|
#include "PlayerState.h"
|
2003-01-02 07:54:28 +00:00
|
|
|
|
2005-01-04 11:06:12 +00:00
|
|
|
#define MAX_STAGES_TEXT THEME->GetMetric (m_sName,"MaxStagesText")
|
2005-01-30 00:01:35 +00:00
|
|
|
#define COIN_MODE_CHANGE_SCREEN THEME->GetMetric (m_sName,"CoinModeChangeScreen")
|
|
|
|
|
|
2002-08-02 09:31:06 +00:00
|
|
|
|
2004-11-26 17:28:47 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenTitleMenu );
|
2005-01-04 11:06:12 +00:00
|
|
|
ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) :
|
|
|
|
|
ScreenSelectMaster( sScreenName )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" );
|
2003-02-12 11:43:08 +00:00
|
|
|
|
2003-11-09 09:00:11 +00:00
|
|
|
// Don't show screen title menu (says "Press Start")
|
|
|
|
|
// if there are 0 credits and inserted and CoinMode is pay.
|
2005-02-21 17:29:49 +00:00
|
|
|
if( GAMESTATE->GetCoinMode() == COIN_PAY &&
|
2003-11-09 09:00:11 +00:00
|
|
|
GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit )
|
|
|
|
|
{
|
2004-07-17 22:15:39 +00:00
|
|
|
SCREENMAN->SetNewScreen( INITIAL_SCREEN );
|
2003-11-09 09:00:11 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-27 20:50:12 +00:00
|
|
|
/* XXX We really need two common calls: 1, something run when exiting from gameplay
|
|
|
|
|
* (to do this reset), and 2, something run when entering gameplay, to apply default
|
|
|
|
|
* options. Having special cases in attract screens and the title menu to reset
|
|
|
|
|
* things stinks ... */
|
2003-04-13 06:29:02 +00:00
|
|
|
GAMESTATE->Reset();
|
2003-03-09 03:28:34 +00:00
|
|
|
|
2005-01-04 11:06:12 +00:00
|
|
|
// TRICKY: Do this after GameState::Reset.
|
|
|
|
|
LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING );
|
2005-02-23 06:29:05 +00:00
|
|
|
}
|
2003-11-16 04:45:12 +00:00
|
|
|
|
2005-02-23 06:29:05 +00:00
|
|
|
void ScreenTitleMenu::Init()
|
|
|
|
|
{
|
|
|
|
|
ScreenSelectMaster::Init();
|
2003-11-16 04:45:12 +00:00
|
|
|
|
2005-01-04 11:06:12 +00:00
|
|
|
m_sprLogo.Load( THEME->GetPathG(m_sName,GAMESTATE->GetCurrentGame()->m_szName) );
|
|
|
|
|
m_sprLogo->SetName( "Logo" );
|
|
|
|
|
m_sprLogo->SetDrawOrder( -1 );
|
|
|
|
|
this->AddChild( m_sprLogo );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( m_sprLogo );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2005-02-06 03:32:53 +00:00
|
|
|
m_textVersion.LoadFromFont( THEME->GetPathF("Common","normal") );
|
2005-01-04 11:06:12 +00:00
|
|
|
m_textVersion.SetName( "Version" );
|
2003-08-10 03:19:16 +00:00
|
|
|
m_textVersion.SetText( PRODUCT_VER );
|
2003-04-13 04:50:08 +00:00
|
|
|
this->AddChild( &m_textVersion );
|
2005-01-04 11:06:12 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_textVersion );
|
2003-04-13 04:50:08 +00:00
|
|
|
|
2005-02-06 03:32:53 +00:00
|
|
|
m_textSongs.LoadFromFont( THEME->GetPathF("Common","normal") );
|
2005-01-04 11:06:12 +00:00
|
|
|
m_textSongs.SetName( "Songs" );
|
2003-07-31 22:50:27 +00:00
|
|
|
CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() );
|
|
|
|
|
if( PREFSMAN->m_bUseUnlockSystem )
|
2004-02-21 01:06:35 +00:00
|
|
|
text += ssprintf(", %d unlocks", UNLOCKMAN->GetNumUnlocks() );
|
2003-07-31 22:50:27 +00:00
|
|
|
m_textSongs.SetText( text );
|
2003-04-13 04:50:08 +00:00
|
|
|
this->AddChild( &m_textSongs );
|
2005-01-04 11:06:12 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_textSongs );
|
2003-04-13 04:50:08 +00:00
|
|
|
|
2004-03-23 21:59:33 +00:00
|
|
|
m_textMaxStages.LoadFromFont( THEME->GetPathF(m_sName,"MaxStages") );
|
2005-01-04 11:06:12 +00:00
|
|
|
m_textMaxStages.SetName( "MaxStages" );
|
2004-03-25 08:46:38 +00:00
|
|
|
CString sText =
|
2005-02-21 17:29:49 +00:00
|
|
|
GAMESTATE->GetEventMode() ?
|
2004-08-06 21:01:28 +00:00
|
|
|
CString("event mode") :
|
2005-02-22 20:18:22 +00:00
|
|
|
ssprintf( "%d %s%s max", PREFSMAN->m_iNumArcadeStages.Value(), MAX_STAGES_TEXT.c_str(), (PREFSMAN->m_iNumArcadeStages>1)?"s":"" );
|
2004-03-25 08:46:38 +00:00
|
|
|
m_textMaxStages.SetText( sText );
|
2004-03-23 21:59:33 +00:00
|
|
|
this->AddChild( &m_textMaxStages );
|
2005-01-04 11:06:12 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_textMaxStages );
|
2003-04-13 04:50:08 +00:00
|
|
|
|
2004-08-21 03:39:28 +00:00
|
|
|
m_textLifeDifficulty.LoadFromFont( THEME->GetPathF(m_sName,"LifeDifficulty") );
|
2005-01-04 11:06:12 +00:00
|
|
|
m_textLifeDifficulty.SetName( "LifeDifficulty" );
|
2004-08-21 03:39:28 +00:00
|
|
|
int iLifeDifficulty;
|
2004-12-07 02:47:21 +00:00
|
|
|
LifeDifficulty( iLifeDifficulty, true, NULL );
|
2004-08-21 03:39:28 +00:00
|
|
|
iLifeDifficulty++; // LifeDifficulty returns an index
|
|
|
|
|
m_textLifeDifficulty.SetText( ssprintf( "life difficulty %d", iLifeDifficulty ) );
|
|
|
|
|
this->AddChild( &m_textLifeDifficulty );
|
2005-01-04 11:06:12 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( m_textLifeDifficulty );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-05-02 03:01:27 +00:00
|
|
|
this->SortByDrawOrder();
|
2004-05-01 23:19:33 +00:00
|
|
|
|
2005-01-04 11:06:12 +00:00
|
|
|
SOUND->PlayOnceFromAnnouncer( "title menu game name" );
|
2003-01-11 08:55:21 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
ScreenTitleMenu::~ScreenTitleMenu()
|
|
|
|
|
{
|
2005-01-04 11:06:13 +00:00
|
|
|
LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" );
|
2003-09-26 09:03:48 +00:00
|
|
|
}
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
|
|
|
|
{
|
2003-01-09 07:46:45 +00:00
|
|
|
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", DeviceI.device, DeviceI.button ); // debugging gameport joystick problem
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-01-19 04:44:22 +00:00
|
|
|
if( type != IET_FIRST_PRESS )
|
|
|
|
|
return;
|
2003-03-09 00:55:49 +00:00
|
|
|
|
|
|
|
|
/* If the CoinMode was changed, we need to reload this screen
|
2004-12-02 06:29:20 +00:00
|
|
|
* so that the right m_aGameCommands will show */
|
2003-03-09 00:55:49 +00:00
|
|
|
if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) )
|
2003-01-19 04:44:22 +00:00
|
|
|
{
|
2005-01-30 00:01:35 +00:00
|
|
|
SCREENMAN->SetNewScreen( COIN_MODE_CHANGE_SCREEN );
|
2003-09-27 01:55:04 +00:00
|
|
|
return;
|
2003-01-19 04:44:22 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-20 06:14:41 +00:00
|
|
|
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
|
2003-09-26 09:03:48 +00:00
|
|
|
return;
|
2005-01-04 11:06:12 +00:00
|
|
|
|
|
|
|
|
//
|
2003-04-13 04:50:08 +00:00
|
|
|
// detect codes
|
2005-01-04 11:06:12 +00:00
|
|
|
//
|
2003-09-25 02:16:37 +00:00
|
|
|
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME) ||
|
|
|
|
|
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME2) )
|
2003-04-13 04:50:08 +00:00
|
|
|
{
|
|
|
|
|
THEME->NextTheme();
|
2003-05-25 22:39:23 +00:00
|
|
|
ApplyGraphicOptions(); // update window title and icon
|
2003-04-13 04:50:08 +00:00
|
|
|
SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() );
|
2005-01-04 11:06:12 +00:00
|
|
|
SCREENMAN->SetNewScreen( m_sName );
|
2003-04-18 23:55:20 +00:00
|
|
|
TEXTUREMAN->DoDelayedDelete();
|
2003-04-13 04:50:08 +00:00
|
|
|
}
|
2003-09-25 02:16:37 +00:00
|
|
|
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_ANNOUNCER) ||
|
|
|
|
|
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_ANNOUNCER2) )
|
2003-04-13 04:50:08 +00:00
|
|
|
{
|
|
|
|
|
ANNOUNCER->NextAnnouncer();
|
|
|
|
|
CString sName = ANNOUNCER->GetCurAnnouncerName();
|
|
|
|
|
if( sName=="" ) sName = "(none)";
|
|
|
|
|
SCREENMAN->SystemMessage( "Announcer: "+sName );
|
2005-01-04 11:06:12 +00:00
|
|
|
SCREENMAN->SetNewScreen( m_sName );
|
2003-04-13 04:50:08 +00:00
|
|
|
}
|
2003-09-25 02:16:37 +00:00
|
|
|
if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME) ||
|
|
|
|
|
CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME2) )
|
|
|
|
|
{
|
2004-07-25 17:07:32 +00:00
|
|
|
vector<const Game*> vGames;
|
2004-07-25 04:27:20 +00:00
|
|
|
GAMEMAN->GetEnabledGames( vGames );
|
|
|
|
|
ASSERT( !vGames.empty() );
|
2004-07-25 17:07:32 +00:00
|
|
|
vector<const Game*>::iterator iter = find(vGames.begin(),vGames.end(),GAMESTATE->m_pCurGame);
|
2004-07-25 04:27:20 +00:00
|
|
|
ASSERT( iter != vGames.end() );
|
|
|
|
|
|
|
|
|
|
iter++; // move to the next game
|
|
|
|
|
|
|
|
|
|
// wrap
|
|
|
|
|
if( iter == vGames.end() )
|
|
|
|
|
iter = vGames.begin();
|
|
|
|
|
|
|
|
|
|
GAMESTATE->m_pCurGame = *iter;
|
2003-09-25 06:05:19 +00:00
|
|
|
|
|
|
|
|
/* Reload the theme if it's changed, but don't back to the initial screen. */
|
|
|
|
|
ResetGame( false );
|
|
|
|
|
|
2004-07-25 17:07:32 +00:00
|
|
|
SCREENMAN->SystemMessage( CString("Game: ") + GAMESTATE->GetCurrentGame()->m_szName );
|
2005-01-04 11:06:12 +00:00
|
|
|
SCREENMAN->SetNewScreen( m_sName );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-04 11:06:12 +00:00
|
|
|
ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI );
|
2002-05-20 08:59:37 +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.
|
|
|
|
|
*/
|