working on new course editor

This commit is contained in:
Chris Danford
2005-06-25 01:58:14 +00:00
parent f0335f486c
commit 8097c2dd61
4 changed files with 308 additions and 39 deletions
+38 -37
View File
@@ -1,35 +1,12 @@
#include "global.h"
#include "ScreenCourseManager.h"
#include "ScreenEditCourse.h"
#include "RageLog.h"
#include "GameState.h"
#include "SongManager.h"
enum CourseManagerRow
{
ROW_GROUP,
ROW_COURSE,
ROW_ACTION
};
enum CourseManagerAction
{
ACTION_EDIT,
ACTION_DELETE,
ACTION_COPY_TO_NEW,
ACTION_CREATE_NEW,
NUM_CourseManagerAction
};
static const CString CourseManagerActionNames[] = {
"Edit",
"Delete",
"Create New",
"Copy to New",
};
XToString( CourseManagerAction, NUM_CourseManagerAction );
static void GetPossibleActions( Course *pCourse, vector<CourseManagerAction> &vActionsOut )
static void GetPossibleActions( vector<CourseManagerAction> &vActionsOut )
{
if( pCourse )
if( GAMESTATE->m_pCurCourse != NULL )
{
vActionsOut.push_back( ACTION_EDIT );
vActionsOut.push_back( ACTION_DELETE );
@@ -42,13 +19,13 @@ static void GetPossibleActions( Course *pCourse, vector<CourseManagerAction> &vA
}
REGISTER_SCREEN_CLASS( ScreenCourseManager );
ScreenCourseManager::ScreenCourseManager( CString sName ) : ScreenOptions( sName )
REGISTER_SCREEN_CLASS( ScreenEditCourse );
ScreenEditCourse::ScreenEditCourse( CString sName ) : ScreenOptions( sName )
{
LOG->Trace( "ScreenCourseManager::ScreenCourseManager()" );
LOG->Trace( "ScreenEditCourse::ScreenEditCourse()" );
}
void ScreenCourseManager::Init()
void ScreenEditCourse::Init()
{
ScreenOptions::Init();
@@ -56,6 +33,7 @@ void ScreenCourseManager::Init()
vector<OptionRowHandler*> vHands;
OptionRowDefinition def;
def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.name = "Group";
def.choices.clear();
@@ -81,12 +59,12 @@ void ScreenCourseManager::Init()
OnChange( GAMESTATE->m_MasterPlayerNumber );
}
void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
{
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenCourseManager::OnChange( PlayerNumber pn )
void ScreenEditCourse::OnChange( PlayerNumber pn )
{
ScreenOptions::OnChange( pn );
@@ -129,7 +107,7 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
vector<CourseManagerAction> vActions;
GetPossibleActions( GAMESTATE->m_pCurCourse, vActions );
GetPossibleActions( vActions );
FOREACH_CONST( CourseManagerAction, vActions, a )
def.choices.push_back( CourseManagerActionToString(*a) );
row.Reload( def );
@@ -142,22 +120,45 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
}
}
void ScreenCourseManager::ImportOptions( int row, const vector<PlayerNumber> &vpns )
void ScreenEditCourse::ImportOptions( int row, const vector<PlayerNumber> &vpns )
{
}
void ScreenCourseManager::ExportOptions( int row, const vector<PlayerNumber> &vpns )
void ScreenEditCourse::ExportOptions( int row, const vector<PlayerNumber> &vpns )
{
}
void ScreenCourseManager::GoToNextScreen()
void ScreenEditCourse::GoToNextScreen()
{
OptionRow &row = *m_pRows[ROW_ACTION];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
vector<CourseManagerAction> vActions;
GetPossibleActions( vActions );
CourseManagerAction action = vActions[iChoice];
switch( action )
{
default:
ASSERT(0);
case ACTION_EDIT:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ACTION_DELETE:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_COPY_TO_NEW:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_CREATE_NEW:
SCREENMAN->PlayInvalidSound();
break;
}
}
void ScreenCourseManager::GoToPrevScreen()
void ScreenEditCourse::GoToPrevScreen()
{
}