2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "ScreenSelectMusic.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include "GameManager.h"
|
2004-07-08 00:10:34 +00:00
|
|
|
#include "GameSoundManager.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "InputMapper.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "GameState.h"
|
2002-09-02 21:59:58 +00:00
|
|
|
#include "CodeDetector.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2003-08-03 00:13:55 +00:00
|
|
|
#include "Steps.h"
|
2003-04-13 21:17:14 +00:00
|
|
|
#include "ActorUtil.h"
|
2003-05-15 06:09:19 +00:00
|
|
|
#include "RageTextureManager.h"
|
2003-07-20 05:13:45 +00:00
|
|
|
#include "Course.h"
|
2003-09-08 07:21:41 +00:00
|
|
|
#include "ProfileManager.h"
|
2005-07-01 05:07:22 +00:00
|
|
|
#include "Profile.h"
|
2003-11-07 20:10:38 +00:00
|
|
|
#include "MenuTimer.h"
|
2003-11-16 04:45:12 +00:00
|
|
|
#include "LightsManager.h"
|
2005-02-16 03:25:45 +00:00
|
|
|
#include "StatsManager.h"
|
2004-04-18 07:34:37 +00:00
|
|
|
#include "StepsUtil.h"
|
2004-05-23 00:53:20 +00:00
|
|
|
#include "Foreach.h"
|
2004-09-12 05:56:24 +00:00
|
|
|
#include "Style.h"
|
2004-12-20 06:25:59 +00:00
|
|
|
#include "PlayerState.h"
|
2005-02-12 21:03:39 +00:00
|
|
|
#include "CommonMetrics.h"
|
2005-03-08 01:39:32 +00:00
|
|
|
#include "BannerCache.h"
|
2005-09-03 06:12:43 +00:00
|
|
|
#include "song.h"
|
2005-09-05 02:26:50 +00:00
|
|
|
#include "InputEventPlus.h"
|
2007-03-01 07:57:04 +00:00
|
|
|
#include "OptionsList.h"
|
2003-04-13 21:17:14 +00:00
|
|
|
|
2003-03-28 23:13:32 +00:00
|
|
|
const int NUM_SCORE_DIGITS = 9;
|
2003-03-24 21:37:13 +00:00
|
|
|
|
2006-08-06 02:01:27 +00:00
|
|
|
#define SHOW_OPTIONS_MESSAGE_SECONDS THEME->GetMetricF( m_sName, "ShowOptionsMessageSeconds" )
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2005-03-28 08:01:36 +00:00
|
|
|
AutoScreenMessage( SM_AllowOptionsMenuRepeat )
|
|
|
|
|
AutoScreenMessage( SM_SongChanged )
|
|
|
|
|
AutoScreenMessage( SM_SortOrderChanging )
|
|
|
|
|
AutoScreenMessage( SM_SortOrderChanged )
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
static RString g_sCDTitlePath;
|
2004-09-08 02:53:54 +00:00
|
|
|
static bool g_bWantFallbackCdTitle;
|
|
|
|
|
static bool g_bCDTitleWaiting = false;
|
2006-01-22 01:00:06 +00:00
|
|
|
static RString g_sBannerPath;
|
2004-09-08 02:53:54 +00:00
|
|
|
static bool g_bBannerWaiting = false;
|
|
|
|
|
static bool g_bSampleMusicWaiting = false;
|
|
|
|
|
static RageTimer g_StartedLoadingAt(RageZeroTimer);
|
|
|
|
|
|
2006-01-15 20:46:15 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenSelectMusic );
|
2006-01-15 19:49:02 +00:00
|
|
|
ScreenSelectMusic::ScreenSelectMusic()
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2005-04-01 05:26:59 +00:00
|
|
|
if( PREFSMAN->m_bScreenTestMode )
|
|
|
|
|
{
|
2005-07-25 03:59:24 +00:00
|
|
|
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
|
2006-09-30 22:22:26 +00:00
|
|
|
GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle(GAMEMAN->GetDefaultGame(),"versus") );
|
2006-09-15 05:56:43 +00:00
|
|
|
GAMESTATE->JoinPlayer( PLAYER_1 );
|
2005-04-01 05:26:59 +00:00
|
|
|
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
|
|
|
|
|
}
|
2005-02-23 06:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenSelectMusic::Init()
|
|
|
|
|
{
|
2006-01-15 19:48:11 +00:00
|
|
|
SAMPLE_MUSIC_DELAY.Load( m_sName, "SampleMusicDelay" );
|
|
|
|
|
DO_ROULETTE_ON_MENU_TIMER.Load( m_sName, "DoRouletteOnMenuTimer" );
|
|
|
|
|
ALIGN_MUSIC_BEATS.Load( m_sName, "AlignMusicBeat" );
|
|
|
|
|
CODES.Load( m_sName, "Codes" );
|
|
|
|
|
MUSIC_WHEEL_TYPE.Load( m_sName, "MusicWheelType" );
|
|
|
|
|
SELECT_MENU_AVAILABLE.Load( m_sName, "SelectMenuAvailable" );
|
|
|
|
|
MODE_MENU_AVAILABLE.Load( m_sName, "ModeMenuAvailable" );
|
2007-03-01 07:57:04 +00:00
|
|
|
USE_OPTIONS_LIST.Load( m_sName, "UseOptionsList" );
|
2007-03-06 01:51:55 +00:00
|
|
|
TWO_PART_SELECTION.Load( m_sName, "TwoPartSelection" );
|
2006-01-15 19:48:11 +00:00
|
|
|
|
2007-01-16 07:47:00 +00:00
|
|
|
m_GameButtonPreviousSong = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"PreviousSongButton") );
|
|
|
|
|
m_GameButtonNextSong = INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName,"NextSongButton") );
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
FOREACH_ENUM( PlayerNumber, p )
|
2007-03-17 06:35:58 +00:00
|
|
|
{
|
2007-03-06 01:51:55 +00:00
|
|
|
m_bSelectIsDown[p] = false; // used by UpdateSelectButton
|
2007-03-17 06:35:58 +00:00
|
|
|
m_bAcceptSelectRelease[p] = false;
|
|
|
|
|
}
|
2005-04-26 06:41:57 +00:00
|
|
|
|
2005-02-23 06:29:05 +00:00
|
|
|
ScreenWithMenuElements::Init();
|
|
|
|
|
|
2003-06-30 06:51:05 +00:00
|
|
|
/* Cache: */
|
2007-03-11 00:52:50 +00:00
|
|
|
m_sSectionMusicPath = THEME->GetPathS(m_sName,"section music");
|
|
|
|
|
m_sSortMusicPath = THEME->GetPathS(m_sName,"sort music");
|
|
|
|
|
m_sRouletteMusicPath = THEME->GetPathS(m_sName,"roulette music");
|
|
|
|
|
m_sRandomMusicPath = THEME->GetPathS(m_sName,"random music");
|
|
|
|
|
m_sCourseMusicPath = THEME->GetPathS(m_sName,"course music");
|
|
|
|
|
m_sFallbackCDTitlePath = THEME->GetPathG(m_sName,"fallback cdtitle");
|
2005-03-08 06:48:31 +00:00
|
|
|
|
|
|
|
|
|
2005-06-30 22:41:22 +00:00
|
|
|
m_TexturePreload.Load( m_sFallbackCDTitlePath );
|
2003-03-16 07:29:58 +00:00
|
|
|
|
2006-10-07 07:43:18 +00:00
|
|
|
if( PREFSMAN->m_BannerCache != BNCACHE_OFF )
|
2005-07-07 01:44:24 +00:00
|
|
|
{
|
|
|
|
|
m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Banner","all music")) );
|
|
|
|
|
m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Common","fallback banner")) );
|
|
|
|
|
m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Banner","roulette")) );
|
|
|
|
|
m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Banner","random")) );
|
2005-09-09 05:51:29 +00:00
|
|
|
m_TexturePreload.Load( Banner::SongBannerTexture(THEME->GetPathG("Banner","mode")) );
|
2005-07-07 01:44:24 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-06 10:05:51 +00:00
|
|
|
if( CommonMetrics::AUTO_SET_STYLE )
|
2007-03-04 20:55:12 +00:00
|
|
|
{
|
|
|
|
|
vector<StepsType> vst;
|
|
|
|
|
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, vst );
|
|
|
|
|
const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined(), vst[0] );
|
2007-03-08 06:01:11 +00:00
|
|
|
GAMESTATE->SetCurrentStyle( pStyle );
|
2007-03-04 20:55:12 +00:00
|
|
|
}
|
2003-03-16 07:29:58 +00:00
|
|
|
|
2005-03-08 01:39:32 +00:00
|
|
|
/* Load low-res banners, if needed. */
|
|
|
|
|
BANNERCACHE->Demand();
|
|
|
|
|
|
2005-05-31 07:37:57 +00:00
|
|
|
m_MusicWheel.SetName( "MusicWheel" );
|
2006-08-10 17:44:11 +00:00
|
|
|
m_MusicWheel.Load( MUSIC_WHEEL_TYPE );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_MusicWheel );
|
2003-05-02 20:36:26 +00:00
|
|
|
this->AddChild( &m_MusicWheel );
|
|
|
|
|
|
2007-03-01 07:57:04 +00:00
|
|
|
if( USE_OPTIONS_LIST )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_PlayerNumber(p)
|
|
|
|
|
{
|
|
|
|
|
m_OptionsList[p].SetName( "OptionsList" + PlayerNumberToString(p) );
|
2007-03-08 04:20:12 +00:00
|
|
|
m_OptionsList[p].Load( "OptionsList", p );
|
2007-03-01 07:57:04 +00:00
|
|
|
m_OptionsList[p].SetDrawOrder( 100 );
|
|
|
|
|
ActorUtil::LoadAllCommands( m_OptionsList[p], m_sName );
|
|
|
|
|
this->AddChild( &m_OptionsList[p] );
|
|
|
|
|
}
|
2007-03-19 00:03:20 +00:00
|
|
|
m_OptionsList[PLAYER_1].Link( &m_OptionsList[PLAYER_2] );
|
|
|
|
|
m_OptionsList[PLAYER_2].Link( &m_OptionsList[PLAYER_1] );
|
2007-03-01 07:57:04 +00:00
|
|
|
}
|
|
|
|
|
|
2003-04-13 21:17:14 +00:00
|
|
|
// this is loaded SetSong and TweenToSong
|
|
|
|
|
m_Banner.SetName( "Banner" );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_Banner );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_Banner );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-05-20 05:31:38 +00:00
|
|
|
m_sprCDTitleFront.SetName( "CDTitle" );
|
2004-05-22 02:24:40 +00:00
|
|
|
m_sprCDTitleFront.Load( THEME->GetPathG(m_sName,"fallback cdtitle") );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprCDTitleFront );
|
2004-06-03 02:55:47 +00:00
|
|
|
COMMAND( m_sprCDTitleFront, "Front" );
|
2003-05-20 05:31:38 +00:00
|
|
|
this->AddChild( &m_sprCDTitleFront );
|
|
|
|
|
|
|
|
|
|
m_sprCDTitleBack.SetName( "CDTitle" );
|
2004-05-22 02:24:40 +00:00
|
|
|
m_sprCDTitleBack.Load( THEME->GetPathG(m_sName,"fallback cdtitle") );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprCDTitleBack );
|
2004-06-03 02:55:47 +00:00
|
|
|
COMMAND( m_sprCDTitleBack, "Back" );
|
2003-05-20 05:31:38 +00:00
|
|
|
this->AddChild( &m_sprCDTitleBack );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2007-03-04 08:52:06 +00:00
|
|
|
FOREACH_ENUM( PlayerNumber, p )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-04-13 21:17:14 +00:00
|
|
|
m_sprHighScoreFrame[p].SetName( ssprintf("ScoreFrameP%d",p+1) );
|
2004-05-22 02:24:40 +00:00
|
|
|
m_sprHighScoreFrame[p].Load( THEME->GetPathG(m_sName,ssprintf("score frame p%d",p+1)) );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_sprHighScoreFrame[p] );
|
2002-09-02 21:59:58 +00:00
|
|
|
this->AddChild( &m_sprHighScoreFrame[p] );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2003-04-13 21:17:14 +00:00
|
|
|
m_textHighScore[p].SetName( ssprintf("ScoreP%d",p+1) );
|
2004-07-25 06:29:50 +00:00
|
|
|
m_textHighScore[p].LoadFromFont( THEME->GetPathF(m_sName,"score") );
|
2004-03-20 02:59:08 +00:00
|
|
|
m_textHighScore[p].SetShadowLength( 0 );
|
2005-10-27 05:16:19 +00:00
|
|
|
m_textHighScore[p].RunCommands( CommonMetrics::PLAYER_COLOR.GetValue(p) );
|
2007-02-19 09:30:07 +00:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_textHighScore[p] );
|
2003-03-28 23:13:32 +00:00
|
|
|
this->AddChild( &m_textHighScore[p] );
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-16 05:11:59 +00:00
|
|
|
RageSoundLoadParams SoundParams;
|
|
|
|
|
SoundParams.m_bSupportPan = true;
|
|
|
|
|
|
2006-11-30 07:38:54 +00:00
|
|
|
m_soundStart.Load( THEME->GetPathS(m_sName,"start") );
|
2007-03-16 05:11:59 +00:00
|
|
|
m_soundDifficultyEasier.Load( THEME->GetPathS(m_sName,"difficulty easier"), false, &SoundParams );
|
|
|
|
|
m_soundDifficultyHarder.Load( THEME->GetPathS(m_sName,"difficulty harder"), false, &SoundParams );
|
2004-05-22 02:24:40 +00:00
|
|
|
m_soundOptionsChange.Load( THEME->GetPathS(m_sName,"options") );
|
|
|
|
|
m_soundLocked.Load( THEME->GetPathS(m_sName,"locked") );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2005-07-22 22:38:53 +00:00
|
|
|
this->SortByDrawOrder();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectMusic::BeginScreen()
|
|
|
|
|
{
|
2007-03-21 06:36:11 +00:00
|
|
|
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet.
|
2007-03-25 09:37:14 +00:00
|
|
|
* Do this before anything that might look at GAMESTATE->m_iCurrentStageIndex or GAMESTATE->m_iPlayerCurrentStageIndexForCurrentCredit. */
|
2007-03-21 06:36:11 +00:00
|
|
|
GAMESTATE->FinishStage();
|
|
|
|
|
|
|
|
|
|
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
|
|
|
|
|
|
|
|
|
|
if( GAMESTATE->GetCurrentStyle() == NULL )
|
|
|
|
|
RageException::Throw( "The Style has not been set. A theme must set the Style before loading ScreenSelectMusic." );
|
|
|
|
|
|
|
|
|
|
if( GAMESTATE->m_PlayMode == PlayMode_Invalid )
|
|
|
|
|
RageException::Throw( "The PlayMode has not been set. A theme must set the PlayMode before loading ScreenSelectMusic." );
|
|
|
|
|
|
2006-08-08 04:01:55 +00:00
|
|
|
OPTIONS_MENU_AVAILABLE.Load( m_sName, "OptionsMenuAvailable" );
|
2007-04-02 00:14:11 +00:00
|
|
|
PlayCommand( "Mods" );
|
2006-04-04 21:39:03 +00:00
|
|
|
m_MusicWheel.BeginScreen();
|
2006-08-18 01:26:22 +00:00
|
|
|
|
2007-03-11 00:52:50 +00:00
|
|
|
m_SelectionState = SelectionState_SelectingSong;
|
2007-03-07 12:11:11 +00:00
|
|
|
ZERO( m_bStepsSelected );
|
2002-06-14 22:25:22 +00:00
|
|
|
m_bGoToOptions = false;
|
2003-02-10 22:10:12 +00:00
|
|
|
m_bAllowOptionsMenu = m_bAllowOptionsMenuRepeat = false;
|
2005-06-23 01:49:47 +00:00
|
|
|
ZERO( m_iSelection );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
AfterMusicChange();
|
2004-02-13 05:39:15 +00:00
|
|
|
|
2005-07-22 22:38:53 +00:00
|
|
|
SOUND->PlayOnceFromAnnouncer( "select music intro" );
|
2007-03-18 06:17:09 +00:00
|
|
|
|
|
|
|
|
ScreenWithMenuElements::BeginScreen();
|
2005-07-22 22:38:53 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
ScreenSelectMusic::~ScreenSelectMusic()
|
|
|
|
|
{
|
2002-08-04 08:03:41 +00:00
|
|
|
LOG->Trace( "ScreenSelectMusic::~ScreenSelectMusic()" );
|
2005-03-08 01:39:32 +00:00
|
|
|
BANNERCACHE->Undemand();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-29 08:14:29 +00:00
|
|
|
/* If bForce is true, the next request will be started even if it might cause a skip. */
|
|
|
|
|
void ScreenSelectMusic::CheckBackgroundRequests( bool bForce )
|
2002-08-13 23:26:46 +00:00
|
|
|
{
|
2004-09-08 02:53:54 +00:00
|
|
|
if( g_bCDTitleWaiting )
|
2002-10-06 16:56:58 +00:00
|
|
|
{
|
2004-09-08 02:53:54 +00:00
|
|
|
/* The CDTitle is normally very small, so we don't bother waiting to display it. */
|
2006-01-22 01:00:06 +00:00
|
|
|
RString sPath;
|
2006-08-14 18:28:02 +00:00
|
|
|
if( !m_BackgroundLoader.IsCacheFileFinished(g_sCDTitlePath, sPath) )
|
|
|
|
|
return;
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-08-14 18:28:02 +00:00
|
|
|
g_bCDTitleWaiting = false;
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-08-14 18:28:02 +00:00
|
|
|
RString sCDTitlePath = sPath;
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-08-14 18:28:02 +00:00
|
|
|
if( sCDTitlePath.empty() || !IsAFile(sCDTitlePath) )
|
|
|
|
|
sCDTitlePath = g_bWantFallbackCdTitle? m_sFallbackCDTitlePath:RString("");
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-08-14 18:28:02 +00:00
|
|
|
if( !sCDTitlePath.empty() )
|
|
|
|
|
{
|
|
|
|
|
TEXTUREMAN->DisableOddDimensionWarning();
|
|
|
|
|
m_sprCDTitleFront.Load( sCDTitlePath );
|
|
|
|
|
m_sprCDTitleBack.Load( sCDTitlePath );
|
|
|
|
|
TEXTUREMAN->EnableOddDimensionWarning();
|
2004-09-08 02:53:54 +00:00
|
|
|
}
|
2006-08-14 18:28:02 +00:00
|
|
|
|
|
|
|
|
m_BackgroundLoader.FinishedWithCachedFile( g_sCDTitlePath );
|
2004-09-08 02:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-10 03:37:33 +00:00
|
|
|
/* Loading the rest can cause small skips, so don't do it until the wheel settles.
|
|
|
|
|
* Do load if we're transitioning out, though, so we don't miss starting the music
|
2005-03-31 03:18:58 +00:00
|
|
|
* for the options screen if a song is selected quickly. Also, don't do this
|
|
|
|
|
* if the wheel is locked, since we're just bouncing around after selecting TYPE_RANDOM,
|
|
|
|
|
* and it'll take a while before the wheel will settle. */
|
2006-03-29 08:14:29 +00:00
|
|
|
if( !m_MusicWheel.IsSettled() && !m_MusicWheel.WheelIsLocked() && !bForce )
|
2004-09-08 02:53:54 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if( g_bBannerWaiting )
|
|
|
|
|
{
|
2005-04-23 06:20:26 +00:00
|
|
|
if( m_Banner.GetTweenTimeLeft() > 0 )
|
2005-03-08 01:39:32 +00:00
|
|
|
return;
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
RString sPath;
|
2005-04-23 06:19:36 +00:00
|
|
|
bool bFreeCache = false;
|
2005-03-08 01:39:32 +00:00
|
|
|
if( TEXTUREMAN->IsTextureRegistered( Sprite::SongBannerTexture(g_sBannerPath) ) )
|
2004-09-08 02:53:54 +00:00
|
|
|
{
|
2005-03-08 01:39:32 +00:00
|
|
|
/* If the file is already loaded into a texture, it's finished,
|
|
|
|
|
* and we only do this to honor the HighQualTime value. */
|
|
|
|
|
sPath = g_sBannerPath;
|
2004-09-08 02:53:54 +00:00
|
|
|
}
|
|
|
|
|
else
|
2005-03-08 01:39:32 +00:00
|
|
|
{
|
|
|
|
|
if( !m_BackgroundLoader.IsCacheFileFinished( g_sBannerPath, sPath ) )
|
|
|
|
|
return;
|
2005-04-23 06:19:36 +00:00
|
|
|
bFreeCache = true;
|
2005-03-08 01:39:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_bBannerWaiting = false;
|
2005-04-23 10:19:47 +00:00
|
|
|
m_Banner.Load( sPath, true );
|
2005-04-23 06:19:36 +00:00
|
|
|
|
|
|
|
|
if( bFreeCache )
|
|
|
|
|
m_BackgroundLoader.FinishedWithCachedFile( g_sBannerPath );
|
2004-09-08 02:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Nothing else is going. Start the music, if we havn't yet. */
|
|
|
|
|
if( g_bSampleMusicWaiting )
|
|
|
|
|
{
|
|
|
|
|
/* Don't start the music sample when moving fast. */
|
2006-03-29 08:37:54 +00:00
|
|
|
if( g_StartedLoadingAt.Ago() < SAMPLE_MUSIC_DELAY && !bForce )
|
2006-03-29 08:11:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
g_bSampleMusicWaiting = false;
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-03-29 08:11:07 +00:00
|
|
|
SOUND->PlayMusic(
|
|
|
|
|
m_sSampleMusicToPlay, m_pSampleMusicTimingData,
|
|
|
|
|
true, m_fSampleStartSeconds, m_fSampleLengthSeconds,
|
|
|
|
|
1.5f, /* fade out for 1.5 seconds */
|
|
|
|
|
ALIGN_MUSIC_BEATS );
|
2002-10-06 16:56:58 +00:00
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-08 02:53:54 +00:00
|
|
|
void ScreenSelectMusic::Update( float fDeltaTime )
|
|
|
|
|
{
|
2006-12-08 20:28:29 +00:00
|
|
|
ScreenWithMenuElements::Update( fDeltaTime );
|
2004-09-08 02:53:54 +00:00
|
|
|
|
2006-03-29 08:14:29 +00:00
|
|
|
CheckBackgroundRequests( false );
|
2004-09-08 02:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
void ScreenSelectMusic::Input( const InputEventPlus &input )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-02-25 00:33:42 +00:00
|
|
|
// LOG->Trace( "ScreenSelectMusic::Input()" );
|
2004-01-11 09:42:37 +00:00
|
|
|
|
2007-03-07 12:11:11 +00:00
|
|
|
|
|
|
|
|
// debugging?
|
|
|
|
|
// I just like being able to see untransliterated titles occasionally.
|
|
|
|
|
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 )
|
|
|
|
|
{
|
|
|
|
|
if( input.type != IET_FIRST_PRESS )
|
|
|
|
|
return;
|
|
|
|
|
PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage );
|
|
|
|
|
m_MusicWheel.RebuildWheelItems();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( !input.GameI.IsValid() )
|
|
|
|
|
return; // don't care
|
|
|
|
|
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
// Handle late joining
|
2007-03-07 22:00:00 +00:00
|
|
|
if( m_SelectionState != SelectionState_Finalized && input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) )
|
2007-03-04 08:52:06 +00:00
|
|
|
{
|
2007-03-08 04:47:47 +00:00
|
|
|
// The current steps may no longer be playable. If one player has double steps
|
|
|
|
|
// selected, they are no longer playable now that P2 has joined.
|
|
|
|
|
|
|
|
|
|
// TODO: Invalidate the CurSteps only if they are no longer playable. That way,
|
|
|
|
|
// after music change will clamp to the nearest in the DifficultyList.
|
2007-03-16 05:11:59 +00:00
|
|
|
GAMESTATE->m_pCurSteps[GAMESTATE->m_MasterPlayerNumber].SetWithoutBroadcast( NULL );
|
2007-03-08 04:47:47 +00:00
|
|
|
FOREACH_ENUM( PlayerNumber, p )
|
2007-03-12 01:47:03 +00:00
|
|
|
GAMESTATE->m_pCurSteps[p].SetWithoutBroadcast( NULL );
|
2007-03-08 04:47:47 +00:00
|
|
|
|
2007-03-06 08:06:26 +00:00
|
|
|
AfterMusicChange();
|
|
|
|
|
|
2007-03-04 08:52:06 +00:00
|
|
|
int iSel = 0;
|
2007-03-05 07:03:36 +00:00
|
|
|
PlayerNumber pn = input.pn;
|
|
|
|
|
m_iSelection[pn] = iSel;
|
|
|
|
|
if( GAMESTATE->IsCourseMode() )
|
|
|
|
|
{
|
|
|
|
|
Trail* pTrail = m_vpTrails.empty()? NULL: m_vpTrails[m_iSelection[pn]];
|
|
|
|
|
GAMESTATE->m_pCurTrail[pn].Set( pTrail );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Steps* pSteps = m_vpSteps.empty()? NULL: m_vpSteps[m_iSelection[pn]];
|
|
|
|
|
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
|
|
|
|
}
|
2007-03-06 08:06:26 +00:00
|
|
|
|
2007-03-04 08:52:06 +00:00
|
|
|
return; // don't handle this press again below
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-07 12:11:11 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(input.pn) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Check for "Press START again for options" button press
|
|
|
|
|
if( m_SelectionState == SelectionState_Finalized &&
|
|
|
|
|
input.MenuI == MENU_BUTTON_START &&
|
|
|
|
|
input.type != IET_RELEASE &&
|
|
|
|
|
OPTIONS_MENU_AVAILABLE.GetValue() )
|
|
|
|
|
{
|
|
|
|
|
if( m_bGoToOptions )
|
|
|
|
|
return; /* got it already */
|
|
|
|
|
if( !m_bAllowOptionsMenu )
|
|
|
|
|
return; /* not allowed */
|
|
|
|
|
|
|
|
|
|
if( !m_bAllowOptionsMenuRepeat && input.type == IET_REPEAT )
|
|
|
|
|
{
|
|
|
|
|
return; /* not allowed yet */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_bGoToOptions = true;
|
|
|
|
|
m_soundStart.Play();
|
|
|
|
|
this->PlayCommand( "ShowEnteringOptions" );
|
|
|
|
|
|
|
|
|
|
// Re-queue SM_BeginFadingOut, since ShowEnteringOptions may have
|
|
|
|
|
// short-circuited animations.
|
|
|
|
|
this->ClearMessageQueue( SM_BeginFadingOut );
|
|
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, this->GetTweenTimeLeft() );
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( IsTransitioning() )
|
|
|
|
|
return; // ignore
|
|
|
|
|
|
|
|
|
|
if( m_SelectionState == SelectionState_Finalized ||
|
|
|
|
|
m_bStepsSelected[input.pn] )
|
|
|
|
|
return; // ignore
|
|
|
|
|
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
// handle options list input
|
2007-03-17 06:35:58 +00:00
|
|
|
if( USE_OPTIONS_LIST )
|
2007-03-01 07:57:04 +00:00
|
|
|
{
|
|
|
|
|
PlayerNumber pn = input.pn;
|
|
|
|
|
if( pn != PLAYER_INVALID )
|
|
|
|
|
{
|
|
|
|
|
if( m_OptionsList[pn].IsOpened() )
|
|
|
|
|
{
|
2007-03-16 22:16:54 +00:00
|
|
|
m_OptionsList[pn].Input( input );
|
|
|
|
|
|
|
|
|
|
if( !m_OptionsList[pn].IsOpened() )
|
|
|
|
|
CloseOptionsList( pn );
|
|
|
|
|
|
|
|
|
|
return;
|
2007-03-01 07:57:04 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2007-03-17 06:35:58 +00:00
|
|
|
if( input.type == IET_RELEASE && input.MenuI == GAME_BUTTON_SELECT && m_bAcceptSelectRelease[pn] )
|
2007-03-07 05:03:18 +00:00
|
|
|
OpenOptionsList( pn );
|
2007-03-01 07:57:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
if( input.MenuI == MENU_BUTTON_SELECT && input.type != IET_REPEAT )
|
|
|
|
|
m_bAcceptSelectRelease[input.pn] = (input.type == IET_FIRST_PRESS);
|
2007-03-01 07:57:04 +00:00
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
if( SELECT_MENU_AVAILABLE && input.MenuI == MENU_BUTTON_SELECT && input.type != IET_REPEAT )
|
|
|
|
|
UpdateSelectButton( input.pn, input.type == IET_FIRST_PRESS );
|
2005-04-26 06:41:57 +00:00
|
|
|
|
2005-09-18 11:41:44 +00:00
|
|
|
|
|
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
if( SELECT_MENU_AVAILABLE && m_bSelectIsDown[input.pn] )
|
2005-04-26 06:41:57 +00:00
|
|
|
{
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.type == IET_FIRST_PRESS )
|
2005-04-26 06:41:57 +00:00
|
|
|
{
|
2006-09-14 20:52:34 +00:00
|
|
|
switch( input.MenuI )
|
2005-04-26 06:41:57 +00:00
|
|
|
{
|
|
|
|
|
case MENU_BUTTON_LEFT:
|
2007-03-07 12:11:11 +00:00
|
|
|
ChangeDifficulty( input.pn, -1 );
|
2007-03-17 06:35:58 +00:00
|
|
|
m_bAcceptSelectRelease[input.pn] = false;
|
|
|
|
|
break;
|
2005-04-26 06:41:57 +00:00
|
|
|
case MENU_BUTTON_RIGHT:
|
2007-03-07 12:11:11 +00:00
|
|
|
ChangeDifficulty( input.pn, +1 );
|
2007-03-17 06:35:58 +00:00
|
|
|
m_bAcceptSelectRelease[input.pn] = false;
|
|
|
|
|
break;
|
2005-04-26 06:41:57 +00:00
|
|
|
case MENU_BUTTON_START:
|
2007-03-17 06:35:58 +00:00
|
|
|
m_bAcceptSelectRelease[input.pn] = false;
|
2005-04-27 04:35:55 +00:00
|
|
|
if( MODE_MENU_AVAILABLE )
|
2007-03-06 03:16:42 +00:00
|
|
|
m_MusicWheel.NextSort();
|
2005-04-27 04:35:55 +00:00
|
|
|
else
|
|
|
|
|
m_soundLocked.Play();
|
2007-03-17 06:35:58 +00:00
|
|
|
break;
|
2005-04-26 06:41:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2007-03-17 06:35:58 +00:00
|
|
|
// return;
|
2005-04-26 06:41:57 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
if( m_SelectionState == SelectionState_SelectingSong &&
|
2007-03-17 06:35:58 +00:00
|
|
|
(input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong || input.MenuI == MENU_BUTTON_SELECT) )
|
2003-01-02 03:00:53 +00:00
|
|
|
{
|
2005-04-11 00:02:55 +00:00
|
|
|
{
|
2005-06-12 23:43:39 +00:00
|
|
|
/* If we're rouletting, hands off. */
|
|
|
|
|
if( m_MusicWheel.IsRouletting() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool bLeftIsDown = false;
|
|
|
|
|
bool bRightIsDown = false;
|
2007-03-04 08:52:06 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2005-04-26 06:41:57 +00:00
|
|
|
{
|
2007-03-17 06:35:58 +00:00
|
|
|
if( m_OptionsList[p].IsOpened() )
|
|
|
|
|
continue;
|
|
|
|
|
if( SELECT_MENU_AVAILABLE && INPUTMAPPER->IsBeingPressed(MENU_BUTTON_SELECT, p) )
|
|
|
|
|
continue;
|
|
|
|
|
|
2007-01-16 07:47:00 +00:00
|
|
|
bLeftIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonPreviousSong, p );
|
|
|
|
|
bRightIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonNextSong, p );
|
2005-04-26 06:41:57 +00:00
|
|
|
}
|
2005-06-12 23:43:39 +00:00
|
|
|
|
|
|
|
|
bool bBothDown = bLeftIsDown && bRightIsDown;
|
|
|
|
|
bool bNeitherDown = !bLeftIsDown && !bRightIsDown;
|
|
|
|
|
|
2004-01-11 09:42:37 +00:00
|
|
|
|
2005-09-18 11:31:49 +00:00
|
|
|
if( bNeitherDown )
|
|
|
|
|
{
|
2005-09-18 11:41:44 +00:00
|
|
|
/* Both buttons released. */
|
2005-09-18 11:31:49 +00:00
|
|
|
m_MusicWheel.Move( 0 );
|
|
|
|
|
}
|
|
|
|
|
else if( bBothDown )
|
2004-01-11 09:42:37 +00:00
|
|
|
{
|
2005-06-12 23:43:39 +00:00
|
|
|
m_MusicWheel.Move( 0 );
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.type == IET_FIRST_PRESS )
|
2005-06-12 23:43:39 +00:00
|
|
|
{
|
2007-01-16 07:47:00 +00:00
|
|
|
if( input.MenuI == m_GameButtonPreviousSong )
|
2005-09-19 09:01:21 +00:00
|
|
|
m_MusicWheel.ChangeMusicUnlessLocked( -1 );
|
2007-01-16 07:47:00 +00:00
|
|
|
else if( input.MenuI == m_GameButtonNextSong )
|
2005-09-19 09:01:21 +00:00
|
|
|
m_MusicWheel.ChangeMusicUnlessLocked( +1 );
|
2005-06-12 23:43:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if( bLeftIsDown )
|
|
|
|
|
{
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.type != IET_RELEASE )
|
2005-06-12 23:43:39 +00:00
|
|
|
m_MusicWheel.Move( -1 );
|
|
|
|
|
}
|
|
|
|
|
else if( bRightIsDown )
|
|
|
|
|
{
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.type != IET_RELEASE )
|
2005-06-12 23:43:39 +00:00
|
|
|
m_MusicWheel.Move( +1 );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reset the repeat timer when the button is released.
|
|
|
|
|
// This fixes jumping when you release Left and Right after entering the sort
|
|
|
|
|
// code at the same if L & R aren't released at the exact same time.
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.type == IET_RELEASE )
|
2005-06-12 23:43:39 +00:00
|
|
|
{
|
2007-03-16 22:14:10 +00:00
|
|
|
INPUTMAPPER->ResetKeyRepeat( m_GameButtonPreviousSong, input.pn );
|
|
|
|
|
INPUTMAPPER->ResetKeyRepeat( m_GameButtonNextSong, input.pn );
|
2004-01-11 09:42:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-01-02 03:00:53 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-06 03:16:42 +00:00
|
|
|
if( m_SelectionState == SelectionState_SelectingSteps &&
|
|
|
|
|
input.type == IET_FIRST_PRESS &&
|
|
|
|
|
(input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong) )
|
|
|
|
|
{
|
|
|
|
|
if( input.MenuI == m_GameButtonPreviousSong )
|
|
|
|
|
{
|
|
|
|
|
if( GAMESTATE->IsAnExtraStage() )
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
else
|
|
|
|
|
ChangeDifficulty( input.pn, -1 );
|
|
|
|
|
}
|
|
|
|
|
else if( input.MenuI == m_GameButtonNextSong )
|
|
|
|
|
{
|
|
|
|
|
if( GAMESTATE->IsAnExtraStage() )
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
else
|
|
|
|
|
ChangeDifficulty( input.pn, +1 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-09-15 03:09:23 +00:00
|
|
|
if( input.type == IET_FIRST_PRESS && DetectCodes(input) )
|
2006-09-15 02:28:05 +00:00
|
|
|
return;
|
|
|
|
|
|
2006-12-08 20:28:29 +00:00
|
|
|
ScreenWithMenuElements::Input( input );
|
2006-09-15 03:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
|
|
|
|
|
{
|
2006-09-15 02:28:05 +00:00
|
|
|
if( CodeDetector::EnteredEasierDifficulty(input.GameI.controller) )
|
2002-08-20 21:00:56 +00:00
|
|
|
{
|
2006-09-15 02:28:05 +00:00
|
|
|
if( GAMESTATE->IsAnExtraStage() )
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
else
|
2006-09-15 03:09:23 +00:00
|
|
|
ChangeDifficulty( input.pn, -1 );
|
2002-09-02 21:59:58 +00:00
|
|
|
}
|
2006-09-15 03:09:23 +00:00
|
|
|
else if( CodeDetector::EnteredHarderDifficulty(input.GameI.controller) )
|
2006-09-15 02:28:05 +00:00
|
|
|
{
|
|
|
|
|
if( GAMESTATE->IsAnExtraStage() )
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
else
|
2006-09-15 03:09:23 +00:00
|
|
|
ChangeDifficulty( input.pn, +1 );
|
2006-09-15 02:28:05 +00:00
|
|
|
}
|
2006-09-15 03:09:23 +00:00
|
|
|
else if( CodeDetector::EnteredModeMenu(input.GameI.controller) )
|
2004-01-11 20:40:49 +00:00
|
|
|
{
|
2006-09-15 02:28:05 +00:00
|
|
|
if( MODE_MENU_AVAILABLE )
|
|
|
|
|
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
|
|
|
|
|
else
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
}
|
2006-09-15 03:09:23 +00:00
|
|
|
else if( CodeDetector::EnteredNextSort(input.GameI.controller) )
|
2006-09-15 02:28:05 +00:00
|
|
|
{
|
|
|
|
|
if( ( GAMESTATE->IsExtraStage() && !PREFSMAN->m_bPickExtraStage ) || GAMESTATE->IsExtraStage2() )
|
|
|
|
|
m_soundLocked.Play();
|
|
|
|
|
else
|
|
|
|
|
m_MusicWheel.NextSort();
|
2004-01-11 20:40:49 +00:00
|
|
|
}
|
2006-09-15 03:09:23 +00:00
|
|
|
else if( !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() && CodeDetector::DetectAndAdjustMusicOptions(input.GameI.controller) )
|
2006-09-15 02:28:05 +00:00
|
|
|
{
|
|
|
|
|
m_soundOptionsChange.Play();
|
2006-09-15 03:09:23 +00:00
|
|
|
MESSAGEMAN->Broadcast( ssprintf("PlayerOptionsChangedP%i", input.pn+1) );
|
2006-09-15 02:28:05 +00:00
|
|
|
MESSAGEMAN->Broadcast( "SongOptionsChanged" );
|
|
|
|
|
}
|
2006-09-15 03:09:23 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
void ScreenSelectMusic::UpdateSelectButton( PlayerNumber pn, bool bSelectIsDown )
|
2005-04-26 06:41:57 +00:00
|
|
|
{
|
2007-03-17 06:35:58 +00:00
|
|
|
if( !SELECT_MENU_AVAILABLE || !CanChangeSong() )
|
|
|
|
|
bSelectIsDown = false;
|
2005-05-04 01:08:35 +00:00
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
if( m_bSelectIsDown[pn] != bSelectIsDown )
|
|
|
|
|
{
|
|
|
|
|
m_bSelectIsDown[pn] = bSelectIsDown;
|
|
|
|
|
Message msg( bSelectIsDown ? "SelectMenuOpened" : "SelectMenuClosed" );
|
|
|
|
|
msg.SetParam( "Player", pn );
|
|
|
|
|
MESSAGEMAN->Broadcast( msg );
|
2005-04-26 06:41:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-07 04:37:47 +00:00
|
|
|
void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2004-05-07 04:37:47 +00:00
|
|
|
LOG->Trace( "ScreenSelectMusic::ChangeDifficulty( %d, %d )", pn, dir );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2004-06-03 08:22:02 +00:00
|
|
|
ASSERT( GAMESTATE->IsHumanPlayer(pn) );
|
2003-07-21 22:57:19 +00:00
|
|
|
|
2006-08-17 01:42:06 +00:00
|
|
|
if( GAMESTATE->m_pCurSong )
|
2003-07-21 22:57:19 +00:00
|
|
|
{
|
2006-08-17 01:23:25 +00:00
|
|
|
m_iSelection[pn] += dir;
|
|
|
|
|
if( CLAMP(m_iSelection[pn],0,m_vpSteps.size()-1) )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// the user explicity switched difficulties. Update the preferred difficulty
|
|
|
|
|
GAMESTATE->ChangePreferredDifficulty( pn, m_vpSteps[ m_iSelection[pn] ]->GetDifficulty() );
|
2006-08-17 01:42:06 +00:00
|
|
|
}
|
|
|
|
|
else if( GAMESTATE->m_pCurCourse )
|
|
|
|
|
{
|
2006-08-17 01:23:25 +00:00
|
|
|
m_iSelection[pn] += dir;
|
|
|
|
|
if( CLAMP(m_iSelection[pn],0,m_vpTrails.size()-1) )
|
|
|
|
|
return;
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2006-08-17 01:23:25 +00:00
|
|
|
// the user explicity switched difficulties. Update the preferred difficulty
|
|
|
|
|
GAMESTATE->ChangePreferredCourseDifficulty( pn, m_vpTrails[ m_iSelection[pn] ]->m_CourseDifficulty );
|
2006-08-17 01:42:06 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-08-17 01:23:25 +00:00
|
|
|
if( !GAMESTATE->ChangePreferredDifficulty( pn, dir ) )
|
|
|
|
|
return;
|
2004-05-07 02:53:07 +00:00
|
|
|
}
|
2006-08-17 01:19:34 +00:00
|
|
|
|
2006-08-17 01:23:25 +00:00
|
|
|
vector<PlayerNumber> vpns;
|
2007-04-01 05:53:14 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2006-08-17 01:23:25 +00:00
|
|
|
{
|
|
|
|
|
if( pn == p || GAMESTATE->DifficultiesLocked() )
|
|
|
|
|
{
|
|
|
|
|
m_iSelection[p] = m_iSelection[pn];
|
|
|
|
|
vpns.push_back( p );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AfterStepsOrTrailChange( vpns );
|
|
|
|
|
|
2007-03-16 05:11:59 +00:00
|
|
|
float fBalance = GameSoundManager::GetPlayerBalance( pn );
|
2006-08-17 01:19:34 +00:00
|
|
|
if( dir < 0 )
|
2007-03-16 05:11:59 +00:00
|
|
|
{
|
|
|
|
|
m_soundDifficultyEasier.SetProperty( "Pan", fBalance );
|
|
|
|
|
m_soundDifficultyEasier.PlayCopy();
|
|
|
|
|
}
|
2006-08-17 01:19:34 +00:00
|
|
|
else
|
2007-03-16 05:11:59 +00:00
|
|
|
{
|
|
|
|
|
m_soundDifficultyHarder.SetProperty( "Pan", fBalance );
|
|
|
|
|
m_soundDifficultyHarder.PlayCopy();
|
|
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
2005-03-23 08:48:38 +00:00
|
|
|
if( SM == SM_AllowOptionsMenuRepeat )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2003-02-10 22:10:12 +00:00
|
|
|
m_bAllowOptionsMenuRepeat = true;
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_MenuTimer )
|
|
|
|
|
{
|
2002-08-20 21:00:56 +00:00
|
|
|
if( m_MusicWheel.IsRouletting() )
|
|
|
|
|
{
|
2006-09-15 01:47:24 +00:00
|
|
|
MenuStart( InputEventPlus() );
|
2004-05-01 23:19:33 +00:00
|
|
|
m_MenuTimer->SetSeconds( 15 );
|
|
|
|
|
m_MenuTimer->Start();
|
2002-08-20 21:00:56 +00:00
|
|
|
}
|
2007-03-07 05:03:18 +00:00
|
|
|
else if( DO_ROULETTE_ON_MENU_TIMER && m_MusicWheel.GetSelectedSong() == NULL && m_MusicWheel.GetSelectedCourse() == NULL )
|
2002-08-20 21:00:56 +00:00
|
|
|
{
|
2007-03-07 05:03:18 +00:00
|
|
|
m_MusicWheel.StartRoulette();
|
|
|
|
|
m_MenuTimer->SetSeconds( 15 );
|
|
|
|
|
m_MenuTimer->Start();
|
2002-08-20 21:00:56 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-06-12 23:43:39 +00:00
|
|
|
// Finish sort changing so that the wheel can respond immediately to our
|
|
|
|
|
// request to choose random.
|
|
|
|
|
m_MusicWheel.FinishChangingSorts();
|
2006-08-17 02:47:35 +00:00
|
|
|
if( m_MusicWheel.GetSelectedSong() == NULL && m_MusicWheel.GetSelectedCourse() == NULL )
|
2004-01-11 07:18:51 +00:00
|
|
|
m_MusicWheel.StartRandom();
|
2006-08-17 02:47:35 +00:00
|
|
|
|
2006-09-15 01:47:24 +00:00
|
|
|
MenuStart( InputEventPlus() );
|
2002-08-20 21:00:56 +00:00
|
|
|
}
|
2004-05-08 06:19:14 +00:00
|
|
|
return;
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_GoToPrevScreen )
|
|
|
|
|
{
|
2003-02-02 21:49:47 +00:00
|
|
|
/* We may have stray SM_SongChanged messages from the music wheel. We can't
|
|
|
|
|
* handle them anymore, since the title menu (and attract screens) reset
|
|
|
|
|
* the game state, so just discard them. */
|
|
|
|
|
ClearMessageQueue();
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_BeginFadingOut )
|
|
|
|
|
{
|
2005-10-30 22:23:07 +00:00
|
|
|
m_bAllowOptionsMenu = false;
|
|
|
|
|
if( OPTIONS_MENU_AVAILABLE && !m_bGoToOptions )
|
|
|
|
|
this->PlayCommand( "HidePressStartForOptions" );
|
|
|
|
|
|
|
|
|
|
this->PostScreenMessage( SM_GoToNextScreen, this->GetTweenTimeLeft() );
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_GoToNextScreen )
|
|
|
|
|
{
|
2005-07-12 05:52:52 +00:00
|
|
|
if( !m_bGoToOptions )
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->StopMusic();
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_SongChanged )
|
|
|
|
|
{
|
2002-06-30 23:19:33 +00:00
|
|
|
AfterMusicChange();
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_SortOrderChanging ) /* happens immediately */
|
|
|
|
|
{
|
2006-08-16 22:17:58 +00:00
|
|
|
this->PlayCommand( "SortChange" );
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_GainFocus )
|
|
|
|
|
{
|
2004-05-22 23:57:01 +00:00
|
|
|
CodeDetector::RefreshCacheItems( CODES );
|
2005-03-23 08:48:38 +00:00
|
|
|
}
|
|
|
|
|
else if( SM == SM_LoseFocus )
|
|
|
|
|
{
|
2004-05-22 23:57:01 +00:00
|
|
|
CodeDetector::RefreshCacheItems(); /* reset for other screens */
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
2004-05-08 05:55:28 +00:00
|
|
|
|
2006-09-14 03:44:27 +00:00
|
|
|
ScreenWithMenuElements::HandleScreenMessage( SM );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-15 01:47:24 +00:00
|
|
|
void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2006-09-15 03:09:23 +00:00
|
|
|
if( input.type != IET_FIRST_PRESS )
|
|
|
|
|
return;
|
2002-09-07 09:37:27 +00:00
|
|
|
|
2007-03-18 06:26:45 +00:00
|
|
|
/* If select is being pressed, this is probably an attempt to change the sort, not
|
|
|
|
|
* to pick a song or difficulty. If it gets here, the actual select press was probably
|
|
|
|
|
* hit during a tween and ignored. Ignore it. */
|
|
|
|
|
if( input.pn != PLAYER_INVALID && INPUTMAPPER->IsBeingPressed(MENU_BUTTON_SELECT, input.pn) )
|
|
|
|
|
return;
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
switch( m_SelectionState )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2007-03-06 01:51:55 +00:00
|
|
|
DEFAULT_FAIL( m_SelectionState );
|
|
|
|
|
case SelectionState_SelectingSong:
|
|
|
|
|
|
|
|
|
|
/* If false, we don't have a selection just yet. */
|
|
|
|
|
if( !m_MusicWheel.Select() )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// a song was selected
|
|
|
|
|
if( m_MusicWheel.GetSelectedSong() != NULL )
|
2002-09-07 09:37:27 +00:00
|
|
|
{
|
2007-03-06 01:51:55 +00:00
|
|
|
const bool bIsNew = PROFILEMAN->IsSongNew( m_MusicWheel.GetSelectedSong() );
|
|
|
|
|
bool bIsHard = false;
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
{
|
|
|
|
|
if( GAMESTATE->m_pCurSteps[p] && GAMESTATE->m_pCurSteps[p]->GetMeter() >= 10 )
|
|
|
|
|
bIsHard = true;
|
|
|
|
|
}
|
2003-07-20 05:13:45 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
/* See if this song is a repeat. If we're in event mode, only check the last five songs. */
|
|
|
|
|
bool bIsRepeat = false;
|
|
|
|
|
int i = 0;
|
|
|
|
|
if( GAMESTATE->IsEventMode() )
|
|
|
|
|
i = max( 0, int(STATSMAN->m_vPlayedStageStats.size())-5 );
|
|
|
|
|
for( ; i < (int)STATSMAN->m_vPlayedStageStats.size(); ++i )
|
|
|
|
|
if( STATSMAN->m_vPlayedStageStats[i].m_vpPlayedSongs.back() == m_MusicWheel.GetSelectedSong() )
|
|
|
|
|
bIsRepeat = true;
|
|
|
|
|
|
|
|
|
|
/* Don't complain about repeats if the user didn't get to pick. */
|
|
|
|
|
if( GAMESTATE->IsExtraStage() && !PREFSMAN->m_bPickExtraStage )
|
|
|
|
|
bIsRepeat = false;
|
|
|
|
|
|
|
|
|
|
if( bIsRepeat )
|
|
|
|
|
SOUND->PlayOnceFromAnnouncer( "select music comment repeat" );
|
|
|
|
|
else if( bIsNew )
|
|
|
|
|
SOUND->PlayOnceFromAnnouncer( "select music comment new" );
|
|
|
|
|
else if( bIsHard )
|
|
|
|
|
SOUND->PlayOnceFromAnnouncer( "select music comment hard" );
|
|
|
|
|
else
|
|
|
|
|
SOUND->PlayOnceFromAnnouncer( "select music comment general" );
|
2002-09-07 09:37:27 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
/* If we're in event mode, we may have just played a course (putting us
|
|
|
|
|
* in course mode). Make sure we're in a single song mode. */
|
|
|
|
|
if( GAMESTATE->IsCourseMode() )
|
|
|
|
|
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
|
|
|
|
|
}
|
|
|
|
|
else if( m_MusicWheel.GetSelectedCourse() != NULL )
|
|
|
|
|
{
|
|
|
|
|
SOUND->PlayOnceFromAnnouncer( "select course comment general" );
|
2004-06-02 07:22:55 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
Course *pCourse = m_MusicWheel.GetSelectedCourse();
|
|
|
|
|
ASSERT( pCourse );
|
|
|
|
|
GAMESTATE->m_PlayMode.Set( pCourse->GetPlayMode() );
|
2006-08-17 02:49:54 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
// apply #LIVES
|
|
|
|
|
if( pCourse->m_iLives != -1 )
|
|
|
|
|
{
|
|
|
|
|
SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_LifeType, SongOptions::LIFE_BATTERY );
|
|
|
|
|
SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_iBatteryLives, pCourse->m_iLives );
|
|
|
|
|
}
|
|
|
|
|
if( pCourse->GetCourseType() == COURSE_TYPE_SURVIVAL)
|
|
|
|
|
SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_LifeType, SongOptions::LIFE_TIME );
|
|
|
|
|
}
|
|
|
|
|
else
|
2006-08-17 02:49:54 +00:00
|
|
|
{
|
2007-03-06 01:51:55 +00:00
|
|
|
/* We havn't made a selection yet. */
|
|
|
|
|
return;
|
2004-06-02 07:22:55 +00:00
|
|
|
}
|
2003-07-20 05:13:45 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
MESSAGEMAN->Broadcast("SongChosen");
|
|
|
|
|
|
|
|
|
|
break;
|
2006-08-31 20:56:11 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
case SelectionState_SelectingSteps:
|
2007-03-07 12:11:11 +00:00
|
|
|
{
|
|
|
|
|
PlayerNumber pn = input.pn;
|
|
|
|
|
bool bInitiatedByMenuTimer = pn == PLAYER_INVALID;
|
|
|
|
|
bool bAllOtherHumanPlayersDone = true;
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
{
|
|
|
|
|
if( p == pn )
|
|
|
|
|
continue;
|
|
|
|
|
bAllOtherHumanPlayersDone &= m_bStepsSelected[p];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bAllPlayersDoneSelectingSteps = bInitiatedByMenuTimer || bAllOtherHumanPlayersDone;
|
|
|
|
|
if( !bAllPlayersDoneSelectingSteps )
|
|
|
|
|
{
|
|
|
|
|
m_bStepsSelected[pn] = true;
|
|
|
|
|
m_soundStart.Play();
|
|
|
|
|
|
|
|
|
|
Message msg("StepsSelected");
|
|
|
|
|
msg.SetParam( "Player", pn );
|
|
|
|
|
MESSAGEMAN->Broadcast( msg );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-06 01:51:55 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2007-03-06 10:05:51 +00:00
|
|
|
|
2007-03-17 06:35:58 +00:00
|
|
|
FOREACH_ENUM( PlayerNumber, p )
|
|
|
|
|
{
|
|
|
|
|
if( !TWO_PART_SELECTION || m_SelectionState == SelectionState_SelectingSteps )
|
|
|
|
|
{
|
|
|
|
|
if( m_OptionsList[p].IsOpened() )
|
|
|
|
|
CloseOptionsList(p);
|
|
|
|
|
}
|
|
|
|
|
UpdateSelectButton( p, false );
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-06 10:05:51 +00:00
|
|
|
m_SelectionState = GetNextSelectionState();
|
|
|
|
|
m_soundStart.Play();
|
|
|
|
|
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
if( m_SelectionState == SelectionState_Finalized )
|
2003-07-20 05:13:45 +00:00
|
|
|
{
|
2007-03-07 12:11:11 +00:00
|
|
|
m_MenuTimer->Stop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
{
|
|
|
|
|
if( !m_bStepsSelected[p] )
|
|
|
|
|
{
|
|
|
|
|
m_bStepsSelected[p] = true;
|
2007-03-07 21:54:10 +00:00
|
|
|
/* Don't play start sound. We play it again below on finalized */
|
|
|
|
|
//m_soundStart.Play();
|
2007-03-07 12:11:11 +00:00
|
|
|
|
|
|
|
|
Message msg("StepsSelected");
|
|
|
|
|
msg.SetParam( "Player", p );
|
|
|
|
|
MESSAGEMAN->Broadcast( msg );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-06 10:05:51 +00:00
|
|
|
if( CommonMetrics::AUTO_SET_STYLE )
|
|
|
|
|
{
|
|
|
|
|
/* Now that Steps have been chosen, set a Style that can play them. */
|
|
|
|
|
StepsType stCurrent;
|
|
|
|
|
PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber;
|
|
|
|
|
if( GAMESTATE->IsCourseMode() )
|
|
|
|
|
stCurrent = GAMESTATE->m_pCurTrail[pn]->m_StepsType;
|
|
|
|
|
else
|
|
|
|
|
stCurrent = GAMESTATE->m_pCurSteps[pn]->m_StepsType;
|
|
|
|
|
vector<StepsType> vst;
|
|
|
|
|
const Style *pStyle = GAMEMAN->GetFirstCompatibleStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined(), stCurrent );
|
2007-03-08 06:01:11 +00:00
|
|
|
GAMESTATE->SetCurrentStyle( pStyle );
|
2007-03-06 10:05:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
/* If we're currently waiting on song assets, abort all except the music and
|
|
|
|
|
* start the music, so if we make a choice quickly before background requests
|
|
|
|
|
* come through, the music will still start. */
|
|
|
|
|
g_bCDTitleWaiting = g_bBannerWaiting = false;
|
|
|
|
|
m_BackgroundLoader.Abort();
|
|
|
|
|
CheckBackgroundRequests( true );
|
2002-09-07 09:37:27 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
if( OPTIONS_MENU_AVAILABLE )
|
|
|
|
|
{
|
|
|
|
|
// show "hold START for options"
|
|
|
|
|
this->PlayCommand( "ShowPressStartForOptions" );
|
2006-08-31 20:56:11 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
m_bAllowOptionsMenu = true;
|
2002-09-07 09:37:27 +00:00
|
|
|
|
2007-03-06 01:51:55 +00:00
|
|
|
/* Don't accept a held START for a little while, so it's not
|
|
|
|
|
* hit accidentally. Accept an initial START right away, though,
|
|
|
|
|
* so we don't ignore deliberate fast presses (which would be
|
|
|
|
|
* annoying). */
|
|
|
|
|
this->PostScreenMessage( SM_AllowOptionsMenuRepeat, 0.5f );
|
|
|
|
|
|
|
|
|
|
StartTransitioningScreen( SM_None );
|
|
|
|
|
float fTime = max( SHOW_OPTIONS_MESSAGE_SECONDS, this->GetTweenTimeLeft() );
|
|
|
|
|
this->PostScreenMessage( SM_BeginFadingOut, fTime );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
StartTransitioningScreen( SM_BeginFadingOut );
|
|
|
|
|
}
|
2002-09-07 09:37:27 +00:00
|
|
|
}
|
2007-03-07 04:18:03 +00:00
|
|
|
else // !finalized. Set the timer for selecting difficulty and mods.
|
|
|
|
|
{
|
2007-03-17 06:35:58 +00:00
|
|
|
float fSeconds = m_MenuTimer->GetSeconds();
|
|
|
|
|
if( fSeconds < 10 )
|
|
|
|
|
{
|
|
|
|
|
m_MenuTimer->SetSeconds( 10 );
|
|
|
|
|
m_MenuTimer->Start();
|
|
|
|
|
}
|
2007-03-07 04:18:03 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-15 01:47:24 +00:00
|
|
|
void ScreenSelectMusic::MenuBack( const InputEventPlus &input )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2005-03-20 06:43:47 +00:00
|
|
|
m_BackgroundLoader.Abort();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2005-03-20 06:14:41 +00:00
|
|
|
Cancel( SM_GoToPrevScreen );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
void ScreenSelectMusic::AfterStepsOrTrailChange( const vector<PlayerNumber> &vpns )
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
2005-03-29 21:30:24 +00:00
|
|
|
FOREACH_CONST( PlayerNumber, vpns, p )
|
|
|
|
|
{
|
|
|
|
|
PlayerNumber pn = *p;
|
|
|
|
|
ASSERT( GAMESTATE->IsHumanPlayer(pn) );
|
|
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
if( GAMESTATE->m_pCurSong )
|
|
|
|
|
{
|
|
|
|
|
CLAMP( m_iSelection[pn], 0, m_vpSteps.size()-1 );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
Song* pSong = GAMESTATE->m_pCurSong;
|
|
|
|
|
Steps* pSteps = m_vpSteps.empty()? NULL: m_vpSteps[m_iSelection[pn]];
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
|
|
|
|
GAMESTATE->m_pCurTrail[pn].Set( NULL );
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
int iScore = 0;
|
|
|
|
|
if( pSteps )
|
|
|
|
|
{
|
|
|
|
|
const Profile *pProfile = PROFILEMAN->IsPersistentProfile(pn) ? PROFILEMAN->GetProfile(pn) : PROFILEMAN->GetMachineProfile();
|
|
|
|
|
iScore = pProfile->GetStepsHighScoreList(pSong,pSteps).GetTopScore().GetScore();
|
|
|
|
|
}
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
|
|
|
|
}
|
|
|
|
|
else
|
2006-08-17 01:25:09 +00:00
|
|
|
{
|
2006-08-17 01:22:20 +00:00
|
|
|
CLAMP( m_iSelection[pn], 0, m_vpTrails.size()-1 );
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
|
|
|
|
Trail* pTrail = m_vpTrails.empty()? NULL: m_vpTrails[m_iSelection[pn]];
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
GAMESTATE->m_pCurSteps[pn].Set( NULL );
|
|
|
|
|
GAMESTATE->m_pCurTrail[pn].Set( pTrail );
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
int iScore = 0;
|
|
|
|
|
if( pTrail )
|
|
|
|
|
{
|
|
|
|
|
const Profile *pProfile = PROFILEMAN->IsPersistentProfile(pn) ? PROFILEMAN->GetProfile(pn) : PROFILEMAN->GetMachineProfile();
|
|
|
|
|
iScore = pProfile->GetCourseHighScoreList(pCourse,pTrail).GetTopScore().GetScore();
|
|
|
|
|
}
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
2005-03-29 21:30:24 +00:00
|
|
|
}
|
2004-06-03 08:22:02 +00:00
|
|
|
}
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-06-03 21:41:54 +00:00
|
|
|
void ScreenSelectMusic::SwitchToPreferredDifficulty()
|
2003-06-25 06:30:13 +00:00
|
|
|
{
|
2004-06-03 21:41:54 +00:00
|
|
|
if( !GAMESTATE->m_pCurCourse )
|
2003-06-25 06:30:13 +00:00
|
|
|
{
|
2004-06-03 21:41:54 +00:00
|
|
|
FOREACH_HumanPlayer( pn )
|
2003-06-25 06:30:13 +00:00
|
|
|
{
|
2004-06-03 21:41:54 +00:00
|
|
|
/* Find the closest match to the user's preferred difficulty. */
|
2006-04-05 01:01:01 +00:00
|
|
|
int iCurDifference = -1;
|
2006-04-05 01:16:45 +00:00
|
|
|
int &iSelection = m_iSelection[pn];
|
2004-06-03 21:41:54 +00:00
|
|
|
for( unsigned i=0; i<m_vpSteps.size(); i++ )
|
2003-06-25 06:30:13 +00:00
|
|
|
{
|
2006-04-05 01:16:45 +00:00
|
|
|
/* If the current steps are listed, use them. */
|
|
|
|
|
if( GAMESTATE->m_pCurSteps[pn] == m_vpSteps[i] )
|
|
|
|
|
{
|
|
|
|
|
iSelection = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-07 04:39:48 +00:00
|
|
|
if( GAMESTATE->m_PreferredDifficulty[pn] != Difficulty_Invalid )
|
2004-06-03 21:41:54 +00:00
|
|
|
{
|
2006-07-14 20:26:11 +00:00
|
|
|
int iDiff = abs(m_vpSteps[i]->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[pn]);
|
|
|
|
|
|
|
|
|
|
if( iCurDifference == -1 || iDiff < iCurDifference )
|
|
|
|
|
{
|
|
|
|
|
iSelection = i;
|
|
|
|
|
iCurDifference = iDiff;
|
|
|
|
|
}
|
2004-06-03 21:41:54 +00:00
|
|
|
}
|
2003-06-25 06:30:13 +00:00
|
|
|
}
|
2004-06-03 21:41:54 +00:00
|
|
|
|
2006-04-05 01:16:45 +00:00
|
|
|
CLAMP( iSelection, 0, m_vpSteps.size()-1 );
|
2003-06-25 06:30:13 +00:00
|
|
|
}
|
2004-06-03 21:41:54 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FOREACH_HumanPlayer( pn )
|
|
|
|
|
{
|
|
|
|
|
/* Find the closest match to the user's preferred difficulty. */
|
2006-04-05 01:01:01 +00:00
|
|
|
int iCurDifference = -1;
|
2006-04-05 01:16:45 +00:00
|
|
|
int &iSelection = m_iSelection[pn];
|
2004-06-03 21:41:54 +00:00
|
|
|
for( unsigned i=0; i<m_vpTrails.size(); i++ )
|
|
|
|
|
{
|
2006-04-05 01:16:45 +00:00
|
|
|
/* If the current trail is listed, use it. */
|
|
|
|
|
if( GAMESTATE->m_pCurTrail[pn] == m_vpTrails[i] )
|
|
|
|
|
{
|
|
|
|
|
iSelection = i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-05 01:01:01 +00:00
|
|
|
int iDiff = abs(m_vpTrails[i]->m_CourseDifficulty - GAMESTATE->m_PreferredCourseDifficulty[pn]);
|
2003-06-25 06:30:13 +00:00
|
|
|
|
2006-04-05 01:01:01 +00:00
|
|
|
if( iCurDifference == -1 || iDiff < iCurDifference )
|
2004-06-03 21:41:54 +00:00
|
|
|
{
|
2006-04-05 01:16:45 +00:00
|
|
|
iSelection = i;
|
2006-04-05 01:01:01 +00:00
|
|
|
iCurDifference = iDiff;
|
2004-06-03 21:41:54 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-05 01:16:45 +00:00
|
|
|
CLAMP( iSelection, 0, m_vpTrails.size()-1 );
|
2004-06-03 21:41:54 +00:00
|
|
|
}
|
2003-06-25 06:30:13 +00:00
|
|
|
}
|
2006-08-17 01:28:56 +00:00
|
|
|
|
|
|
|
|
if( GAMESTATE->DifficultiesLocked() )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_HumanPlayer( p )
|
|
|
|
|
m_iSelection[p] = m_iSelection[GAMESTATE->m_MasterPlayerNumber];
|
|
|
|
|
}
|
2003-06-25 06:30:13 +00:00
|
|
|
}
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
void ScreenSelectMusic::AfterMusicChange()
|
|
|
|
|
{
|
2003-07-30 21:49:21 +00:00
|
|
|
if( !m_MusicWheel.IsRouletting() )
|
2004-05-01 23:19:33 +00:00
|
|
|
m_MenuTimer->Stall();
|
2002-08-20 21:00:56 +00:00
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
Song* pSong = m_MusicWheel.GetSelectedSong();
|
2005-02-24 12:27:30 +00:00
|
|
|
GAMESTATE->m_pCurSong.Set( pSong );
|
2004-05-21 20:16:13 +00:00
|
|
|
if( pSong )
|
2004-05-26 05:50:22 +00:00
|
|
|
GAMESTATE->m_pPreferredSong = pSong;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-07-20 05:13:45 +00:00
|
|
|
Course* pCourse = m_MusicWheel.GetSelectedCourse();
|
2005-05-18 07:14:19 +00:00
|
|
|
GAMESTATE->m_pCurCourse.Set( pCourse );
|
2003-07-20 05:13:45 +00:00
|
|
|
if( pCourse )
|
2004-05-26 05:50:22 +00:00
|
|
|
GAMESTATE->m_pPreferredCourse = pCourse;
|
|
|
|
|
|
2006-04-05 01:07:53 +00:00
|
|
|
m_vpSteps.clear();
|
|
|
|
|
m_vpTrails.clear();
|
|
|
|
|
|
2003-06-11 01:48:25 +00:00
|
|
|
m_Banner.SetMovingFast( !!m_MusicWheel.IsMoving() );
|
2003-01-02 03:00:53 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
vector<RString> m_Artists, m_AltArtists;
|
2003-07-15 03:21:50 +00:00
|
|
|
|
2004-08-15 23:16:30 +00:00
|
|
|
m_sSampleMusicToPlay = "";
|
|
|
|
|
m_pSampleMusicTimingData = NULL;
|
2004-09-08 02:53:54 +00:00
|
|
|
g_sCDTitlePath = "";
|
|
|
|
|
g_sBannerPath = "";
|
|
|
|
|
g_bWantFallbackCdTitle = false;
|
|
|
|
|
bool bWantBanner = true;
|
|
|
|
|
|
2006-10-07 04:25:28 +00:00
|
|
|
static SortOrder s_lastSortOrder = SortOrder_Invalid;
|
2005-04-29 08:18:44 +00:00
|
|
|
if( GAMESTATE->m_SortOrder != s_lastSortOrder )
|
2005-04-15 07:18:40 +00:00
|
|
|
{
|
|
|
|
|
// Reload to let Lua metrics have a chance to change the help text.
|
2005-04-29 08:18:44 +00:00
|
|
|
s_lastSortOrder = GAMESTATE->m_SortOrder;
|
2005-04-15 07:18:40 +00:00
|
|
|
}
|
|
|
|
|
|
2002-05-20 08:59:37 +00:00
|
|
|
switch( m_MusicWheel.GetSelectedType() )
|
|
|
|
|
{
|
|
|
|
|
case TYPE_SECTION:
|
2003-06-16 17:28:58 +00:00
|
|
|
case TYPE_SORT:
|
2006-08-17 02:07:00 +00:00
|
|
|
case TYPE_ROULETTE:
|
|
|
|
|
case TYPE_RANDOM:
|
2006-08-17 02:04:21 +00:00
|
|
|
FOREACH_PlayerNumber( p )
|
|
|
|
|
m_iSelection[p] = -1;
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2006-08-17 02:04:21 +00:00
|
|
|
g_sCDTitlePath = ""; // none
|
2003-04-21 22:26:07 +00:00
|
|
|
|
2006-08-17 02:04:21 +00:00
|
|
|
m_fSampleStartSeconds = 0;
|
|
|
|
|
m_fSampleLengthSeconds = -1;
|
2004-05-22 22:56:58 +00:00
|
|
|
|
2006-08-17 02:04:21 +00:00
|
|
|
switch( m_MusicWheel.GetSelectedType() )
|
|
|
|
|
{
|
|
|
|
|
case TYPE_SECTION:
|
|
|
|
|
g_sBannerPath = SONGMAN->GetSongGroupBannerPath( m_MusicWheel.GetSelectedSection() );
|
|
|
|
|
m_sSampleMusicToPlay = m_sSectionMusicPath;
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_SORT:
|
|
|
|
|
bWantBanner = false; /* we load it ourself */
|
|
|
|
|
m_Banner.LoadMode();
|
|
|
|
|
m_sSampleMusicToPlay = m_sSortMusicPath;
|
|
|
|
|
break;
|
2006-08-17 02:07:00 +00:00
|
|
|
case TYPE_ROULETTE:
|
|
|
|
|
bWantBanner = false; /* we load it ourself */
|
|
|
|
|
m_Banner.LoadRoulette();
|
|
|
|
|
m_sSampleMusicToPlay = m_sRouletteMusicPath;
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_RANDOM:
|
|
|
|
|
bWantBanner = false; /* we load it ourself */
|
|
|
|
|
m_Banner.LoadRandom();
|
|
|
|
|
m_sSampleMusicToPlay = m_sRandomMusicPath;
|
|
|
|
|
break;
|
2006-08-17 02:04:21 +00:00
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_SONG:
|
2004-06-02 05:12:45 +00:00
|
|
|
case TYPE_PORTAL:
|
2006-08-17 02:08:38 +00:00
|
|
|
m_sSampleMusicToPlay = pSong->GetMusicPath();
|
|
|
|
|
m_pSampleMusicTimingData = &pSong->m_Timing;
|
|
|
|
|
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
|
|
|
|
|
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
|
2002-10-02 16:56:09 +00:00
|
|
|
|
2007-03-06 08:06:26 +00:00
|
|
|
SongUtil::GetPlayableSteps( pSong, m_vpSteps );
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2006-08-17 02:08:38 +00:00
|
|
|
if ( PREFSMAN->m_bShowBanners )
|
|
|
|
|
g_sBannerPath = pSong->GetBannerPath();
|
2002-08-13 23:26:46 +00:00
|
|
|
|
2006-08-17 02:08:38 +00:00
|
|
|
g_sCDTitlePath = pSong->GetCDTitlePath();
|
|
|
|
|
g_bWantFallbackCdTitle = true;
|
2003-05-20 05:31:38 +00:00
|
|
|
|
2006-08-17 02:08:38 +00:00
|
|
|
SwitchToPreferredDifficulty();
|
2003-03-13 23:45:52 +00:00
|
|
|
break;
|
2006-08-17 02:08:38 +00:00
|
|
|
|
2003-07-20 05:13:45 +00:00
|
|
|
case TYPE_COURSE:
|
|
|
|
|
{
|
|
|
|
|
Course* pCourse = m_MusicWheel.GetSelectedCourse();
|
2004-06-28 07:26:00 +00:00
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
2004-06-04 02:05:56 +00:00
|
|
|
Trail *pTrail = pCourse->GetTrail( st );
|
2004-06-03 21:41:54 +00:00
|
|
|
ASSERT( pTrail );
|
2003-07-20 05:13:45 +00:00
|
|
|
|
2004-06-28 07:26:00 +00:00
|
|
|
pCourse->GetTrails( m_vpTrails, GAMESTATE->GetCurrentStyle()->m_StepsType );
|
2004-06-03 08:22:02 +00:00
|
|
|
|
2005-03-08 06:48:31 +00:00
|
|
|
m_sSampleMusicToPlay = m_sCourseMusicPath;
|
2004-04-02 04:27:42 +00:00
|
|
|
m_fSampleStartSeconds = 0;
|
|
|
|
|
m_fSampleLengthSeconds = -1;
|
|
|
|
|
|
2004-09-08 02:53:54 +00:00
|
|
|
g_sBannerPath = pCourse->m_sBannerPath;
|
|
|
|
|
if( g_sBannerPath.empty() )
|
|
|
|
|
m_Banner.LoadFallback();
|
|
|
|
|
|
2004-06-03 21:41:54 +00:00
|
|
|
SwitchToPreferredDifficulty();
|
2003-07-20 05:13:45 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2003-03-13 23:45:52 +00:00
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-08 02:53:54 +00:00
|
|
|
m_sprCDTitleFront.UnloadTexture();
|
|
|
|
|
m_sprCDTitleBack.UnloadTexture();
|
|
|
|
|
|
2004-10-16 17:53:47 +00:00
|
|
|
/* Cancel any previous, incomplete requests for song assets, since we need new ones. */
|
2004-09-08 02:53:54 +00:00
|
|
|
m_BackgroundLoader.Abort();
|
|
|
|
|
|
|
|
|
|
g_bCDTitleWaiting = false;
|
|
|
|
|
if( !g_sCDTitlePath.empty() || g_bWantFallbackCdTitle )
|
|
|
|
|
{
|
|
|
|
|
LOG->Trace( "cache \"%s\"", g_sCDTitlePath.c_str());
|
|
|
|
|
m_BackgroundLoader.CacheFile( g_sCDTitlePath ); // empty OK
|
|
|
|
|
g_bCDTitleWaiting = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_bBannerWaiting = false;
|
|
|
|
|
if( bWantBanner )
|
|
|
|
|
{
|
|
|
|
|
LOG->Trace("LoadFromCachedBanner(%s)",g_sBannerPath .c_str());
|
|
|
|
|
if( m_Banner.LoadFromCachedBanner( g_sBannerPath ) )
|
|
|
|
|
{
|
2005-03-08 01:39:32 +00:00
|
|
|
/* If the high-res banner is already loaded, just
|
|
|
|
|
* delay before loading it, so the low-res one has
|
|
|
|
|
* time to fade in. */
|
|
|
|
|
if( !TEXTUREMAN->IsTextureRegistered( Sprite::SongBannerTexture(g_sBannerPath) ) )
|
|
|
|
|
m_BackgroundLoader.CacheFile( g_sBannerPath );
|
|
|
|
|
|
2004-09-08 02:53:54 +00:00
|
|
|
g_bBannerWaiting = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-11-25 18:25:43 +00:00
|
|
|
|
2003-07-15 03:21:50 +00:00
|
|
|
// Don't stop music if it's already playing the right file.
|
2004-09-08 02:53:54 +00:00
|
|
|
g_bSampleMusicWaiting = false;
|
|
|
|
|
if( !m_MusicWheel.IsRouletting() && SOUND->GetMusicPath() != m_sSampleMusicToPlay )
|
2003-07-15 03:21:50 +00:00
|
|
|
{
|
2003-07-26 23:05:16 +00:00
|
|
|
SOUND->StopMusic();
|
2004-09-08 02:53:54 +00:00
|
|
|
if( !m_sSampleMusicToPlay.empty() )
|
|
|
|
|
g_bSampleMusicWaiting = true;
|
2003-07-15 03:21:50 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-08 02:53:54 +00:00
|
|
|
g_StartedLoadingAt.Touch();
|
|
|
|
|
|
2005-03-29 21:30:24 +00:00
|
|
|
vector<PlayerNumber> vpns;
|
2004-06-03 08:22:02 +00:00
|
|
|
FOREACH_HumanPlayer( p )
|
2005-03-29 21:30:24 +00:00
|
|
|
vpns.push_back( p );
|
|
|
|
|
|
2006-08-17 01:22:20 +00:00
|
|
|
AfterStepsOrTrailChange( vpns );
|
2002-05-20 08:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
2007-03-07 05:03:18 +00:00
|
|
|
void ScreenSelectMusic::OpenOptionsList( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
m_OptionsList[pn].Open();
|
2007-03-07 20:36:34 +00:00
|
|
|
Message msg("OptionsListOpened");
|
2007-03-07 05:03:18 +00:00
|
|
|
msg.SetParam( "Player", pn );
|
|
|
|
|
MESSAGEMAN->Broadcast( msg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenSelectMusic::CloseOptionsList( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
m_OptionsList[pn].Close();
|
2007-03-07 20:36:34 +00:00
|
|
|
Message msg("OptionsListClosed");
|
2007-03-07 05:03:18 +00:00
|
|
|
msg.SetParam( "Player", pn );
|
|
|
|
|
MESSAGEMAN->Broadcast( msg );
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-12 05:52:52 +00:00
|
|
|
// lua start
|
|
|
|
|
#include "LuaBinding.h"
|
|
|
|
|
|
|
|
|
|
class LunaScreenSelectMusic: public Luna<ScreenSelectMusic>
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
static int GetGoToOptions( T* p, lua_State *L ) { lua_pushboolean( L, p->GetGoToOptions() ); return 1; }
|
2006-09-27 19:47:52 +00:00
|
|
|
|
|
|
|
|
LunaScreenSelectMusic()
|
2005-07-12 05:52:52 +00:00
|
|
|
{
|
2006-09-27 19:47:52 +00:00
|
|
|
ADD_METHOD( GetGoToOptions );
|
2005-07-12 05:52:52 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LUA_REGISTER_DERIVED_CLASS( ScreenSelectMusic, ScreenWithMenuElements )
|
|
|
|
|
// lua end
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|