working on course editor

This commit is contained in:
Chris Danford
2005-07-29 23:03:43 +00:00
parent 4c2a8e4cd7
commit 93b9cc156a
8 changed files with 75 additions and 41 deletions
+4 -1
View File
@@ -7,6 +7,7 @@
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include "GameManager.h" #include "GameManager.h"
#include "song.h" #include "song.h"
#include "FontCharAliases.h"
enum EditCourseRow enum EditCourseRow
{ {
@@ -98,7 +99,9 @@ void ScreenOptionsEditCourse::Init()
def.m_sName = "Insert Entry"; def.m_sName = "Insert Entry";
def.m_vsChoices.clear(); def.m_vsChoices.clear();
def.m_vsChoices.push_back( "" ); CString sStart = "&Start;";
FontCharAliases::ReplaceMarkers( sStart );
def.m_vsChoices.push_back( sStart );
vDefs.push_back( def ); vDefs.push_back( def );
vHands.push_back( NULL ); vHands.push_back( NULL );
@@ -7,6 +7,7 @@
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include "GameManager.h" #include "GameManager.h"
#include "song.h" #include "song.h"
#include "FontCharAliases.h"
enum EditCourseEntryRow enum EditCourseEntryRow
{ {
@@ -58,7 +59,9 @@ void ScreenOptionsEditCourseEntry::Init()
def.m_sName = "Song"; def.m_sName = "Song";
def.m_vsChoices.clear(); def.m_vsChoices.clear();
def.m_vsChoices.push_back( "" ); CString sStart = "&Start;";
FontCharAliases::ReplaceMarkers( sStart );
def.m_vsChoices.push_back( sStart );
vDefs.push_back( def ); vDefs.push_back( def );
vHands.push_back( NULL ); vHands.push_back( NULL );
@@ -1,7 +1,6 @@
#include "global.h" #include "global.h"
#include "ScreenOptionsEditProfile.h" #include "ScreenOptionsEditProfile.h"
#include "ScreenMiniMenu.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
+68 -37
View File
@@ -7,9 +7,12 @@
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
#include "FontCharAliases.h"
#include "ScreenMiniMenu.h"
AutoScreenMessage( SM_BackFromEnterName ) AutoScreenMessage( SM_BackFromEnterName )
AutoScreenMessage( SM_BackFromDeleteConfirm ) AutoScreenMessage( SM_BackFromDeleteConfirm )
AutoScreenMessage( SM_BackFromContextMenu )
enum CourseAction enum CourseAction
{ {
@@ -26,6 +29,9 @@ static const CString CourseActionNames[] = {
XToString( CourseAction, NUM_CourseAction ); XToString( CourseAction, NUM_CourseAction );
#define FOREACH_CourseAction( i ) FOREACH_ENUM( CourseAction, NUM_CourseAction, i ) #define FOREACH_CourseAction( i ) FOREACH_ENUM( CourseAction, NUM_CourseAction, i )
static MenuDef g_TempMenu(
"ScreenMiniMenuContext"
);
REGISTER_SCREEN_CLASS( ScreenOptionsManageCourses ); REGISTER_SCREEN_CLASS( ScreenOptionsManageCourses );
ScreenOptionsManageCourses::ScreenOptionsManageCourses( CString sName ) : ScreenOptions( sName ) ScreenOptionsManageCourses::ScreenOptionsManageCourses( CString sName ) : ScreenOptions( sName )
@@ -43,19 +49,20 @@ void ScreenOptionsManageCourses::Init()
OptionRowDefinition def; OptionRowDefinition def;
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_sName = "Create New"; def.m_sName = "";
def.m_vsChoices.clear(); def.m_vsChoices.clear();
def.m_vsChoices.push_back( "" ); CString sStart = "Create New";
FontCharAliases::ReplaceMarkers( sStart );
def.m_vsChoices.push_back( sStart );
vDefs.push_back( def ); vDefs.push_back( def );
vHands.push_back( NULL ); vHands.push_back( NULL );
SONGMAN->GetAllCourses( m_vpCourses, false ); SONGMAN->GetAllCourses( m_vpCourses, false );
FOREACH_CONST( Course*, m_vpCourses, c ) FOREACH_CONST( Course*, m_vpCourses, c )
{ {
def.m_sName = (*c)->GetDisplayFullTitle(); def.m_sName = CourseTypeToThemedString( (*c)->GetCourseType() );
def.m_vsChoices.clear(); def.m_vsChoices.clear();
FOREACH_CourseAction( i ) def.m_vsChoices.push_back( (*c)->GetDisplayFullTitle() );
def.m_vsChoices.push_back( CourseActionToString(i) );
vDefs.push_back( def ); vDefs.push_back( def );
vHands.push_back( NULL ); vHands.push_back( NULL );
} }
@@ -67,7 +74,7 @@ void ScreenOptionsManageCourses::BeginScreen()
{ {
ScreenOptions::BeginScreen(); ScreenOptions::BeginScreen();
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber ); AfterChangeRow( PLAYER_1 );
} }
void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
@@ -106,37 +113,11 @@ void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
SCREENMAN->SetNewScreen( this->m_sName ); // reload SCREENMAN->SetNewScreen( this->m_sName ); // reload
} }
} }
else if( SM == SM_BackFromContextMenu )
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsManageCourses::AfterChangeValueInRow( PlayerNumber pn )
{
ScreenOptions::AfterChangeValueInRow( 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"
{ {
CString sCurrentProfileName = "New Course"; if( !ScreenMiniMenu::s_bCancelled )
ScreenTextEntry::TextEntry(
SM_BackFromEnterName,
"Enter a name for a new course.",
sCurrentProfileName,
MAX_EDIT_COURSE_TITLE_LENGTH,
SongManager::ValidateEditCourseName );
}
else if( iCurRow == m_pRows.size()-1 ) // "done"
{ {
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN ); switch( ScreenMiniMenu::s_iLastRowCode )
}
else // a course
{
switch( row.GetChoiceInRowWithFocusShared() )
{ {
case CourseAction_Edit: case CourseAction_Edit:
GAMESTATE->m_pCurCourse.Set( GetCourseWithFocus() ); GAMESTATE->m_pCurCourse.Set( GetCourseWithFocus() );
@@ -162,6 +143,54 @@ void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputE
break; break;
} }
} }
}
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
{
Course *pCourse = GetCourseWithFocus();
Trail *pTrail = pCourse ? pCourse->GetTrail( STEPS_TYPE_DANCE_SINGLE ) : NULL;
GAMESTATE->m_pCurCourse.Set( pCourse );
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
ScreenOptions::AfterChangeRow( 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"
{
CString sCurrentProfileName = "New Course";
ScreenTextEntry::TextEntry(
SM_BackFromEnterName,
"Enter a name for a new course.",
sCurrentProfileName,
MAX_EDIT_COURSE_TITLE_LENGTH,
SongManager::ValidateEditCourseName );
}
else if( iCurRow == m_pRows.size()-1 ) // "done"
{
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
}
else // a course
{
g_TempMenu.rows.clear();
FOREACH_CourseAction( i )
{
MenuRowDef mrd( i, CourseActionToString(i), true, EDIT_MODE_HOME, 0, "" );
g_TempMenu.rows.push_back( mrd );
}
int iWidth, iX, iY;
this->GetWidthXY( PLAYER_1, iCurRow, 0, iWidth, iX, iY );
ScreenMiniMenu::MiniMenu( &g_TempMenu, SM_BackFromContextMenu, SM_BackFromContextMenu, iX, iY );
}
} }
void ScreenOptionsManageCourses::ImportOptions( int iRow, const vector<PlayerNumber> &vpns ) void ScreenOptionsManageCourses::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
@@ -181,8 +210,10 @@ Course *ScreenOptionsManageCourses::GetCourseWithFocus() const
return NULL; return NULL;
else if( iCurRow == m_pRows.size()-1 ) // "done" else if( iCurRow == m_pRows.size()-1 ) // "done"
return NULL; return NULL;
else // a course
return m_vpCourses[iCurRow]; // a course
int iCourseIndex = iCurRow - 1;
return m_vpCourses[iCourseIndex];
} }
/* /*
+1 -1
View File
@@ -19,7 +19,7 @@ protected:
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns ); virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns ); virtual void ExportOptions( int iRow, const vector<PlayerNumber> &vpns );
virtual void AfterChangeValueInRow( PlayerNumber pn ); virtual void AfterChangeRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
Course *GetCourseWithFocus() const; Course *GetCourseWithFocus() const;
@@ -1,7 +1,6 @@
#include "global.h" #include "global.h"
#include "ScreenOptionsSelectProfile.h" #include "ScreenOptionsSelectProfile.h"
#include "ScreenMiniMenu.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
-1
View File
@@ -1,7 +1,6 @@
#include "global.h" #include "global.h"
#include "ScreenSelectProfile.h" #include "ScreenSelectProfile.h"
#include "ScreenMiniMenu.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
+1 -1
View File
@@ -129,7 +129,7 @@ protected:
CStringArray m_sSongGroupBannerPaths; // each song group may have a banner associated with it CStringArray m_sSongGroupBannerPaths; // each song group may have a banner associated with it
vector<Course*> m_pCourses; vector<Course*> m_pCourses;
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_COURSE_TYPES]; vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_CourseType];
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
CStringArray m_sCourseGroupNames; CStringArray m_sCourseGroupNames;
CStringArray m_sCourseGroupBannerPaths; // each course group may have a banner associated with it CStringArray m_sCourseGroupBannerPaths; // each course group may have a banner associated with it