Have a MiniMenu of TimingData in ScreenEdit.

This commit is contained in:
Jason Felds
2011-01-18 00:49:03 -05:00
parent 3ae691806d
commit a9bd89d336
4 changed files with 105 additions and 80 deletions
+1
View File
@@ -831,6 +831,7 @@ Edit steps information=Edit steps information
Exit Edit Mode=Exit Edit Mode
Edit stop=Edit stop
Edit delay=Edit delay
Edit Timing Data=Edit Timing Data
Edit time signature=Edit time signature (not working yet)
Edit time signature (top)=Edit time signature (beats per measure)
Edit time signature (bottom)=Edit time signature (single beat note value)
+3
View File
@@ -3611,6 +3611,9 @@ Fallback="ScreenMiniMenu"
[ScreenMiniMenuSongInformation]
Fallback="ScreenMiniMenu"
[ScreenMiniMenuTimingDataInformation]
Fallback="ScreenMiniMenu"
[ScreenMiniMenuBackgroundChange]
Fallback="ScreenMiniMenu"
+87 -74
View File
@@ -71,6 +71,7 @@ AutoScreenMessage( SM_BackFromInsertCourseAttackPlayerOptions );
AutoScreenMessage( SM_BackFromCourseModeMenu );
AutoScreenMessage( SM_DoRevertToLastSave );
AutoScreenMessage( SM_DoRevertFromDisk );
AutoScreenMessage( SM_BackFromTimingDataInformation );
AutoScreenMessage( SM_BackFromBPMChange );
AutoScreenMessage( SM_BackFromStopChange );
AutoScreenMessage( SM_BackFromDelayChange );
@@ -506,12 +507,7 @@ static MenuDef g_MainMenu(
MenuRowDef( ScreenEdit::revert_from_disk, "Revert from disk", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::options, "Editor options", true, EditMode_Practice, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_song_info, "Edit song info", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_bpm, "Edit BPM change", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_stop, "Edit stop", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_delay, "Edit delay", true, EditMode_Full, true, true, 0, NULL ),
//MenuRowDef( ScreenEdit::edit_time_signature, "Edit time signature", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_time_signature_numerator, "Edit time signature (top)", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_time_signature_denominator,"Edit time signature (bottom)", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::edit_timing_data, "Edit Timing Data", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::play_preview_music, "Play preview music", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::exit, "Exit Edit Mode", true, EditMode_Practice, true, true, 0, NULL )
);
@@ -572,6 +568,16 @@ static MenuDef g_SongInformation(
MenuRowDef( ScreenEdit::last_beat_hint, "Last beat hint", true, EditMode_Full, true, true, 0, NULL )
);
static MenuDef g_TimingDataInformation(
"ScreenMiniMenuTimingDataInformation",
MenuRowDef( ScreenEdit::bpm, "Edit BPM change", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::stop, "Edit stop", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::delay, "Edit delay", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::time_signature_numerator, "Edit time signature (top)", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::time_signature_denominator, "Edit time signature (bottom)", true, EditMode_Full, true, true, 0, NULL )
);
enum { song_bganimation, song_movie, song_bitmap, global_bganimation, global_movie, global_movie_song_group, global_movie_song_group_and_genre, dynamic_random, baked_random, none };
static bool EnabledIfSet1SongBGAnimation();
static bool EnabledIfSet1SongMovie();
@@ -2556,6 +2562,10 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
HandleSongInformationChoice( (SongInformationChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
}
else if( SM == SM_BackFromTimingDataInformation )
{
HandleTimingDataInformationChoice( (TimingDataInformationChoice)ScreenMiniMenu::s_iLastRowCode, ScreenMiniMenu::s_viLastAnswers );
}
else if( SM == SM_BackFromBPMChange )
{
float fBPM = StringToFloat( ScreenTextEntry::s_sLastAnswer );
@@ -2901,11 +2911,6 @@ static LocalizedString REVERT_LAST_SAVE ( "ScreenEdit", "Do you want to revert
static LocalizedString DESTROY_ALL_UNSAVED_CHANGES ( "ScreenEdit", "This will destroy all unsaved changes." );
static LocalizedString REVERT_FROM_DISK ( "ScreenEdit", "Do you want to revert from disk?" );
static LocalizedString SAVE_CHANGES_BEFORE_EXITING ( "ScreenEdit", "Do you want to save changes before exiting?" );
static LocalizedString ENTER_BPM_VALUE ( "ScreenEdit", "Enter a new BPM value." );
static LocalizedString ENTER_STOP_VALUE ( "ScreenEdit", "Enter a new Stop value." );
static LocalizedString ENTER_DELAY_VALUE ( "ScreenEdit", "Enter a new Delay value." );
static LocalizedString ENTER_TIME_SIGNATURE_NUMERATOR_VALUE ( "ScreenEdit", "Enter a new Time Signature numerator value." );
static LocalizedString ENTER_TIME_SIGNATURE_DENOMINATOR_VALUE ( "ScreenEdit", "Enter a new Time Signature denominator value." );
void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAnswers )
{
@@ -3091,70 +3096,21 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation );
}
break;
case edit_bpm:
// todo: Call a screen with class ScreenTextEntry instead. -aj
ScreenTextEntry::TextEntry(
SM_BackFromBPMChange,
ENTER_BPM_VALUE,
ssprintf( "%.4f", m_pSong->GetBPMAtBeat(GAMESTATE->m_fSongBeat) ),
10
);
break;
case edit_stop:
// todo: Call a screen with class ScreenTextEntry instead. -aj
bool bThrowaway; // is it?
ScreenTextEntry::TextEntry(
SM_BackFromStopChange,
ENTER_STOP_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ),
10
);
break;
case edit_delay:
// todo: Call a screen with class ScreenTextEntry instead. -aj
ScreenTextEntry::TextEntry(
SM_BackFromDelayChange,
ENTER_DELAY_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ),
10
);
break;
/*
The following code does not work due to problems with having two
ScreenTextEntry's at the same time. A proper fix is not known
at the time of this comment. -wolfman2000
case edit_time_signature:
// These need to be in reverse order due to the stack nature.
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureDenominatorChange,
ENTER_TIME_SIGNATURE_DENOMINATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iDenominator ),
3
);
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureNumeratorChange,
ENTER_TIME_SIGNATURE_NUMERATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iNumerator ),
3
);
break;
*/
case edit_time_signature_numerator:
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureNumeratorChange,
ENTER_TIME_SIGNATURE_NUMERATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iNumerator ),
3
);
break;
case edit_time_signature_denominator:
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureDenominatorChange,
ENTER_TIME_SIGNATURE_DENOMINATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iDenominator ),
3
);
case edit_timing_data:
{
const Song* pSong = GAMESTATE->m_pCurSong;
TimingData pTime = pSong->m_Timing;
const float fBeat = GAMESTATE->m_fSongBeat;
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.5f", pSong->GetBPMAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetStopAtBeat( fBeat ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetDelayAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[time_signature_numerator].SetOneUnthemedChoice( ssprintf("%d", pTime.GetTimeSignatureNumeratorAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[time_signature_denominator].SetOneUnthemedChoice( ssprintf("%d", pTime.GetTimeSignatureDenominatorAtBeat( fBeat ) ) );
EditMiniMenu( &g_TimingDataInformation, SM_BackFromTimingDataInformation );
}
break;
case play_preview_music:
PlayPreviewMusic();
break;
@@ -3571,6 +3527,63 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec
};
}
static LocalizedString ENTER_BPM_VALUE ( "ScreenEdit", "Enter a new BPM value." );
static LocalizedString ENTER_STOP_VALUE ( "ScreenEdit", "Enter a new Stop value." );
static LocalizedString ENTER_DELAY_VALUE ( "ScreenEdit", "Enter a new Delay value." );
static LocalizedString ENTER_TIME_SIGNATURE_NUMERATOR_VALUE ( "ScreenEdit", "Enter a new Time Signature numerator value." );
static LocalizedString ENTER_TIME_SIGNATURE_DENOMINATOR_VALUE ( "ScreenEdit", "Enter a new Time Signature denominator value." );
void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice c, const vector<int> &iAnswers )
{
switch( c )
{
DEFAULT_FAIL( c );
case bpm:
// todo: Call a screen with class ScreenTextEntry instead. -aj
ScreenTextEntry::TextEntry(
SM_BackFromBPMChange,
ENTER_BPM_VALUE,
ssprintf( "%.4f", m_pSong->GetBPMAtBeat(GAMESTATE->m_fSongBeat) ),
10
);
break;
case stop:
// todo: Call a screen with class ScreenTextEntry instead. -aj
bool bThrowaway; // is it?
ScreenTextEntry::TextEntry(
SM_BackFromStopChange,
ENTER_STOP_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ),
10
);
break;
case delay:
// todo: Call a screen with class ScreenTextEntry instead. -aj
ScreenTextEntry::TextEntry(
SM_BackFromDelayChange,
ENTER_DELAY_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ),
10
);
break;
case time_signature_numerator:
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureNumeratorChange,
ENTER_TIME_SIGNATURE_NUMERATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iNumerator ),
3
);
break;
case time_signature_denominator:
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureDenominatorChange,
ENTER_TIME_SIGNATURE_DENOMINATOR_VALUE,
ssprintf( "%d", m_pSong->m_Timing.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_fSongBeat ).m_iDenominator ),
3
);
break;
}
}
void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAnswers )
{
BackgroundChange newChange;
+14 -6
View File
@@ -310,12 +310,7 @@ public:
revert_from_disk,
options,
edit_song_info,
edit_bpm,
edit_stop,
edit_delay,
// edit_time_signature,
edit_time_signature_numerator,
edit_time_signature_denominator,
edit_timing_data,
play_preview_music,
exit,
save_on_exit,
@@ -442,6 +437,19 @@ public:
NUM_SONG_INFORMATION_CHOICES
};
void HandleSongInformationChoice( SongInformationChoice c, const vector<int> &iAnswers );
enum TimingDataInformationChoice
{
bpm,
stop,
delay,
// time_signature,
time_signature_numerator,
time_signature_denominator,
NUM_TIMING_DATA_INFORMATION_CHOICES
};
void HandleTimingDataInformationChoice ( TimingDataInformationChoice c, const vector<int> &iAnswers );
enum BGChangeChoice
{