move song selection for the editor to SongSelector
This commit is contained in:
@@ -48,6 +48,11 @@ const float GAME_STYLE_Y = CENTER_Y + 40;
|
|||||||
const float STEPS_X = CENTER_X;
|
const float STEPS_X = CENTER_X;
|
||||||
const float STEPS_Y = CENTER_Y + 90;
|
const float STEPS_Y = CENTER_Y + 90;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const float EXPLANATION_X = CENTER_X;
|
const float EXPLANATION_X = CENTER_X;
|
||||||
const float EXPLANATION_Y = SCREEN_BOTTOM - 70;
|
const float EXPLANATION_Y = SCREEN_BOTTOM - 70;
|
||||||
const CString EXPLANATION_TEXT =
|
const CString EXPLANATION_TEXT =
|
||||||
@@ -62,80 +67,9 @@ ScreenEditMenu::ScreenEditMenu()
|
|||||||
{
|
{
|
||||||
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
|
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
|
||||||
|
|
||||||
m_textGroup.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
Selector.SetXY( 0, 0 );
|
||||||
m_textGroup.SetXY( GROUP_X, GROUP_Y );
|
// Selector.AllowNewNotes();
|
||||||
m_textGroup.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
this->AddSubActor( &Selector );
|
||||||
m_textGroup.SetText( "blah" );
|
|
||||||
this->AddSubActor( &m_textGroup );
|
|
||||||
|
|
||||||
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
|
|
||||||
m_Banner.SetCroppedSize( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT );
|
|
||||||
this->AddSubActor( &m_Banner );
|
|
||||||
|
|
||||||
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
|
|
||||||
this->AddSubActor( &m_TextBanner );
|
|
||||||
|
|
||||||
m_sprArrowLeft.Load( THEME->GetPathTo("Graphics","edit menu left") );
|
|
||||||
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
|
|
||||||
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
||||||
this->AddSubActor( &m_sprArrowLeft );
|
|
||||||
|
|
||||||
m_sprArrowRight.Load( THEME->GetPathTo("Graphics","edit menu right") );
|
|
||||||
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
|
|
||||||
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
||||||
this->AddSubActor( &m_sprArrowRight );
|
|
||||||
|
|
||||||
m_textNotesType.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
|
||||||
m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
|
|
||||||
m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
||||||
m_textNotesType.SetText( "blah" );
|
|
||||||
this->AddSubActor( &m_textNotesType );
|
|
||||||
|
|
||||||
m_textNotes.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
|
||||||
m_textNotes.SetXY( STEPS_X, STEPS_Y );
|
|
||||||
m_textNotes.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
||||||
m_textNotes.SetText( "blah" );
|
|
||||||
this->AddSubActor( &m_textNotes );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// data structures
|
|
||||||
ChangeSelectedRow(ROW_GROUP);
|
|
||||||
|
|
||||||
SONGMAN->GetGroupNames( m_sGroups );
|
|
||||||
GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, m_NotesTypes );
|
|
||||||
m_iSelectedGroup = 0;
|
|
||||||
m_iSelectedSong = 0;
|
|
||||||
m_iSelectedNotesType = 0;
|
|
||||||
m_iSelectedNotes = 0;
|
|
||||||
|
|
||||||
if( GAMESTATE->m_pCurSong )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for( i=0; i<m_sGroups.GetSize(); i++ )
|
|
||||||
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
|
|
||||||
m_iSelectedGroup = i;
|
|
||||||
OnGroupChange();
|
|
||||||
|
|
||||||
for( i=0; i<m_pSongs.GetSize(); i++ )
|
|
||||||
if( GAMESTATE->m_pCurSong == m_pSongs[i] )
|
|
||||||
m_iSelectedSong = i;
|
|
||||||
OnSongChange();
|
|
||||||
|
|
||||||
for( i=0; i<m_NotesTypes.GetSize(); i++ )
|
|
||||||
if( GAMESTATE->GetCurrentStyleDef()->m_NotesType == m_NotesTypes[i] )
|
|
||||||
m_iSelectedNotesType = i;
|
|
||||||
OnNotesTypeChange();
|
|
||||||
|
|
||||||
for( i=0; i<m_pNotess.GetSize(); i++ )
|
|
||||||
if( GAMESTATE->m_pCurNotes[PLAYER_1] == m_pNotess[i] )
|
|
||||||
m_iSelectedNotes = i;
|
|
||||||
OnNotesChange();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
OnGroupChange();
|
|
||||||
|
|
||||||
|
|
||||||
m_textExplanation.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
|
m_textExplanation.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
|
||||||
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
||||||
@@ -143,27 +77,12 @@ ScreenEditMenu::ScreenEditMenu()
|
|||||||
m_textExplanation.SetZoom( 0.7f );
|
m_textExplanation.SetZoom( 0.7f );
|
||||||
this->AddSubActor( &m_textExplanation );
|
this->AddSubActor( &m_textExplanation );
|
||||||
|
|
||||||
m_Menu.Load(
|
|
||||||
THEME->GetPathTo("Graphics","edit background"),
|
|
||||||
THEME->GetPathTo("Graphics","edit top edge"),
|
|
||||||
ssprintf("%c %c change line %c %c change value START to continue", char(3), char(4), char(1), char(2) ),
|
|
||||||
false, false, 40
|
|
||||||
);
|
|
||||||
this->AddSubActor( &m_Menu );
|
|
||||||
|
|
||||||
|
|
||||||
m_Fade.SetOpened();
|
m_Fade.SetOpened();
|
||||||
this->AddSubActor( &m_Fade);
|
this->AddSubActor( &m_Fade);
|
||||||
|
|
||||||
|
|
||||||
m_soundChangeMusic.Load( THEME->GetPathTo("Sounds","select music change music") );
|
|
||||||
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
|
|
||||||
|
|
||||||
MUSIC->Load( THEME->GetPathTo("Sounds","edit menu music") );
|
MUSIC->Load( THEME->GetPathTo("Sounds","edit menu music") );
|
||||||
MUSIC->Play( true );
|
MUSIC->Play( true );
|
||||||
|
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
|
||||||
|
|
||||||
m_Menu.TweenOnScreenFromBlack( SM_None );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -172,13 +91,6 @@ ScreenEditMenu::~ScreenEditMenu()
|
|||||||
LOG->Trace( "ScreenEditMenu::~ScreenEditMenu()" );
|
LOG->Trace( "ScreenEditMenu::~ScreenEditMenu()" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::DrawPrimitives()
|
|
||||||
{
|
|
||||||
m_Menu.DrawBottomLayer();
|
|
||||||
Screen::DrawPrimitives();
|
|
||||||
m_Menu.DrawTopLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
void ScreenEditMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenEditMenu::Input()" );
|
LOG->Trace( "ScreenEditMenu::Input()" );
|
||||||
@@ -205,7 +117,7 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
// Find the first Style that will play the selected notes type.
|
// Find the first Style that will play the selected notes type.
|
||||||
// Set the current Style, then let ScreenEdit infer the desired
|
// Set the current Style, then let ScreenEdit infer the desired
|
||||||
// NotesType from that Style.
|
// NotesType from that Style.
|
||||||
NotesType nt = GetSelectedNotesType();
|
NotesType nt = Selector.GetSelectedNotesType();
|
||||||
Style style = GAMEMAN->GetEditStyleThatPlaysNotesType( nt );
|
Style style = GAMEMAN->GetEditStyleThatPlaysNotesType( nt );
|
||||||
GAMESTATE->m_CurStyle = style;
|
GAMESTATE->m_CurStyle = style;
|
||||||
GAMESTATE->m_CurGame = GAMEMAN->GetStyleDefForStyle(style)->m_Game;
|
GAMESTATE->m_CurGame = GAMEMAN->GetStyleDefForStyle(style)->m_Game;
|
||||||
@@ -215,173 +127,38 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::ChangeSelectedRow( SelectedRow row )
|
|
||||||
{
|
|
||||||
m_textGroup.SetEffectNone();
|
|
||||||
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
||||||
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
||||||
m_textNotesType.SetEffectNone();
|
|
||||||
m_textNotes.SetEffectNone();
|
|
||||||
|
|
||||||
m_SelectedRow = row;
|
|
||||||
|
|
||||||
switch( m_SelectedRow )
|
|
||||||
{
|
|
||||||
case ROW_GROUP: m_textGroup.SetEffectGlowing(); break;
|
|
||||||
case ROW_SONG:
|
|
||||||
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
|
||||||
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
|
||||||
break;
|
|
||||||
case ROW_NOTES_TYPE: m_textNotesType.SetEffectGlowing(); break;
|
|
||||||
case ROW_STEPS: m_textNotes.SetEffectGlowing(); break;
|
|
||||||
default: ASSERT(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::OnGroupChange()
|
|
||||||
{
|
|
||||||
m_iSelectedGroup = clamp( m_iSelectedGroup, 0, m_sGroups.GetSize()-1 );
|
|
||||||
|
|
||||||
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
|
|
||||||
|
|
||||||
// reload songs
|
|
||||||
m_pSongs.RemoveAll();
|
|
||||||
SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs );
|
|
||||||
|
|
||||||
OnSongChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::OnSongChange()
|
|
||||||
{
|
|
||||||
m_iSelectedSong = clamp( m_iSelectedSong, 0, m_pSongs.GetSize()-1 );
|
|
||||||
|
|
||||||
m_Banner.LoadFromSong( GetSelectedSong() );
|
|
||||||
m_TextBanner.LoadFromSong( GetSelectedSong() );
|
|
||||||
|
|
||||||
OnNotesTypeChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::OnNotesTypeChange()
|
|
||||||
{
|
|
||||||
m_iSelectedNotesType = clamp( m_iSelectedNotesType, 0, m_NotesTypes.GetSize()-1 );
|
|
||||||
|
|
||||||
m_textNotesType.SetText( NotesTypeToString( GetSelectedNotesType() ) );
|
|
||||||
|
|
||||||
m_pNotess.RemoveAll();
|
|
||||||
GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess );
|
|
||||||
SortNotesArrayByDifficulty( m_pNotess );
|
|
||||||
m_pNotess.Add( NULL ); // marker for "(NEW)"
|
|
||||||
m_iSelectedNotes = 0;
|
|
||||||
|
|
||||||
|
|
||||||
OnNotesChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::OnNotesChange()
|
|
||||||
{
|
|
||||||
m_iSelectedNotes = clamp( m_iSelectedNotes, 0, m_pNotess.GetSize()-1 );
|
|
||||||
|
|
||||||
if( GetSelectedNotes() == NULL )
|
|
||||||
m_textNotes.SetText( "(NEW)" );
|
|
||||||
else
|
|
||||||
m_textNotes.SetText( GetSelectedNotes()->m_sDescription!="" ? GetSelectedNotes()->m_sDescription : "[no name]" );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenEditMenu::MenuUp( const PlayerNumber p )
|
void ScreenEditMenu::MenuUp( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
if( m_SelectedRow == 0 ) // can't go up any further
|
Selector.Up();
|
||||||
return;
|
|
||||||
|
|
||||||
ChangeSelectedRow(SelectedRow(m_SelectedRow-1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::MenuDown( const PlayerNumber p )
|
void ScreenEditMenu::MenuDown( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
|
Selector.Down();
|
||||||
return;
|
|
||||||
|
|
||||||
ChangeSelectedRow(SelectedRow(m_SelectedRow+1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::MenuLeft( const PlayerNumber p )
|
void ScreenEditMenu::MenuLeft( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
switch( m_SelectedRow )
|
Selector.Left();
|
||||||
{
|
|
||||||
case ROW_GROUP:
|
|
||||||
if( m_iSelectedGroup == 0 ) // can't go left any further
|
|
||||||
return;
|
|
||||||
m_iSelectedGroup--;
|
|
||||||
OnGroupChange();
|
|
||||||
break;
|
|
||||||
case ROW_SONG:
|
|
||||||
if( m_iSelectedSong == 0 ) // can't go left any further
|
|
||||||
return;
|
|
||||||
m_iSelectedSong--;
|
|
||||||
OnSongChange();
|
|
||||||
break;
|
|
||||||
case ROW_NOTES_TYPE:
|
|
||||||
if( m_iSelectedNotesType == 0 ) // can't go left any further
|
|
||||||
return;
|
|
||||||
m_iSelectedNotesType--;
|
|
||||||
OnNotesTypeChange();
|
|
||||||
break;
|
|
||||||
case ROW_STEPS:
|
|
||||||
if( m_iSelectedNotes == 0 ) // can't go left any further
|
|
||||||
return;
|
|
||||||
m_iSelectedNotes--;
|
|
||||||
OnNotesChange();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::MenuRight( const PlayerNumber p )
|
void ScreenEditMenu::MenuRight( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
switch( m_SelectedRow )
|
Selector.Right();
|
||||||
{
|
|
||||||
case ROW_GROUP:
|
|
||||||
if( m_iSelectedGroup == m_sGroups.GetSize()-1 ) // can't go right any further
|
|
||||||
return;
|
|
||||||
m_iSelectedGroup++;
|
|
||||||
OnGroupChange();
|
|
||||||
break;
|
|
||||||
case ROW_SONG:
|
|
||||||
if( m_iSelectedSong == m_pSongs.GetSize()-1 ) // can't go right any further
|
|
||||||
return;
|
|
||||||
m_iSelectedSong++;
|
|
||||||
OnSongChange();
|
|
||||||
break;
|
|
||||||
case ROW_NOTES_TYPE:
|
|
||||||
if( m_iSelectedNotesType == m_NotesTypes.GetSize()-1 ) // can't go right any further
|
|
||||||
return;
|
|
||||||
m_iSelectedNotesType++;
|
|
||||||
OnNotesTypeChange();
|
|
||||||
break;
|
|
||||||
case ROW_STEPS:
|
|
||||||
if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further
|
|
||||||
return;
|
|
||||||
m_iSelectedNotes++;
|
|
||||||
OnNotesChange();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenEditMenu::MenuStart( const PlayerNumber p )
|
void ScreenEditMenu::MenuStart( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
m_Menu.TweenOffScreenToBlack( SM_None, false );
|
Selector.TweenOffScreenToBlack( SM_None, false );
|
||||||
|
|
||||||
MUSIC->Stop();
|
MUSIC->Stop();
|
||||||
|
|
||||||
GAMESTATE->m_pCurSong = GetSelectedSong();
|
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
|
||||||
|
|
||||||
// find the first style that matches this notes type
|
// find the first style that matches this notes type
|
||||||
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
|
||||||
GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( GetSelectedNotesType() );
|
GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( Selector.GetSelectedNotesType() );
|
||||||
GAMESTATE->m_pCurNotes[PLAYER_1] = GetSelectedNotes();
|
GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.GetSelectedNotes();
|
||||||
|
|
||||||
m_soundSelect.PlayRandom();
|
m_soundSelect.PlayRandom();
|
||||||
|
|
||||||
@@ -390,8 +167,7 @@ void ScreenEditMenu::MenuStart( const PlayerNumber p )
|
|||||||
|
|
||||||
void ScreenEditMenu::MenuBack( const PlayerNumber p )
|
void ScreenEditMenu::MenuBack( const PlayerNumber p )
|
||||||
{
|
{
|
||||||
m_Menu.TweenOffScreenToBlack( SM_None, true );
|
Selector.TweenOffScreenToBlack( SM_None, true );
|
||||||
|
|
||||||
|
|
||||||
MUSIC->Stop();
|
MUSIC->Stop();
|
||||||
|
|
||||||
|
|||||||
@@ -10,17 +10,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "Sprite.h"
|
#include "SongSelector.h"
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "TransitionFade.h"
|
#include "TransitionFade.h"
|
||||||
#include "RandomSample.h"
|
#include "RandomSample.h"
|
||||||
#include "Banner.h"
|
|
||||||
#include "TextBanner.h"
|
|
||||||
#include "RandomSample.h"
|
|
||||||
#include "TransitionInvisible.h"
|
|
||||||
#include "MenuElements.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ScreenEditMenu : public Screen
|
class ScreenEditMenu : public Screen
|
||||||
{
|
{
|
||||||
@@ -28,20 +21,10 @@ public:
|
|||||||
ScreenEditMenu();
|
ScreenEditMenu();
|
||||||
virtual ~ScreenEditMenu();
|
virtual ~ScreenEditMenu();
|
||||||
|
|
||||||
virtual void DrawPrimitives();
|
|
||||||
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnGroupChange();
|
|
||||||
void OnSongChange();
|
|
||||||
void OnNotesTypeChange();
|
|
||||||
void OnNotesChange();
|
|
||||||
|
|
||||||
CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; };
|
|
||||||
Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; };
|
|
||||||
NotesType GetSelectedNotesType() { return m_NotesTypes[m_iSelectedNotesType]; };
|
|
||||||
Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; };
|
|
||||||
|
|
||||||
void MenuUp( const PlayerNumber p );
|
void MenuUp( const PlayerNumber p );
|
||||||
void MenuDown( const PlayerNumber p );
|
void MenuDown( const PlayerNumber p );
|
||||||
@@ -50,40 +33,13 @@ private:
|
|||||||
void MenuBack( const PlayerNumber p );
|
void MenuBack( const PlayerNumber p );
|
||||||
void MenuStart( const PlayerNumber p );
|
void MenuStart( const PlayerNumber p );
|
||||||
|
|
||||||
|
SongSelector Selector;
|
||||||
enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_NOTES_TYPE, ROW_STEPS, NUM_ROWS };
|
|
||||||
SelectedRow m_SelectedRow;
|
|
||||||
|
|
||||||
MenuElements m_Menu;
|
|
||||||
|
|
||||||
CStringArray m_sGroups;
|
|
||||||
int m_iSelectedGroup; // index into m_sGroups
|
|
||||||
BitmapText m_textGroup;
|
|
||||||
|
|
||||||
CArray<Song*, Song*> m_pSongs;
|
|
||||||
int m_iSelectedSong; // index into m_pSongs
|
|
||||||
Banner m_Banner;
|
|
||||||
TextBanner m_TextBanner;
|
|
||||||
Sprite m_sprArrowLeft;
|
|
||||||
Sprite m_sprArrowRight;
|
|
||||||
|
|
||||||
CArray<NotesType, NotesType> m_NotesTypes;
|
|
||||||
int m_iSelectedNotesType; // index into m_NotesTypes
|
|
||||||
BitmapText m_textNotesType;
|
|
||||||
|
|
||||||
CArray<Notes*, Notes*> m_pNotess;
|
|
||||||
int m_iSelectedNotes; // index into m_pNotess
|
|
||||||
BitmapText m_textNotes;
|
|
||||||
|
|
||||||
|
|
||||||
BitmapText m_textExplanation;
|
BitmapText m_textExplanation;
|
||||||
|
|
||||||
TransitionFade m_Fade;
|
TransitionFade m_Fade;
|
||||||
|
|
||||||
RandomSample m_soundChangeMusic;
|
|
||||||
RandomSample m_soundSelect;
|
RandomSample m_soundSelect;
|
||||||
|
|
||||||
void ChangeSelectedRow( SelectedRow row );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,301 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: SongSelector
|
||||||
|
|
||||||
|
Desc: See header.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "SongSelector.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// Defines specific to SongSelector
|
||||||
|
//
|
||||||
|
const float GROUP_X = CENTER_X;
|
||||||
|
const float GROUP_Y = CENTER_Y - 160;
|
||||||
|
|
||||||
|
const float SONG_BANNER_X = CENTER_X;
|
||||||
|
const float SONG_BANNER_Y = CENTER_Y - 80;
|
||||||
|
|
||||||
|
const float SONG_BANNER_WIDTH = 286;
|
||||||
|
const float SONG_BANNER_HEIGHT = 92;
|
||||||
|
|
||||||
|
const float ARROWS_X[2] = { SONG_BANNER_X - 200, SONG_BANNER_X + 200 };
|
||||||
|
const float ARROWS_Y[2] = { SONG_BANNER_Y, SONG_BANNER_Y };
|
||||||
|
|
||||||
|
const float SONG_TEXT_BANNER_X = CENTER_X;
|
||||||
|
const float SONG_TEXT_BANNER_Y = CENTER_Y - 10;
|
||||||
|
|
||||||
|
const float GAME_STYLE_X = CENTER_X;
|
||||||
|
const float GAME_STYLE_Y = CENTER_Y + 40;
|
||||||
|
|
||||||
|
const float STEPS_X = CENTER_X;
|
||||||
|
const float STEPS_Y = CENTER_Y + 90;
|
||||||
|
|
||||||
|
SongSelector::SongSelector()
|
||||||
|
{
|
||||||
|
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
|
||||||
|
|
||||||
|
NewNotes = false;
|
||||||
|
|
||||||
|
m_textGroup.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
||||||
|
m_textGroup.SetXY( GROUP_X, GROUP_Y );
|
||||||
|
m_textGroup.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||||
|
m_textGroup.SetText( "blah" );
|
||||||
|
this->AddSubActor( &m_textGroup );
|
||||||
|
|
||||||
|
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
|
||||||
|
m_Banner.SetCroppedSize( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT );
|
||||||
|
this->AddSubActor( &m_Banner );
|
||||||
|
|
||||||
|
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
|
||||||
|
this->AddSubActor( &m_TextBanner );
|
||||||
|
|
||||||
|
m_sprArrowLeft.Load( THEME->GetPathTo("Graphics","edit menu left") );
|
||||||
|
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
|
||||||
|
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
this->AddSubActor( &m_sprArrowLeft );
|
||||||
|
|
||||||
|
m_sprArrowRight.Load( THEME->GetPathTo("Graphics","edit menu right") );
|
||||||
|
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
|
||||||
|
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
this->AddSubActor( &m_sprArrowRight );
|
||||||
|
|
||||||
|
m_textNotesType.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
||||||
|
m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
|
||||||
|
m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||||
|
m_textNotesType.SetText( "blah" );
|
||||||
|
this->AddSubActor( &m_textNotesType );
|
||||||
|
|
||||||
|
m_textNotes.LoadFromFont( THEME->GetPathTo("Fonts","header1") );
|
||||||
|
m_textNotes.SetXY( STEPS_X, STEPS_Y );
|
||||||
|
m_textNotes.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
||||||
|
m_textNotes.SetText( "blah" );
|
||||||
|
this->AddSubActor( &m_textNotes );
|
||||||
|
|
||||||
|
// data structures
|
||||||
|
ChangeSelectedRow(ROW_GROUP);
|
||||||
|
|
||||||
|
SONGMAN->GetGroupNames( m_sGroups );
|
||||||
|
GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, m_NotesTypes );
|
||||||
|
m_iSelectedGroup = m_iSelectedSong = m_iSelectedNotesType = m_iSelectedNotes = 0;
|
||||||
|
|
||||||
|
if( GAMESTATE->m_pCurSong )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i=0; i<m_sGroups.GetSize(); i++ )
|
||||||
|
if( GAMESTATE->m_pCurSong->m_sGroupName == m_sGroups[i] )
|
||||||
|
m_iSelectedGroup = i;
|
||||||
|
OnGroupChange();
|
||||||
|
|
||||||
|
for( i=0; i<m_pSongs.GetSize(); i++ )
|
||||||
|
if( GAMESTATE->m_pCurSong == m_pSongs[i] )
|
||||||
|
m_iSelectedSong = i;
|
||||||
|
OnSongChange();
|
||||||
|
|
||||||
|
for( i=0; i<m_NotesTypes.GetSize(); i++ )
|
||||||
|
if( GAMESTATE->GetCurrentStyleDef()->m_NotesType == m_NotesTypes[i] )
|
||||||
|
m_iSelectedNotesType = i;
|
||||||
|
OnNotesTypeChange();
|
||||||
|
|
||||||
|
for( i=0; i<m_pNotess.GetSize(); i++ )
|
||||||
|
if( GAMESTATE->m_pCurNotes[PLAYER_1] == m_pNotess[i] )
|
||||||
|
m_iSelectedNotes = i;
|
||||||
|
OnNotesChange();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
OnGroupChange();
|
||||||
|
|
||||||
|
m_Menu.Load(
|
||||||
|
THEME->GetPathTo("Graphics","edit background"),
|
||||||
|
THEME->GetPathTo("Graphics","edit top edge"),
|
||||||
|
ssprintf("%c %c change line %c %c change value START to continue", char(3), char(4), char(1), char(2) ),
|
||||||
|
false, false, 40
|
||||||
|
);
|
||||||
|
this->AddSubActor( &m_Menu );
|
||||||
|
|
||||||
|
m_soundChangeMusic.Load( THEME->GetPathTo("Sounds","select music change music") );
|
||||||
|
|
||||||
|
m_Menu.TweenOnScreenFromBlack( SM_None );
|
||||||
|
}
|
||||||
|
|
||||||
|
SongSelector::~SongSelector()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::DrawPrimitives()
|
||||||
|
{
|
||||||
|
m_Menu.DrawBottomLayer();
|
||||||
|
ActorFrame::DrawPrimitives();
|
||||||
|
m_Menu.DrawTopLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::Up()
|
||||||
|
{
|
||||||
|
if( m_SelectedRow == 0 ) // can't go up any further
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChangeSelectedRow(SelectedRow(m_SelectedRow-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::Down()
|
||||||
|
{
|
||||||
|
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChangeSelectedRow(SelectedRow(m_SelectedRow+1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::Left()
|
||||||
|
{
|
||||||
|
switch( m_SelectedRow )
|
||||||
|
{
|
||||||
|
case ROW_GROUP:
|
||||||
|
if( m_iSelectedGroup == 0 ) // can't go left any further
|
||||||
|
return;
|
||||||
|
m_iSelectedGroup--;
|
||||||
|
OnGroupChange();
|
||||||
|
break;
|
||||||
|
case ROW_SONG:
|
||||||
|
if( m_iSelectedSong == 0 ) // can't go left any further
|
||||||
|
return;
|
||||||
|
m_iSelectedSong--;
|
||||||
|
OnSongChange();
|
||||||
|
break;
|
||||||
|
case ROW_NOTES_TYPE:
|
||||||
|
if( m_iSelectedNotesType == 0 ) // can't go left any further
|
||||||
|
return;
|
||||||
|
m_iSelectedNotesType--;
|
||||||
|
OnNotesTypeChange();
|
||||||
|
break;
|
||||||
|
case ROW_STEPS:
|
||||||
|
if( m_iSelectedNotes == 0 ) // can't go left any further
|
||||||
|
return;
|
||||||
|
m_iSelectedNotes--;
|
||||||
|
OnNotesChange();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::Right()
|
||||||
|
{
|
||||||
|
switch( m_SelectedRow )
|
||||||
|
{
|
||||||
|
case ROW_GROUP:
|
||||||
|
if( m_iSelectedGroup == m_sGroups.GetSize()-1 ) // can't go right any further
|
||||||
|
return;
|
||||||
|
m_iSelectedGroup++;
|
||||||
|
OnGroupChange();
|
||||||
|
break;
|
||||||
|
case ROW_SONG:
|
||||||
|
if( m_iSelectedSong == m_pSongs.GetSize()-1 ) // can't go right any further
|
||||||
|
return;
|
||||||
|
m_iSelectedSong++;
|
||||||
|
OnSongChange();
|
||||||
|
break;
|
||||||
|
case ROW_NOTES_TYPE:
|
||||||
|
if( m_iSelectedNotesType == m_NotesTypes.GetSize()-1 ) // can't go right any further
|
||||||
|
return;
|
||||||
|
m_iSelectedNotesType++;
|
||||||
|
OnNotesTypeChange();
|
||||||
|
break;
|
||||||
|
case ROW_STEPS:
|
||||||
|
if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further
|
||||||
|
return;
|
||||||
|
m_iSelectedNotes++;
|
||||||
|
OnNotesChange();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SongSelector::ChangeSelectedRow( SelectedRow row )
|
||||||
|
{
|
||||||
|
m_textGroup.SetEffectNone();
|
||||||
|
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
||||||
|
m_textNotesType.SetEffectNone();
|
||||||
|
m_textNotes.SetEffectNone();
|
||||||
|
|
||||||
|
m_SelectedRow = row;
|
||||||
|
|
||||||
|
switch( m_SelectedRow )
|
||||||
|
{
|
||||||
|
case ROW_GROUP: m_textGroup.SetEffectGlowing(); break;
|
||||||
|
case ROW_SONG:
|
||||||
|
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||||
|
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||||
|
break;
|
||||||
|
case ROW_NOTES_TYPE: m_textNotesType.SetEffectGlowing(); break;
|
||||||
|
case ROW_STEPS: m_textNotes.SetEffectGlowing(); break;
|
||||||
|
default: ASSERT(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::OnGroupChange()
|
||||||
|
{
|
||||||
|
m_iSelectedGroup = clamp( m_iSelectedGroup, 0, m_sGroups.GetSize()-1 );
|
||||||
|
|
||||||
|
m_textGroup.SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) );
|
||||||
|
|
||||||
|
// reload songs
|
||||||
|
m_pSongs.RemoveAll();
|
||||||
|
SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs );
|
||||||
|
|
||||||
|
OnSongChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::OnSongChange()
|
||||||
|
{
|
||||||
|
m_iSelectedSong = clamp( m_iSelectedSong, 0, m_pSongs.GetSize()-1 );
|
||||||
|
|
||||||
|
m_Banner.LoadFromSong( GetSelectedSong() );
|
||||||
|
m_TextBanner.LoadFromSong( GetSelectedSong() );
|
||||||
|
|
||||||
|
OnNotesTypeChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::OnNotesTypeChange()
|
||||||
|
{
|
||||||
|
m_iSelectedNotesType = clamp( m_iSelectedNotesType, 0, m_NotesTypes.GetSize()-1 );
|
||||||
|
|
||||||
|
m_textNotesType.SetText( NotesTypeToString( GetSelectedNotesType() ) );
|
||||||
|
|
||||||
|
m_pNotess.RemoveAll();
|
||||||
|
GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess );
|
||||||
|
SortNotesArrayByDifficulty( m_pNotess );
|
||||||
|
m_pNotess.Add( NULL ); // marker for "(NEW)"
|
||||||
|
m_iSelectedNotes = 0;
|
||||||
|
|
||||||
|
OnNotesChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::OnNotesChange()
|
||||||
|
{
|
||||||
|
m_iSelectedNotes = clamp( m_iSelectedNotes, 0, m_pNotess.GetSize()-1 );
|
||||||
|
|
||||||
|
if( GetSelectedNotes() == NULL )
|
||||||
|
{
|
||||||
|
m_textNotes.SetText( "(NEW)" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_textNotes.SetText( GetSelectedNotes()->m_sDescription!="" ? GetSelectedNotes()->m_sDescription : "[no name]" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongSelector::TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPlayBackSound )
|
||||||
|
{
|
||||||
|
m_Menu.TweenOffScreenToBlack( smSendWhenDone, bPlayBackSound );
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
Class: SongSelector
|
||||||
|
|
||||||
|
Desc: Choose a game, style, song and notes on one screen.
|
||||||
|
|
||||||
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||||
|
Chris Danford
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SONG_SELECTOR_H
|
||||||
|
#define SONG_SELECTOR_H
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "ActorFrame.h"
|
||||||
|
|
||||||
|
#include "MenuElements.h"
|
||||||
|
#include "Banner.h"
|
||||||
|
#include "TextBanner.h"
|
||||||
|
|
||||||
|
class SongSelector: public ActorFrame {
|
||||||
|
public:
|
||||||
|
SongSelector();
|
||||||
|
~SongSelector();
|
||||||
|
virtual void DrawPrimitives();
|
||||||
|
|
||||||
|
void Up();
|
||||||
|
void Down();
|
||||||
|
void Left();
|
||||||
|
void Right();
|
||||||
|
|
||||||
|
CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; };
|
||||||
|
Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; };
|
||||||
|
NotesType GetSelectedNotesType() { return m_NotesTypes[m_iSelectedNotesType]; };
|
||||||
|
Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; };
|
||||||
|
|
||||||
|
void TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPlayBackSound );
|
||||||
|
|
||||||
|
/* not used yet */
|
||||||
|
bool NewNotes;
|
||||||
|
void AllowNewNotes(bool NewNotes_=true) { NewNotes = NewNotes; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_NOTES_TYPE, ROW_STEPS, NUM_ROWS };
|
||||||
|
SelectedRow m_SelectedRow;
|
||||||
|
|
||||||
|
MenuElements m_Menu;
|
||||||
|
|
||||||
|
CStringArray m_sGroups;
|
||||||
|
int m_iSelectedGroup; // index into m_sGroups
|
||||||
|
BitmapText m_textGroup;
|
||||||
|
|
||||||
|
CArray<Song*, Song*> m_pSongs;
|
||||||
|
int m_iSelectedSong; // index into m_pSongs
|
||||||
|
Banner m_Banner;
|
||||||
|
TextBanner m_TextBanner;
|
||||||
|
|
||||||
|
Sprite m_sprArrowLeft;
|
||||||
|
Sprite m_sprArrowRight;
|
||||||
|
CArray<NotesType, NotesType> m_NotesTypes;
|
||||||
|
int m_iSelectedNotesType; // index into m_NotesTypes
|
||||||
|
BitmapText m_textNotesType;
|
||||||
|
|
||||||
|
CArray<Notes*, Notes*> m_pNotess;
|
||||||
|
int m_iSelectedNotes; // index into m_pNotess
|
||||||
|
BitmapText m_textNotes;
|
||||||
|
|
||||||
|
RandomSample m_soundChangeMusic;
|
||||||
|
|
||||||
|
void OnGroupChange();
|
||||||
|
void OnSongChange();
|
||||||
|
void OnNotesTypeChange();
|
||||||
|
void OnNotesChange();
|
||||||
|
|
||||||
|
void ChangeSelectedRow( SelectedRow row );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -724,6 +724,14 @@ SOURCE=.\SongInfoFrame.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SongSelector.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\SongSelector.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\StageBox.cpp
|
SOURCE=.\StageBox.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|||||||
Reference in New Issue
Block a user