working on new course editor

This commit is contained in:
Chris Danford
2005-06-26 21:31:07 +00:00
parent 6203875335
commit 7a1d736694
20 changed files with 705 additions and 190 deletions
+12
View File
@@ -22,6 +22,18 @@
#include "UnlockManager.h"
#include <limits.h>
static const CString CourseEntryTypeNames[] = {
"Fixed",
"Random",
"RandomWithinGroup",
"Best",
"Worst",
};
XToString( CourseEntryType, NUM_CourseEntryType );
XToThemedString( CourseEntryType, NUM_CourseEntryType );
/* Amount to increase meter ranges to make them difficult: */
const int COURSE_DIFFICULTY_CLASS_CHANGE[NUM_DIFFICULTIES] = { -1, -1, 0, 1, 1 };
+5 -13
View File
@@ -31,6 +31,7 @@ enum CourseType
inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); }
inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); }
enum CourseEntryType
{
COURSE_ENTRY_FIXED,
@@ -38,21 +39,12 @@ enum CourseEntryType
COURSE_ENTRY_RANDOM_WITHIN_GROUP,
COURSE_ENTRY_BEST,
COURSE_ENTRY_WORST,
NUM_COURSE_ENTRY_TYPES // leave this at the end
NUM_CourseEntryType // leave this at the end
};
#define FOREACH_CourseEntryType( i ) FOREACH_ENUM( CourseEntryType, NUM_CourseEntryType, i )
const CString &CourseEntryTypeToString( CourseEntryType cet );
const CString &CourseEntryTypeToThemedString( CourseEntryType cet );
inline CString CourseEntryTypeToString( CourseEntryType cet )
{
switch( cet )
{
case COURSE_ENTRY_FIXED: return "fixed";
case COURSE_ENTRY_RANDOM: return "random";
case COURSE_ENTRY_RANDOM_WITHIN_GROUP: return "random_within_group";
case COURSE_ENTRY_BEST: return "best";
case COURSE_ENTRY_WORST: return "worst";
default: ASSERT(0); return "";
}
}
class CourseEntry
{
+2 -2
View File
@@ -63,7 +63,7 @@ enum CourseOptionsMenuRow
const bool g_bRowEnabledForType[NUM_COURSE_ENTRY_TYPES][NUM_ENTRY_OPTIONS_MENU_ROWS] =
const bool g_bRowEnabledForType[NUM_CourseEntryType][NUM_ENTRY_OPTIONS_MENU_ROWS] =
{ // song, group, difficulty, low_meter, high_meter, best_worst
/* fixed */ { true, false, true, true, true, false },
/* random */ { false, false, true, true, true, false },
@@ -174,7 +174,7 @@ bool EditCoursesMenu::CanGoRight()
1,
NUM_ACTIONS,
(int)GetSelectedCourse()->m_entries.size(),
NUM_COURSE_ENTRY_TYPES,
NUM_CourseEntryType,
1,
1,
1
+2 -2
View File
@@ -16,7 +16,7 @@
#define ROW_Y( i ) THEME->GetMetricF("EditCoursesSongMenu",ssprintf("Row%dY",i+1))
const bool g_bRowEnabledForType[NUM_COURSE_ENTRY_TYPES][EditCoursesSongMenu::NUM_ROWS] =
const bool g_bRowEnabledForType[NUM_CourseEntryType][EditCoursesSongMenu::NUM_ROWS] =
{ // group, song, type, difficulty, low_meter, high_meter, best_worst
/* fixed */ { true, true, true, true, true, true, false },
/* random */ { false, false, true, true, true, true, false },
@@ -79,7 +79,7 @@ bool EditCoursesSongMenu::CanGoRight()
{
m_aGroups.size(),
m_aSongs.size(),
NUM_COURSE_ENTRY_TYPES,
NUM_CourseEntryType,
NUM_DIFFICULTIES+1,
11,
11,
+5 -1
View File
@@ -74,7 +74,9 @@ GameState::GameState() :
m_pCurTrail( MESSAGE_CURRENT_TRAIL_P1_CHANGED ),
m_stEdit( MESSAGE_EDIT_STEPS_TYPE_CHANGED ),
m_pEditSourceSteps( MESSAGE_EDIT_SOURCE_STEPS_CHANGED ),
m_stEditSource( MESSAGE_EDIT_SOURCE_STEPS_TYPE_CHANGED )
m_stEditSource( MESSAGE_EDIT_SOURCE_STEPS_TYPE_CHANGED ),
m_iEditCourseEntryIndex(MESSAGE_EDIT_COURSE_ENTRY_INDEX_CHANGED ),
m_EditCourseEntryAction(MESSAGE_EDIT_COURSE_ENTRY_ACTION_CHANGED )
{
m_pCurStyle.Set( NULL );
@@ -252,6 +254,8 @@ void GameState::Reset()
m_stEdit.Set( STEPS_TYPE_INVALID );
m_pEditSourceSteps.Set( NULL );
m_stEditSource.Set( STEPS_TYPE_INVALID );
m_iEditCourseEntryIndex.Set( -1 );
m_EditCourseEntryAction.Set( ACTION_EDIT );
ApplyCmdline();
}
+3
View File
@@ -298,6 +298,9 @@ public:
BroadcastOnChange<StepsType> m_stEdit;
BroadcastOnChangePtr<Steps> m_pEditSourceSteps;
BroadcastOnChange<StepsType> m_stEditSource;
BroadcastOnChange<int> m_iEditCourseEntryIndex;
enum EditCourseEntryAction { ACTION_EDIT, ACTION_INSERT };
BroadcastOnChange<EditCourseEntryAction> m_EditCourseEntryAction;
// Workout stuff
float GetGoalPercentComplete( PlayerNumber pn );
+2
View File
@@ -23,6 +23,8 @@ static const CString MessageNames[] = {
"EditPreferredDifficutyP2Changed",
"EditPreferredCourseDifficutyP1Changed",
"EditPreferredCourseDifficutyP2Changed",
"EditCourseEntryIndexChanged",
"EditCourseEntryActionChanged",
"GoalCompleteP1",
"GoalCompleteP2",
"NoteCrossed",
+2
View File
@@ -31,6 +31,8 @@ enum Message
MESSAGE_EDIT_PREFERRED_DIFFICULTY_P2_CHANGED,
MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P1_CHANGED,
MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P2_CHANGED,
MESSAGE_EDIT_COURSE_ENTRY_INDEX_CHANGED,
MESSAGE_EDIT_COURSE_ENTRY_ACTION_CHANGED,
MESSAGE_GOAL_COMPLETE_P1,
MESSAGE_GOAL_COMPLETE_P2,
MESSAGE_NOTE_CROSSED,
+5 -1
View File
@@ -731,7 +731,11 @@ void OptionRow::Reload( const OptionRowDefinition &def )
{
case SELECT_ONE:
FOREACH_HumanPlayer( p )
m_iChoiceInRowWithFocus[p] = GetOneSelection(p);
{
m_iChoiceInRowWithFocus[p] = GetOneSelection(p, true);
if( m_iChoiceInRowWithFocus[p] == -1 )
m_iChoiceInRowWithFocus[p] = 0;
}
break;
case SELECT_MULTIPLE:
FOREACH_HumanPlayer( p )
+68 -25
View File
@@ -3,12 +3,14 @@
#include "RageLog.h"
#include "GameState.h"
#include "SongManager.h"
#include "CommonMetrics.h"
enum CourseManagerRow
{
ROW_GROUP,
ROW_COURSE_GROUP,
ROW_COURSE,
ROW_ACTION
ROW_ACTION,
ROW_DONE,
};
enum CourseManagerAction
@@ -64,7 +66,7 @@ void ScreenCourseManager::Init()
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Course";
def.name = "Course Group";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
@@ -79,7 +81,7 @@ void ScreenCourseManager::Init()
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
OnChange( GAMESTATE->m_MasterPlayerNumber );
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber );
}
void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
@@ -87,16 +89,18 @@ void ScreenCourseManager::HandleScreenMessage( const ScreenMessage SM )
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenCourseManager::OnChange( PlayerNumber pn )
void ScreenCourseManager::AfterChangeValueInRow( PlayerNumber pn )
{
ScreenOptions::OnChange( pn );
ScreenOptions::AfterChangeValueInRow( pn );
switch( m_iCurrentRow[pn] )
{
case ROW_GROUP:
default:
ASSERT(0);
case ROW_COURSE_GROUP:
// export current course group
{
OptionRow &row = *m_pRows[ROW_GROUP];
OptionRow &row = *m_pRows[ROW_COURSE_GROUP];
int iChoice = row.GetChoiceInRowWithFocus(pn);
CString sCourseGroup = row.GetRowDef().choices[iChoice];
GAMESTATE->m_sPreferredCourseGroup.Set( sCourseGroup );
@@ -138,8 +142,29 @@ void ScreenCourseManager::OnChange( PlayerNumber pn )
// fall through
case ROW_ACTION:
// fall through
case ROW_DONE:
break;
}
}
void ScreenCourseManager::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
switch( m_iCurrentRow[pn] )
{
default:
; // nothing left to do
ASSERT(0);
case ROW_COURSE_GROUP:
SCREENMAN->PlayInvalidSound();
break;
case ROW_COURSE:
SCREENMAN->PlayInvalidSound();
break;
case ROW_ACTION:
ScreenOptions::BeginFadingOut();
break;
case ROW_DONE:
ScreenOptions::BeginFadingOut();
break;
}
}
@@ -155,35 +180,53 @@ void ScreenCourseManager::ExportOptions( int row, const vector<PlayerNumber> &vp
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 )
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
ASSERT(0);
case ACTION_EDIT:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
case ACTION_DELETE:
case ROW_COURSE_GROUP:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_COPY_TO_NEW:
case ROW_COURSE:
SCREENMAN->PlayInvalidSound();
break;
case ACTION_CREATE_NEW:
SCREENMAN->PlayInvalidSound();
case ROW_ACTION:
{
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;
}
}
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
break;
}
}
void ScreenCourseManager::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( FIRST_ATTRACT_SCREEN );
}
/*
+3 -2
View File
@@ -12,14 +12,15 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM );
private:
protected:
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 );
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
};
#endif
+177 -108
View File
@@ -10,15 +10,42 @@
enum EditCourseRow
{
ROW_TITLE,
ROW_STEPS_TYPE,
ROW_DIFFICULTY,
ROW_METER,
ROW_SONG_NUMBER,
ROW_SONG,
ROW_STEPS,
ROW_SET_MODS,
ROW_REPEAT,
ROW_RANDOMIZE,
ROW_LIVES,
ROW_TYPE,
ROW_TYPE_METER,
ROW_EDIT_ENTRY,
ROW_INSERT_ENTRY,
ROW_DONE,
};
struct StepsTypeAndDifficulty
{
StepsType st;
CourseDifficulty cd;
};
static void GetStepsTypeAndDifficulty( vector<StepsTypeAndDifficulty> &vOut, vector<CString> &vsOut )
{
Course *pCourse = GAMESTATE->m_pCurCourse;
FOREACH_CONST( StepsType, STEPS_TYPES_TO_SHOW.GetValue(), st )
{
CString s1 = GAMEMAN->StepsTypeToString(*st);
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
{
if( pCourse->GetTrail( *st, *cd ) == NULL )
continue;
CString s2 = CourseDifficultyToThemedString(*cd);
StepsTypeAndDifficulty stad = { *st, *cd };
vOut.push_back( stad );
vsOut.push_back( s1+" "+s2 );
}
}
}
REGISTER_SCREEN_CLASS( ScreenEditCourse );
ScreenEditCourse::ScreenEditCourse( CString sName ) : ScreenOptions( sName )
{
@@ -43,53 +70,57 @@ void ScreenEditCourse::Init()
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Steps Type";
def.name = "Repeat";
def.choices.clear();
def.choices.push_back( "NO" );
def.choices.push_back( "YES" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Randomize";
def.choices.clear();
def.choices.push_back( "NO" );
def.choices.push_back( "YES" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Lives";
def.choices.clear();
def.choices.push_back( "Use Bar Life" );
for( int i=1; i<=10; i++ )
def.choices.push_back( ssprintf("%d",i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Type";
def.choices.clear();
FOREACH_CONST( StepsType, STEPS_TYPES_TO_SHOW.GetValue(), st )
def.choices.push_back( GAMEMAN->StepsTypeToString(*st) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Difficulty";
def.name = "Type Meter";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Meter";
def.choices.clear();
for( int i=MIN_METER; i<=MAX_METER; i++ )
def.choices.push_back( ssprintf("%d",i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Song Number";
def.name = "Edit Entry";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Song";
def.name = "Insert Entry";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Steps";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Set Mods";
def.choices.clear();
def.choices.push_back( "Set Mods" );
vDefs.push_back( def );
vHands.push_back( NULL );
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
OnChange( GAMESTATE->m_MasterPlayerNumber );
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber );
}
void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
@@ -97,103 +128,118 @@ void ScreenEditCourse::HandleScreenMessage( const ScreenMessage SM )
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenEditCourse::OnChange( PlayerNumber pn )
void ScreenEditCourse::AfterChangeValueInRow( PlayerNumber pn )
{
ScreenOptions::OnChange( pn );
ScreenOptions::AfterChangeValueInRow( pn );
Course *pCourse = GAMESTATE->m_pCurCourse;
StepsType st = STEPS_TYPE_INVALID;
CourseDifficulty cd = DIFFICULTY_INVALID;
Trail *pTrail = NULL;
int iMeter = -1;
int iSongNumber = -1;
Song *pSong = NULL;
Steps *pSteps = NULL;
switch( m_iCurrentRow[pn] )
{
case ROW_STEPS_TYPE:
// export StepsType
default:
ASSERT(0);
case ROW_TITLE:
// fall through
case ROW_REPEAT:
// fall through
case ROW_RANDOMIZE:
// fall through
case ROW_LIVES:
// Refresh type
{
OptionRow &row = *m_pRows[ROW_STEPS_TYPE];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
st = STEPS_TYPES_TO_SHOW.GetValue()[iChoice];
}
// Refresh difficulties
{
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
OptionRow &row = *m_pRows[ROW_TYPE];
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
def.choices.push_back( CourseDifficultyToThemedString(*cd) );
vector<StepsTypeAndDifficulty> vThrowAway;
GetStepsTypeAndDifficulty( vThrowAway, def.choices );
row.Reload( def );
}
// fall through
case ROW_DIFFICULTY:
// export CouresDifficulty
case ROW_TYPE:
// export StepsType and CouresDifficulty
{
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
OptionRow &row = *m_pRows[ROW_TYPE];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
cd = COURSE_DIFFICULTIES_TO_SHOW.GetValue()[iChoice];
pTrail = pCourse->GetTrail( st, cd );
vector<StepsTypeAndDifficulty> v;
vector<CString> vsThrowAway;
GetStepsTypeAndDifficulty( v, vsThrowAway );
st = v[iChoice].st;
cd = v[iChoice].cd;
GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber].Set( pCourse->GetTrail( st, cd ) );
}
// refresh meter
{
OptionRow &row = *m_pRows[ROW_METER];
OptionRow &row = *m_pRows[ROW_TYPE_METER];
OptionRowDefinition def = row.GetRowDef();
row.SetOneSharedSelection( pTrail->GetMeter()-1 );
Trail *pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
def.choices.clear();
if( pTrail != NULL )
{
for( int i=MIN_METER; i<=MAX_METER; i++ )
def.choices.push_back( ssprintf("%d",i) );
row.SetOneSharedSelection( pTrail->GetMeter()-MIN_METER );
}
else
{
def.choices.push_back( "N/A" );
}
row.Reload( def );
}
// fall through
case ROW_METER:
// export meter
// refresh edit entry
{
OptionRow &row = *m_pRows[ROW_METER];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
iMeter = 1+iChoice;
}
// refresh song number
{
OptionRow &row = *m_pRows[ROW_SONG_NUMBER];
OptionRow &row = *m_pRows[ROW_EDIT_ENTRY];
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
Trail *pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
ASSERT( pTrail );
for( unsigned i=0; i<pTrail->m_vEntries.size(); i++ )
def.choices.push_back( ssprintf("%u of %u",i+1,pTrail->m_vEntries.size()) );
row.SetOneSharedSelection( 0 );
row.Reload( def );
}
// refresh insert entry
{
OptionRow &row = *m_pRows[ROW_INSERT_ENTRY];
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
Trail *pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
ASSERT( pTrail );
for( unsigned i=0; i<=pTrail->m_vEntries.size(); i++ )
{
CString s;
if( i == pTrail->m_vEntries.size() )
s = ssprintf("After %u",i);
else
s = ssprintf("Before %u",i+1);
def.choices.push_back( s );
}
row.SetOneSharedSelection( 0 );
row.Reload( def );
}
// fall through
case ROW_SONG_NUMBER:
// export song number
case ROW_TYPE_METER:
// export meter
{
OptionRow &row = *m_pRows[ROW_SONG_NUMBER];
OptionRow &row = *m_pRows[ROW_TYPE_METER];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
iSongNumber = 1+iChoice;
}
// refresh song
{
OptionRow &row = *m_pRows[ROW_SONG];
OptionRowDefinition def = row.GetRowDef();
row.SetOneSharedSelection( pTrail->GetMeter()-1 );
row.Reload( def );
iMeter = 1+iChoice;
}
// fall through
case ROW_SONG:
// export song
case ROW_EDIT_ENTRY:
// fall through
case ROW_INSERT_ENTRY:
// export entry number
{
OptionRow &row = *m_pRows[ROW_SONG];
EditCourseRow ecr = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] == ROW_EDIT_ENTRY ? ROW_EDIT_ENTRY : ROW_INSERT_ENTRY;
OptionRow &row = *m_pRows[ecr];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
pSong = SONGMAN->GetAllSongs()[iChoice];
GAMESTATE->m_iEditCourseEntryIndex.Set( iChoice );
}
// fall through
case ROW_STEPS:
// export steps
{
OptionRow &row = *m_pRows[ROW_SONG];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
pSteps = pSong->GetStepsByStepsType(st)[iChoice];
}
// fall through
case ROW_SET_MODS:
// fall through
default:
; // nothing left to do
case ROW_DONE:
break;
}
}
@@ -209,33 +255,56 @@ void ScreenEditCourse::ExportOptions( int row, const vector<PlayerNumber> &vpns
void ScreenEditCourse::GoToNextScreen()
{
SCREENMAN->SetNewScreen( "ScreenEditCourseMenu" );
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
case ROW_TITLE:
case ROW_REPEAT:
case ROW_RANDOMIZE:
case ROW_LIVES:
case ROW_TYPE:
case ROW_TYPE_METER:
ASSERT(0);
case ROW_EDIT_ENTRY:
SCREENMAN->SetNewScreen( "ScreenEditCourseEntry" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
break;
}
}
void ScreenEditCourse::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( "ScreenCourseManager" );
}
void ScreenEditCourse::BeginFadingOut()
void ScreenEditCourse::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
default:
ASSERT(0);
case ROW_TITLE:
case ROW_REPEAT:
case ROW_RANDOMIZE:
case ROW_LIVES:
case ROW_TYPE:
case ROW_TYPE_METER:
SCREENMAN->PlayInvalidSound();
break;
case ROW_STEPS_TYPE:
break;
case ROW_DIFFICULTY:
break;
case ROW_METER:
break;
case ROW_SONG_NUMBER:
break;
case ROW_SONG:
break;
case ROW_STEPS:
break;
case ROW_SET_MODS:
case ROW_EDIT_ENTRY:
case ROW_INSERT_ENTRY:
{
Trail *pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
if( pTrail == NULL )
{
SCREENMAN->PlayInvalidSound();
return;
}
}
case ROW_DONE:
ScreenOptions::BeginFadingOut();
break;
}
}
+3 -4
View File
@@ -12,16 +12,15 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM );
private:
protected:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void OnChange( PlayerNumber pn );
virtual void BeginFadingOut();
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
};
#endif
+288
View File
@@ -0,0 +1,288 @@
#include "global.h"
#include "ScreenEditCourseEntry.h"
#include "RageLog.h"
#include "GameState.h"
#include "SongManager.h"
#include "CommonMetrics.h"
#include "GameManager.h"
#include "song.h"
enum EditCourseRow
{
ROW_ENTRY_TYPE,
ROW_SONG_GROUP,
ROW_SONG,
ROW_DIFFICULTY,
ROW_LOW_METER,
ROW_HIGH_METER,
ROW_BEST_WORST_VALUE,
ROW_SET_MODS,
ROW_DONE,
};
REGISTER_SCREEN_CLASS( ScreenEditCourseEntry );
ScreenEditCourseEntry::ScreenEditCourseEntry( CString sName ) : ScreenOptions( sName )
{
LOG->Trace( "ScreenEditCourseEntry::ScreenEditCourseEntry()" );
}
void ScreenEditCourseEntry::Init()
{
ScreenOptions::Init();
vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands;
OptionRowDefinition def;
def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.name = "Entry Type";
def.choices.clear();
FOREACH_CourseEntryType( i )
def.choices.push_back( CourseEntryTypeToThemedString(i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Song Group";
def.choices.clear();
vector<CString> vsSongGroups;
SONGMAN->GetSongGroupNames( vsSongGroups );
FOREACH_CONST( CString, vsSongGroups, s )
def.choices.push_back( *s );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Song";
def.choices.clear();
def.choices.push_back( "" );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Difficulty";
def.choices.clear();
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), dc )
def.choices.push_back( DifficultyToThemedString(*dc) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Low Meter";
def.choices.clear();
for( int i=MIN_METER; i<=MAX_METER; i++ )
def.choices.push_back( ssprintf("%i",i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "High Meter";
def.choices.clear();
for( int i=MIN_METER; i<=MAX_METER; i++ )
def.choices.push_back( ssprintf("%i",i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Best/Worst Value";
def.choices.clear();
for( int i=1; i<=20; i++ )
def.choices.push_back( ssprintf("%i",i) );
vDefs.push_back( def );
vHands.push_back( NULL );
def.name = "Set Mods";
def.choices.clear();
def.choices.push_back( "Set Mods" );
vDefs.push_back( def );
vHands.push_back( NULL );
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber );
}
void ScreenEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
{
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn )
{
ScreenOptions::AfterChangeValueInRow( pn );
Course *pCourse = GAMESTATE->m_pCurCourse;
CourseEntry &ce = pCourse->m_entries[ GAMESTATE->m_iEditCourseEntryIndex ];
CString sSongGroup;
switch( m_iCurrentRow[pn] )
{
case ROW_ENTRY_TYPE:
// export entry type
{
}
// fall through
case ROW_SONG_GROUP:
// export song group
{
OptionRow &row = *m_pRows[ROW_SONG_GROUP];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
sSongGroup = row.GetRowDef().choices[ iChoice ];
}
// refresh songs
{
OptionRow &row = *m_pRows[ROW_SONG];
OptionRowDefinition def = row.GetRowDef();
def.choices.clear();
vector<Song*> vpSongs;
SONGMAN->GetSongs( vpSongs, sSongGroup );
FOREACH_CONST( Song*, vpSongs, s )
def.choices.push_back( (*s)->GetTranslitFullTitle() );
vector<Song*>::const_iterator iter = find( vpSongs.begin(), vpSongs.end(), ce.pSong );
if( iter != vpSongs.end() )
{
int iSongIndex = iter - vpSongs.begin();
row.SetOneSharedSelection( iSongIndex );
}
else
{
row.SetOneSharedSelection( 0 );
}
row.Reload( def );
}
// fall through
case ROW_SONG:
// export song
{
OptionRow &row = *m_pRows[ROW_SONG];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
ce.pSong = SONGMAN->GetAllSongs()[iChoice];
}
// fall through
case ROW_DIFFICULTY:
// export difficulty
{
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
ce.difficulty = DIFFICULTIES_TO_SHOW.GetValue()[iChoice];
}
// fall through
case ROW_LOW_METER:
// export low meter
{
}
// fall through
case ROW_HIGH_METER:
// export high meter
{
}
// fall through
case ROW_BEST_WORST_VALUE:
// export best/worst value
{
}
// fall through
case ROW_SET_MODS:
// fall through
default:
; // nothing left to do
}
}
void ScreenEditCourseEntry::ImportOptions( int row, const vector<PlayerNumber> &vpns )
{
Course *pCourse = GAMESTATE->m_pCurCourse;
CourseEntry &ce = pCourse->m_entries[ GAMESTATE->m_iEditCourseEntryIndex ];
// import entry song
{
int iSongIndex = -1;
vector<Song*>::const_iterator iter = find( SONGMAN->GetAllSongs().begin(), SONGMAN->GetAllSongs().end(), ce.pSong );
if( iter != SONGMAN->GetAllSongs().end() )
iSongIndex = iter - SONGMAN->GetAllSongs().begin();
OptionRow &row = *m_pRows[ROW_SONG];
if( iSongIndex != -1 )
row.SetOneSharedSelection( iSongIndex );
}
/*
// import entry difficulty
{
int iDifficultyIndex = -1;
vector<Difficulty>::const_iterator iter = find( DIFFICULTIES_TO_SHOW.GetValue().begin(), DIFFICULTIES_TO_SHOW.GetValue().end(), ce.difficulty );
if( iter != DIFFICULTIES_TO_SHOW.GetValue().end() )
iDifficultyIndex = iter - DIFFICULTIES_TO_SHOW.GetValue().begin();
OptionRow &row = *m_pRows[ROW_DIFFICULTY];
if( iDifficultyIndex != -1 )
row.SetOneSharedSelection( iDifficultyIndex );
}
*/
}
void ScreenEditCourseEntry::ExportOptions( int row, const vector<PlayerNumber> &vpns )
{
}
void ScreenEditCourseEntry::GoToNextScreen()
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
case ROW_ENTRY_TYPE:
case ROW_SONG_GROUP:
case ROW_SONG:
case ROW_DIFFICULTY:
case ROW_LOW_METER:
case ROW_HIGH_METER:
case ROW_BEST_WORST_VALUE:
break;
case ROW_SET_MODS:
SCREENMAN->SetNewScreen( "ScreenEditCourseMods" );
break;
case ROW_DONE:
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
break;
}
}
void ScreenEditCourseEntry::GoToPrevScreen()
{
SCREENMAN->SetNewScreen( "ScreenEditCourse" );
}
void ScreenEditCourseEntry::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
switch( m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber] )
{
case ROW_ENTRY_TYPE:
case ROW_SONG_GROUP:
case ROW_SONG:
case ROW_DIFFICULTY:
case ROW_LOW_METER:
case ROW_HIGH_METER:
case ROW_BEST_WORST_VALUE:
break;
case ROW_SET_MODS:
case ROW_DONE:
ScreenOptions::ProcessMenuStart( pn, type );
break;
}
}
/*
* (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.
*/
+51
View File
@@ -0,0 +1,51 @@
#ifndef ScreenEditCourseEntry_H
#define ScreenEditCourseEntry_H
#include "ScreenOptions.h"
class ScreenEditCourseEntry : public ScreenOptions
{
public:
ScreenEditCourseEntry( CString sName );
void Init();
virtual void HandleScreenMessage( const ScreenMessage SM );
protected:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void GoToNextScreen();
virtual void GoToPrevScreen();
virtual void AfterChangeValueInRow( PlayerNumber pn );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
};
#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.
*/
+9 -4
View File
@@ -768,10 +768,6 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
break;
}
int iCurRow = m_iCurrentRow[pn];
OptionRow &row = *m_pRows[iCurRow];
/* If we are in a three-button mode, check to see if MENU_BUTTON_LEFT and
* MENU_BUTTON_RIGHT are being held. */
switch( m_OptionsNavigation )
@@ -790,6 +786,14 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type )
}
}
this->ProcessMenuStart( pn, type );
}
void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type )
{
int iCurRow = m_iCurrentRow[pn];
OptionRow &row = *m_pRows[iCurRow];
//
// Check whether Start ends this screen.
//
@@ -1000,6 +1004,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
UpdateText( iCurRow );
OnChange( pn );
this->AfterChangeValueInRow( pn );
if( m_OptionsNavigation != NAV_THREE_KEY_MENU )
m_SoundChangeCol.Play();
+2
View File
@@ -56,12 +56,14 @@ protected:
virtual void MenuBack( PlayerNumber pn );
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type );
virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); }
virtual void GoToNextScreen() = 0;
virtual void GoToPrevScreen() = 0;
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
virtual void AfterChangeValueInRow( PlayerNumber pn ) {} // override this to detect when the value in a row has changed
void MoveRow( PlayerNumber pn, int dir, bool Repeat );
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
+18 -6
View File
@@ -282,6 +282,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenCenterImage.h">
</File>
<File
RelativePath=".\ScreenCourseManager.cpp">
</File>
<File
RelativePath=".\ScreenCourseManager.h">
</File>
<File
RelativePath="ScreenCredits.cpp">
</File>
@@ -309,6 +315,18 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenEdit.h">
</File>
<File
RelativePath=".\ScreenEditCourse.cpp">
</File>
<File
RelativePath=".\ScreenEditCourse.h">
</File>
<File
RelativePath=".\ScreenEditCourseEntry.cpp">
</File>
<File
RelativePath=".\ScreenEditCourseEntry.h">
</File>
<File
RelativePath="ScreenEditCoursesMenu.cpp">
</File>
@@ -387,12 +405,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenJukebox.h">
</File>
<File
RelativePath="ScreenLogo.cpp">
</File>
<File
RelativePath="ScreenLogo.h">
</File>
<File
RelativePath="ScreenMapControllers.cpp">
</File>
+26 -18
View File
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
TargetDir=\cvs\stepmania\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -99,7 +99,7 @@ IntDir=.\../Release6
TargetDir=\cvs\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -2282,14 +2282,6 @@ SOURCE=.\GraphDisplay.h
# End Source File
# Begin Source File
SOURCE=.\GrooveGraph.cpp
# End Source File
# Begin Source File
SOURCE=.\GrooveGraph.h
# End Source File
# Begin Source File
SOURCE=.\GrooveRadar.cpp
# End Source File
# Begin Source File
@@ -2526,6 +2518,14 @@ SOURCE=.\ScreenCenterImage.h
# End Source File
# Begin Source File
SOURCE=.\ScreenCourseManager.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenCourseManager.h
# End Source File
# Begin Source File
SOURCE=.\ScreenCredits.cpp
# End Source File
# Begin Source File
@@ -2558,6 +2558,22 @@ SOURCE=.\ScreenEdit.h
# End Source File
# Begin Source File
SOURCE=.\ScreenEditCourse.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenEditCourse.h
# End Source File
# Begin Source File
SOURCE=.\ScreenEditCourseEntry.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenEditCourseEntry.h
# End Source File
# Begin Source File
SOURCE=.\ScreenEditCoursesMenu.cpp
# End Source File
# Begin Source File
@@ -2672,14 +2688,6 @@ SOURCE=.\ScreenJukebox.h
# End Source File
# Begin Source File
SOURCE=.\ScreenLogo.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenLogo.h
# End Source File
# Begin Source File
SOURCE=.\ScreenMapControllers.cpp
# End Source File
# Begin Source File
+18
View File
@@ -262,6 +262,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenCenterImage.h">
</File>
<File
RelativePath="ScreenCourseManager.cpp">
</File>
<File
RelativePath="ScreenCourseManager.h">
</File>
<File
RelativePath="ScreenCredits.cpp">
</File>
@@ -289,6 +295,18 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="ScreenEdit.h">
</File>
<File
RelativePath="ScreenEditCourse.cpp">
</File>
<File
RelativePath="ScreenEditCourse.h">
</File>
<File
RelativePath="ScreenEditCourseEntry.cpp">
</File>
<File
RelativePath="ScreenEditCourseEntry.h">
</File>
<File
RelativePath="ScreenEditCoursesMenu.cpp">
</File>