move song selection for the editor to SongSelector

This commit is contained in:
Glenn Maynard
2002-08-22 05:57:15 +00:00
parent b657027ad6
commit 78bd46eb04
5 changed files with 409 additions and 289 deletions
+19 -243
View File
@@ -48,6 +48,11 @@ const float GAME_STYLE_Y = CENTER_Y + 40;
const float STEPS_X = CENTER_X;
const float STEPS_Y = CENTER_Y + 90;
const float EXPLANATION_X = CENTER_X;
const float EXPLANATION_Y = SCREEN_BOTTOM - 70;
const CString EXPLANATION_TEXT =
@@ -62,80 +67,9 @@ ScreenEditMenu::ScreenEditMenu()
{
LOG->Trace( "ScreenEditMenu::ScreenEditMenu()" );
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 = 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();
Selector.SetXY( 0, 0 );
// Selector.AllowNewNotes();
this->AddSubActor( &Selector );
m_textExplanation.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
@@ -143,27 +77,12 @@ ScreenEditMenu::ScreenEditMenu()
m_textExplanation.SetZoom( 0.7f );
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();
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->Play( true );
m_Menu.TweenOnScreenFromBlack( SM_None );
m_soundSelect.Load( THEME->GetPathTo("Sounds","menu start") );
}
@@ -172,13 +91,6 @@ 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 )
{
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.
// Set the current Style, then let ScreenEdit infer the desired
// NotesType from that Style.
NotesType nt = GetSelectedNotesType();
NotesType nt = Selector.GetSelectedNotesType();
Style style = GAMEMAN->GetEditStyleThatPlaysNotesType( nt );
GAMESTATE->m_CurStyle = style;
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 )
{
if( m_SelectedRow == 0 ) // can't go up any further
return;
ChangeSelectedRow(SelectedRow(m_SelectedRow-1));
Selector.Up();
}
void ScreenEditMenu::MenuDown( const PlayerNumber p )
{
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
return;
ChangeSelectedRow(SelectedRow(m_SelectedRow+1));
Selector.Down();
}
void ScreenEditMenu::MenuLeft( const PlayerNumber p )
{
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);
}
Selector.Left();
}
void ScreenEditMenu::MenuRight( const PlayerNumber p )
{
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);
}
Selector.Right();
}
void ScreenEditMenu::MenuStart( const PlayerNumber p )
{
m_Menu.TweenOffScreenToBlack( SM_None, false );
Selector.TweenOffScreenToBlack( SM_None, false );
MUSIC->Stop();
GAMESTATE->m_pCurSong = GetSelectedSong();
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
// find the first style that matches this notes type
GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( GetSelectedNotesType() );
GAMESTATE->m_pCurNotes[PLAYER_1] = GetSelectedNotes();
GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( Selector.GetSelectedNotesType() );
GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.GetSelectedNotes();
m_soundSelect.PlayRandom();
@@ -390,8 +167,7 @@ void ScreenEditMenu::MenuStart( const PlayerNumber p )
void ScreenEditMenu::MenuBack( const PlayerNumber p )
{
m_Menu.TweenOffScreenToBlack( SM_None, true );
Selector.TweenOffScreenToBlack( SM_None, true );
MUSIC->Stop();