working on new course edit screens
This commit is contained in:
@@ -12,10 +12,8 @@
|
||||
|
||||
enum EditCourseRow
|
||||
{
|
||||
ROW_REPEAT,
|
||||
ROW_RANDOMIZE,
|
||||
ROW_LIVES,
|
||||
ROW_METER,
|
||||
EditCourseRow_Type,
|
||||
EditCourseRow_Meter,
|
||||
NUM_EditCourseRow
|
||||
};
|
||||
|
||||
@@ -41,7 +39,7 @@ static MenuDef g_TempMenu(
|
||||
);
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenOptionsEditCourse );
|
||||
ScreenOptionsEditCourse::ScreenOptionsEditCourse( CString sName ) : ScreenOptions( sName )
|
||||
ScreenOptionsEditCourse::ScreenOptionsEditCourse( CString sName ) : ScreenOptionsEditCourseSubMenu( sName )
|
||||
{
|
||||
LOG->Trace( "ScreenOptionsEditCourse::ScreenOptionsEditCourse()" );
|
||||
}
|
||||
@@ -62,31 +60,19 @@ void ScreenOptionsEditCourse::Init()
|
||||
|
||||
OptionRowDefinition def;
|
||||
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
|
||||
def.m_sName = "Repeat";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "NO" );
|
||||
def.m_vsChoices.push_back( "YES" );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
def.m_bExportOnChange = true;
|
||||
|
||||
def.m_sName = "Randomize";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "NO" );
|
||||
def.m_vsChoices.push_back( "YES" );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
|
||||
def.m_sName = "Lives";
|
||||
def.m_sName = "Type";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "Use Bar Life" );
|
||||
for( int i=1; i<=10; i++ )
|
||||
def.m_vsChoices.push_back( ssprintf("%d",i) );
|
||||
FOREACH_CourseType( i )
|
||||
def.m_vsChoices.push_back( CourseTypeToThemedString(i) );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
|
||||
def.m_sName = "Meter";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "Auto" );
|
||||
for( int i=MIN_METER; i<=MAX_METER; i++ )
|
||||
def.m_vsChoices.push_back( ssprintf("%d",i) );
|
||||
vDefs.push_back( def );
|
||||
@@ -95,10 +81,9 @@ void ScreenOptionsEditCourse::Init()
|
||||
FOREACH_CONST( CourseEntry, pCourse->m_vEntries, ce )
|
||||
{
|
||||
int iEntryIndex = ce - pCourse->m_vEntries.begin();
|
||||
CourseEntry &ce = pCourse->m_vEntries[iEntryIndex];
|
||||
def.m_sName = ssprintf( "Entry %d", iEntryIndex+1 );
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( ce.GetTextDescription() );
|
||||
def.m_vsChoices.push_back( ce->GetTextDescription() );
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
}
|
||||
@@ -128,7 +113,7 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
|
||||
if( SM == SM_GoToNextScreen )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
if( iCurRow == m_pRows.size() - 1 )
|
||||
if( iCurRow == (int)m_pRows.size() - 1 )
|
||||
{
|
||||
this->HandleScreenMessage( SM_GoToPrevScreen );
|
||||
return; // don't call base
|
||||
@@ -161,6 +146,12 @@ void ScreenOptionsEditCourse::HandleScreenMessage( const ScreenMessage SM )
|
||||
break;
|
||||
case CourseEntryAction_Delete:
|
||||
{
|
||||
if( pCourse->m_vEntries.size() == 1 )
|
||||
{
|
||||
CString sError = "You cannot delete the last entry in a course.";
|
||||
ScreenPrompt::Prompt( SM_None, sError );
|
||||
return;
|
||||
}
|
||||
pCourse->m_vEntries.erase( pCourse->m_vEntries.begin() + GetCourseEntryIndexWithFocus() );
|
||||
GAMESTATE->m_iEditCourseEntryIndex.Set( GAMESTATE->m_iEditCourseEntryIndex );
|
||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||
@@ -181,40 +172,79 @@ void ScreenOptionsEditCourse::AfterChangeRow( PlayerNumber pn )
|
||||
GAMESTATE->m_iEditCourseEntryIndex.Set( iCourseEntry );
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourse::AfterChangeValueInRow( int iRow, PlayerNumber pn )
|
||||
{
|
||||
ScreenOptions::AfterChangeValueInRow( iRow, pn );
|
||||
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
|
||||
// Regemerate Trails so that the new values propagate
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( NULL );
|
||||
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] );
|
||||
|
||||
// cause overlay elements to refresh by changing the course
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourse::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
{
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
|
||||
switch( iRow )
|
||||
{
|
||||
case ROW_REPEAT:
|
||||
//row.SetChoiceInRowWithFocusShared( iEntryIndex );
|
||||
case EditCourseRow_Type:
|
||||
row.SetOneSharedSelection( pCourse->GetCourseType() );
|
||||
break;
|
||||
case ROW_RANDOMIZE:
|
||||
//row.SetChoiceInRowWithFocusShared( iEntryIndex );
|
||||
break;
|
||||
case ROW_LIVES:
|
||||
//row.SetChoiceInRowWithFocusShared( iEntryIndex );
|
||||
break;
|
||||
case ROW_METER:
|
||||
case EditCourseRow_Meter:
|
||||
{
|
||||
int iMeter = pCourse->m_iCustomMeter[DIFFICULTY_MEDIUM];
|
||||
if( iMeter == -1 )
|
||||
row.SetOneSharedSelection( 0 );
|
||||
else
|
||||
row.SetOneSharedSelection( iMeter + 1 - MIN_METER );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourse::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
{
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
||||
|
||||
switch( iRow )
|
||||
{
|
||||
case EditCourseRow_Type:
|
||||
{
|
||||
CourseType ct = (CourseType)row.GetOneSharedSelection();
|
||||
pCourse->SetCourseType( ct );
|
||||
}
|
||||
break;
|
||||
case EditCourseRow_Meter:
|
||||
{
|
||||
int iSel = row.GetOneSharedSelection();
|
||||
if( iSel == 0 ) // "auto"
|
||||
pCourse->m_iCustomMeter[DIFFICULTY_MEDIUM] = -1;
|
||||
else
|
||||
pCourse->m_iCustomMeter[DIFFICULTY_MEDIUM] = iSel - 1 + MIN_METER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourse::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[PLAYER_1];
|
||||
OptionRow &row = *m_pRows[iCurRow];
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
|
||||
if( iCurRow < NUM_EditCourseRow )
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else if( iCurRow == m_pRows.size()-2 ) // "create entry"
|
||||
else if( iCurRow == (int)m_pRows.size()-2 ) // "create entry"
|
||||
{
|
||||
if( pCourse->m_vEntries.size() >= MAX_ENTRIES_PER_COURSE )
|
||||
{
|
||||
@@ -226,7 +256,7 @@ void ScreenOptionsEditCourse::ProcessMenuStart( PlayerNumber pn, const InputEven
|
||||
GAMESTATE->m_iEditCourseEntryIndex.Set( pCourse->m_vEntries.size()-1 );
|
||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||
}
|
||||
else if( iCurRow == m_pRows.size()-1 ) // "done"
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
{
|
||||
this->BeginFadingOut();
|
||||
}
|
||||
@@ -241,7 +271,7 @@ void ScreenOptionsEditCourse::ProcessMenuStart( PlayerNumber pn, const InputEven
|
||||
|
||||
int iWidth, iX, iY;
|
||||
this->GetWidthXY( PLAYER_1, iCurRow, 0, iWidth, iX, iY );
|
||||
ScreenMiniMenu::MiniMenu( &g_TempMenu, SM_BackFromContextMenu, SM_BackFromContextMenu, iX, iY );
|
||||
ScreenMiniMenu::MiniMenu( &g_TempMenu, SM_BackFromContextMenu, SM_BackFromContextMenu, (float)iX, (float)iY );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -251,7 +281,7 @@ int ScreenOptionsEditCourse::GetCourseEntryIndexWithFocus() const
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
if( iCurRow < NUM_EditCourseRow ) // not a CourseEntry
|
||||
return -1;
|
||||
else if( iCurRow == m_pRows.size() - 1 ) // "done"
|
||||
else if( iCurRow == (int)m_pRows.size() - 1 ) // "done"
|
||||
return -1;
|
||||
else
|
||||
return iCurRow - NUM_EditCourseRow;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef ScreenOptionsEditCourse_H
|
||||
#define ScreenOptionsEditCourse_H
|
||||
|
||||
#include "ScreenOptions.h"
|
||||
#include "ScreenOptionsManageCourses.h"
|
||||
#include "Course.h"
|
||||
|
||||
class ScreenOptionsEditCourse : public ScreenOptions
|
||||
class ScreenOptionsEditCourse : public ScreenOptionsEditCourseSubMenu
|
||||
{
|
||||
public:
|
||||
ScreenOptionsEditCourse( CString sName );
|
||||
@@ -19,6 +19,7 @@ protected:
|
||||
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
|
||||
|
||||
virtual void AfterChangeRow( PlayerNumber pn );
|
||||
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
|
||||
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
|
||||
|
||||
int GetCourseEntryIndexWithFocus() const;
|
||||
|
||||
@@ -46,7 +46,7 @@ static void FillSongsAndChoices( const CString &sSongGroup, vector<Song*> &vpSon
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenOptionsEditCourseEntry );
|
||||
ScreenOptionsEditCourseEntry::ScreenOptionsEditCourseEntry( CString sName ) : ScreenOptions( sName )
|
||||
ScreenOptionsEditCourseEntry::ScreenOptionsEditCourseEntry( CString sName ) : ScreenOptionsEditCourseSubMenu( sName )
|
||||
{
|
||||
LOG->Trace( "ScreenOptionsEditCourseEntry::ScreenOptionsEditCourseEntry()" );
|
||||
}
|
||||
@@ -67,6 +67,7 @@ void ScreenOptionsEditCourseEntry::Init()
|
||||
|
||||
OptionRowDefinition def;
|
||||
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
def.m_bExportOnChange = true;
|
||||
|
||||
def.m_sName = "Song Group";
|
||||
def.m_vsChoices.clear();
|
||||
@@ -154,7 +155,7 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
||||
break;
|
||||
case ROW_SET_MODS:
|
||||
{
|
||||
Trail *pTrail = pCourse->GetTrail( STEPS_TYPE_DANCE_SINGLE );
|
||||
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
||||
TrailEntry *pTrailEntry = &pTrail->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
|
||||
Song *pSong = pTrailEntry->pSong;
|
||||
Steps *pSteps = pTrailEntry->pSteps;
|
||||
@@ -191,6 +192,8 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( int iRow, PlayerNumber
|
||||
ScreenOptions::AfterChangeValueInRow( iRow, pn );
|
||||
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( NULL );
|
||||
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] );
|
||||
int iEntryIndex = GAMESTATE->m_iEditCourseEntryIndex;
|
||||
ASSERT( iEntryIndex >= 0 && iEntryIndex < pCourse->m_vEntries.size() );
|
||||
CourseEntry &ce = pCourse->m_vEntries[ iEntryIndex ];
|
||||
@@ -223,6 +226,12 @@ void ScreenOptionsEditCourseEntry::AfterChangeValueInRow( int iRow, PlayerNumber
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// cause overlay elements to refresh by changing the course
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseEntry::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||
@@ -325,17 +334,22 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vector<PlayerN
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_SONG];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
if( iChoice == 0 )
|
||||
ce.pSong = NULL;
|
||||
else
|
||||
ce.pSong = m_vpDisplayedSongs[iChoice-1];
|
||||
ce.pSong = m_vpDisplayedSongs[iChoice];
|
||||
}
|
||||
break;
|
||||
case ROW_BASE_DIFFICULTY:
|
||||
{
|
||||
OptionRow &row = *m_pRows[ROW_BASE_DIFFICULTY];
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
ce.baseDifficulty = DIFFICULTIES_TO_SHOW.GetValue()[iChoice];
|
||||
if( iChoice == 0 )
|
||||
{
|
||||
ce.baseDifficulty = DIFFICULTY_INVALID;
|
||||
}
|
||||
else
|
||||
{
|
||||
Difficulty d = DIFFICULTIES_TO_SHOW.GetValue()[iChoice-1];
|
||||
ce.baseDifficulty = d;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ROW_LOW_METER:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef ScreenOptionsEditCourseEntry_H
|
||||
#define ScreenOptionsEditCourseEntry_H
|
||||
|
||||
#include "ScreenOptions.h"
|
||||
#include "ScreenOptionsManageCourses.h"
|
||||
#include "Course.h"
|
||||
class Song;
|
||||
|
||||
class ScreenOptionsEditCourseEntry : public ScreenOptions
|
||||
class ScreenOptionsEditCourseEntry : public ScreenOptionsEditCourseSubMenu
|
||||
{
|
||||
public:
|
||||
ScreenOptionsEditCourseEntry( CString sName );
|
||||
|
||||
@@ -8,6 +8,79 @@
|
||||
#include "ScreenTextEntry.h"
|
||||
#include "ScreenPrompt.h"
|
||||
#include "ScreenMiniMenu.h"
|
||||
#include "GameManager.h"
|
||||
#include "Difficulty.h"
|
||||
|
||||
static void RefreshTrail()
|
||||
{
|
||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||
if( pCourse == NULL )
|
||||
return;
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
Trail *pTrail = pCourse->GetTrail( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] );
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||
}
|
||||
|
||||
struct StepsTypeAndDifficulty
|
||||
{
|
||||
StepsType st;
|
||||
Difficulty cd;
|
||||
|
||||
bool operator==( const StepsTypeAndDifficulty &stad ) const { return st == stad.st && cd == stad.cd; }
|
||||
};
|
||||
static void SetNextCombination()
|
||||
{
|
||||
vector<StepsTypeAndDifficulty> v;
|
||||
{
|
||||
FOREACH_CONST( StepsType, STEPS_TYPES_TO_SHOW.GetValue(), st )
|
||||
{
|
||||
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
|
||||
{
|
||||
StepsTypeAndDifficulty stad = { *st, *cd };
|
||||
v.push_back( stad );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StepsTypeAndDifficulty curVal = { GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] };
|
||||
|
||||
int iIndex = -1;
|
||||
vector<StepsTypeAndDifficulty>::const_iterator iter = find( v.begin(), v.end(), curVal );
|
||||
if( iter != v.end() )
|
||||
{
|
||||
iIndex = iter - v.begin();
|
||||
}
|
||||
|
||||
iIndex++;
|
||||
wrap( iIndex, v.size() );
|
||||
curVal = v[iIndex];
|
||||
|
||||
GAMESTATE->m_stEdit.Set( curVal.st );
|
||||
GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1].Set( curVal.cd );
|
||||
|
||||
RefreshTrail();
|
||||
}
|
||||
|
||||
ScreenOptionsEditCourseSubMenu::ScreenOptionsEditCourseSubMenu( CString sName ) : ScreenOptions( sName )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ScreenOptionsEditCourseSubMenu::MenuSelect( PlayerNumber pn, const InputEventType type )
|
||||
{
|
||||
if( type == IET_FIRST_PRESS )
|
||||
{
|
||||
SetNextCombination();
|
||||
|
||||
SCREENMAN->PlayInvalidSound();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenOptions::MenuSelect( pn, type );
|
||||
}
|
||||
|
||||
|
||||
|
||||
AutoScreenMessage( SM_BackFromEnterName )
|
||||
AutoScreenMessage( SM_BackFromDeleteConfirm )
|
||||
@@ -33,7 +106,7 @@ static MenuDef g_TempMenu(
|
||||
);
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenOptionsManageCourses );
|
||||
ScreenOptionsManageCourses::ScreenOptionsManageCourses( CString sName ) : ScreenOptions( sName )
|
||||
ScreenOptionsManageCourses::ScreenOptionsManageCourses( CString sName ) : ScreenOptionsEditCourseSubMenu( sName )
|
||||
{
|
||||
LOG->Trace( "ScreenOptionsManageCourses::ScreenOptionsManageCourses()" );
|
||||
}
|
||||
@@ -42,6 +115,16 @@ void ScreenOptionsManageCourses::Init()
|
||||
{
|
||||
ScreenOptions::Init();
|
||||
|
||||
EDIT_MODE.Load(m_sName,"EditMode");
|
||||
|
||||
|
||||
if( GAMESTATE->m_stEdit == STEPS_TYPE_INVALID ||
|
||||
GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] == DIFFICULTY_INVALID )
|
||||
{
|
||||
SetNextCombination();
|
||||
}
|
||||
|
||||
|
||||
vector<OptionRowDefinition> vDefs;
|
||||
vector<OptionRowHandler*> vHands;
|
||||
|
||||
@@ -55,9 +138,42 @@ void ScreenOptionsManageCourses::Init()
|
||||
vHands.push_back( NULL );
|
||||
|
||||
SONGMAN->GetAllCourses( m_vpCourses, false );
|
||||
|
||||
switch( EDIT_MODE.GetValue() )
|
||||
{
|
||||
default:
|
||||
ASSERT(0);
|
||||
case EDIT_MODE_PRACTICE:
|
||||
case EDIT_MODE_HOME:
|
||||
// strip out non-edits
|
||||
for( int i=m_vpCourses.size()-1; i>=0; i-- )
|
||||
{
|
||||
if( !m_vpCourses[i]->IsAnEdit() )
|
||||
m_vpCourses.erase( m_vpCourses.begin()+i );
|
||||
}
|
||||
break;
|
||||
case EDIT_MODE_FULL:
|
||||
break;
|
||||
}
|
||||
|
||||
FOREACH_CONST( Course*, m_vpCourses, c )
|
||||
{
|
||||
def.m_sName = CourseTypeToThemedString( (*c)->GetCourseType() );
|
||||
switch( EDIT_MODE.GetValue() )
|
||||
{
|
||||
default:
|
||||
ASSERT(0);
|
||||
case EDIT_MODE_PRACTICE:
|
||||
case EDIT_MODE_HOME:
|
||||
def.m_sName = CourseTypeToThemedString( (*c)->GetCourseType() );
|
||||
break;
|
||||
case EDIT_MODE_FULL:
|
||||
if( (*c)->IsAnEdit() )
|
||||
def.m_sName = "Edit";
|
||||
else
|
||||
def.m_sName = (*c)->m_sGroupName;
|
||||
break;
|
||||
}
|
||||
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( (*c)->GetDisplayFullTitle() );
|
||||
vDefs.push_back( def );
|
||||
@@ -71,6 +187,17 @@ void ScreenOptionsManageCourses::BeginScreen()
|
||||
{
|
||||
ScreenOptions::BeginScreen();
|
||||
|
||||
// select the last chosen course
|
||||
if( GAMESTATE->m_pCurCourse )
|
||||
{
|
||||
vector<Course*>::const_iterator iter = find( m_vpCourses.begin(), m_vpCourses.end(), GAMESTATE->m_pCurCourse );
|
||||
if( iter != m_vpCourses.end() )
|
||||
{
|
||||
int iIndex = iter - m_vpCourses.begin();
|
||||
this->MoveRowAbsolute( PLAYER_1, 1 + iIndex, false );
|
||||
}
|
||||
}
|
||||
|
||||
AfterChangeRow( PLAYER_1 );
|
||||
}
|
||||
|
||||
@@ -79,7 +206,7 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
|
||||
if( SM == SM_GoToNextScreen )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
if( iCurRow == m_pRows.size() - 1 )
|
||||
if( iCurRow == (int)m_pRows.size() - 1 )
|
||||
{
|
||||
this->HandleScreenMessage( SM_GoToPrevScreen );
|
||||
return; // don't call base
|
||||
@@ -96,9 +223,15 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
// create
|
||||
Course *pCourse = new Course;
|
||||
pCourse->m_sMainTitle = ScreenTextEntry::s_sLastAnswer;
|
||||
pCourse->SetLoadedFromProfile( PROFILE_SLOT_MACHINE );
|
||||
pCourse->m_vEntries.push_back( CourseEntry() ); // one blank entry
|
||||
pCourse->m_vEntries[0].baseDifficulty = DIFFICULTY_MEDIUM;
|
||||
SONGMAN->AddCourse( pCourse );
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
|
||||
RefreshTrail();
|
||||
|
||||
this->HandleScreenMessage( SM_GoToNextScreen );
|
||||
}
|
||||
}
|
||||
@@ -117,8 +250,14 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
|
||||
switch( ScreenMiniMenu::s_iLastRowCode )
|
||||
{
|
||||
case CourseAction_Edit:
|
||||
GAMESTATE->m_pCurCourse.Set( GetCourseWithFocus() );
|
||||
ScreenOptions::BeginFadingOut();
|
||||
{
|
||||
Course *pCourse = GetCourseWithFocus();
|
||||
Trail *pTrail = pCourse->GetTrail( STEPS_TYPE_DANCE_SINGLE );
|
||||
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||
|
||||
ScreenOptions::BeginFadingOut();
|
||||
}
|
||||
break;
|
||||
case CourseAction_Rename:
|
||||
{
|
||||
@@ -159,7 +298,6 @@ void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
|
||||
void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
OptionRow &row = *m_pRows[iCurRow];
|
||||
|
||||
if( iCurRow == 0 ) // "create new"
|
||||
{
|
||||
@@ -171,7 +309,7 @@ void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputE
|
||||
MAX_EDIT_COURSE_TITLE_LENGTH,
|
||||
SongManager::ValidateEditCourseName );
|
||||
}
|
||||
else if( iCurRow == m_pRows.size()-1 ) // "done"
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
{
|
||||
this->BeginFadingOut();
|
||||
}
|
||||
@@ -186,7 +324,7 @@ void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputE
|
||||
|
||||
int iWidth, iX, iY;
|
||||
this->GetWidthXY( PLAYER_1, iCurRow, 0, iWidth, iX, iY );
|
||||
ScreenMiniMenu::MiniMenu( &g_TempMenu, SM_BackFromContextMenu, SM_BackFromContextMenu, iX, iY );
|
||||
ScreenMiniMenu::MiniMenu( &g_TempMenu, SM_BackFromContextMenu, SM_BackFromContextMenu, (float)iX, (float)iY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +343,7 @@ Course *ScreenOptionsManageCourses::GetCourseWithFocus() const
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
if( iCurRow == 0 )
|
||||
return NULL;
|
||||
else if( iCurRow == m_pRows.size()-1 ) // "done"
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
return NULL;
|
||||
|
||||
// a course
|
||||
|
||||
@@ -5,7 +5,16 @@
|
||||
|
||||
class Course;
|
||||
|
||||
class ScreenOptionsManageCourses : public ScreenOptions
|
||||
class ScreenOptionsEditCourseSubMenu : public ScreenOptions
|
||||
{
|
||||
public:
|
||||
ScreenOptionsEditCourseSubMenu( CString sName );
|
||||
|
||||
protected:
|
||||
virtual void MenuSelect( PlayerNumber pn, const InputEventType type );
|
||||
};
|
||||
|
||||
class ScreenOptionsManageCourses : public ScreenOptionsEditCourseSubMenu
|
||||
{
|
||||
public:
|
||||
ScreenOptionsManageCourses( CString sName );
|
||||
@@ -25,6 +34,8 @@ protected:
|
||||
Course *GetCourseWithFocus() const;
|
||||
|
||||
vector<Course*> m_vpCourses;
|
||||
|
||||
ThemeMetricEnum<EditMode> EDIT_MODE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user