Addition of ScreenNetSelectMusic.
This commit is contained in:
@@ -30,7 +30,7 @@ ScreenDownloadMachineStats.cpp ScreenDownloadMachineStats.h ScreenEdit.cpp Scree
|
|||||||
ScreenEditCoursesMenu.cpp ScreenEditCoursesMenu.h EditCoursesSongMenu.cpp EditCoursesSongMenu.h \
|
ScreenEditCoursesMenu.cpp ScreenEditCoursesMenu.h EditCoursesSongMenu.cpp EditCoursesSongMenu.h \
|
||||||
ScreenEditMenu.cpp ScreenEditMenu.h ScreenEnding.cpp ScreenEnding.h \
|
ScreenEditMenu.cpp ScreenEditMenu.h ScreenEnding.cpp ScreenEnding.h \
|
||||||
ScreenEndlessBreak.cpp ScreenEndlessBreak.h ScreenEvaluation.cpp ScreenEvaluation.h ScreenExit.cpp ScreenExit.h \
|
ScreenEndlessBreak.cpp ScreenEndlessBreak.h ScreenEvaluation.cpp ScreenEvaluation.h ScreenExit.cpp ScreenExit.h \
|
||||||
ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \
|
ScreenNetSelectMusic.cpp ScreenNetSlectMusic.h ScreenEz2SelectMusic.cpp ScreenEz2SelectMusic.h ScreenEz2SelectPlayer.cpp ScreenEz2SelectPlayer.h \
|
||||||
ScreenGameOver.cpp ScreenGameOver.h ScreenGameplay.cpp ScreenGameplay.h ScreenHowToPlay.cpp ScreenHowToPlay.h \
|
ScreenGameOver.cpp ScreenGameOver.h ScreenGameplay.cpp ScreenGameplay.h ScreenHowToPlay.cpp ScreenHowToPlay.h \
|
||||||
ScreenInstructions.cpp ScreenInstructions.h ScreenInsertCredit.cpp ScreenInsertCredit.h \
|
ScreenInstructions.cpp ScreenInstructions.h ScreenInsertCredit.cpp ScreenInsertCredit.h \
|
||||||
ScreenJukebox.cpp ScreenJukebox.h \
|
ScreenJukebox.cpp ScreenJukebox.h \
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ void Screen::ClearMessageQueue( const ScreenMessage SM )
|
|||||||
#include "ScreenTestFonts.h"
|
#include "ScreenTestFonts.h"
|
||||||
#include "ScreenTestSound.h"
|
#include "ScreenTestSound.h"
|
||||||
#include "ScreenTitleMenu.h"
|
#include "ScreenTitleMenu.h"
|
||||||
|
#include "ScreenNetSelectMusic.h"
|
||||||
#include "ScreenEz2SelectMusic.h"
|
#include "ScreenEz2SelectMusic.h"
|
||||||
#include "ScreenRanking.h"
|
#include "ScreenRanking.h"
|
||||||
#include "ScreenLogo.h"
|
#include "ScreenLogo.h"
|
||||||
@@ -336,6 +337,7 @@ Screen* Screen::Create( CString sClassName )
|
|||||||
IF_RETURN( ScreenTestSound );
|
IF_RETURN( ScreenTestSound );
|
||||||
IF_RETURN( ScreenTitleMenu );
|
IF_RETURN( ScreenTitleMenu );
|
||||||
IF_RETURN( ScreenEz2SelectMusic );
|
IF_RETURN( ScreenEz2SelectMusic );
|
||||||
|
IF_RETURN( ScreenNetSelectMusic );
|
||||||
IF_RETURN( ScreenRanking );
|
IF_RETURN( ScreenRanking );
|
||||||
IF_RETURN( ScreenLogo );
|
IF_RETURN( ScreenLogo );
|
||||||
IF_RETURN( ScreenUnlock );
|
IF_RETURN( ScreenUnlock );
|
||||||
|
|||||||
@@ -0,0 +1,545 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "ScreenNetSelectMusic.h"
|
||||||
|
#include "ScreenManager.h"
|
||||||
|
#include "GameSoundManager.h"
|
||||||
|
#include "GameConstantsAndTypes.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "ThemeManager.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "Style.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
|
#include "CodeDetector.h"
|
||||||
|
#include "Steps.h"
|
||||||
|
#include "RageTimer.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
#include "Actor.h"
|
||||||
|
#include "RageTextureManager.h"
|
||||||
|
#include "AnnouncerManager.h"
|
||||||
|
#include "MenuTimer.h"
|
||||||
|
#include "StepsUtil.h"
|
||||||
|
|
||||||
|
#define CHATINPUT_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxWidth")
|
||||||
|
#define CHATINPUT_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","ChatInputBoxHeight")
|
||||||
|
#define CHATINPUT_COLOR THEME->GetMetricC("ScreenNetSelectMusic","ChatInputBoxColor")
|
||||||
|
#define CHATOUTPUT_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","ChatOutputBoxWidth")
|
||||||
|
#define CHATOUTPUT_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","ChatOutputBoxHeight")
|
||||||
|
#define CHATOUTPUT_COLOR THEME->GetMetricC("ScreenNetSelectMusic","ChatOutputBoxColor")
|
||||||
|
|
||||||
|
#define GROUPSBG_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","GroupsBGWidth")
|
||||||
|
#define GROUPSBG_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","GroupsBGHeight")
|
||||||
|
#define GROUPSBG_COLOR THEME->GetMetricC("ScreenNetSelectMusic","GroupsBGColor")
|
||||||
|
|
||||||
|
#define SONGSBG_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","SongsBGWidth")
|
||||||
|
#define SONGSBG_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","SongsBGHeight")
|
||||||
|
#define SONGSBG_COLOR THEME->GetMetricC("ScreenNetSelectMusic","SongsBGColor")
|
||||||
|
|
||||||
|
#define NUM_GROUPS_SHOW THEME->GetMetricI("ScreenNetSelectMusic","NumGroupsShow");
|
||||||
|
#define NUM_SONGS_SHOW THEME->GetMetricI("ScreenNetSelectMusic","NumSongsShow");
|
||||||
|
|
||||||
|
#define SEL_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","SelWidth")
|
||||||
|
#define SEL_HEIGHT THEME->GetMetricF("ScreenNetSelectMusic","SelHeight")
|
||||||
|
#define SEL_COLOR THEME->GetMetricC("ScreenNetSelectMusic","SelColor")
|
||||||
|
|
||||||
|
#define SUBTITLE_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","SongsSubtitleWidth")
|
||||||
|
#define ARTIST_WIDTH THEME->GetMetricF("ScreenNetSelectMusic","SongsArtistWidth")
|
||||||
|
|
||||||
|
const ScreenMessage SM_NoSongs = ScreenMessage(SM_User+3);
|
||||||
|
const CString AllGroups = "[ALL MUSIC]";
|
||||||
|
|
||||||
|
ScreenNetSelectMusic::ScreenNetSelectMusic( CString sName ) : ScreenWithMenuElements( sName )
|
||||||
|
{
|
||||||
|
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet. */
|
||||||
|
GAMESTATE->FinishStage();
|
||||||
|
|
||||||
|
//ChatBox
|
||||||
|
m_rectChatInputBox.SetDiffuse( CHATINPUT_COLOR );
|
||||||
|
m_rectChatInputBox.SetName( "ChatInputBox" );
|
||||||
|
m_rectChatInputBox.SetWidth( CHATINPUT_WIDTH );
|
||||||
|
m_rectChatInputBox.SetHeight( CHATINPUT_HEIGHT );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_rectChatInputBox );
|
||||||
|
this->AddChild( &m_rectChatInputBox );
|
||||||
|
|
||||||
|
m_rectChatOutputBox.SetDiffuse( CHATOUTPUT_COLOR );
|
||||||
|
m_rectChatOutputBox.SetName( "ChatOutputBox" );
|
||||||
|
m_rectChatOutputBox.SetWidth( CHATOUTPUT_WIDTH );
|
||||||
|
m_rectChatOutputBox.SetHeight( CHATOUTPUT_HEIGHT );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_rectChatOutputBox );
|
||||||
|
this->AddChild( &m_rectChatOutputBox );
|
||||||
|
|
||||||
|
m_textChatInput.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textChatInput.SetHorizAlign( align_left );
|
||||||
|
m_textChatInput.SetVertAlign( align_top );
|
||||||
|
m_textChatInput.SetShadowLength( 0 );
|
||||||
|
m_textChatInput.SetName( "ChatInput" );
|
||||||
|
m_textChatInput.SetWrapWidthPixels( CHATINPUT_WIDTH * 2 );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textChatInput );
|
||||||
|
this->AddChild( &m_textChatInput );
|
||||||
|
|
||||||
|
m_textChatOutput.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textChatOutput.SetHorizAlign( align_left );
|
||||||
|
m_textChatOutput.SetVertAlign( align_top );
|
||||||
|
m_textChatOutput.SetShadowLength( 0 );
|
||||||
|
m_textChatOutput.SetName( "ChatOutput" );
|
||||||
|
m_textChatOutput.SetWrapWidthPixels( CHATOUTPUT_WIDTH * 2 );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textChatOutput );
|
||||||
|
this->AddChild( &m_textChatOutput );
|
||||||
|
|
||||||
|
//Groups
|
||||||
|
|
||||||
|
m_rectGroupsBackground.SetDiffuse( GROUPSBG_COLOR );
|
||||||
|
m_rectGroupsBackground.SetName( "GroupsBG" );
|
||||||
|
m_rectGroupsBackground.SetWidth( GROUPSBG_WIDTH );
|
||||||
|
m_rectGroupsBackground.SetHeight( GROUPSBG_HEIGHT );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_rectGroupsBackground );
|
||||||
|
this->AddChild( &m_rectGroupsBackground );
|
||||||
|
|
||||||
|
m_textGroups.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textGroups.SetShadowLength( 0 );
|
||||||
|
m_textGroups.SetName( "GroupsList" );
|
||||||
|
m_textGroups.SetMaxWidth( GROUPSBG_WIDTH );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textGroups );
|
||||||
|
this->AddChild( &m_textGroups);
|
||||||
|
|
||||||
|
//Songs
|
||||||
|
m_rectSongsBackground.SetDiffuse( SONGSBG_COLOR );
|
||||||
|
m_rectSongsBackground.SetName( "SongsBackground" );
|
||||||
|
m_rectSongsBackground.SetWidth( SONGSBG_WIDTH );
|
||||||
|
m_rectSongsBackground.SetHeight( SONGSBG_HEIGHT );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_rectSongsBackground );
|
||||||
|
this->AddChild( &m_rectSongsBackground );
|
||||||
|
|
||||||
|
m_textSongs.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textSongs.SetShadowLength( 0 );
|
||||||
|
m_textSongs.SetName( "SongsList" );
|
||||||
|
m_textSongs.SetMaxWidth( SONGSBG_WIDTH );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textSongs );
|
||||||
|
this->AddChild( &m_textSongs);
|
||||||
|
|
||||||
|
m_SelectMode = SelectGroup;
|
||||||
|
m_rectSelection.SetDiffuse( SEL_COLOR );
|
||||||
|
m_rectSelection.SetName( "Sel" );
|
||||||
|
m_rectSelection.SetWidth( SEL_WIDTH );
|
||||||
|
m_rectSelection.SetHeight( SEL_HEIGHT );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_rectSelection );
|
||||||
|
this->AddChild( &m_rectSelection );
|
||||||
|
|
||||||
|
m_textArtist.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textArtist.SetShadowLength( 0 );
|
||||||
|
m_textArtist.SetName( "SongsArtist" );
|
||||||
|
m_textArtist.SetMaxWidth( ARTIST_WIDTH );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textArtist );
|
||||||
|
this->AddChild( &m_textArtist);
|
||||||
|
|
||||||
|
m_textSubtitle.LoadFromFont( THEME->GetPathF(m_sName,"chat") );
|
||||||
|
m_textSubtitle.SetShadowLength( 0 );
|
||||||
|
m_textSubtitle.SetName( "SongsSubtitle" );
|
||||||
|
m_textSubtitle.SetMaxWidth( SUBTITLE_WIDTH );
|
||||||
|
SET_XY_AND_ON_COMMAND( m_textSubtitle );
|
||||||
|
this->AddChild( &m_textSubtitle );
|
||||||
|
|
||||||
|
|
||||||
|
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_DIFFICULTIES)) );
|
||||||
|
SET_XY( m_DifficultyIcon[p] );
|
||||||
|
this->AddChild( &m_DifficultyIcon[p] );
|
||||||
|
ON_COMMAND( m_DifficultyIcon[p] );
|
||||||
|
m_DC[p] = GAMESTATE->m_PreferredDifficulty[p];
|
||||||
|
m_DifficultyIcon[p].SetFromDifficulty( p, m_DC[p] );
|
||||||
|
}
|
||||||
|
|
||||||
|
SONGMAN->GetGroupNames( m_vGroups );
|
||||||
|
if (m_vGroups.size()<1)
|
||||||
|
{
|
||||||
|
SCREENMAN->SendMessageToTopScreen( SM_NoSongs );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make the last group the full list group.
|
||||||
|
//XXX: what if someone has a group named [All Songs]?
|
||||||
|
//Must be last
|
||||||
|
m_vGroups.push_back( AllGroups );
|
||||||
|
|
||||||
|
|
||||||
|
m_iShowGroups = NUM_GROUPS_SHOW;
|
||||||
|
m_iShowSongs = NUM_SONGS_SHOW;
|
||||||
|
m_iGroupNum=m_vGroups.size()-1; //Alphabetical
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (GAMESTATE->m_pCurSong == NULL)
|
||||||
|
i=0;
|
||||||
|
else
|
||||||
|
for ( int i=0;i<m_vSongs.size(); i++ )
|
||||||
|
if (m_vSongs[i] == GAMESTATE->m_pCurSong)
|
||||||
|
break;
|
||||||
|
|
||||||
|
m_iSongNum=i;
|
||||||
|
|
||||||
|
UpdateGroupsListPos();
|
||||||
|
UpdateSongsList();
|
||||||
|
UpdateSongsListPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
|
{
|
||||||
|
if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( type != IET_FIRST_PRESS )
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
bool bHoldingShift =
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT)) ||
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT));
|
||||||
|
|
||||||
|
bool bHoldingCtrl =
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_LCTRL)) ||
|
||||||
|
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, SDLK_RCTRL));
|
||||||
|
|
||||||
|
switch( DeviceI.button )
|
||||||
|
{
|
||||||
|
case SDLK_RETURN:
|
||||||
|
case SDLK_KP_ENTER:
|
||||||
|
if (!bHoldingCtrl)
|
||||||
|
{
|
||||||
|
m_sTextInput="";
|
||||||
|
UpdateTextInput();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SDLK_BACKSPACE:
|
||||||
|
if(!m_sTextInput.empty())
|
||||||
|
m_sTextInput = m_sTextInput.erase( m_sTextInput.size()-1 );
|
||||||
|
UpdateTextInput();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
char c;
|
||||||
|
c = DeviceI.ToChar();
|
||||||
|
|
||||||
|
if( bHoldingShift && (!bHoldingCtrl) )
|
||||||
|
{
|
||||||
|
c = (char)toupper(c);
|
||||||
|
|
||||||
|
switch( c )
|
||||||
|
{
|
||||||
|
case '`': c='~'; break;
|
||||||
|
case '1': c='!'; break;
|
||||||
|
case '2': c='@'; break;
|
||||||
|
case '3': c='#'; break;
|
||||||
|
case '4': c='$'; break;
|
||||||
|
case '5': c='%'; break;
|
||||||
|
case '6': c='^'; break;
|
||||||
|
case '7': c='&'; break;
|
||||||
|
case '8': c='*'; break;
|
||||||
|
case '9': c='('; break;
|
||||||
|
case '0': c=')'; break;
|
||||||
|
case '-': c='_'; break;
|
||||||
|
case '=': c='+'; break;
|
||||||
|
case '[': c='{'; break;
|
||||||
|
case ']': c='}'; break;
|
||||||
|
case '\\': c='|'; break;
|
||||||
|
case ';': c=':'; break;
|
||||||
|
case '\'': c='"'; break;
|
||||||
|
case ',': c='<'; break;
|
||||||
|
case '.': c='>'; break;
|
||||||
|
case '/': c='?'; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Search list for given letter (to aide in searching)
|
||||||
|
if( bHoldingCtrl )
|
||||||
|
{
|
||||||
|
c = (char)toupper(c);
|
||||||
|
int i;
|
||||||
|
for (i=0;i<m_vSongs.size();i++)
|
||||||
|
if ( (char) toupper(m_vSongs[i]->GetTranslitMainTitle().c_str()[0]) == (char) c )
|
||||||
|
{
|
||||||
|
m_iSongNum = i;
|
||||||
|
UpdateSongsListPos();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (c >= ' ') && (!bHoldingCtrl) )
|
||||||
|
{
|
||||||
|
m_sTextInput += c;
|
||||||
|
UpdateTextInput();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
Screen::HandleScreenMessage( SM );
|
||||||
|
|
||||||
|
switch( SM )
|
||||||
|
{
|
||||||
|
case SM_GoToPrevScreen:
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
|
break;
|
||||||
|
case SM_GoToNextScreen:
|
||||||
|
SOUND->StopMusic();
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenStage" );
|
||||||
|
case SM_NoSongs:
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
switch (m_SelectMode)
|
||||||
|
{
|
||||||
|
case SelectGroup:
|
||||||
|
m_iGroupNum--;
|
||||||
|
UpdateGroupsListPos();
|
||||||
|
UpdateSongsList();
|
||||||
|
UpdateSongsListPos();
|
||||||
|
break;
|
||||||
|
case SelectSong:
|
||||||
|
m_iSongNum--;
|
||||||
|
UpdateSongsListPos();
|
||||||
|
break;
|
||||||
|
case SelectDifficulty:
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
vector <Steps *> MultiSteps;
|
||||||
|
MultiSteps = m_vSongs[m_iSongNum % m_vSongs.size()]->GetAllSteps( st );
|
||||||
|
if (MultiSteps.size() == 0)
|
||||||
|
m_DC[pn] = NUM_DIFFICULTIES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( i=0; i<MultiSteps.size(); i++ )
|
||||||
|
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( i == MultiSteps.size() )
|
||||||
|
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
|
||||||
|
else
|
||||||
|
if (i > 0) //If we are at the easiest difficulty, do nothign
|
||||||
|
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
|
||||||
|
}
|
||||||
|
m_DifficultyIcon[pn].SetFromDifficulty( pn, m_DC[pn] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
switch (m_SelectMode)
|
||||||
|
{
|
||||||
|
case SelectGroup:
|
||||||
|
m_iGroupNum++;
|
||||||
|
UpdateGroupsListPos();
|
||||||
|
UpdateSongsList();
|
||||||
|
UpdateSongsListPos();
|
||||||
|
break;
|
||||||
|
case SelectSong:
|
||||||
|
m_iSongNum++;
|
||||||
|
UpdateSongsListPos();
|
||||||
|
break;
|
||||||
|
case SelectDifficulty:
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
vector <Steps *> MultiSteps;
|
||||||
|
MultiSteps = m_vSongs[m_iSongNum % m_vSongs.size()]->GetAllSteps( st );
|
||||||
|
if (MultiSteps.size() == 0)
|
||||||
|
m_DC[pn] = NUM_DIFFICULTIES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( i=0; i<MultiSteps.size(); i++ )
|
||||||
|
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( i == MultiSteps.size() )
|
||||||
|
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
|
||||||
|
else
|
||||||
|
if (i < MultiSteps.size() - 1 ) //If we are at the hardest difficulty, do nothign
|
||||||
|
m_DC[pn] = MultiSteps[i+1]->GetDifficulty();
|
||||||
|
}
|
||||||
|
m_DifficultyIcon[pn].SetFromDifficulty( pn, m_DC[pn] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuUp( PlayerNumber pn, const InputEventType type )
|
||||||
|
{
|
||||||
|
m_SelectMode = (NetScreenSelectModes) ( ( (int)m_SelectMode - 1) % (int)SelectModes);
|
||||||
|
if ( (int) m_SelectMode < 0)
|
||||||
|
m_SelectMode = (NetScreenSelectModes) (SelectModes - 1);
|
||||||
|
COMMAND( m_rectSelection, ssprintf("To%d", m_SelectMode+1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuDown( PlayerNumber pn, const InputEventType type )
|
||||||
|
{
|
||||||
|
m_SelectMode = (NetScreenSelectModes) ( ( (int)m_SelectMode + 1) % (int)SelectModes);
|
||||||
|
COMMAND( m_rectSelection, ssprintf("To%d", m_SelectMode+1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuStart( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
Song * pSong = m_vSongs[m_iSongNum%m_vSongs.size()];
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; //STEPS_TYPE_DANCE_SINGLE;
|
||||||
|
FOREACH_EnabledPlayer (pn)
|
||||||
|
{
|
||||||
|
GAMESTATE->m_PreferredDifficulty[pn] = m_DC[pn];
|
||||||
|
Steps * pSteps = pSong->GetStepsByDifficulty(st,m_DC[pn]);
|
||||||
|
GAMESTATE->m_pCurSteps[pn] = pSteps;
|
||||||
|
}
|
||||||
|
GAMESTATE->m_pCurSong = pSong;
|
||||||
|
|
||||||
|
SCREENMAN->SetNewScreen( "ScreenStage" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::MenuBack( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
SOUND->StopMusic();
|
||||||
|
TweenOffScreen();
|
||||||
|
|
||||||
|
Back( SM_GoToPrevScreen );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::TweenOffScreen()
|
||||||
|
{
|
||||||
|
OFF_COMMAND( m_rectChatInputBox );
|
||||||
|
OFF_COMMAND( m_rectChatOutputBox );
|
||||||
|
OFF_COMMAND( m_textChatInput );
|
||||||
|
OFF_COMMAND( m_textChatOutput );
|
||||||
|
|
||||||
|
OFF_COMMAND( m_rectSelection );
|
||||||
|
OFF_COMMAND( m_textGroups );
|
||||||
|
OFF_COMMAND( m_rectGroupsBackground );
|
||||||
|
|
||||||
|
OFF_COMMAND( m_textSongs );
|
||||||
|
OFF_COMMAND( m_rectSongsBackground );
|
||||||
|
|
||||||
|
OFF_COMMAND( m_textArtist );
|
||||||
|
OFF_COMMAND( m_textSubtitle );
|
||||||
|
|
||||||
|
FOREACH_EnabledPlayer (pn)
|
||||||
|
OFF_COMMAND( m_DifficultyIcon[pn] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::Update( float fDeltaTime )
|
||||||
|
{
|
||||||
|
Screen::Update( fDeltaTime );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::DrawPrimitives()
|
||||||
|
{
|
||||||
|
Screen::DrawPrimitives();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::UpdateTextInput()
|
||||||
|
{
|
||||||
|
m_textChatInput.SetText( m_sTextInput );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::UpdateSongsListPos()
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
if (m_iSongNum<m_iShowSongs)
|
||||||
|
m_iSongNum+=m_vSongs.size();
|
||||||
|
CString SongsDisplay="";
|
||||||
|
for (i=m_iSongNum-m_iShowSongs;i<=m_iSongNum+m_iShowSongs;i++)
|
||||||
|
{
|
||||||
|
j= i % m_vSongs.size();
|
||||||
|
SongsDisplay+=m_vSongs.at(j)->GetTranslitMainTitle();
|
||||||
|
if (i<m_iSongNum+m_iShowSongs)
|
||||||
|
SongsDisplay+='\n';
|
||||||
|
}
|
||||||
|
m_textSongs.SetText( SongsDisplay );
|
||||||
|
|
||||||
|
j= m_iSongNum % m_vSongs.size();
|
||||||
|
|
||||||
|
m_textArtist.SetText( m_vSongs[j]->GetTranslitArtist() );
|
||||||
|
m_textSubtitle.SetText( m_vSongs[j]->GetTranslitSubTitle() );
|
||||||
|
|
||||||
|
//Update the difficulty Icons
|
||||||
|
|
||||||
|
FOREACH_EnabledPlayer (pn)
|
||||||
|
{
|
||||||
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
|
vector <Steps *> MultiSteps;
|
||||||
|
MultiSteps = m_vSongs[j]->GetAllSteps( st );
|
||||||
|
if (MultiSteps.size() == 0)
|
||||||
|
m_DC[pn] = NUM_DIFFICULTIES;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( i=0; i<MultiSteps.size(); i++ )
|
||||||
|
if ( MultiSteps[i]->GetDifficulty() >= m_DC[pn] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( i == MultiSteps.size() )
|
||||||
|
m_DC[pn] = MultiSteps[i-1]->GetDifficulty();
|
||||||
|
else
|
||||||
|
m_DC[pn] = MultiSteps[i]->GetDifficulty();
|
||||||
|
}
|
||||||
|
m_DifficultyIcon[pn].SetFromDifficulty( pn, m_DC[pn] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenNetSelectMusic::UpdateGroupsListPos()
|
||||||
|
{
|
||||||
|
int i,j;
|
||||||
|
if (m_iGroupNum<m_iShowGroups)
|
||||||
|
m_iGroupNum+=m_vGroups.size();
|
||||||
|
CString GroupsDisplay="";
|
||||||
|
for (i=m_iGroupNum-m_iShowGroups;i<=m_iGroupNum+m_iShowGroups;i++)
|
||||||
|
{
|
||||||
|
j=i%m_vGroups.size();
|
||||||
|
GroupsDisplay+=m_vGroups[j];
|
||||||
|
if (i<m_iGroupNum+m_iShowGroups)
|
||||||
|
GroupsDisplay+='\n';
|
||||||
|
}
|
||||||
|
m_textGroups.SetText( GroupsDisplay );
|
||||||
|
}
|
||||||
|
void ScreenNetSelectMusic::UpdateSongsList()
|
||||||
|
{
|
||||||
|
m_vSongs.clear();
|
||||||
|
SONGMAN->SortSongs();
|
||||||
|
if (m_iGroupNum<m_iShowGroups)
|
||||||
|
m_iGroupNum+=m_vGroups.size();
|
||||||
|
int j=m_iGroupNum%m_vGroups.size();
|
||||||
|
if ( m_vGroups[j]==AllGroups )
|
||||||
|
SONGMAN->GetSongs( m_vSongs ); //this gets it alphabetically
|
||||||
|
else
|
||||||
|
SONGMAN->GetSongs( m_vSongs, m_vGroups[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2004 Charles Lohr
|
||||||
|
* All rights reserved.
|
||||||
|
* Based off of ScreenEz2SelectMusic by Frieza
|
||||||
|
* Elements from ScreenTextEntry
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
/* ScreenNetSelectMusic - A method for Online/Net song selection */
|
||||||
|
|
||||||
|
#ifndef SCREENNETSELECTMUSIC_H
|
||||||
|
#define SCREENNETSELECTMUSIC_H
|
||||||
|
|
||||||
|
#include "ScreenWithMenuElements.h"
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "Quad.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
#include "MusicBannerWheel.h"
|
||||||
|
#include "DifficultyRating.h"
|
||||||
|
#include "ModeSwitcher.h"
|
||||||
|
#include "DifficultyIcon.h"
|
||||||
|
#include "Difficulty.h"
|
||||||
|
|
||||||
|
class ScreenNetSelectMusic : public ScreenWithMenuElements
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenNetSelectMusic( CString sName );
|
||||||
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
|
virtual void Update( float fDeltaTime );
|
||||||
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
void UpdateSongsListPos();
|
||||||
|
void UpdateGroupsListPos();
|
||||||
|
void UpdateSongsList();
|
||||||
|
void UpdateTextInput();
|
||||||
|
|
||||||
|
int m_iSongNum;
|
||||||
|
int m_iShowSongs; //The number of songs to display to each side
|
||||||
|
int m_iGroupNum;
|
||||||
|
int m_iShowGroups; //The number of groups to display to each side
|
||||||
|
|
||||||
|
enum NetScreenSelectModes
|
||||||
|
{
|
||||||
|
SelectGroup = 0,
|
||||||
|
SelectSong,
|
||||||
|
SelectDifficulty,
|
||||||
|
SelectModes,
|
||||||
|
};
|
||||||
|
|
||||||
|
NetScreenSelectModes m_SelectMode;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void MenuStart( PlayerNumber pn );
|
||||||
|
virtual void MenuLeft( PlayerNumber pn, const InputEventType type );
|
||||||
|
virtual void MenuUp( PlayerNumber pn, const InputEventType type );
|
||||||
|
virtual void MenuDown( PlayerNumber pn, const InputEventType type );
|
||||||
|
virtual void MenuRight( PlayerNumber pn, const InputEventType type );
|
||||||
|
virtual void MenuBack( PlayerNumber pn );
|
||||||
|
|
||||||
|
void MusicChanged();
|
||||||
|
|
||||||
|
void TweenOffScreen();
|
||||||
|
|
||||||
|
//Chatting
|
||||||
|
BitmapText m_textChatInput;
|
||||||
|
BitmapText m_textChatOutput;
|
||||||
|
Quad m_rectChatInputBox;
|
||||||
|
Quad m_rectChatOutputBox;
|
||||||
|
CString m_sTextInput;
|
||||||
|
|
||||||
|
//Selection
|
||||||
|
Quad m_rectSelection;
|
||||||
|
|
||||||
|
//Groups
|
||||||
|
BitmapText m_textGroups;
|
||||||
|
Quad m_rectGroupsBackground;
|
||||||
|
vector <CString> m_vGroups;
|
||||||
|
|
||||||
|
//Songs
|
||||||
|
BitmapText m_textSongs;
|
||||||
|
Quad m_rectSongsBackground;
|
||||||
|
vector <Song *> m_vSongs;
|
||||||
|
|
||||||
|
BitmapText m_textArtist;
|
||||||
|
BitmapText m_textSubtitle;
|
||||||
|
|
||||||
|
//Difficulty Icon(s)
|
||||||
|
DifficultyIcon m_DifficultyIcon[NUM_PLAYERS];
|
||||||
|
Difficulty m_DC[NUM_PLAYERS];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2004 Charles Lohr
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* based off of ScreenEz2SelectMusic by "Frieza"
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
@@ -2579,6 +2579,14 @@ SOURCE=.\ScreenNameEntryTraditional.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ScreenNetSelectMusic.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\ScreenNetSelectMusic.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\ScreenNetworkOptions.cpp
|
SOURCE=.\ScreenNetworkOptions.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
@@ -367,6 +367,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ScreenNetworkOptions.h">
|
RelativePath="ScreenNetworkOptions.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenNetSelectMusic.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="ScreenNetSelectMusic.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenOptions.cpp">
|
RelativePath="ScreenOptions.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Reference in New Issue
Block a user