working on new course editor
This commit is contained in:
@@ -1,35 +1,12 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ScreenCourseManager.h"
|
#include "ScreenEditCourse.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "SongManager.h"
|
#include "SongManager.h"
|
||||||
|
|
||||||
enum CourseManagerRow
|
static void GetPossibleActions( vector<CourseManagerAction> &vActionsOut )
|
||||||
{
|
{
|
||||||
ROW_GROUP,
|
if( GAMESTATE->m_pCurCourse != NULL )
|
||||||
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 )
|
|
||||||
{
|
|
||||||
if( pCourse )
|
|
||||||
{
|
{
|
||||||
vActionsOut.push_back( ACTION_EDIT );
|
vActionsOut.push_back( ACTION_EDIT );
|
||||||
vActionsOut.push_back( ACTION_DELETE );
|
vActionsOut.push_back( ACTION_DELETE );
|
||||||
@@ -42,13 +19,13 @@ static void GetPossibleActions( Course *pCourse, vector<CourseManagerAction> &vA
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenCourseManager );
|
REGISTER_SCREEN_CLASS( ScreenEditCourse );
|
||||||
ScreenCourseManager::ScreenCourseManager( CString sName ) : ScreenOptions( sName )
|
ScreenEditCourse::ScreenEditCourse( CString sName ) : ScreenOptions( sName )
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenCourseManager::ScreenCourseManager()" );
|
LOG->Trace( "ScreenEditCourse::ScreenEditCourse()" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCourseManager::Init()
|
void ScreenEditCourse::Init()
|
||||||
{
|
{
|
||||||
ScreenOptions::Init();
|
ScreenOptions::Init();
|
||||||
|
|
||||||
@@ -56,6 +33,7 @@ void ScreenCourseManager::Init()
|
|||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
OptionRowDefinition def;
|
OptionRowDefinition def;
|
||||||
|
def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
|
||||||
def.name = "Group";
|
def.name = "Group";
|
||||||
def.choices.clear();
|
def.choices.clear();
|
||||||
@@ -81,12 +59,12 @@ void ScreenCourseManager::Init()
|
|||||||
OnChange( GAMESTATE->m_MasterPlayerNumber );
|
OnChange( GAMESTATE->m_MasterPlayerNumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
ScreenOptions::HandleScreenMessage( SM );
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCourseManager::OnChange( PlayerNumber pn )
|
void ScreenEditCourse::OnChange( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
ScreenOptions::OnChange( pn );
|
ScreenOptions::OnChange( pn );
|
||||||
|
|
||||||
@@ -129,7 +107,7 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
|
|||||||
OptionRowDefinition def = row.GetRowDef();
|
OptionRowDefinition def = row.GetRowDef();
|
||||||
def.choices.clear();
|
def.choices.clear();
|
||||||
vector<CourseManagerAction> vActions;
|
vector<CourseManagerAction> vActions;
|
||||||
GetPossibleActions( GAMESTATE->m_pCurCourse, vActions );
|
GetPossibleActions( vActions );
|
||||||
FOREACH_CONST( CourseManagerAction, vActions, a )
|
FOREACH_CONST( CourseManagerAction, vActions, a )
|
||||||
def.choices.push_back( CourseManagerActionToString(*a) );
|
def.choices.push_back( CourseManagerActionToString(*a) );
|
||||||
row.Reload( def );
|
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()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,212 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "ScreenCourseManager.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( vector<CourseManagerAction> &vActionsOut )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->m_pCurCourse != NULL )
|
||||||
|
{
|
||||||
|
vActionsOut.push_back( ACTION_EDIT );
|
||||||
|
vActionsOut.push_back( ACTION_DELETE );
|
||||||
|
vActionsOut.push_back( ACTION_COPY_TO_NEW );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vActionsOut.push_back( ACTION_CREATE_NEW );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
REGISTER_SCREEN_CLASS( ScreenCourseManager );
|
||||||
|
ScreenCourseManager::ScreenCourseManager( CString sName ) : ScreenOptions( sName )
|
||||||
|
{
|
||||||
|
LOG->Trace( "ScreenCourseManager::ScreenCourseManager()" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::Init()
|
||||||
|
{
|
||||||
|
ScreenOptions::Init();
|
||||||
|
|
||||||
|
vector<OptionRowDefinition> vDefs;
|
||||||
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
|
OptionRowDefinition def;
|
||||||
|
def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
|
||||||
|
def.name = "Group";
|
||||||
|
def.choices.clear();
|
||||||
|
SONGMAN->GetCourseGroupNames( def.choices );
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
|
||||||
|
def.name = "Course";
|
||||||
|
def.choices.clear();
|
||||||
|
def.choices.push_back( "" );
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
|
||||||
|
def.name = "Action";
|
||||||
|
def.choices.clear();
|
||||||
|
def.choices.push_back( "" );
|
||||||
|
vDefs.push_back( def );
|
||||||
|
vHands.push_back( NULL );
|
||||||
|
|
||||||
|
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
|
||||||
|
|
||||||
|
|
||||||
|
OnChange( GAMESTATE->m_MasterPlayerNumber );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::OnChange( PlayerNumber pn )
|
||||||
|
{
|
||||||
|
ScreenOptions::OnChange( pn );
|
||||||
|
|
||||||
|
switch( m_iCurrentRow[pn] )
|
||||||
|
{
|
||||||
|
case ROW_GROUP:
|
||||||
|
// export current course group
|
||||||
|
{
|
||||||
|
OptionRow &row = *m_pRows[ROW_GROUP];
|
||||||
|
int iChoice = row.GetChoiceInRowWithFocus(pn);
|
||||||
|
CString sCourseGroup = row.GetRowDef().choices[iChoice];
|
||||||
|
GAMESTATE->m_sPreferredCourseGroup.Set( sCourseGroup );
|
||||||
|
}
|
||||||
|
// Refresh courses
|
||||||
|
{
|
||||||
|
OptionRow &row = *m_pRows[ROW_COURSE];
|
||||||
|
vector<Course*> vpCourses;
|
||||||
|
SONGMAN->GetCoursesInGroup( vpCourses, GAMESTATE->m_sPreferredCourseGroup.Get(), false );
|
||||||
|
OptionRowDefinition def = row.GetRowDef();
|
||||||
|
def.choices.clear();
|
||||||
|
FOREACH_CONST( Course*, vpCourses, c )
|
||||||
|
def.choices.push_back( (*c)->GetTranslitFullTitle() );
|
||||||
|
def.choices.push_back( NULL ); // new course
|
||||||
|
row.Reload( def );
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
case ROW_COURSE:
|
||||||
|
// export current course
|
||||||
|
{
|
||||||
|
OptionRow &row = *m_pRows[ROW_COURSE];
|
||||||
|
int iChoice = row.GetChoiceInRowWithFocus(pn);
|
||||||
|
vector<Course*> vpCourses;
|
||||||
|
SONGMAN->GetCoursesInGroup( vpCourses, GAMESTATE->m_sPreferredCourseGroup.Get(), false );
|
||||||
|
Course *pCourse = vpCourses[iChoice];
|
||||||
|
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||||
|
}
|
||||||
|
// refresh actions
|
||||||
|
{
|
||||||
|
OptionRow &row = *m_pRows[ROW_ACTION];
|
||||||
|
OptionRowDefinition def = row.GetRowDef();
|
||||||
|
def.choices.clear();
|
||||||
|
vector<CourseManagerAction> vActions;
|
||||||
|
GetPossibleActions( vActions );
|
||||||
|
FOREACH_CONST( CourseManagerAction, vActions, a )
|
||||||
|
def.choices.push_back( CourseManagerActionToString(*a) );
|
||||||
|
row.Reload( def );
|
||||||
|
}
|
||||||
|
// fall through
|
||||||
|
case ROW_ACTION:
|
||||||
|
// fall through
|
||||||
|
default:
|
||||||
|
; // nothing left to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::ImportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::ExportOptions( int row, const vector<PlayerNumber> &vpns )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenCourseManager::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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2002-2004 Chris Danford
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
#ifndef ScreenCourseManager_H
|
||||||
|
#define ScreenCourseManager_H
|
||||||
|
|
||||||
|
#include "ScreenOptions.h"
|
||||||
|
|
||||||
|
class ScreenCourseManager : public ScreenOptions
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScreenCourseManager( CString sName );
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
|
||||||
|
|
||||||
|
virtual void GoToNextScreen();
|
||||||
|
virtual void GoToPrevScreen();
|
||||||
|
|
||||||
|
void OnChange( PlayerNumber pn );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2003-2004 Chris Danford
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386 "$(intdir)\verstub.obj""
|
AdditionalOptions="/MACHINE:I386 "$(intdir)\verstub.obj""
|
||||||
OutputFile="../Program/StepMania-debug.exe"
|
OutputFile="../../itg/Program/StepMania-debug.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories=""
|
AdditionalLibraryDirectories=""
|
||||||
@@ -202,7 +202,7 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalOptions="/MACHINE:I386 "$(intdir)\verstub.obj""
|
AdditionalOptions="/MACHINE:I386 "$(intdir)\verstub.obj""
|
||||||
OutputFile="../Program/StepMania-debug.exe"
|
OutputFile="../../itg/Program/StepMania-debug.exe"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
AdditionalLibraryDirectories=""
|
AdditionalLibraryDirectories=""
|
||||||
@@ -315,6 +315,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath="ScreenEdit.h">
|
RelativePath="ScreenEdit.h">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ScreenEditCourse.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\ScreenEditCourse.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="ScreenEditCoursesMenu.cpp">
|
RelativePath="ScreenEditCoursesMenu.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
Reference in New Issue
Block a user