Fix crash on random entry. Add metric to hide the mods row.
This commit is contained in:
@@ -339,7 +339,7 @@ void ScreenOptionsEditCourse::HandleMessage( const RString& sMessage )
|
|||||||
{
|
{
|
||||||
if( sMessage == "EditCourseDifficultyChanged" )
|
if( sMessage == "EditCourseDifficultyChanged" )
|
||||||
{
|
{
|
||||||
#if 1
|
#if 0
|
||||||
const int iMeter = GAMESTATE->m_pCurCourse->m_iCustomMeter[GAMESTATE->m_cdEdit];
|
const int iMeter = GAMESTATE->m_pCurCourse->m_iCustomMeter[GAMESTATE->m_cdEdit];
|
||||||
int iSel;
|
int iSel;
|
||||||
|
|
||||||
@@ -350,9 +350,11 @@ void ScreenOptionsEditCourse::HandleMessage( const RString& sMessage )
|
|||||||
ChangeValueInRowAbsolute( EditCourseRow_Meter, GAMESTATE->m_MasterPlayerNumber, iSel, false );
|
ChangeValueInRowAbsolute( EditCourseRow_Meter, GAMESTATE->m_MasterPlayerNumber, iSel, false );
|
||||||
#else
|
#else
|
||||||
const vector<PlayerNumber> vpns( 1, GAMESTATE->m_MasterPlayerNumber );
|
const vector<PlayerNumber> vpns( 1, GAMESTATE->m_MasterPlayerNumber );
|
||||||
|
OptionRow &row = *m_pRows[EditCourseRow_Meter];
|
||||||
|
|
||||||
|
row.Reload();
|
||||||
ImportOptions( EditCourseRow_Meter, vpns );
|
ImportOptions( EditCourseRow_Meter, vpns );
|
||||||
AfterChangeValueOrRow( GAMESTATE->m_MasterPlayerNumber );
|
row.AfterImportOptions( GAMESTATE->m_MasterPlayerNumber );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ScreenOptionsEditCourseSubMenu::HandleMessage( sMessage );
|
ScreenOptionsEditCourseSubMenu::HandleMessage( sMessage );
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ REGISTER_SCREEN_CLASS( ScreenOptionsEditCourseEntry );
|
|||||||
|
|
||||||
void ScreenOptionsEditCourseEntry::Init()
|
void ScreenOptionsEditCourseEntry::Init()
|
||||||
{
|
{
|
||||||
ScreenOptions::Init();
|
ScreenOptionsEditCourseSubMenu::Init();
|
||||||
|
|
||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
|
||||||
@@ -133,7 +133,7 @@ void ScreenOptionsEditCourseEntry::Init()
|
|||||||
pHand->m_Def.m_bAllowThemeItems = false;
|
pHand->m_Def.m_bAllowThemeItems = false;
|
||||||
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||||
pHand->m_Def.m_vsChoices.push_back( "(any)" );
|
pHand->m_Def.m_vsChoices.push_back( "(any)" );
|
||||||
for( int i=MIN_METER; i<=MAX_METER; i++ )
|
for( int i=MIN_METER; i<=MAX_METER; ++i )
|
||||||
pHand->m_Def.m_vsChoices.push_back( ssprintf("%i",i) );
|
pHand->m_Def.m_vsChoices.push_back( ssprintf("%i",i) );
|
||||||
vHands.push_back( pHand );
|
vHands.push_back( pHand );
|
||||||
|
|
||||||
@@ -168,14 +168,20 @@ void ScreenOptionsEditCourseEntry::Init()
|
|||||||
pHand->m_Def.m_vsChoices.push_back( FormatNumberAndSuffix(i+1) );
|
pHand->m_Def.m_vsChoices.push_back( FormatNumberAndSuffix(i+1) );
|
||||||
vHands.push_back( pHand );
|
vHands.push_back( pHand );
|
||||||
|
|
||||||
m_pModChangesHandler = OptionRowHandlerUtil::MakeNull();
|
SHOW_MODS_ROW.Load( m_sName, "ShowModsRow" );
|
||||||
m_pModChangesHandler->m_Def.m_sName = "Set Mods";
|
|
||||||
m_pModChangesHandler->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
m_pModChangesHandler = NULL;
|
||||||
m_pModChangesHandler->m_Def.m_bExportOnChange = true;
|
if( SHOW_MODS_ROW )
|
||||||
m_pModChangesHandler->m_Def.m_bAllowThemeItems = false;
|
{
|
||||||
m_pModChangesHandler->m_Def.m_bOneChoiceForAllPlayers = true;
|
m_pModChangesHandler = OptionRowHandlerUtil::MakeNull();
|
||||||
m_pModChangesHandler->m_Def.m_vsChoices.push_back( "" );
|
m_pModChangesHandler->m_Def.m_sName = "Set Mods";
|
||||||
vHands.push_back( m_pModChangesHandler );
|
m_pModChangesHandler->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
m_pModChangesHandler->m_Def.m_bExportOnChange = true;
|
||||||
|
m_pModChangesHandler->m_Def.m_bAllowThemeItems = false;
|
||||||
|
m_pModChangesHandler->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||||
|
m_pModChangesHandler->m_Def.m_vsChoices.push_back( "" );
|
||||||
|
vHands.push_back( m_pModChangesHandler );
|
||||||
|
}
|
||||||
|
|
||||||
ScreenOptions::InitMenu( vHands );
|
ScreenOptions::InitMenu( vHands );
|
||||||
}
|
}
|
||||||
@@ -187,11 +193,10 @@ void ScreenOptionsEditCourseEntry::BeginScreen()
|
|||||||
const CourseEntry &ce = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
const CourseEntry &ce = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||||
m_Original = ce;
|
m_Original = ce;
|
||||||
|
|
||||||
|
|
||||||
m_pSongHandler->m_sSongGroup = ce.sSongGroup;
|
m_pSongHandler->m_sSongGroup = ce.sSongGroup;
|
||||||
|
|
||||||
RString s = ssprintf( "%d mod changes", ce.GetNumModChanges() );
|
if( SHOW_MODS_ROW )
|
||||||
m_pModChangesHandler->m_Def.m_vsChoices[0] = s;
|
m_pModChangesHandler->m_Def.m_vsChoices[0] = ssprintf( "%d mod changes", ce.GetNumModChanges() );
|
||||||
|
|
||||||
ScreenOptions::BeginScreen();
|
ScreenOptions::BeginScreen();
|
||||||
}
|
}
|
||||||
@@ -210,36 +215,40 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
case ROW_LOW_METER:
|
case ROW_LOW_METER:
|
||||||
case ROW_HIGH_METER:
|
case ROW_HIGH_METER:
|
||||||
case ROW_CHOOSE_INDEX:
|
case ROW_CHOOSE_INDEX:
|
||||||
break;
|
return;
|
||||||
case ROW_SET_MODS:
|
case ROW_SET_MODS:
|
||||||
{
|
if( SHOW_MODS_ROW )
|
||||||
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
{
|
||||||
TrailEntry *pTrailEntry = &pTrail->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
|
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
||||||
Song *pSong = pTrailEntry->pSong;
|
TrailEntry *pTrailEntry = &pTrail->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
|
||||||
Steps *pSteps = pTrailEntry->pSteps;
|
Song *pSong = pTrailEntry->pSong;
|
||||||
|
Steps *pSteps = pTrailEntry->pSteps;
|
||||||
|
|
||||||
// Set up for ScreenEdit
|
// Set up for ScreenEdit
|
||||||
const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType(pSteps->m_StepsType);
|
const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType(pSteps->m_StepsType);
|
||||||
GAMESTATE->m_pCurStyle.Set( pStyle );
|
GAMESTATE->m_pCurStyle.Set( pStyle );
|
||||||
GAMESTATE->m_pCurSong.Set( pSong );
|
GAMESTATE->m_pCurSong.Set( pSong );
|
||||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
||||||
|
break;
|
||||||
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ROW_DONE:
|
case ROW_DONE:
|
||||||
|
m_Original = pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ];
|
||||||
SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" );
|
SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" );
|
||||||
break;
|
HandleScreenMessage( SM_GoToPrevScreen );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if( SM == SM_GoToPrevScreen )
|
else if( SM == SM_GoToPrevScreen )
|
||||||
{
|
{
|
||||||
// revert
|
// revert
|
||||||
pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ] = m_Original;
|
pCourse->m_vEntries[ GAMESTATE->m_iEditCourseEntryIndex ] = m_Original;
|
||||||
|
|
||||||
SCREENMAN->SetNewScreen( "ScreenOptionsEditCourse" );
|
// cause overlay elements to refresh by changing the course
|
||||||
return;
|
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit );
|
||||||
|
|
||||||
|
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||||
|
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenOptions::HandleScreenMessage( SM );
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
@@ -367,13 +376,13 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
||||||
ASSERT( iEntryIndex >= 0 && iEntryIndex < (int) pCourse->m_vEntries.size() );
|
ASSERT( iEntryIndex >= 0 && iEntryIndex < (int) pCourse->m_vEntries.size() );
|
||||||
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
||||||
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
int iChoice = row.GetOneSharedSelection( true );
|
||||||
|
|
||||||
switch( iRow )
|
switch( iRow )
|
||||||
{
|
{
|
||||||
case ROW_SONG_GROUP:
|
case ROW_SONG_GROUP:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_SONG_GROUP];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
if( iChoice == 0 )
|
if( iChoice == 0 )
|
||||||
ce.sSongGroup = "";
|
ce.sSongGroup = "";
|
||||||
else
|
else
|
||||||
@@ -383,7 +392,6 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
case ROW_SONG:
|
case ROW_SONG:
|
||||||
{
|
{
|
||||||
// XXX: copy and pasted from ScreenOptionsMaster
|
// XXX: copy and pasted from ScreenOptionsMaster
|
||||||
OptionRow &row = *m_pRows[iRow];
|
|
||||||
bool bRowHasFocus[NUM_PLAYERS];
|
bool bRowHasFocus[NUM_PLAYERS];
|
||||||
ZERO( bRowHasFocus );
|
ZERO( bRowHasFocus );
|
||||||
FOREACH_CONST( PlayerNumber, vpns, p )
|
FOREACH_CONST( PlayerNumber, vpns, p )
|
||||||
@@ -398,8 +406,6 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
}
|
}
|
||||||
case ROW_BASE_DIFFICULTY:
|
case ROW_BASE_DIFFICULTY:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_BASE_DIFFICULTY];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
if( iChoice == 0 )
|
if( iChoice == 0 )
|
||||||
{
|
{
|
||||||
ce.baseDifficulty = DIFFICULTY_INVALID;
|
ce.baseDifficulty = DIFFICULTY_INVALID;
|
||||||
@@ -413,8 +419,6 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
}
|
}
|
||||||
case ROW_LOW_METER:
|
case ROW_LOW_METER:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_LOW_METER];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
if( iChoice == 0 )
|
if( iChoice == 0 )
|
||||||
ce.iLowMeter = -1;
|
ce.iLowMeter = -1;
|
||||||
else
|
else
|
||||||
@@ -423,8 +427,6 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
}
|
}
|
||||||
case ROW_HIGH_METER:
|
case ROW_HIGH_METER:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_HIGH_METER];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
if( iChoice == 0 )
|
if( iChoice == 0 )
|
||||||
ce.iHighMeter = -1;
|
ce.iHighMeter = -1;
|
||||||
else
|
else
|
||||||
@@ -433,15 +435,11 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
|||||||
}
|
}
|
||||||
case ROW_SORT:
|
case ROW_SORT:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_SORT];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
ce.songSort = (SongSort)iChoice;
|
ce.songSort = (SongSort)iChoice;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ROW_CHOOSE_INDEX:
|
case ROW_CHOOSE_INDEX:
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[ROW_CHOOSE_INDEX];
|
|
||||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
|
||||||
ce.iChooseIndex = iChoice;
|
ce.iChooseIndex = iChoice;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -461,6 +459,12 @@ void ScreenOptionsEditCourseEntry::ProcessMenuStart( const InputEventPlus &input
|
|||||||
case ROW_CHOOSE_INDEX:
|
case ROW_CHOOSE_INDEX:
|
||||||
break;
|
break;
|
||||||
case ROW_SET_MODS:
|
case ROW_SET_MODS:
|
||||||
|
if( SHOW_MODS_ROW )
|
||||||
|
{
|
||||||
|
if( !GAMESTATE->m_pCurCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex].IsFixedSong() )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
case ROW_DONE:
|
case ROW_DONE:
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
ScreenOptions::BeginFadingOut();
|
ScreenOptions::BeginFadingOut();
|
||||||
@@ -470,7 +474,7 @@ void ScreenOptionsEditCourseEntry::ProcessMenuStart( const InputEventPlus &input
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2002-2004 Chris Danford
|
* (c) 2002-2006 Chris Danford, Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ protected:
|
|||||||
virtual void ProcessMenuStart( const InputEventPlus &input );
|
virtual void ProcessMenuStart( const InputEventPlus &input );
|
||||||
|
|
||||||
CourseEntry m_Original; // use this to revert when cancelling
|
CourseEntry m_Original; // use this to revert when cancelling
|
||||||
|
ThemeMetric<bool> SHOW_MODS_ROW;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Chris Danford
|
* (c) 2003-2006 Chris Danford, Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
Reference in New Issue
Block a user