c5570839d9
attention, because one of my code additions might save you some work in the future. * NotesTypeToStyle(nt) and StyleToNotesType(s) Look in GameConstantsAndTypes.h for these two new functions. Essentially, they provide a centralized automation for the NotesType/Style switch() tables in several functions. On top of that, I've even included a Perl script which will actually rewrite the two functions for you - all you have to do is keep the array at the beginning of the script updated, then run the script and paste the results. See the notes in GameConstantsAndTypes.h for details. * Changes in ScreenEditMenu and ScreenEdit I changed ScreenEditMenu and ScreenEdit in order to correct a bug that made it so that in Edit mode, when working with a (NEW) sequence (previously created sequences were not affected), no matter which style was selected, it was only possible to edit the leftmost four arrows of the style. This made creating ez2-single, pump-single, and dance-solo (among others) impractical (one would have to manually add a new section to the .sm file with the correct number of columns; then it would be editable). The change made to ScreenEditMenu is only to update the NotesType to Style conversion; the former switch() table in HandleScreenMessage() was already out of date and unable to support EZ2 styles/types. The change made to ScreenEdit changes the m_NotesType of the freshly initialized Notes object. In Notes::Notes(), m_NotesType is initialized to NOTES_TYPE_DANCE_SINGLE (hence the locking to four arrows). My addition changes m_NotesType to reflect the selection made in ScreenEditMenu. Word up. - Dro -
370 lines
9.5 KiB
C++
370 lines
9.5 KiB
C++
#include "stdafx.h"
|
|
/*
|
|
-----------------------------------------------------------------------------
|
|
File: ScreenEditMenu.h
|
|
|
|
Desc: The main title screen and menu.
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#include "ScreenEditMenu.h"
|
|
#include "SongManager.h"
|
|
#include "ScreenManager.h"
|
|
#include "ScreenTitleMenu.h"
|
|
#include "ScreenEdit.h"
|
|
#include "GameConstantsAndTypes.h"
|
|
#include "RageUtil.h"
|
|
#include "ThemeManager.h"
|
|
#include "GameManager.h"
|
|
#include "ScreenPrompt.h"
|
|
#include "RageLog.h"
|
|
|
|
|
|
//
|
|
// Defines specific to ScreenEditMenu
|
|
//
|
|
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 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;
|
|
|
|
const float EXPLANATION_X = CENTER_X;
|
|
const float EXPLANATION_Y = SCREEN_BOTTOM - 70;
|
|
const CString EXPLANATION_TEXT =
|
|
"In this mode, you can edit existing notes patterns,\n"
|
|
"create note patterns, or synchronize notes with the music.";
|
|
|
|
const ScreenMessage SM_GoToPrevState = ScreenMessage(SM_User+1);
|
|
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User+2);
|
|
|
|
|
|
ScreenEditMenu::ScreenEditMenu()
|
|
{
|
|
LOG->WriteLine( "ScreenEditMenu::ScreenEditMenu()" );
|
|
|
|
|
|
// data structures
|
|
m_SelectedRow = ROW_GROUP;
|
|
|
|
SONGMAN->GetGroupNames( m_sGroups );
|
|
m_iSelectedGroup = 0;
|
|
m_iSelectedSong = 0;
|
|
m_CurNotesType = NOTES_TYPE_DANCE_SINGLE;
|
|
m_iSelectedNotes = 0;
|
|
|
|
m_textGroup.Load( THEME->GetPathTo(FONT_HEADER1) );
|
|
m_textGroup.SetXY( GROUP_X, GROUP_Y );
|
|
m_textGroup.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
this->AddActor( &m_textGroup );
|
|
|
|
m_Banner.SetXY( SONG_BANNER_X, SONG_BANNER_Y );
|
|
this->AddActor( &m_Banner );
|
|
|
|
m_TextBanner.SetXY( SONG_TEXT_BANNER_X, SONG_TEXT_BANNER_Y );
|
|
this->AddActor( &m_TextBanner );
|
|
|
|
m_sprArrowLeft.Load( THEME->GetPathTo(GRAPHIC_ARROWS_LEFT) );
|
|
m_sprArrowLeft.SetXY( ARROWS_X[0], ARROWS_Y[0] );
|
|
m_sprArrowLeft.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
this->AddActor( &m_sprArrowLeft );
|
|
|
|
m_sprArrowRight.Load( THEME->GetPathTo(GRAPHIC_ARROWS_RIGHT) );
|
|
m_sprArrowRight.SetXY( ARROWS_X[1], ARROWS_Y[1] );
|
|
m_sprArrowRight.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
|
|
this->AddActor( &m_sprArrowRight );
|
|
|
|
m_textNotesType.Load( THEME->GetPathTo(FONT_HEADER1) );
|
|
m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y );
|
|
m_textNotesType.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
this->AddActor( &m_textNotesType );
|
|
|
|
m_textNotes.Load( THEME->GetPathTo(FONT_HEADER1) );
|
|
m_textNotes.SetXY( STEPS_X, STEPS_Y );
|
|
m_textNotes.SetDiffuseColor( D3DXCOLOR(0.7f,0.7f,0.7f,1) );
|
|
this->AddActor( &m_textNotes );
|
|
|
|
|
|
AfterRowChange();
|
|
OnGroupChange();
|
|
|
|
|
|
m_textExplanation.Load( THEME->GetPathTo(FONT_NORMAL) );
|
|
m_textExplanation.SetXY( EXPLANATION_X, EXPLANATION_Y );
|
|
m_textExplanation.SetText( EXPLANATION_TEXT );
|
|
m_textExplanation.SetZoom( 0.7f );
|
|
this->AddActor( &m_textExplanation );
|
|
|
|
m_Menu.Load(
|
|
THEME->GetPathTo(GRAPHIC_EDIT_BACKGROUND),
|
|
THEME->GetPathTo(GRAPHIC_EDIT_TOP_EDGE),
|
|
ssprintf("%s %s change music START to continue", CString(char(1)), CString(char(2)) ),
|
|
false, true, 40
|
|
);
|
|
this->AddActor( &m_Menu );
|
|
|
|
|
|
m_Fade.SetOpened();
|
|
this->AddActor( &m_Fade);
|
|
|
|
|
|
m_soundChangeMusic.Load( THEME->GetPathTo(SOUND_SELECT_MUSIC_CHANGE_MUSIC) );
|
|
m_soundSelect.Load( THEME->GetPathTo(SOUND_MENU_START) );
|
|
|
|
MUSIC->Load( THEME->GetPathTo(SOUND_MENU_MUSIC) );
|
|
MUSIC->Play( true );
|
|
|
|
|
|
m_Menu.TweenOnScreenFromBlack( SM_None );
|
|
}
|
|
|
|
|
|
ScreenEditMenu::~ScreenEditMenu()
|
|
{
|
|
LOG->WriteLine( "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->WriteLine( "ScreenEditMenu::Input()" );
|
|
|
|
|
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
}
|
|
|
|
void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
|
|
{
|
|
switch( SM )
|
|
{
|
|
case SM_GoToPrevState:
|
|
SCREENMAN->SetNewScreen( new ScreenTitleMenu );
|
|
break;
|
|
case SM_GoToNextState:
|
|
// set the current style based on the notes type
|
|
|
|
//switch( GetSelectedNotesType() )
|
|
//{
|
|
//case NOTES_TYPE_DANCE_SINGLE: GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE; break;
|
|
//case NOTES_TYPE_DANCE_DOUBLE: GAMEMAN->m_CurStyle = STYLE_DANCE_DOUBLE; break;
|
|
//case NOTES_TYPE_DANCE_COUPLE: GAMEMAN->m_CurStyle = STYLE_DANCE_COUPLE; break;
|
|
//case NOTES_TYPE_DANCE_SOLO: GAMEMAN->m_CurStyle = STYLE_DANCE_SOLO; break;
|
|
//case NOTES_TYPE_PUMP_SINGLE: GAMEMAN->m_CurStyle = STYLE_PUMP_SINGLE; break;
|
|
//case NOTES_TYPE_PUMP_DOUBLE: GAMEMAN->m_CurStyle = STYLE_PUMP_DOUBLE; break;
|
|
//}
|
|
|
|
// Dro Kulix:
|
|
// A centralized solution for this switching mess...
|
|
// (See GameConstantsAndTypes.h)
|
|
GAMEMAN->m_CurStyle = NotesTypeToStyle( GetSelectedNotesType() );
|
|
|
|
SCREENMAN->SetNewScreen( new ScreenEdit );
|
|
break;
|
|
}
|
|
}
|
|
|
|
void ScreenEditMenu::BeforeRowChange()
|
|
{
|
|
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();
|
|
}
|
|
|
|
void ScreenEditMenu::AfterRowChange()
|
|
{
|
|
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_CurNotesType = (NotesType)clamp( m_CurNotesType, 0, NUM_NOTES_TYPES );
|
|
|
|
m_textNotesType.SetText( NotesTypeToString( GetSelectedNotesType() ) );
|
|
|
|
m_pNotess.RemoveAll();
|
|
GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess );
|
|
SortNotesArrayByDifficultyClass( m_pNotess );
|
|
m_pNotess.Add( NULL ); // marker for "(NEW)"
|
|
m_iSelectedNotes = 0;
|
|
|
|
|
|
OnStepsChange();
|
|
}
|
|
|
|
void ScreenEditMenu::OnStepsChange()
|
|
{
|
|
m_iSelectedNotes = clamp( m_iSelectedNotes, 0, m_pNotess.GetSize()-1 );
|
|
|
|
if( GetSelectedNotes() == NULL )
|
|
m_textNotes.SetText( "(NEW)" );
|
|
else
|
|
m_textNotes.SetText( GetSelectedNotes()->m_sDescription );
|
|
|
|
}
|
|
|
|
void ScreenEditMenu::MenuUp( const PlayerNumber p )
|
|
{
|
|
if( m_SelectedRow == 0 ) // can't go up any further
|
|
return;
|
|
|
|
BeforeRowChange();
|
|
m_SelectedRow = SelectedRow(m_SelectedRow-1);
|
|
AfterRowChange();
|
|
}
|
|
|
|
void ScreenEditMenu::MenuDown( const PlayerNumber p )
|
|
{
|
|
if( m_SelectedRow == NUM_ROWS-1 ) // can't go down any further
|
|
return;
|
|
|
|
BeforeRowChange();
|
|
m_SelectedRow = SelectedRow(m_SelectedRow+1);
|
|
AfterRowChange();
|
|
}
|
|
|
|
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_CurNotesType == 0 ) // can't go left any further
|
|
return;
|
|
m_CurNotesType = NotesType( m_CurNotesType-1 );
|
|
OnNotesTypeChange();
|
|
break;
|
|
case ROW_STEPS:
|
|
if( m_iSelectedNotes == 0 ) // can't go left any further
|
|
return;
|
|
m_iSelectedNotes--;
|
|
OnStepsChange();
|
|
break;
|
|
default:
|
|
ASSERT(false);
|
|
}
|
|
}
|
|
|
|
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_CurNotesType == NUM_NOTES_TYPES-1 ) // can't go right any further
|
|
return;
|
|
m_CurNotesType = NotesType( m_CurNotesType+1 );
|
|
OnNotesTypeChange();
|
|
break;
|
|
case ROW_STEPS:
|
|
if( m_iSelectedNotes == m_pNotess.GetSize()-1 ) // can't go right any further
|
|
return;
|
|
m_iSelectedNotes++;
|
|
OnStepsChange();
|
|
break;
|
|
default:
|
|
ASSERT(false);
|
|
}
|
|
}
|
|
|
|
void ScreenEditMenu::MenuStart( const PlayerNumber p )
|
|
{
|
|
m_Menu.TweenOffScreenToBlack( SM_None, false );
|
|
|
|
MUSIC->Stop();
|
|
|
|
SONGMAN->SetCurrentSong( GetSelectedSong() );
|
|
GAMEMAN->m_CurNotesType = GetSelectedNotesType();
|
|
SONGMAN->SetCurrentNotes( PLAYER_1, GetSelectedNotes() );
|
|
|
|
m_soundSelect.PlayRandom();
|
|
|
|
m_Fade.CloseWipingRight( SM_GoToNextState );
|
|
}
|
|
|
|
void ScreenEditMenu::MenuBack( const PlayerNumber p )
|
|
{
|
|
m_Menu.TweenOffScreenToBlack( SM_None, true );
|
|
|
|
|
|
MUSIC->Stop();
|
|
|
|
m_Fade.CloseWipingLeft( SM_GoToPrevState );
|
|
}
|