make EDIT_MODE less fragile by using switches
don't allow going past last beat in practice
This commit is contained in:
@@ -58,14 +58,21 @@ static void GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpSong
|
|||||||
{
|
{
|
||||||
vpSongsOut.clear();
|
vpSongsOut.clear();
|
||||||
SONGMAN->GetSongs( vpSongsOut, sGroup );
|
SONGMAN->GetSongs( vpSongsOut, sGroup );
|
||||||
if( EDIT_MODE < EDIT_MODE_FULL )
|
switch( EDIT_MODE )
|
||||||
{
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
for( int i=vpSongsOut.size()-1; i>=0; i-- )
|
for( int i=vpSongsOut.size()-1; i>=0; i-- )
|
||||||
{
|
{
|
||||||
const Song* pSong = vpSongsOut[i];
|
const Song* pSong = vpSongsOut[i];
|
||||||
if( UNLOCKMAN->SongIsLocked(pSong) )
|
if( UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
vpSongsOut.erase( vpSongsOut.begin()+i );
|
vpSongsOut.erase( vpSongsOut.begin()+i );
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
SongUtil::SortSongPointerArrayByTitle( vpSongsOut );
|
SongUtil::SortSongPointerArrayByTitle( vpSongsOut );
|
||||||
}
|
}
|
||||||
@@ -340,18 +347,38 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
FOREACH_CONST( Steps*, v, p )
|
FOREACH_CONST( Steps*, v, p )
|
||||||
m_vpSteps.push_back( StepsAndDifficulty(*p,dc) );
|
m_vpSteps.push_back( StepsAndDifficulty(*p,dc) );
|
||||||
|
|
||||||
if( EDIT_MODE != EDIT_MODE_PRACTICE )
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit"
|
m_vpSteps.push_back( StepsAndDifficulty(NULL,dc) ); // "New Edit"
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// don't allow selecting of non-edits in HomeMode
|
|
||||||
if( EDIT_MODE == EDIT_MODE_HOME )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedStepsType(), dc );
|
Steps *pSteps = GetSelectedSong()->GetStepsByDifficulty( GetSelectedStepsType(), dc );
|
||||||
if( pSteps || EDIT_MODE != EDIT_MODE_PRACTICE )
|
|
||||||
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
// don't allow selecting of non-edits in HomeMode
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
// only show this difficulty if steps exist
|
||||||
|
if( pSteps )
|
||||||
|
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
// show this difficulty whether or not steps exist.
|
||||||
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
|
m_vpSteps.push_back( StepsAndDifficulty(pSteps,dc) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,8 +402,17 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
s = DifficultyToThemedString(GetSelectedDifficulty());
|
s = DifficultyToThemedString(GetSelectedDifficulty());
|
||||||
|
|
||||||
// UGLY. "Edit" -> "New Edit"
|
// UGLY. "Edit" -> "New Edit"
|
||||||
if( EDIT_MODE == EDIT_MODE_HOME )
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
s = "New " + s;
|
s = "New " + s;
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_textValue[ROW_STEPS].SetText( s );
|
m_textValue[ROW_STEPS].SetText( s );
|
||||||
}
|
}
|
||||||
@@ -441,8 +477,17 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
if( GetSelectedSteps() )
|
if( GetSelectedSteps() )
|
||||||
{
|
{
|
||||||
m_Actions.push_back( EDIT_MENU_ACTION_EDIT );
|
m_Actions.push_back( EDIT_MENU_ACTION_EDIT );
|
||||||
if( EDIT_MODE != EDIT_MODE_PRACTICE )
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
m_Actions.push_back( EDIT_MENU_ACTION_DELETE );
|
m_Actions.push_back( EDIT_MENU_ACTION_DELETE );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+22
-13
@@ -488,25 +488,34 @@ void NoteField::DrawPrimitives()
|
|||||||
//
|
//
|
||||||
// BGChange text
|
// BGChange text
|
||||||
//
|
//
|
||||||
if( EDIT_MODE == EDIT_MODE_FULL )
|
switch( EDIT_MODE )
|
||||||
{
|
{
|
||||||
vector<BackgroundChange> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges;
|
case EDIT_MODE_HOME:
|
||||||
for( unsigned i=0; i<aBackgroundChanges.size(); i++ )
|
case EDIT_MODE_PRACTICE:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
{
|
{
|
||||||
if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw &&
|
vector<BackgroundChange> &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges;
|
||||||
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw)
|
for( unsigned i=0; i<aBackgroundChanges.size(); i++ )
|
||||||
{
|
{
|
||||||
const BackgroundChange& change = aBackgroundChanges[i];
|
if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw &&
|
||||||
CString sChangeText = ssprintf("%s\n%.0f%%%s%s%s",
|
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw)
|
||||||
change.m_sBGName.c_str(),
|
{
|
||||||
change.m_fRate*100,
|
const BackgroundChange& change = aBackgroundChanges[i];
|
||||||
change.m_bFadeLast ? " Fade" : "",
|
CString sChangeText = ssprintf("%s\n%.0f%%%s%s%s",
|
||||||
change.m_bRewindMovie ? " Rewind" : "",
|
change.m_sBGName.c_str(),
|
||||||
change.m_bLoop ? " Loop" : "" );
|
change.m_fRate*100,
|
||||||
|
change.m_bFadeLast ? " Fade" : "",
|
||||||
|
change.m_bRewindMovie ? " Rewind" : "",
|
||||||
|
change.m_bLoop ? " Loop" : "" );
|
||||||
|
|
||||||
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -753,26 +753,49 @@ void ScreenEdit::UpdateTextInfo()
|
|||||||
CString sText;
|
CString sText;
|
||||||
sText += ssprintf( "Current beat:\n %.3f\n", GAMESTATE->m_fSongBeat );
|
sText += ssprintf( "Current beat:\n %.3f\n", GAMESTATE->m_fSongBeat );
|
||||||
sText += ssprintf( "Current sec:\n %.3f\n", m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
|
sText += ssprintf( "Current sec:\n %.3f\n", m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
|
||||||
if( EDIT_MODE >= EDIT_MODE_HOME )
|
switch( EDIT_MODE )
|
||||||
sText += ssprintf( "Snap to:\n %s\n", sNoteType.c_str() );
|
|
||||||
sText += ssprintf( "Selection beat:\n %s\n %s\n", m_NoteFieldEdit.m_iBeginMarker==-1 ? "----" : ssprintf("%.3f",NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker)).c_str(), m_NoteFieldEdit.m_iEndMarker==-1 ? "----" : ssprintf("%.3f",NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker)).c_str() );
|
|
||||||
if( EDIT_MODE == EDIT_MODE_FULL )
|
|
||||||
{
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
sText += ssprintf( "Snap to:\n %s\n", sNoteType.c_str() );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
sText += ssprintf( "Selection beat:\n %s\n %s\n", m_NoteFieldEdit.m_iBeginMarker==-1 ? "----" : ssprintf("%.3f",NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker)).c_str(), m_NoteFieldEdit.m_iEndMarker==-1 ? "----" : ssprintf("%.3f",NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker)).c_str() );
|
||||||
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
sText += ssprintf( "Difficulty:\n %s\n", DifficultyToString( m_pSteps->GetDifficulty() ).c_str() );
|
sText += ssprintf( "Difficulty:\n %s\n", DifficultyToString( m_pSteps->GetDifficulty() ).c_str() );
|
||||||
sText += ssprintf( "Description:\n %s\n", GAMESTATE->m_pCurSteps[PLAYER_1] ? GAMESTATE->m_pCurSteps[PLAYER_1]->GetDescription().c_str() : "no description" );
|
sText += ssprintf( "Description:\n %s\n", GAMESTATE->m_pCurSteps[PLAYER_1] ? GAMESTATE->m_pCurSteps[PLAYER_1]->GetDescription().c_str() : "no description" );
|
||||||
sText += ssprintf( "Main title:\n %s\n", m_pSong->m_sMainTitle.c_str() );
|
sText += ssprintf( "Main title:\n %s\n", m_pSong->m_sMainTitle.c_str() );
|
||||||
sText += ssprintf( "Sub title:\n %s\n", m_pSong->m_sSubTitle.c_str() );
|
sText += ssprintf( "Sub title:\n %s\n", m_pSong->m_sSubTitle.c_str() );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
sText += ssprintf( "Tap steps:\n %d\n", iNumTaps );
|
sText += ssprintf( "Tap steps:\n %d\n", iNumTaps );
|
||||||
sText += ssprintf( "Jumps:\n %d\n", iNumJumps );
|
sText += ssprintf( "Jumps:\n %d\n", iNumJumps );
|
||||||
sText += ssprintf( "Hands:\n %d\n", iNumHands );
|
sText += ssprintf( "Hands:\n %d\n", iNumHands );
|
||||||
sText += ssprintf( "Holds:\n %d\n", iNumHolds );
|
sText += ssprintf( "Holds:\n %d\n", iNumHolds );
|
||||||
sText += ssprintf( "Mines:\n %d\n", iNumMines );
|
sText += ssprintf( "Mines:\n %d\n", iNumMines );
|
||||||
if( EDIT_MODE == EDIT_MODE_FULL )
|
switch( EDIT_MODE )
|
||||||
{
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
sText += ssprintf( "Beat 0 Offset:\n %.3f secs\n", m_pSong->m_Timing.m_fBeat0OffsetInSeconds );
|
sText += ssprintf( "Beat 0 Offset:\n %.3f secs\n", m_pSong->m_Timing.m_fBeat0OffsetInSeconds );
|
||||||
sText += ssprintf( "Preview Start:\n %.2f secs\n", m_pSong->m_fMusicSampleStartSeconds );
|
sText += ssprintf( "Preview Start:\n %.2f secs\n", m_pSong->m_fMusicSampleStartSeconds );
|
||||||
sText += ssprintf( "Preview Length:\n %.2f secs\n",m_pSong->m_fMusicSampleLengthSeconds );
|
sText += ssprintf( "Preview Length:\n %.2f secs\n",m_pSong->m_fMusicSampleLengthSeconds );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_textInfo.SetText( sText );
|
m_textInfo.SetText( sText );
|
||||||
@@ -1781,11 +1804,48 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
|||||||
FOREACH_Difficulty( dc )
|
FOREACH_Difficulty( dc )
|
||||||
g_StepsInformation.rows[difficulty].choices.push_back( DifficultyToThemedString(pSteps->GetDifficulty()) );
|
g_StepsInformation.rows[difficulty].choices.push_back( DifficultyToThemedString(pSteps->GetDifficulty()) );
|
||||||
g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
|
g_StepsInformation.rows[difficulty].iDefaultChoice = pSteps->GetDifficulty();
|
||||||
g_StepsInformation.rows[difficulty].bEnabled = EDIT_MODE >= EDIT_MODE_FULL;
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
g_StepsInformation.rows[difficulty].bEnabled = false;
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
g_StepsInformation.rows[difficulty].bEnabled = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
g_StepsInformation.rows[meter].iDefaultChoice = clamp( pSteps->GetMeter()-1, 0, MAX_METER+1 );
|
g_StepsInformation.rows[meter].iDefaultChoice = clamp( pSteps->GetMeter()-1, 0, MAX_METER+1 );
|
||||||
g_StepsInformation.rows[meter].bEnabled = EDIT_MODE >= EDIT_MODE_HOME;
|
switch( EDIT_MODE )
|
||||||
g_StepsInformation.rows[predict_meter].choices.resize(1);g_StepsInformation.rows[predict_meter].choices[0] = ssprintf("%.2f",pSteps->PredictMeter());
|
{
|
||||||
g_StepsInformation.rows[description].choices.resize(1); g_StepsInformation.rows[description].choices[0] = pSteps->GetDescription(); g_StepsInformation.rows[description].bEnabled = EDIT_MODE == EDIT_MODE_FULL;
|
case EDIT_MODE_PRACTICE:
|
||||||
|
g_StepsInformation.rows[meter].bEnabled = false;
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
g_StepsInformation.rows[meter].bEnabled = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
g_StepsInformation.rows[predict_meter].choices.resize(1);
|
||||||
|
g_StepsInformation.rows[predict_meter].choices[0] = ssprintf("%.2f",pSteps->PredictMeter());
|
||||||
|
g_StepsInformation.rows[description].choices.resize(1);
|
||||||
|
g_StepsInformation.rows[description].choices[0] = pSteps->GetDescription();
|
||||||
|
switch( EDIT_MODE )
|
||||||
|
{
|
||||||
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
g_StepsInformation.rows[description].bEnabled = false;
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
|
g_StepsInformation.rows[description].bEnabled = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
g_StepsInformation.rows[description].choices.resize(1); g_StepsInformation.rows[description].choices[0] = pSteps->GetDescription();
|
||||||
g_StepsInformation.rows[tap_notes].choices.resize(1); g_StepsInformation.rows[tap_notes].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumTapNotes());
|
g_StepsInformation.rows[tap_notes].choices.resize(1); g_StepsInformation.rows[tap_notes].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumTapNotes());
|
||||||
g_StepsInformation.rows[jumps].choices.resize(1); g_StepsInformation.rows[jumps].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumJumps());
|
g_StepsInformation.rows[jumps].choices.resize(1); g_StepsInformation.rows[jumps].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumJumps());
|
||||||
g_StepsInformation.rows[hands].choices.resize(1); g_StepsInformation.rows[hands].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumHands());
|
g_StepsInformation.rows[hands].choices.resize(1); g_StepsInformation.rows[hands].choices[0] = ssprintf("%d", m_NoteDataEdit.GetNumHands());
|
||||||
@@ -2670,21 +2730,25 @@ void ScreenEdit::CheckNumberOfNotesAndUndo()
|
|||||||
|
|
||||||
float ScreenEdit::GetMaximumBeatForNewNote() const
|
float ScreenEdit::GetMaximumBeatForNewNote() const
|
||||||
{
|
{
|
||||||
if( GAMESTATE->m_pCurSteps[0]->IsAnEdit() )
|
switch( EDIT_MODE )
|
||||||
{
|
{
|
||||||
float fEndBeat = GAMESTATE->m_pCurSong->m_fLastBeat;
|
case EDIT_MODE_PRACTICE:
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
{
|
||||||
|
float fEndBeat = GAMESTATE->m_pCurSong->m_fLastBeat;
|
||||||
|
|
||||||
// Round up to the next measure end. Some songs end on weird beats
|
// Round up to the next measure end. Some songs end on weird beats
|
||||||
// mid-measure, and it's odd to have movement capped to these weird
|
// mid-measure, and it's odd to have movement capped to these weird
|
||||||
// beats.
|
// beats.
|
||||||
fEndBeat += BEATS_PER_MEASURE;
|
fEndBeat += BEATS_PER_MEASURE;
|
||||||
fEndBeat = ftruncf( fEndBeat, (float)BEATS_PER_MEASURE );
|
fEndBeat = ftruncf( fEndBeat, (float)BEATS_PER_MEASURE );
|
||||||
|
|
||||||
return fEndBeat;
|
return fEndBeat;
|
||||||
}
|
}
|
||||||
else
|
case EDIT_MODE_FULL:
|
||||||
{
|
|
||||||
return FLT_MAX;
|
return FLT_MAX;
|
||||||
|
default:
|
||||||
|
ASSERT(0); return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,16 @@ void DeleteCurSteps( void* pThrowAway )
|
|||||||
Song* pSong = GAMESTATE->m_pCurSong;
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
Steps* pStepsToDelete = GAMESTATE->m_pCurSteps[PLAYER_1];
|
Steps* pStepsToDelete = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||||
pSong->RemoveSteps( pStepsToDelete );
|
pSong->RemoveSteps( pStepsToDelete );
|
||||||
if( EDIT_MODE == EDIT_MODE_FULL )
|
switch( EDIT_MODE )
|
||||||
{
|
{
|
||||||
|
case EDIT_MODE_HOME:
|
||||||
|
break;
|
||||||
|
case EDIT_MODE_FULL:
|
||||||
pSong->Save();
|
pSong->Save();
|
||||||
SCREENMAN->ZeroNextUpdate();
|
SCREENMAN->ZeroNextUpdate();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
SCREENMAN->SendMessageToTopScreen( SM_RefreshSelector );
|
SCREENMAN->SendMessageToTopScreen( SM_RefreshSelector );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user