working on new course editor

This commit is contained in:
Chris Danford
2005-06-23 22:43:48 +00:00
parent 80c21cef06
commit 888b116b23
6 changed files with 247 additions and 2 deletions
+8 -1
View File
@@ -77,7 +77,7 @@ Choice1=@"ApplyDefaultOptions;screen,"..ScreenCautionBranch()
Choice2=screen,ScreenSelectGame Choice2=screen,ScreenSelectGame
Choice3=screen,ScreenOptionsMenu Choice3=screen,ScreenOptionsMenu
Choice4=screen,ScreenEditMenu Choice4=screen,ScreenEditMenu
Choice5=screen,ScreenEditCoursesMenu Choice5=screen,ScreenCourseManager
Choice6=screen,ScreenJukeboxMenu Choice6=screen,ScreenJukeboxMenu
Choice7=screen,ScreenExit Choice7=screen,ScreenExit
Choice8=screen,ScreenTest Choice8=screen,ScreenTest
@@ -4540,3 +4540,10 @@ Fallback=Screen
Fallback=ScreenPrompt Fallback=ScreenPrompt
Class=ScreenSaveSync Class=ScreenSaveSync
NextScreen=@GetGameplayNextScreen() NextScreen=@GetGameplayNextScreen()
[ScreenCourseManager]
Class=ScreenCourseManager
Fallback=ScreenOptions
TimerSeconds=0
ShowExitRow=0
ThemeItems=0
+173
View File
@@ -0,0 +1,173 @@
#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_CREATE_NEW,
ACTION_COPY_TO_NEW,
NUM_CourseManagerAction
};
static const CString CourseManagerActionNames[] = {
"Edit",
"Delete",
"Create New",
"Copy to New",
};
XToString( CourseManagerAction, NUM_CourseManagerAction );
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.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
}
// 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];
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
}
// 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()
{
}
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.
*/
+50
View File
@@ -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.
*/
+8
View File
@@ -886,6 +886,14 @@ void SongManager::GetCourses( CourseType ct, vector<Course*> &AddTo, bool bInclu
AddTo.push_back( m_pCourses[i] ); AddTo.push_back( m_pCourses[i] );
} }
void SongManager::GetCoursesInGroup( vector<Course*> &AddTo, const CString &sCourseGroup, bool bIncludeAutogen )
{
for( unsigned i=0; i<m_pCourses.size(); i++ )
if( m_pCourses[i]->m_sGroupName == sCourseGroup )
if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen )
AddTo.push_back( m_pCourses[i] );
}
bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup, bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out ) Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out )
{ {
+2 -1
View File
@@ -86,6 +86,7 @@ public:
void GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen ); void GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen );
void GetCourses( CourseType ct, vector<Course*> &AddTo, bool bIncludeAutogen ); void GetCourses( CourseType ct, vector<Course*> &AddTo, bool bIncludeAutogen );
void GetCoursesInGroup( vector<Course*> &AddTo, const CString &sCourseGroup, bool bIncludeAutogen );
void GetExtraStageInfo( bool bExtra2, const Style *s, void GetExtraStageInfo( bool bExtra2, const Style *s,
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out ); Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out );
@@ -125,7 +126,7 @@ protected:
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_COURSE_TYPES]; vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_COURSE_TYPES];
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
CStringArray m_sCourseGroupNames; CStringArray m_sCourseGroupNames;
CStringArray m_sCourseGroupBannerPaths; // each song group may have a banner associated with it CStringArray m_sCourseGroupBannerPaths; // each course group may have a banner associated with it
ThemeMetric<int> NUM_SONG_GROUP_COLORS; ThemeMetric<int> NUM_SONG_GROUP_COLORS;
+6
View File
@@ -282,6 +282,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="ScreenCenterImage.h"> RelativePath="ScreenCenterImage.h">
</File> </File>
<File
RelativePath=".\ScreenCourseManager.cpp">
</File>
<File
RelativePath=".\ScreenCourseManager.h">
</File>
<File <File
RelativePath="ScreenCredits.cpp"> RelativePath="ScreenCredits.cpp">
</File> </File>