2010-01-26 21:00:30 -06:00
|
|
|
#include "global.h"
|
|
|
|
|
|
|
|
|
|
#if !defined(WITHOUT_NETWORKING)
|
|
|
|
|
#include "ScreenNetSelectMusic.h"
|
|
|
|
|
#include "ScreenManager.h"
|
|
|
|
|
#include "GameSoundManager.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "GameState.h"
|
2011-02-08 04:04:59 -06:00
|
|
|
#include "CodeDetector.h"
|
2010-01-26 21:00:30 -06:00
|
|
|
#include "Style.h"
|
|
|
|
|
#include "Steps.h"
|
|
|
|
|
#include "RageTimer.h"
|
|
|
|
|
#include "ActorUtil.h"
|
|
|
|
|
#include "AnnouncerManager.h"
|
|
|
|
|
#include "MenuTimer.h"
|
|
|
|
|
#include "NetworkSyncManager.h"
|
|
|
|
|
#include "StepsUtil.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "MusicWheel.h"
|
|
|
|
|
#include "InputMapper.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "Song.h"
|
|
|
|
|
#include "InputEventPlus.h"
|
|
|
|
|
#include "SongUtil.h"
|
|
|
|
|
#include "RageInput.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
|
|
|
|
|
AutoScreenMessage( SM_NoSongs )
|
|
|
|
|
AutoScreenMessage( SM_ChangeSong )
|
|
|
|
|
AutoScreenMessage( SM_SMOnlinePack )
|
|
|
|
|
AutoScreenMessage( SM_SetWheelSong )
|
|
|
|
|
AutoScreenMessage( SM_RefreshWheelLocation )
|
|
|
|
|
AutoScreenMessage( SM_SongChanged )
|
|
|
|
|
AutoScreenMessage( SM_UsersUpdate )
|
|
|
|
|
AutoScreenMessage( SM_BackFromPlayerOptions )
|
|
|
|
|
|
|
|
|
|
REGISTER_SCREEN_CLASS( ScreenNetSelectMusic );
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::Init()
|
|
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
// Finish any previous stage. It's OK to call this when we haven't played a stage yet.
|
2010-01-26 21:00:30 -06:00
|
|
|
GAMESTATE->FinishStage();
|
|
|
|
|
|
|
|
|
|
ScreenNetSelectBase::Init();
|
|
|
|
|
|
2010-08-10 23:36:04 -05:00
|
|
|
SAMPLE_MUSIC_PREVIEW_MODE.Load( m_sName, "SampleMusicPreviewMode" );
|
2011-02-08 04:04:59 -06:00
|
|
|
CODES.Load( m_sName, "Codes" );
|
2010-08-10 23:36:04 -05:00
|
|
|
|
2010-01-26 21:00:30 -06:00
|
|
|
FOREACH_EnabledPlayer (p)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) );
|
|
|
|
|
m_DifficultyIcon[p].Load( THEME->GetPathG( "ScreenSelectMusic",
|
|
|
|
|
ssprintf("difficulty icons 1x%d",
|
|
|
|
|
NUM_Difficulty)) );
|
|
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_DifficultyIcon[p] );
|
|
|
|
|
this->AddChild( &m_DifficultyIcon[p] );
|
|
|
|
|
ON_COMMAND( m_DifficultyIcon[p] );
|
|
|
|
|
*/
|
2011-02-08 04:04:59 -06:00
|
|
|
m_Difficulty[p] = GAMESTATE->m_PreferredDifficulty[p];
|
2010-01-26 21:00:30 -06:00
|
|
|
|
|
|
|
|
m_StepsDisplays[p].SetName( ssprintf("StepsDisplayP%d",p+1) );
|
2010-12-26 11:36:46 -06:00
|
|
|
m_StepsDisplays[p].Load( "StepsDisplayNet", NULL );
|
2010-01-26 21:00:30 -06:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_StepsDisplays[p] );
|
|
|
|
|
this->AddChild( &m_StepsDisplays[p] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_MusicWheel.SetName( "MusicWheel" );
|
2010-08-10 23:36:04 -05:00
|
|
|
m_MusicWheel.Load( "OnlineMusicWheel" );
|
2010-01-26 21:00:30 -06:00
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY( m_MusicWheel );
|
|
|
|
|
m_MusicWheel.BeginScreen();
|
|
|
|
|
ON_COMMAND( m_MusicWheel );
|
|
|
|
|
this->AddChild( &m_MusicWheel );
|
|
|
|
|
this->MoveToHead( &m_MusicWheel );
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
// todo: handle me theme-side -aj
|
2010-01-26 21:00:30 -06:00
|
|
|
m_BPMDisplay.SetName( "BPMDisplay" );
|
|
|
|
|
m_BPMDisplay.LoadFromFont( THEME->GetPathF("BPMDisplay","bpm") );
|
|
|
|
|
m_BPMDisplay.Load();
|
|
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_BPMDisplay );
|
|
|
|
|
this->AddChild( &m_BPMDisplay );
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
// todo: handle me theme-side -aj
|
2010-01-26 21:00:30 -06:00
|
|
|
FOREACH_EnabledPlayer( p )
|
|
|
|
|
{
|
|
|
|
|
m_ModIconRow[p].SetName( ssprintf("ModIconsP%d",p+1) );
|
|
|
|
|
m_ModIconRow[p].Load( "ModIconRowSelectMusic", p );
|
|
|
|
|
m_ModIconRow[p].SetFromGameState();
|
|
|
|
|
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_ModIconRow[p] );
|
|
|
|
|
this->AddChild( &m_ModIconRow[p] );
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-10 23:36:04 -05:00
|
|
|
// Load SFX and music
|
2010-01-26 21:00:30 -06:00
|
|
|
m_soundChangeOpt.Load( THEME->GetPathS(m_sName,"change opt") );
|
|
|
|
|
m_soundChangeSel.Load( THEME->GetPathS(m_sName,"change sel") );
|
2010-08-10 23:36:04 -05:00
|
|
|
m_sSectionMusicPath = THEME->GetPathS(m_sName,"section music");
|
|
|
|
|
m_sRouletteMusicPath = THEME->GetPathS(m_sName,"roulette music");
|
|
|
|
|
m_sRandomMusicPath = THEME->GetPathS(m_sName,"random music");
|
2010-01-26 21:00:30 -06:00
|
|
|
|
|
|
|
|
NSMAN->ReportNSSOnOff(1);
|
|
|
|
|
NSMAN->ReportPlayerOptions();
|
|
|
|
|
|
|
|
|
|
m_bInitialSelect = false;
|
|
|
|
|
m_bAllowInput = false;
|
2011-02-08 04:04:59 -06:00
|
|
|
|
|
|
|
|
ZERO( m_iSelection );
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::Input( const InputEventPlus &input )
|
|
|
|
|
{
|
|
|
|
|
if( !m_bAllowInput || IsTransitioning() )
|
|
|
|
|
return;
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( input.type == IET_RELEASE )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
m_MusicWheel.Move(0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool bHoldingCtrl =
|
|
|
|
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
|
|
|
|
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL)) ||
|
2011-02-08 01:47:43 -06:00
|
|
|
(!NSMAN->useSMserver); //If we are disconnected, assume no chatting
|
2010-01-26 21:00:30 -06:00
|
|
|
|
|
|
|
|
wchar_t c = INPUTMAN->DeviceInputToChar(input.DeviceI,false);
|
|
|
|
|
MakeUpper( &c, 1 );
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
// Ctrl+[A-Z] to go to that letter of the alphabet
|
|
|
|
|
if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
SortOrder so = GAMESTATE->m_SortOrder;
|
2011-02-08 01:47:43 -06:00
|
|
|
if( ( so != SORT_TITLE ) && ( so != SORT_ARTIST ) )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
so = SORT_TITLE;
|
|
|
|
|
|
|
|
|
|
GAMESTATE->m_PreferredSortOrder = so;
|
|
|
|
|
GAMESTATE->m_SortOrder.Set( so );
|
2011-02-08 01:47:43 -06:00
|
|
|
// Odd, changing the sort order requires us to call SetOpenSection more than once
|
2010-01-26 21:00:30 -06:00
|
|
|
m_MusicWheel.ChangeSort( so );
|
|
|
|
|
m_MusicWheel.SetOpenSection( ssprintf("%c", c ) );
|
|
|
|
|
}
|
|
|
|
|
m_MusicWheel.SelectSection( ssprintf("%c", c ) );
|
|
|
|
|
m_MusicWheel.ChangeSort( so );
|
|
|
|
|
m_MusicWheel.SetOpenSection( ssprintf("%c", c ) );
|
|
|
|
|
m_MusicWheel.Move(+1);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
// todo: handle input here instead of in Menu* functions -aj
|
|
|
|
|
if( input.MenuI == GAME_BUTTON_SELECT && input.type != IET_REPEAT )
|
|
|
|
|
{
|
|
|
|
|
NSMAN->ReportNSSOnOff(3);
|
|
|
|
|
GAMESTATE->m_EditMode = EditMode_Full;
|
|
|
|
|
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// handle CodeDetector
|
|
|
|
|
if( input.type == IET_FIRST_PRESS && DetectCodes(input) )
|
|
|
|
|
return;
|
|
|
|
|
|
2010-01-26 21:00:30 -06:00
|
|
|
ScreenNetSelectBase::Input( input );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
if( SM == SM_GoToPrevScreen )
|
|
|
|
|
{
|
|
|
|
|
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "PrevScreen") );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_GoToNextScreen )
|
|
|
|
|
{
|
|
|
|
|
SOUND->StopMusic();
|
|
|
|
|
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "NextScreen") );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_UsersUpdate )
|
|
|
|
|
{
|
|
|
|
|
m_MusicWheel.Move( 0 );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_NoSongs )
|
|
|
|
|
{
|
|
|
|
|
SCREENMAN->SetNewScreen( THEME->GetMetric (m_sName, "NoSongsScreen") );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_ChangeSong )
|
|
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
/* First check to see if this song is already selected. This is so that
|
|
|
|
|
* if you have multiple copies of the "same" song, you can choose which
|
|
|
|
|
* copy to play. */
|
2010-01-26 21:00:30 -06:00
|
|
|
Song* CurSong = m_MusicWheel.GetSelectedSong();
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if(CurSong != NULL )
|
2010-01-26 21:00:30 -06:00
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( ( !CurSong->GetTranslitArtist().CompareNoCase( NSMAN->m_sArtist ) ) &&
|
2010-01-26 21:00:30 -06:00
|
|
|
( !CurSong->GetTranslitMainTitle().CompareNoCase( NSMAN->m_sMainTitle ) ) &&
|
|
|
|
|
( !CurSong->GetTranslitSubTitle().CompareNoCase( NSMAN->m_sSubTitle ) ) )
|
|
|
|
|
{
|
|
|
|
|
switch ( NSMAN->m_iSelectMode )
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
case 1:
|
|
|
|
|
NSMAN->m_iSelectMode = 0;
|
|
|
|
|
NSMAN->SelectUserSong();
|
|
|
|
|
break;
|
|
|
|
|
case 2: //Proper starting of song
|
|
|
|
|
case 3: //Blind starting of song
|
|
|
|
|
StartSelectedSong();
|
|
|
|
|
goto done;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector <Song *> AllSongs = SONGMAN->GetAllSongs();
|
|
|
|
|
unsigned i;
|
|
|
|
|
for( i=0; i < AllSongs.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
m_cSong = AllSongs[i];
|
2011-02-08 01:47:43 -06:00
|
|
|
if( ( !m_cSong->GetTranslitArtist().CompareNoCase( NSMAN->m_sArtist ) ) &&
|
2010-01-26 21:00:30 -06:00
|
|
|
( !m_cSong->GetTranslitMainTitle().CompareNoCase( NSMAN->m_sMainTitle ) ) &&
|
|
|
|
|
( !m_cSong->GetTranslitSubTitle().CompareNoCase( NSMAN->m_sSubTitle ) ) )
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool haveSong = i != AllSongs.size();
|
|
|
|
|
|
|
|
|
|
switch (NSMAN->m_iSelectMode)
|
|
|
|
|
{
|
|
|
|
|
case 3:
|
|
|
|
|
StartSelectedSong();
|
|
|
|
|
break;
|
|
|
|
|
case 2: //We need to do cmd 1 as well here
|
2011-02-08 01:47:43 -06:00
|
|
|
if(haveSong)
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if(!m_MusicWheel.SelectSong( m_cSong ) )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
m_MusicWheel.ChangeSort( SORT_GROUP );
|
|
|
|
|
m_MusicWheel.FinishTweening();
|
|
|
|
|
SCREENMAN->PostMessageToTopScreen( SM_SetWheelSong, 0.710f );
|
|
|
|
|
}
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
m_MusicWheel.Move(-1);
|
|
|
|
|
m_MusicWheel.Move(1);
|
|
|
|
|
StartSelectedSong();
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1: //Scroll to song as well
|
2011-02-08 01:47:43 -06:00
|
|
|
if(haveSong)
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if(!m_MusicWheel.SelectSong( m_cSong ) )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
//m_MusicWheel.ChangeSort( SORT_GROUP );
|
|
|
|
|
//m_MusicWheel.FinishTweening();
|
|
|
|
|
//SCREENMAN->PostMessageToTopScreen( SM_SetWheelSong, 0.710f );
|
|
|
|
|
m_MusicWheel.ChangeSort( SORT_GROUP );
|
|
|
|
|
m_MusicWheel.SetOpenSection( "" );
|
|
|
|
|
}
|
|
|
|
|
m_MusicWheel.SelectSong( m_cSong );
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
m_MusicWheel.Move(-1);
|
|
|
|
|
m_MusicWheel.Move(1);
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
}
|
|
|
|
|
//don't break here
|
|
|
|
|
case 0: //See if client has song
|
2011-02-08 01:47:43 -06:00
|
|
|
if(haveSong)
|
2010-01-26 21:00:30 -06:00
|
|
|
NSMAN->m_iSelectMode = 0;
|
|
|
|
|
else
|
|
|
|
|
NSMAN->m_iSelectMode = 1;
|
|
|
|
|
NSMAN->SelectUserSong();
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-08 01:47:43 -06:00
|
|
|
else if( SM == SM_SetWheelSong ) // After we're done the sort on wheel, select song.
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
m_MusicWheel.SelectSong( m_cSong );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_RefreshWheelLocation )
|
|
|
|
|
{
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
m_MusicWheel.Move(-1);
|
|
|
|
|
m_MusicWheel.Move(1);
|
|
|
|
|
m_MusicWheel.Select();
|
|
|
|
|
m_bAllowInput = true;
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_BackFromPlayerOptions )
|
|
|
|
|
{
|
2010-08-10 23:36:04 -05:00
|
|
|
// XXX HACK: This will cause ScreenSelectOptions to go back here.
|
2010-01-26 21:00:30 -06:00
|
|
|
NSMAN->ReportNSSOnOff(1);
|
|
|
|
|
GAMESTATE->m_EditMode = EditMode_Invalid;
|
|
|
|
|
NSMAN->ReportPlayerOptions();
|
|
|
|
|
|
2010-08-10 23:36:04 -05:00
|
|
|
// Update changes
|
2010-01-26 21:00:30 -06:00
|
|
|
FOREACH_EnabledPlayer(p)
|
|
|
|
|
m_ModIconRow[p].SetFromGameState();
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_SongChanged )
|
|
|
|
|
{
|
|
|
|
|
GAMESTATE->m_pCurSong.Set( m_MusicWheel.GetSelectedSong() );
|
|
|
|
|
MusicChanged();
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_SMOnlinePack )
|
|
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if( NSMAN->m_SMOnlinePacket.Read1() == 1 )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
switch ( NSMAN->m_SMOnlinePacket.Read1() )
|
|
|
|
|
{
|
2010-08-10 23:36:04 -05:00
|
|
|
case 0: // Room title Change
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
RString titleSub;
|
|
|
|
|
titleSub = NSMAN->m_SMOnlinePacket.ReadNT() + "\n";
|
|
|
|
|
titleSub += NSMAN->m_SMOnlinePacket.ReadNT();
|
2011-02-08 01:47:43 -06:00
|
|
|
if( NSMAN->m_SMOnlinePacket.Read1() != 1 )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
RString SMOnlineSelectScreen = THEME->GetMetric( m_sName, "RoomSelectScreen" );
|
|
|
|
|
SCREENMAN->SetNewScreen( SMOnlineSelectScreen );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-08 04:04:59 -06:00
|
|
|
else if( SM == SM_GainFocus )
|
|
|
|
|
{
|
|
|
|
|
CodeDetector::RefreshCacheItems( CODES );
|
|
|
|
|
}
|
|
|
|
|
else if( SM == SM_LoseFocus )
|
|
|
|
|
{
|
|
|
|
|
CodeDetector::RefreshCacheItems(); // reset for other screens
|
|
|
|
|
}
|
2010-01-26 21:00:30 -06:00
|
|
|
|
|
|
|
|
done:
|
2010-08-10 23:36:04 -05:00
|
|
|
// Must be at end, as so it is last resort for SMOnline packets.
|
|
|
|
|
// If it doesn't know what to do, then it'll just remove them.
|
2010-01-26 21:00:30 -06:00
|
|
|
ScreenNetSelectBase::HandleScreenMessage( SM );
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
void ScreenNetSelectMusic::ChangeSteps( const InputEventPlus &input, int dir )
|
2011-02-08 01:55:28 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
if( GAMESTATE->m_pCurSong == NULL )
|
|
|
|
|
return;
|
2011-02-08 01:55:28 -06:00
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
|
|
|
|
m_vpSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
|
2010-01-26 21:00:30 -06:00
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
if( m_vpSteps.size() == 0 )
|
|
|
|
|
m_Difficulty[input.pn] = NUM_Difficulty;
|
2010-01-26 21:00:30 -06:00
|
|
|
else
|
2011-02-08 04:04:59 -06:00
|
|
|
{
|
|
|
|
|
m_iSelection[input.pn] += dir;
|
|
|
|
|
wrap( m_iSelection[input.pn], m_vpSteps.size() );
|
|
|
|
|
|
|
|
|
|
Steps *pSteps = m_vpSteps[m_iSelection[input.pn]];
|
|
|
|
|
m_Difficulty[input.pn] = (Difficulty)pSteps->GetDifficulty();
|
|
|
|
|
GAMESTATE->ChangePreferredDifficultyAndStepsType( input.pn, m_Difficulty[input.pn], st );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateDifficulty( input.pn );
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
bool ScreenNetSelectMusic::DetectCodes( const InputEventPlus &input )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
if( CodeDetector::EnteredPrevSteps(input.GameI.controller) )
|
|
|
|
|
{
|
|
|
|
|
ChangeSteps( input, -1 );
|
|
|
|
|
}
|
|
|
|
|
else if( CodeDetector::EnteredNextSteps(input.GameI.controller) )
|
|
|
|
|
{
|
|
|
|
|
ChangeSteps( input, +1 );
|
|
|
|
|
}
|
|
|
|
|
else if( CodeDetector::EnteredModeMenu(input.GameI.controller) )
|
|
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
m_MusicWheel.ChangeSort( SORT_MODE_MENU );
|
2011-02-08 04:04:59 -06:00
|
|
|
}
|
|
|
|
|
// todo: support NextGroup/PrevGroup
|
|
|
|
|
else if( CodeDetector::EnteredCloseFolder(input.GameI.controller) )
|
|
|
|
|
{
|
|
|
|
|
RString sCurSection = m_MusicWheel.GetSelectedSection();
|
|
|
|
|
m_MusicWheel.SelectSection(sCurSection);
|
|
|
|
|
m_MusicWheel.SetOpenSection("");
|
|
|
|
|
MusicChanged();
|
|
|
|
|
}
|
2010-01-26 21:00:30 -06:00
|
|
|
else
|
2011-02-08 04:04:59 -06:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
MESSAGEMAN->Broadcast( "PreviousSong" );
|
|
|
|
|
m_MusicWheel.Move( -1 );
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
MESSAGEMAN->Broadcast( "NextSong" );
|
|
|
|
|
m_MusicWheel.Move( +1 );
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input )
|
|
|
|
|
{
|
|
|
|
|
bool bResult = m_MusicWheel.Select();
|
|
|
|
|
|
|
|
|
|
if( !bResult )
|
|
|
|
|
return;
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( m_MusicWheel.GetSelectedType() != TYPE_SONG )
|
2010-01-26 21:00:30 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Song * pSong = m_MusicWheel.GetSelectedSong();
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( pSong == NULL )
|
2010-01-26 21:00:30 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
GAMESTATE->m_pCurSong.Set( pSong );
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( NSMAN->useSMserver )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
NSMAN->m_sArtist = pSong->GetTranslitArtist();
|
|
|
|
|
NSMAN->m_sMainTitle = pSong->GetTranslitMainTitle();
|
|
|
|
|
NSMAN->m_sSubTitle = pSong->GetTranslitSubTitle();
|
2011-02-08 01:47:43 -06:00
|
|
|
NSMAN->m_iSelectMode = 2; // Command for user selecting song
|
2010-01-26 21:00:30 -06:00
|
|
|
NSMAN->SelectUserSong ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
StartSelectedSong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::MenuBack( const InputEventPlus &input )
|
|
|
|
|
{
|
|
|
|
|
SOUND->StopMusic();
|
|
|
|
|
TweenOffScreen();
|
|
|
|
|
|
|
|
|
|
Cancel( SM_GoToPrevScreen );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::TweenOffScreen()
|
|
|
|
|
{
|
|
|
|
|
ScreenNetSelectBase::TweenOffScreen();
|
|
|
|
|
|
|
|
|
|
OFF_COMMAND( m_MusicWheel );
|
|
|
|
|
|
|
|
|
|
OFF_COMMAND( m_BPMDisplay );
|
|
|
|
|
|
|
|
|
|
FOREACH_EnabledPlayer (pn)
|
|
|
|
|
{
|
|
|
|
|
OFF_COMMAND( m_StepsDisplays[pn] );
|
|
|
|
|
//OFF_COMMAND( m_DifficultyIcon[pn] );
|
|
|
|
|
OFF_COMMAND( m_ModIconRow[pn] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OFF_COMMAND( m_MusicWheel );
|
|
|
|
|
|
|
|
|
|
NSMAN->ReportNSSOnOff(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::StartSelectedSong()
|
|
|
|
|
{
|
|
|
|
|
Song * pSong = m_MusicWheel.GetSelectedSong();
|
|
|
|
|
GAMESTATE->m_pCurSong.Set( pSong );
|
|
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; //StepsType_dance_single;
|
|
|
|
|
FOREACH_EnabledPlayer (pn)
|
|
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
GAMESTATE->m_PreferredDifficulty[pn].Set( m_Difficulty[pn] );
|
|
|
|
|
Steps *pSteps = SongUtil::GetStepsByDifficulty(pSong, st, m_Difficulty[pn]);
|
2010-01-26 21:00:30 -06:00
|
|
|
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GAMESTATE->m_PreferredSortOrder = GAMESTATE->m_SortOrder;
|
|
|
|
|
GAMESTATE->m_pPreferredSong = pSong;
|
2011-02-01 15:04:59 -06:00
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
// force event mode
|
2010-01-26 21:00:30 -06:00
|
|
|
GAMESTATE->m_bTemporaryEventMode = true;
|
|
|
|
|
|
|
|
|
|
TweenOffScreen();
|
|
|
|
|
StartTransitioningScreen( SM_GoToNextScreen );
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
void ScreenNetSelectMusic::UpdateDifficulty( PlayerNumber pn )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if( GAMESTATE->m_pCurSong == NULL )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid );
|
2010-01-26 21:00:30 -06:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
2011-02-08 04:04:59 -06:00
|
|
|
Steps* pSteps = SongUtil::GetStepsByDifficulty( GAMESTATE->m_pCurSong, st, m_Difficulty[pn] );
|
2010-01-26 21:00:30 -06:00
|
|
|
GAMESTATE->m_pCurSteps[pn].Set( pSteps );
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
if( ( m_Difficulty[pn] < NUM_Difficulty ) && ( m_Difficulty[pn] >= Difficulty_Beginner ) )
|
2010-01-26 21:00:30 -06:00
|
|
|
m_StepsDisplays[pn].SetFromSteps( pSteps );
|
|
|
|
|
else
|
|
|
|
|
m_StepsDisplays[pn].SetFromStepsTypeAndMeterAndDifficultyAndCourseType( StepsType_Invalid, 0, Difficulty_Beginner, CourseType_Invalid );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::MusicChanged()
|
|
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if( GAMESTATE->m_pCurSong == NULL )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
m_BPMDisplay.NoBPM();
|
|
|
|
|
FOREACH_EnabledPlayer (pn)
|
2011-02-08 04:04:59 -06:00
|
|
|
UpdateDifficulty( pn );
|
2010-08-10 23:36:04 -05:00
|
|
|
|
|
|
|
|
SOUND->StopMusic();
|
2011-02-08 01:47:43 -06:00
|
|
|
// todo: handle playing section music correctly. -aj
|
|
|
|
|
// SOUND->PlayMusic( m_sSectionMusicPath, NULL, true, 0, -1 );
|
2010-01-26 21:00:30 -06:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_BPMDisplay.SetBpmFromSong( GAMESTATE->m_pCurSong );
|
|
|
|
|
|
2011-02-08 04:04:59 -06:00
|
|
|
SongUtil::GetPlayableSteps( GAMESTATE->m_pCurSong, m_vpSteps );
|
|
|
|
|
|
|
|
|
|
FOREACH_EnabledPlayer(pn)
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
// xxx: using the old difficulty reset code -aj
|
|
|
|
|
m_Difficulty[pn] = GAMESTATE->m_PreferredDifficulty[pn];
|
2010-01-26 21:00:30 -06:00
|
|
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
2011-02-08 04:04:59 -06:00
|
|
|
vector<Steps*> MultiSteps;
|
2010-01-26 21:00:30 -06:00
|
|
|
MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
|
2011-02-08 01:47:43 -06:00
|
|
|
if(MultiSteps.size() == 0)
|
2011-02-08 04:04:59 -06:00
|
|
|
m_Difficulty[pn] = NUM_Difficulty;
|
2010-01-26 21:00:30 -06:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
Difficulty Target = Difficulty_Easy;
|
|
|
|
|
|
|
|
|
|
bool dcs[NUM_Difficulty];
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
for( i=0; i<NUM_Difficulty; ++i )
|
2010-01-26 21:00:30 -06:00
|
|
|
dcs[i] = false;
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
for( i=0; i<(int)MultiSteps.size(); ++i )
|
2010-01-26 21:00:30 -06:00
|
|
|
dcs[MultiSteps[i]->GetDifficulty()] = true;
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
for( i=0; i<NUM_Difficulty; ++i )
|
|
|
|
|
if( dcs[i] )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
Target = (Difficulty)i;
|
2011-02-08 04:04:59 -06:00
|
|
|
if( i >= m_Difficulty[pn] )
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
2011-02-08 04:04:59 -06:00
|
|
|
m_Difficulty[pn] = (Difficulty)i;
|
2010-01-26 21:00:30 -06:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-08 01:47:43 -06:00
|
|
|
if( i == NUM_Difficulty )
|
2011-02-08 04:04:59 -06:00
|
|
|
m_Difficulty[pn] = Target;
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
2011-02-08 04:04:59 -06:00
|
|
|
UpdateDifficulty( pn );
|
2010-01-26 21:00:30 -06:00
|
|
|
}
|
2010-08-10 23:36:04 -05:00
|
|
|
|
|
|
|
|
// Copied from ScreenSelectMusic
|
|
|
|
|
// TODO: Update me! -aj
|
2010-01-26 21:00:30 -06:00
|
|
|
SOUND->StopMusic();
|
|
|
|
|
if( GAMESTATE->m_pCurSong->HasMusic() )
|
|
|
|
|
{
|
|
|
|
|
if(SOUND->GetMusicPath().CompareNoCase(GAMESTATE->m_pCurSong->GetMusicPath())) // dont play the same sound over and over
|
|
|
|
|
{
|
|
|
|
|
SOUND->StopMusic();
|
|
|
|
|
SOUND->PlayMusic(
|
|
|
|
|
GAMESTATE->m_pCurSong->GetMusicPath(),
|
|
|
|
|
NULL,
|
|
|
|
|
true,
|
|
|
|
|
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds,
|
|
|
|
|
GAMESTATE->m_pCurSong->m_fMusicSampleLengthSeconds );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenNetSelectMusic::Update( float fDeltaTime )
|
|
|
|
|
{
|
2011-02-08 01:47:43 -06:00
|
|
|
if(!m_bInitialSelect)
|
2010-01-26 21:00:30 -06:00
|
|
|
{
|
|
|
|
|
m_bInitialSelect = true;
|
|
|
|
|
SCREENMAN->PostMessageToTopScreen( SM_RefreshWheelLocation, 1.0f );
|
|
|
|
|
}
|
|
|
|
|
ScreenNetSelectBase::Update( fDeltaTime );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
2011-02-08 01:47:43 -06:00
|
|
|
|
2010-01-26 21:00:30 -06:00
|
|
|
/*
|
|
|
|
|
* (c) 2004-2005 Charles Lohr
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|