remove Workout, fold into EditCourses
This commit is contained in:
@@ -170,7 +170,7 @@ void CatalogXml::Save( LoadingWindow *loading_window )
|
|||||||
{
|
{
|
||||||
XNode* pNode = xml.AppendChild( "Songs" );
|
XNode* pNode = xml.AppendChild( "Songs" );
|
||||||
|
|
||||||
const vector<Song*>& vpSongs = SONGMAN->GetSongs();
|
const vector<Song*>& vpSongs = SONGMAN->GetAllSongs();
|
||||||
|
|
||||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void ControllerStateDisplay::Update( float fDelta )
|
|||||||
class LunaControllerStateDisplay: public Luna<ControllerStateDisplay>
|
class LunaControllerStateDisplay: public Luna<ControllerStateDisplay>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), (GameController)IArg(2) ); return 0; }
|
static int LoadGameController( T* p, lua_State *L ) { p->LoadGameController( SArg(1), Enum::Check<GameController>(L, 2) ); return 0; }
|
||||||
static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check<MultiPlayer>(L, 2) ); return 0; }
|
static int LoadMultiPlayer( T* p, lua_State *L ) { p->LoadMultiPlayer( SArg(1), Enum::Check<MultiPlayer>(L, 2) ); return 0; }
|
||||||
|
|
||||||
LunaControllerStateDisplay()
|
LunaControllerStateDisplay()
|
||||||
|
|||||||
@@ -207,7 +207,9 @@ void Course::Init()
|
|||||||
m_sGroupName = "";
|
m_sGroupName = "";
|
||||||
|
|
||||||
m_bRepeat = false;
|
m_bRepeat = false;
|
||||||
|
m_fGoalSeconds = 0;
|
||||||
m_bShuffle = false;
|
m_bShuffle = false;
|
||||||
|
|
||||||
m_iLives = -1;
|
m_iLives = -1;
|
||||||
FOREACH_ENUM( Difficulty,dc)
|
FOREACH_ENUM( Difficulty,dc)
|
||||||
m_iCustomMeter[dc] = -1;
|
m_iCustomMeter[dc] = -1;
|
||||||
@@ -471,13 +473,13 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
|
|||||||
if( m_bShuffle )
|
if( m_bShuffle )
|
||||||
{
|
{
|
||||||
/* Always randomize the same way per round. Otherwise, the displayed course
|
/* Always randomize the same way per round. Otherwise, the displayed course
|
||||||
* will change every time it's viewed, and the displayed order will have no
|
* will change every time it's viewed, and the displayed order will have no
|
||||||
* bearing on what you'll actually play. */
|
* bearing on what you'll actually play. */
|
||||||
tmp_entries = m_vEntries;
|
tmp_entries = m_vEntries;
|
||||||
random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd );
|
random_shuffle( tmp_entries.begin(), tmp_entries.end(), rnd );
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<CourseEntry> &entries = m_bShuffle? tmp_entries:m_vEntries;
|
const vector<CourseEntry> &entries = m_bShuffle ? tmp_entries:m_vEntries;
|
||||||
|
|
||||||
/* This can take some time, so don't fill it out unless we need it. */
|
/* This can take some time, so don't fill it out unless we need it. */
|
||||||
vector<Song*> vSongsByMostPlayed;
|
vector<Song*> vSongsByMostPlayed;
|
||||||
@@ -751,6 +753,11 @@ const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Course::InvalidateTrailCache()
|
||||||
|
{
|
||||||
|
m_TrailCache.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void Course::Invalidate( const Song *pStaleSong )
|
void Course::Invalidate( const Song *pStaleSong )
|
||||||
{
|
{
|
||||||
FOREACH_CONST( CourseEntry, m_vEntries, e )
|
FOREACH_CONST( CourseEntry, m_vEntries, e )
|
||||||
@@ -1032,6 +1039,8 @@ public:
|
|||||||
lua_pushnumber( L, fTotalSeconds );
|
lua_pushnumber( L, fTotalSeconds );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
DEFINE_METHOD( IsEndless, IsEndless() )
|
||||||
|
DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds )
|
||||||
|
|
||||||
LunaCourse()
|
LunaCourse()
|
||||||
{
|
{
|
||||||
@@ -1048,6 +1057,8 @@ public:
|
|||||||
ADD_METHOD( IsAutogen );
|
ADD_METHOD( IsAutogen );
|
||||||
ADD_METHOD( GetEstimatedNumStages );
|
ADD_METHOD( GetEstimatedNumStages );
|
||||||
ADD_METHOD( GetTotalSeconds );
|
ADD_METHOD( GetTotalSeconds );
|
||||||
|
ADD_METHOD( IsEndless );
|
||||||
|
ADD_METHOD( GetGoalSeconds );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ public:
|
|||||||
void PushSelf( lua_State *L );
|
void PushSelf( lua_State *L );
|
||||||
};
|
};
|
||||||
|
|
||||||
const int MAX_ENTRIES_PER_COURSE = 50;
|
|
||||||
|
|
||||||
class Course
|
class Course
|
||||||
{
|
{
|
||||||
@@ -151,6 +150,8 @@ public:
|
|||||||
/* Call to regenerate Trails with random entries */
|
/* Call to regenerate Trails with random entries */
|
||||||
void RegenerateNonFixedTrails() const;
|
void RegenerateNonFixedTrails() const;
|
||||||
|
|
||||||
|
void InvalidateTrailCache();
|
||||||
|
|
||||||
/* Call when a Song or its Steps are deleted/changed. */
|
/* Call when a Song or its Steps are deleted/changed. */
|
||||||
void Invalidate( const Song *pStaleSong );
|
void Invalidate( const Song *pStaleSong );
|
||||||
|
|
||||||
@@ -186,7 +187,8 @@ public:
|
|||||||
RString m_sGroupName;
|
RString m_sGroupName;
|
||||||
|
|
||||||
bool m_bRepeat; // repeat after last song? "Endless"
|
bool m_bRepeat; // repeat after last song? "Endless"
|
||||||
bool m_bShuffle; // play the songs in a random order
|
float m_fGoalSeconds; // if not 0, stop play after this number of seconds
|
||||||
|
bool m_bShuffle;
|
||||||
int m_iLives; // -1 means use bar life meter
|
int m_iLives; // -1 means use bar life meter
|
||||||
int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified
|
int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified
|
||||||
bool m_bSortByMeter;
|
bool m_bSortByMeter;
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ void CourseContentsList::SetFromGameState()
|
|||||||
const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
|
const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber];
|
||||||
if( pMasterTrail == NULL )
|
if( pMasterTrail == NULL )
|
||||||
return;
|
return;
|
||||||
unsigned uNumEntriesToShow = min( pMasterTrail->m_vEntries.size(), m_vpDisplay.size() );
|
unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size();
|
||||||
|
CLAMP( uNumEntriesToShow, 0, m_vpDisplay.size() );
|
||||||
|
|
||||||
for( int i=0; i<(int)uNumEntriesToShow; i++ )
|
for( int i=0; i<(int)uNumEntriesToShow; i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ static const char *GameControllerNames[] = {
|
|||||||
};
|
};
|
||||||
XToString( GameController );
|
XToString( GameController );
|
||||||
StringToX( GameController );
|
StringToX( GameController );
|
||||||
|
LuaXType( GameController );
|
||||||
|
|
||||||
|
|
||||||
RString GameButtonToString( const InputScheme* pInputs, GameButton i )
|
RString GameButtonToString( const InputScheme* pInputs, GameButton i )
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ enum GameController
|
|||||||
NUM_GameController, // leave this at the end
|
NUM_GameController, // leave this at the end
|
||||||
GameController_Invalid,
|
GameController_Invalid,
|
||||||
};
|
};
|
||||||
|
const RString& GameControllerToString( GameController mp );
|
||||||
|
LuaDeclareType( GameController );
|
||||||
|
|
||||||
enum GameButton
|
enum GameButton
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -843,14 +843,17 @@ void GameState::Update( float fDelta )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WORKOUTMAN->m_pCurWorkout != NULL && !m_bWorkoutGoalComplete )
|
if( GAMESTATE->m_pCurCourse )
|
||||||
{
|
{
|
||||||
const StageStats &ssCurrent = STATSMAN->m_CurStageStats;
|
if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 && !m_bWorkoutGoalComplete )
|
||||||
bool bGoalComplete = ssCurrent.m_fGameplaySeconds > WORKOUTMAN->m_pCurWorkout->m_iMinutes*60;
|
|
||||||
if( bGoalComplete )
|
|
||||||
{
|
{
|
||||||
MESSAGEMAN->Broadcast( "WorkoutGoalComplete" );
|
const StageStats &ssCurrent = STATSMAN->m_CurStageStats;
|
||||||
m_bWorkoutGoalComplete = true;
|
bool bGoalComplete = ssCurrent.m_fGameplaySeconds > GAMESTATE->m_pCurCourse->m_fGoalSeconds;
|
||||||
|
if( bGoalComplete )
|
||||||
|
{
|
||||||
|
MESSAGEMAN->Broadcast( "WorkoutGoalComplete" );
|
||||||
|
m_bWorkoutGoalComplete = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -702,11 +702,12 @@ int OptionRow::GetOneSharedSelection( bool bAllowFail ) const
|
|||||||
|
|
||||||
void OptionRow::SetOneSelection( PlayerNumber pn, int iChoice )
|
void OptionRow::SetOneSelection( PlayerNumber pn, int iChoice )
|
||||||
{
|
{
|
||||||
if( m_vbSelected[pn].empty() )
|
vector<bool> &vb = m_vbSelected[pn];
|
||||||
|
if( vb.empty() )
|
||||||
return;
|
return;
|
||||||
for( unsigned i=0; i<(unsigned)m_vbSelected[pn].size(); i++ )
|
FOREACH( bool, vb, b )
|
||||||
m_vbSelected[pn][i] = false;
|
*b = false;
|
||||||
m_vbSelected[pn][iChoice] = true;
|
vb[iChoice] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptionRow::SetOneSharedSelection( int iChoice )
|
void OptionRow::SetOneSharedSelection( int iChoice )
|
||||||
@@ -888,7 +889,7 @@ void OptionRow::ImportOptions( const vector<PlayerNumber> &vpns )
|
|||||||
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pHand->ImportOption( vpns, m_vbSelected );
|
m_pHand->ImportOption( this, vpns, m_vbSelected );
|
||||||
|
|
||||||
FOREACH_CONST( PlayerNumber, vpns, iter )
|
FOREACH_CONST( PlayerNumber, vpns, iter )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
@@ -576,7 +576,7 @@ public:
|
|||||||
m_pDifficultyToFill->Set( m_vDifficulties[0] );
|
m_pDifficultyToFill->Set( m_vDifficulties[0] );
|
||||||
m_ppStepsToFill->Set( m_vSteps[0] );
|
m_ppStepsToFill->Set( m_vSteps[0] );
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
@@ -961,7 +961,7 @@ public:
|
|||||||
return RELOAD_CHANGED_ENABLED;
|
return RELOAD_CHANGED_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
|
|
||||||
@@ -1114,7 +1114,7 @@ public:
|
|||||||
|
|
||||||
m_Def.m_sName = m_pOpt->name;
|
m_Def.m_sName = m_pOpt->name;
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
@@ -1213,7 +1213,7 @@ public:
|
|||||||
m_pstToFill->Set( m_vStepsTypesToShow[0] );
|
m_pstToFill->Set( m_vStepsTypesToShow[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
{
|
{
|
||||||
@@ -1276,7 +1276,7 @@ public:
|
|||||||
m_Def.m_selectType = SELECT_NONE;
|
m_Def.m_selectType = SELECT_NONE;
|
||||||
m_Def.m_vsChoices.push_back( "" );
|
m_Def.m_vsChoices.push_back( "" );
|
||||||
}
|
}
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
struct MenuRowDef;
|
struct MenuRowDef;
|
||||||
|
class OptionRow;
|
||||||
struct ConfOption;
|
struct ConfOption;
|
||||||
|
|
||||||
enum SelectType
|
enum SelectType
|
||||||
@@ -123,7 +123,7 @@ public:
|
|||||||
virtual ReloadChanged Reload() { return RELOAD_CHANGED_NONE; }
|
virtual ReloadChanged Reload() { return RELOAD_CHANGED_NONE; }
|
||||||
|
|
||||||
virtual int GetDefaultOption() const { return -1; }
|
virtual int GetDefaultOption() const { return -1; }
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const { }
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const { }
|
||||||
/* Returns an OPT mask. */
|
/* Returns an OPT mask. */
|
||||||
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const { return 0; }
|
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const { return 0; }
|
||||||
virtual void GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const;
|
virtual void GetIconTextAndGameCommand( int iFirstSelection, RString &sIconTextOut, GameCommand &gcOut ) const;
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ void OptionsList::ImportRow( RString sRow )
|
|||||||
vpns.push_back( m_pn );
|
vpns.push_back( m_pn );
|
||||||
OptionRowHandler *pHandler = m_Rows[sRow];
|
OptionRowHandler *pHandler = m_Rows[sRow];
|
||||||
aSelections[ m_pn ].resize( pHandler->m_Def.m_vsChoices.size() );
|
aSelections[ m_pn ].resize( pHandler->m_Def.m_vsChoices.size() );
|
||||||
pHandler->ImportOption( vpns, aSelections );
|
pHandler->ImportOption( NULL, vpns, aSelections );
|
||||||
m_bSelections[sRow] = aSelections[ m_pn ];
|
m_bSelections[sRow] = aSelections[ m_pn ];
|
||||||
|
|
||||||
if( m_setTopMenus.find(sRow) != m_setTopMenus.end() )
|
if( m_setTopMenus.find(sRow) != m_setTopMenus.end() )
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
#include "WorkoutManager.h"
|
#include "WorkoutManager.h"
|
||||||
|
#include "Course.h"
|
||||||
|
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( PercentageDisplay )
|
REGISTER_ACTOR_CLASS( PercentageDisplay )
|
||||||
@@ -191,7 +192,17 @@ void PercentageDisplay::Refresh()
|
|||||||
bool PercentageDisplay::ShowDancePointsNotPercentage() const
|
bool PercentageDisplay::ShowDancePointsNotPercentage() const
|
||||||
{
|
{
|
||||||
// Use staight dance points in workout because the percentage denominator isn't accurate - we don't know when the players are going to stop.
|
// Use staight dance points in workout because the percentage denominator isn't accurate - we don't know when the players are going to stop.
|
||||||
return (WORKOUTMAN->m_pCurWorkout != NULL) || PREFSMAN->m_bDancePointsForOni;
|
|
||||||
|
if( GAMESTATE->m_pCurCourse )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( PREFSMAN->m_bDancePointsForOni )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ int Profile::GetTotalStepsWithTopGrade( StepsType st, Difficulty d, Grade g ) co
|
|||||||
{
|
{
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
|
|
||||||
FOREACH_CONST( Song*, SONGMAN->GetSongs(), pSong )
|
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), pSong )
|
||||||
{
|
{
|
||||||
if( !(*pSong)->NormallyDisplayed() )
|
if( !(*pSong)->NormallyDisplayed() )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
@@ -310,7 +310,7 @@ float Profile::GetSongsPossible( StepsType st, Difficulty dc ) const
|
|||||||
int iTotalSteps = 0;
|
int iTotalSteps = 0;
|
||||||
|
|
||||||
// add steps high scores
|
// add steps high scores
|
||||||
const vector<Song*> &vSongs = SONGMAN->GetSongs();
|
const vector<Song*> &vSongs = SONGMAN->GetAllSongs();
|
||||||
for( unsigned i=0; i<vSongs.size(); i++ )
|
for( unsigned i=0; i<vSongs.size(); i++ )
|
||||||
{
|
{
|
||||||
Song* pSong = vSongs[i];
|
Song* pSong = vSongs[i];
|
||||||
|
|||||||
@@ -538,6 +538,11 @@ void ProfileManager::LoadMachineProfile()
|
|||||||
// If the machine name has changed, make sure we use the new name
|
// If the machine name has changed, make sure we use the new name
|
||||||
m_pMachineProfile->m_sDisplayName = PREFSMAN->m_sMachineName;
|
m_pMachineProfile->m_sDisplayName = PREFSMAN->m_sMachineName;
|
||||||
|
|
||||||
|
LoadMachineProfileEdits();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProfileManager::LoadMachineProfileEdits()
|
||||||
|
{
|
||||||
SONGMAN->FreeAllLoadedFromProfile( ProfileSlot_Machine );
|
SONGMAN->FreeAllLoadedFromProfile( ProfileSlot_Machine );
|
||||||
SONGMAN->LoadStepEditsFromProfileDir( MACHINE_PROFILE_DIR, ProfileSlot_Machine );
|
SONGMAN->LoadStepEditsFromProfileDir( MACHINE_PROFILE_DIR, ProfileSlot_Machine );
|
||||||
SONGMAN->LoadCourseEditsFromProfileDir( MACHINE_PROFILE_DIR, ProfileSlot_Machine );
|
SONGMAN->LoadCourseEditsFromProfileDir( MACHINE_PROFILE_DIR, ProfileSlot_Machine );
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ public:
|
|||||||
//
|
//
|
||||||
// High scores
|
// High scores
|
||||||
//
|
//
|
||||||
void LoadMachineProfile();
|
void LoadMachineProfile(); // including edits
|
||||||
|
void LoadMachineProfileEdits();
|
||||||
void SaveMachineProfile() const;
|
void SaveMachineProfile() const;
|
||||||
|
|
||||||
bool IsPersistentProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); }
|
bool IsPersistentProfile( PlayerNumber pn ) const { return !m_sProfileDir[pn].empty(); }
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void ScreenBookkeeping::UpdateView()
|
|||||||
|
|
||||||
vector<Song*> vpSongs;
|
vector<Song*> vpSongs;
|
||||||
int iCount = 0;
|
int iCount = 0;
|
||||||
FOREACH_CONST( Song *, SONGMAN->GetSongs(), s )
|
FOREACH_CONST( Song *, SONGMAN->GetAllSongs(), s )
|
||||||
{
|
{
|
||||||
Song *pSong = *s;
|
Song *pSong = *s;
|
||||||
if( UNLOCKMAN->SongIsLocked(pSong) & ~LOCKED_DISABLED )
|
if( UNLOCKMAN->SongIsLocked(pSong) & ~LOCKED_DISABLED )
|
||||||
|
|||||||
@@ -818,7 +818,7 @@ static void FillProfileStats( Profile *pProfile )
|
|||||||
PREFSMAN->m_iMaxHighScoresPerListForMachine.Get():
|
PREFSMAN->m_iMaxHighScoresPerListForMachine.Get():
|
||||||
PREFSMAN->m_iMaxHighScoresPerListForPlayer.Get();
|
PREFSMAN->m_iMaxHighScoresPerListForPlayer.Get();
|
||||||
|
|
||||||
vector<Song*> vpAllSongs = SONGMAN->GetSongs();
|
vector<Song*> vpAllSongs = SONGMAN->GetAllSongs();
|
||||||
FOREACH( Song*, vpAllSongs, pSong )
|
FOREACH( Song*, vpAllSongs, pSong )
|
||||||
{
|
{
|
||||||
vector<Steps*> vpAllSteps = (*pSong)->GetAllSteps();
|
vector<Steps*> vpAllSteps = (*pSong)->GetAllSteps();
|
||||||
|
|||||||
@@ -906,8 +906,11 @@ ScreenGameplay::~ScreenGameplay()
|
|||||||
|
|
||||||
bool ScreenGameplay::IsLastSong()
|
bool ScreenGameplay::IsLastSong()
|
||||||
{
|
{
|
||||||
if( WORKOUTMAN->m_pCurWorkout != NULL && GAMESTATE->m_bWorkoutGoalComplete )
|
if( GAMESTATE->m_pCurCourse )
|
||||||
return true;
|
{
|
||||||
|
if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 && GAMESTATE->m_bWorkoutGoalComplete )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if( GAMESTATE->m_pCurCourse && GAMESTATE->m_pCurCourse->m_bRepeat )
|
if( GAMESTATE->m_pCurCourse && GAMESTATE->m_pCurCourse->m_bRepeat )
|
||||||
return false;
|
return false;
|
||||||
return GAMESTATE->GetCourseSongIndex() >= (int)m_apSongsQueue.size()-1; // GetCourseSongIndex() is 0-based
|
return GAMESTATE->GetCourseSongIndex() >= (int)m_apSongsQueue.size()-1; // GetCourseSongIndex() is 0-based
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ REGISTER_SCREEN_CLASS( ScreenHighScores );
|
|||||||
static void GetAllSongsToShow( vector<Song*> &vpOut, int iNumMostRecentScoresToShow )
|
static void GetAllSongsToShow( vector<Song*> &vpOut, int iNumMostRecentScoresToShow )
|
||||||
{
|
{
|
||||||
vpOut.clear();
|
vpOut.clear();
|
||||||
FOREACH_CONST( Song*, SONGMAN->GetSongs(), s )
|
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), s )
|
||||||
{
|
{
|
||||||
if( !(*s)->NormallyDisplayed() )
|
if( !(*s)->NormallyDisplayed() )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ struct MenuRowDef
|
|||||||
int iRowCode;
|
int iRowCode;
|
||||||
RString sName;
|
RString sName;
|
||||||
bool bEnabled;
|
bool bEnabled;
|
||||||
MenuRowUpdateEnabled pfnEnabled; // if ! NULL, used to fill bEnabled
|
MenuRowUpdateEnabled pfnEnabled; // if ! NULL, used instead of bEnabled
|
||||||
EditMode emShowIn;
|
EditMode emShowIn;
|
||||||
int iDefaultChoice;
|
int iDefaultChoice;
|
||||||
vector<RString> choices;
|
vector<RString> choices;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void ScreenNameEntryTraditional::Init()
|
|||||||
for( int z = 0; z < 3; ++z )
|
for( int z = 0; z < 3; ++z )
|
||||||
{
|
{
|
||||||
StageStats ss;
|
StageStats ss;
|
||||||
const vector<Song*> &apSongs = SONGMAN->GetSongs();
|
const vector<Song*> &apSongs = SONGMAN->GetAllSongs();
|
||||||
ss.m_vpPlayedSongs.push_back( apSongs[rand()%apSongs.size()] );
|
ss.m_vpPlayedSongs.push_back( apSongs[rand()%apSongs.size()] );
|
||||||
ss.m_vpPossibleSongs = ss.m_vpPlayedSongs;
|
ss.m_vpPossibleSongs = ss.m_vpPlayedSongs;
|
||||||
ss.m_pStyle = GAMESTATE->GetCurrentStyle();
|
ss.m_pStyle = GAMESTATE->GetCurrentStyle();
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector <Song *> AllSongs = SONGMAN->GetSongs();
|
vector <Song *> AllSongs = SONGMAN->GetAllSongs();
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i=0; i < AllSongs.size(); i++ )
|
for( i=0; i < AllSongs.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "OptionRowHandler.h"
|
#include "OptionRowHandler.h"
|
||||||
|
|
||||||
|
const int MAX_ENTRIES_PER_COURSE = 50;
|
||||||
|
|
||||||
|
|
||||||
enum EditCourseRow
|
enum EditCourseRow
|
||||||
{
|
{
|
||||||
EditCourseRow_Type,
|
EditCourseRow_Type,
|
||||||
@@ -57,7 +60,7 @@ void ScreenOptionsEditCourse::BeginScreen()
|
|||||||
ASSERT( GAMESTATE->m_pCurCourse );
|
ASSERT( GAMESTATE->m_pCurCourse );
|
||||||
Course *pCourse = GAMESTATE->m_pCurCourse;
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||||
m_Original = *pCourse;
|
m_Original = *pCourse;
|
||||||
m_vpDisplayedSongs = SONGMAN->GetSongs();
|
m_vpDisplayedSongs = SONGMAN->GetAllSongs();
|
||||||
|
|
||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
return RELOAD_CHANGED_ALL;
|
return RELOAD_CHANGED_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ImportOption( const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
{
|
{
|
||||||
vector<Song*>::const_iterator iter = find( m_vpDisplayedSongs.begin(), m_vpDisplayedSongs.end(), GAMESTATE->m_pCurSong.Get() );
|
vector<Song*>::const_iterator iter = find( m_vpDisplayedSongs.begin(), m_vpDisplayedSongs.end(), GAMESTATE->m_pCurSong.Get() );
|
||||||
int iChoice = 0;
|
int iChoice = 0;
|
||||||
@@ -250,7 +250,7 @@ void ScreenOptionsEditCourseEntry::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
if( pSong == NULL )
|
if( pSong == NULL )
|
||||||
{
|
{
|
||||||
// Find the longest non-tutorial song.
|
// Find the longest non-tutorial song.
|
||||||
const vector<Song *> &vSongs = SONGMAN->GetSongs();
|
const vector<Song *> &vSongs = SONGMAN->GetAllSongs();
|
||||||
float fLen = -1.f;
|
float fLen = -1.f;
|
||||||
|
|
||||||
FOREACH_CONST( Song*, vSongs, i )
|
FOREACH_CONST( Song*, vSongs, i )
|
||||||
|
|||||||
@@ -11,36 +11,230 @@
|
|||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "WorkoutManager.h"
|
#include "WorkoutManager.h"
|
||||||
|
#include "song.h"
|
||||||
|
#include "Style.h"
|
||||||
|
#include "Steps.h"
|
||||||
|
|
||||||
static const MenuRowDef g_MenuSong = MenuRowDef( -1, "Song", true, EditMode_Practice, false, true, 0, "Off", "On" );
|
|
||||||
|
static void GetStepsForSong( Song *pSong, vector<Steps*> &vpStepsOut )
|
||||||
|
{
|
||||||
|
SongUtil::GetSteps( pSong, vpStepsOut, GAMESTATE->GetCurrentStyle()->m_StepsType );
|
||||||
|
StepsUtil::RemoveLockedSteps( pSong, vpStepsOut );
|
||||||
|
StepsUtil::SortNotesArrayByDifficulty( vpStepsOut );
|
||||||
|
}
|
||||||
|
|
||||||
|
// XXX: very similar to OptionRowHandlerSteps
|
||||||
|
class OptionRowHandlerSteps : public OptionRowHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Load( int iEntryIndex )
|
||||||
|
{
|
||||||
|
m_iEntryIndex = iEntryIndex;
|
||||||
|
}
|
||||||
|
virtual ReloadChanged Reload()
|
||||||
|
{
|
||||||
|
m_Def.m_vsChoices.clear();
|
||||||
|
m_vpSteps.clear();
|
||||||
|
|
||||||
|
Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
|
if( pSong ) // playing a song
|
||||||
|
{
|
||||||
|
GetStepsForSong( pSong, m_vpSteps );
|
||||||
|
FOREACH_CONST( Steps*, m_vpSteps, steps )
|
||||||
|
{
|
||||||
|
RString s;
|
||||||
|
if( (*steps)->GetDifficulty() == Difficulty_Edit )
|
||||||
|
s = (*steps)->GetDescription();
|
||||||
|
else
|
||||||
|
s = DifficultyToLocalizedString( (*steps)->GetDifficulty() );
|
||||||
|
s += ssprintf( " %d", (*steps)->GetMeter() );
|
||||||
|
m_Def.m_vsChoices.push_back( s );
|
||||||
|
}
|
||||||
|
m_Def.m_vEnabledForPlayers.clear();
|
||||||
|
m_Def.m_vEnabledForPlayers.insert( PLAYER_1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Def.m_vsChoices.push_back( "n/a" );
|
||||||
|
m_vpSteps.push_back( NULL );
|
||||||
|
m_Def.m_vEnabledForPlayers.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return RELOAD_CHANGED_ALL;
|
||||||
|
}
|
||||||
|
virtual void ImportOption( OptionRow *pRow, const vector<PlayerNumber> &vpns, vector<bool> vbSelectedOut[NUM_PLAYERS] ) const
|
||||||
|
{
|
||||||
|
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
||||||
|
Steps *pSteps;
|
||||||
|
if( m_iEntryIndex < (int)pTrail->m_vEntries.size() )
|
||||||
|
pSteps = pTrail->m_vEntries[ m_iEntryIndex ].pSteps;
|
||||||
|
|
||||||
|
vector<Steps*>::const_iterator iter = find( m_vpSteps.begin(), m_vpSteps.end(), pSteps );
|
||||||
|
if( iter == m_vpSteps.end() )
|
||||||
|
{
|
||||||
|
pRow->SetOneSharedSelection( 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = iter - m_vpSteps.begin();
|
||||||
|
pRow->SetOneSharedSelection( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
virtual int ExportOption( const vector<PlayerNumber> &vpns, const vector<bool> vbSelected[NUM_PLAYERS] ) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Steps *GetSteps( int iStepsIndex ) const
|
||||||
|
{
|
||||||
|
return m_vpSteps[iStepsIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_iEntryIndex;
|
||||||
|
vector<Steps*> m_vpSteps;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const int NUM_SONG_ROWS = 20;
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenOptionsEditPlaylist );
|
REGISTER_SCREEN_CLASS( ScreenOptionsEditPlaylist );
|
||||||
|
|
||||||
|
enum WorkoutDetailsRow
|
||||||
|
{
|
||||||
|
WorkoutDetailsRow_Minutes,
|
||||||
|
NUM_WorkoutDetailsRow
|
||||||
|
};
|
||||||
|
|
||||||
|
enum RowType
|
||||||
|
{
|
||||||
|
RowType_Song,
|
||||||
|
RowType_Steps,
|
||||||
|
NUM_RowType,
|
||||||
|
RowType_Invalid,
|
||||||
|
};
|
||||||
|
static int RowToEntryIndex( int iRow )
|
||||||
|
{
|
||||||
|
if( iRow < NUM_WorkoutDetailsRow )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return (iRow-NUM_WorkoutDetailsRow)/NUM_RowType;
|
||||||
|
}
|
||||||
|
static RowType RowToRowType( int iRow )
|
||||||
|
{
|
||||||
|
if( iRow < NUM_WorkoutDetailsRow )
|
||||||
|
return RowType_Invalid;
|
||||||
|
return (RowType)((iRow-NUM_WorkoutDetailsRow) % NUM_RowType);
|
||||||
|
}
|
||||||
|
static int EntryIndexAndRowTypeToRow( int iEntryIndex, RowType rowType )
|
||||||
|
{
|
||||||
|
return NUM_WorkoutDetailsRow + iEntryIndex*NUM_RowType + rowType;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::Init()
|
void ScreenOptionsEditPlaylist::Init()
|
||||||
{
|
{
|
||||||
ScreenOptions::Init();
|
ScreenOptions::Init();
|
||||||
SongUtil::GetAllSongGenres( m_vsSongGenres );
|
SONGMAN->GetPreferredSortSongs( m_vpSongs );
|
||||||
|
SongUtil::SortSongPointerArrayByTitle( m_vpSongs );
|
||||||
|
}
|
||||||
|
|
||||||
|
const MenuRowDef g_MenuRows[] =
|
||||||
|
{
|
||||||
|
MenuRowDef( -1, "Workout Minutes", true, EditMode_Practice, true, false, 0, NULL ),
|
||||||
|
};
|
||||||
|
|
||||||
|
static LocalizedString EMPTY ("ScreenOptionsEditPlaylist","-Empty-");
|
||||||
|
static LocalizedString SONG ("ScreenOptionsEditPlaylist","Song");
|
||||||
|
static LocalizedString STEPS ("ScreenOptionsEditPlaylist","Steps");
|
||||||
|
static LocalizedString MINUTES ("ScreenOptionsEditPlaylist","minutes");
|
||||||
|
|
||||||
|
static RString MakeMinutesString( int mins )
|
||||||
|
{
|
||||||
|
if( mins == 0 )
|
||||||
|
return "No Cut-off";
|
||||||
|
return ssprintf( "%d", mins ) + " " + MINUTES.GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::BeginScreen()
|
void ScreenOptionsEditPlaylist::BeginScreen()
|
||||||
{
|
{
|
||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
FOREACH_CONST( RString, m_vsSongGenres, s )
|
FOREACH_ENUM( WorkoutDetailsRow, rowIndex )
|
||||||
{
|
{
|
||||||
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeSimple( g_MenuSong );
|
const MenuRowDef &mr = g_MenuRows[rowIndex];
|
||||||
vHands.push_back( pHand );
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeSimple( mr );
|
||||||
pHand->m_Def.m_sName = (*s);
|
|
||||||
pHand->m_Def.m_sExplanationName = "Enable Song Genre";
|
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ALL_IN_ROW;
|
pHand->m_Def.m_vsChoices.clear();
|
||||||
|
|
||||||
|
switch( rowIndex )
|
||||||
|
{
|
||||||
|
DEFAULT_FAIL(rowIndex);
|
||||||
|
case WorkoutDetailsRow_Minutes:
|
||||||
|
pHand->m_Def.m_vsChoices.push_back( MakeMinutesString(0) );
|
||||||
|
for( int i=MIN_WORKOUT_MINUTES; i<=20; i+=2 )
|
||||||
|
pHand->m_Def.m_vsChoices.push_back( MakeMinutesString(i) );
|
||||||
|
for( int i=20; i<=MAX_WORKOUT_MINUTES; i+=5 )
|
||||||
|
pHand->m_Def.m_vsChoices.push_back( MakeMinutesString(i) );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
pHand->m_Def.m_bExportOnChange = true;
|
pHand->m_Def.m_bExportOnChange = true;
|
||||||
|
vHands.push_back( pHand );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for( int i=0; i<NUM_SONG_ROWS; i++ )
|
||||||
|
{
|
||||||
|
{
|
||||||
|
MenuRowDef mrd = MenuRowDef( -1, "---", true, EditMode_Practice, true, false, 0, EMPTY.GetValue() );
|
||||||
|
FOREACH_CONST( Song*, m_vpSongs, s )
|
||||||
|
mrd.choices.push_back( (*s)->GetDisplayFullTitle() );
|
||||||
|
mrd.sName = ssprintf(SONG.GetValue() + " %d",i+1);
|
||||||
|
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeSimple( mrd );
|
||||||
|
pHand->m_Def.m_bAllowThemeTitle = false; // already themed
|
||||||
|
pHand->m_Def.m_sExplanationName = "Choose Song";
|
||||||
|
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
pHand->m_Def.m_bExportOnChange = true;
|
||||||
|
vHands.push_back( pHand );
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
OptionRowHandlerSteps *pHand = new OptionRowHandlerSteps;
|
||||||
|
pHand->Load( i );
|
||||||
|
pHand->m_Def.m_vsChoices.push_back( "n/a" );
|
||||||
|
pHand->m_Def.m_sName = ssprintf(STEPS.GetValue() + " %d",i+1);
|
||||||
|
pHand->m_Def.m_bAllowThemeTitle = false; // already themed
|
||||||
|
pHand->m_Def.m_bAllowThemeItems = false; // already themed
|
||||||
|
pHand->m_Def.m_sExplanationName = "Choose Steps";
|
||||||
|
pHand->m_Def.m_bOneChoiceForAllPlayers = true;
|
||||||
|
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
|
pHand->m_Def.m_bExportOnChange = true;
|
||||||
|
vHands.push_back( pHand );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenOptions::InitMenu( vHands );
|
ScreenOptions::InitMenu( vHands );
|
||||||
|
|
||||||
ScreenOptions::BeginScreen();
|
ScreenOptions::BeginScreen();
|
||||||
|
|
||||||
this->AfterChangeRow( PLAYER_1 );
|
|
||||||
|
for( int i=0; i<(int)m_pRows.size(); i++ )
|
||||||
|
{
|
||||||
|
OptionRow *pRow = m_pRows[i];
|
||||||
|
m_iCurrentRow[PLAYER_1] = i;
|
||||||
|
this->SetCurrentSong();
|
||||||
|
pRow->Reload();
|
||||||
|
}
|
||||||
|
m_iCurrentRow[PLAYER_1] = 0;
|
||||||
|
|
||||||
|
this->SetCurrentSong();
|
||||||
|
|
||||||
|
//this->AfterChangeRow( PLAYER_1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenOptionsEditPlaylist::~ScreenOptionsEditPlaylist()
|
ScreenOptionsEditPlaylist::~ScreenOptionsEditPlaylist()
|
||||||
@@ -54,41 +248,100 @@ void ScreenOptionsEditPlaylist::ImportOptions( int iRow, const vector<PlayerNumb
|
|||||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RString sSongGenre = m_vsSongGenres[iRow];
|
switch( iRow )
|
||||||
|
|
||||||
bool bEnabled = false;
|
|
||||||
FOREACH_CONST( RString, WORKOUTMAN->m_pCurWorkout->m_vsSongGenres, s )
|
|
||||||
{
|
{
|
||||||
if( *s == sSongGenre )
|
case WorkoutDetailsRow_Minutes:
|
||||||
|
row.SetOneSharedSelection( 0 );
|
||||||
|
row.SetOneSharedSelectionIfPresent( MakeMinutesString(GAMESTATE->m_pCurCourse->m_fGoalSeconds/60) );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
{
|
{
|
||||||
bEnabled = true;
|
int iEntryIndex = RowToEntryIndex( iRow );
|
||||||
break;
|
RowType rowType = RowToRowType( iRow );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
row.SetOneSharedSelection( bEnabled ? 1:0 );
|
switch( rowType )
|
||||||
|
{
|
||||||
|
DEFAULT_FAIL( rowType );
|
||||||
|
case RowType_Song:
|
||||||
|
{
|
||||||
|
Song *pSong = NULL;
|
||||||
|
if( iEntryIndex < (int)GAMESTATE->m_pCurCourse->m_vEntries.size() )
|
||||||
|
pSong = GAMESTATE->m_pCurCourse->m_vEntries[iEntryIndex].songID.ToSong();
|
||||||
|
|
||||||
|
vector<Song*>::iterator iter = find( m_vpSongs.begin(), m_vpSongs.end(), pSong );
|
||||||
|
if( iter == m_vpSongs.end() )
|
||||||
|
row.SetOneSharedSelection( 0 );
|
||||||
|
else
|
||||||
|
row.SetOneSharedSelection( 1 + iter - m_vpSongs.begin() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RowType_Steps:
|
||||||
|
// the OptionRowHandler does its own importing
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
void ScreenOptionsEditPlaylist::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[iRow];
|
FOREACH_ENUM( WorkoutDetailsRow, i )
|
||||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
|
||||||
return;
|
|
||||||
|
|
||||||
RString sSongGenre = m_vsSongGenres[iRow];
|
|
||||||
|
|
||||||
bool bEnabled = !!row.GetOneSharedSelection();
|
|
||||||
vector<RString>::iterator iter = find( WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.begin(), WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.end(), sSongGenre );
|
|
||||||
bool bAlreadyExists = iter != WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.end();
|
|
||||||
if( bEnabled && !bAlreadyExists )
|
|
||||||
{
|
{
|
||||||
WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.push_back( sSongGenre );
|
OptionRow &row = *m_pRows[i];
|
||||||
sort( WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.begin(), WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.end() );
|
int iIndex = row.GetOneSharedSelection( true );
|
||||||
|
RString sValue;
|
||||||
|
if( iIndex >= 0 )
|
||||||
|
sValue = row.GetRowDef().m_vsChoices[ iIndex ];
|
||||||
|
|
||||||
|
switch( i )
|
||||||
|
{
|
||||||
|
DEFAULT_FAIL(i);
|
||||||
|
case WorkoutDetailsRow_Minutes:
|
||||||
|
GAMESTATE->m_pCurCourse->m_fGoalSeconds = 0;
|
||||||
|
int mins;
|
||||||
|
if( sscanf( sValue, "%d", &mins ) == 1 )
|
||||||
|
GAMESTATE->m_pCurCourse->m_fGoalSeconds = mins * 60;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( !bEnabled && bAlreadyExists )
|
|
||||||
|
GAMESTATE->m_pCurCourse->m_vEntries.clear();
|
||||||
|
|
||||||
|
for( int i=NUM_WorkoutDetailsRow; i<(int)m_pRows.size(); i++ )
|
||||||
{
|
{
|
||||||
WORKOUTMAN->m_pCurWorkout->m_vsSongGenres.erase( iter );
|
OptionRow &row = *m_pRows[i];
|
||||||
|
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RowType rowType = RowToRowType( i );
|
||||||
|
int iEntryIndex = RowToEntryIndex( i );
|
||||||
|
|
||||||
|
switch( rowType )
|
||||||
|
{
|
||||||
|
case RowType_Song:
|
||||||
|
{
|
||||||
|
Song *pSong = this->GetSongForEntry( iEntryIndex );
|
||||||
|
if( pSong )
|
||||||
|
{
|
||||||
|
Steps *pSteps = this->GetStepsForEntry( iEntryIndex );
|
||||||
|
ASSERT( pSteps );
|
||||||
|
CourseEntry ce;
|
||||||
|
ce.songID.FromSong( pSong );
|
||||||
|
ce.stepsCriteria.m_difficulty = pSteps->GetDifficulty();
|
||||||
|
GAMESTATE->m_pCurCourse->m_vEntries.push_back( ce );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RowType_Steps:
|
||||||
|
// push each CourseEntry when we handle each RowType_Song above
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditCourseUtil::UpdateAndSetTrail();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::GoToNextScreen()
|
void ScreenOptionsEditPlaylist::GoToNextScreen()
|
||||||
@@ -109,30 +362,106 @@ void ScreenOptionsEditPlaylist::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
ScreenOptions::HandleScreenMessage( SM );
|
ScreenOptions::HandleScreenMessage( SM );
|
||||||
}
|
}
|
||||||
|
|
||||||
static RString g_sSongGenre;
|
void ScreenOptionsEditPlaylist::SetCurrentSong()
|
||||||
|
{
|
||||||
|
int iRow = m_iCurrentRow[PLAYER_1];
|
||||||
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
|
||||||
|
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||||
|
{
|
||||||
|
GAMESTATE->m_pCurSong.Set( NULL );
|
||||||
|
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int iRow = m_iCurrentRow[PLAYER_1];
|
||||||
|
int iEntryIndex = RowToEntryIndex( iRow );
|
||||||
|
Song *pSong = NULL;
|
||||||
|
if( iEntryIndex != -1 )
|
||||||
|
{
|
||||||
|
int iCurrentSongRow = EntryIndexAndRowTypeToRow(iEntryIndex,RowType_Song);
|
||||||
|
OptionRow &row = *m_pRows[ iCurrentSongRow ];
|
||||||
|
int index = row.GetOneSelection(PLAYER_1);
|
||||||
|
if( index != 0 )
|
||||||
|
pSong = m_vpSongs[ index - 1 ];
|
||||||
|
}
|
||||||
|
GAMESTATE->m_pCurSong.Set( pSong );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScreenOptionsEditPlaylist::SetCurrentSteps()
|
||||||
|
{
|
||||||
|
Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
|
if( pSong )
|
||||||
|
{
|
||||||
|
int iRow = m_iCurrentRow[PLAYER_1];
|
||||||
|
int iEntryIndex = RowToEntryIndex( iRow );
|
||||||
|
OptionRow &row = *m_pRows[ EntryIndexAndRowTypeToRow(iEntryIndex, RowType_Steps) ];
|
||||||
|
int iStepsIndex = row.GetOneSharedSelection();
|
||||||
|
const OptionRowHandlerSteps *pHand = dynamic_cast<const OptionRowHandlerSteps *>( row.GetHandler() );
|
||||||
|
ASSERT( pHand );
|
||||||
|
Steps *pSteps = pHand->GetSteps( iStepsIndex );
|
||||||
|
GAMESTATE->m_pCurSteps[PLAYER_1].Set( pSteps );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Song *ScreenOptionsEditPlaylist::GetSongForEntry( int iEntryIndex )
|
||||||
|
{
|
||||||
|
int iRow = EntryIndexAndRowTypeToRow( iEntryIndex, RowType_Song );
|
||||||
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
|
||||||
|
int index = row.GetOneSharedSelection();
|
||||||
|
if( index == 0 )
|
||||||
|
return NULL;
|
||||||
|
return m_vpSongs[ index - 1 ];
|
||||||
|
}
|
||||||
|
|
||||||
|
Steps *ScreenOptionsEditPlaylist::GetStepsForEntry( int iEntryIndex )
|
||||||
|
{
|
||||||
|
int iRow = EntryIndexAndRowTypeToRow( iEntryIndex, RowType_Steps );
|
||||||
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
int index = row.GetOneSharedSelection();
|
||||||
|
Song *pSong = GetSongForEntry( iEntryIndex );
|
||||||
|
vector<Steps*> vpSteps;
|
||||||
|
GetStepsForSong( pSong, vpSteps );
|
||||||
|
return vpSteps[index];
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::AfterChangeRow( PlayerNumber pn )
|
void ScreenOptionsEditPlaylist::AfterChangeRow( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
ScreenOptions::AfterChangeRow( pn );
|
ScreenOptions::AfterChangeRow( pn );
|
||||||
|
|
||||||
int iRow = m_iCurrentRow[pn];
|
SetCurrentSong();
|
||||||
OptionRow &row = *m_pRows[iRow];
|
|
||||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
|
||||||
g_sSongGenre = "";
|
|
||||||
else
|
|
||||||
g_sSongGenre = m_vsSongGenres[iRow];
|
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( "EditPlaylistSongGenreChanged" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditPlaylist::AfterChangeValueInRow( int iRow, PlayerNumber pn )
|
void ScreenOptionsEditPlaylist::AfterChangeValueInRow( int iRow, PlayerNumber pn )
|
||||||
{
|
{
|
||||||
ScreenOptions::AfterChangeValueInRow( iRow, pn );
|
ScreenOptions::AfterChangeValueInRow( iRow, pn );
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( "WorkoutChanged" );
|
int iEntryIndex = RowToEntryIndex( iRow );
|
||||||
|
RowType rowType = RowToRowType( iRow );
|
||||||
|
switch( rowType )
|
||||||
|
{
|
||||||
|
case RowType_Song:
|
||||||
|
{
|
||||||
|
SetCurrentSong();
|
||||||
|
OptionRow &row = *m_pRows[ EntryIndexAndRowTypeToRow(iEntryIndex, RowType_Steps) ];
|
||||||
|
row.Reload();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RowType_Steps:
|
||||||
|
SetCurrentSteps();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int MIN_ENABLED_SONGS = 10;
|
const int MIN_ENABLED_SONGS = 2;
|
||||||
|
|
||||||
static LocalizedString MUST_ENABLE_AT_LEAST("ScreenOptionsEditPlaylist","You must enable at least %d songs.");
|
static LocalizedString MUST_ENABLE_AT_LEAST("ScreenOptionsEditPlaylist","You must enable at least %d songs.");
|
||||||
void ScreenOptionsEditPlaylist::ProcessMenuStart( const InputEventPlus &input )
|
void ScreenOptionsEditPlaylist::ProcessMenuStart( const InputEventPlus &input )
|
||||||
@@ -142,10 +471,9 @@ void ScreenOptionsEditPlaylist::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
|
|
||||||
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||||
|
|
||||||
vector<Song*> vpSongGenreSongs;
|
int iSongCount = GAMESTATE->m_pCurCourse->m_vEntries.size();
|
||||||
WORKOUTMAN->GetWorkoutSongsForGenres( WORKOUTMAN->m_pCurWorkout->m_vsSongGenres, vpSongGenreSongs );
|
|
||||||
|
|
||||||
if( m_pRows[iRow]->GetRowType() == OptionRow::RowType_Exit && vpSongGenreSongs.size() < unsigned(MIN_ENABLED_SONGS) )
|
if( m_pRows[iRow]->GetRowType() == OptionRow::RowType_Exit && iSongCount < unsigned(MIN_ENABLED_SONGS) )
|
||||||
{
|
{
|
||||||
ScreenPrompt::Prompt( SM_None, ssprintf(MUST_ENABLE_AT_LEAST.GetValue(),MIN_ENABLED_SONGS) );
|
ScreenPrompt::Prompt( SM_None, ssprintf(MUST_ENABLE_AT_LEAST.GetValue(),MIN_ENABLED_SONGS) );
|
||||||
return;
|
return;
|
||||||
@@ -154,32 +482,6 @@ void ScreenOptionsEditPlaylist::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
ScreenOptions::ProcessMenuStart( input );
|
ScreenOptions::ProcessMenuStart( input );
|
||||||
}
|
}
|
||||||
|
|
||||||
RString GetEditPlaylistSelectedSongGenreText( int iColumnIndex, int iMaxPerCol )
|
|
||||||
{
|
|
||||||
vector<RString> vsSongGenres;
|
|
||||||
vsSongGenres.push_back( g_sSongGenre );
|
|
||||||
vector<Song*> vpSongGenreSongs;
|
|
||||||
WORKOUTMAN->GetWorkoutSongsForGenres( vsSongGenres, vpSongGenreSongs );
|
|
||||||
|
|
||||||
const int iSongPerCoumn = iMaxPerCol;
|
|
||||||
vector<RString> vs;
|
|
||||||
for( int i=iColumnIndex*iSongPerCoumn; i<(iColumnIndex+1)*iSongPerCoumn && i<(int)vpSongGenreSongs.size(); i++ )
|
|
||||||
{
|
|
||||||
Song *pSong = vpSongGenreSongs[i];
|
|
||||||
RString s2 = pSong->GetDisplayFullTitle();
|
|
||||||
//if( s2.size() > 16 )
|
|
||||||
// s2 = s2.Left(14) + "...";
|
|
||||||
//s2.Replace( " ", " " );
|
|
||||||
vs.push_back( s2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return join("\n", vs);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "LuaManager.h"
|
|
||||||
LuaFunction( GetEditPlaylistSelectedSongGenre, g_sSongGenre );
|
|
||||||
LuaFunction( GetEditPlaylistSelectedSongGenreText, GetEditPlaylistSelectedSongGenreText(IArg(1),IArg(2)) );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Chris Danford
|
* (c) 2003-2004 Chris Danford
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "ScreenOptions.h"
|
#include "ScreenOptions.h"
|
||||||
class Song;
|
class Song;
|
||||||
|
class Steps;
|
||||||
|
|
||||||
class ScreenOptionsEditPlaylist : public ScreenOptions
|
class ScreenOptionsEditPlaylist : public ScreenOptions
|
||||||
{
|
{
|
||||||
@@ -25,7 +26,12 @@ private:
|
|||||||
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
|
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
|
||||||
virtual void ProcessMenuStart( const InputEventPlus &input );
|
virtual void ProcessMenuStart( const InputEventPlus &input );
|
||||||
|
|
||||||
vector<RString> m_vsSongGenres;
|
void SetCurrentSong();
|
||||||
|
void SetCurrentSteps();
|
||||||
|
Song *GetSongForEntry( int iEntryIndex );
|
||||||
|
Steps *GetStepsForEntry( int iEntryIndex );
|
||||||
|
|
||||||
|
vector<Song*> m_vpSongs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -91,22 +91,27 @@ void ScreenOptionsEditWorkout::ImportOptions( int iRow, const vector<PlayerNumbe
|
|||||||
{
|
{
|
||||||
OptionRow &row = *m_pRows[iRow];
|
OptionRow &row = *m_pRows[iRow];
|
||||||
|
|
||||||
|
/*
|
||||||
|
FIXME
|
||||||
switch( iRow )
|
switch( iRow )
|
||||||
{
|
{
|
||||||
case WorkoutDetailsRow_WorkoutProgram:
|
case WorkoutDetailsRow_WorkoutProgram:
|
||||||
row.SetOneSharedSelectionIfPresent( WorkoutProgramToLocalizedString(WORKOUTMAN->m_pCurWorkout->m_WorkoutProgram) );
|
row.SetOneSharedSelectionIfPresent( WorkoutProgramToLocalizedString(WORKOUTMAN->GetCurrentWorkout()->m_WorkoutProgram) );
|
||||||
break;
|
break;
|
||||||
case WorkoutDetailsRow_Minutes:
|
case WorkoutDetailsRow_Minutes:
|
||||||
row.SetOneSharedSelectionIfPresent( MakeMinutesString(WORKOUTMAN->m_pCurWorkout->m_iMinutes) );
|
row.SetOneSharedSelectionIfPresent( MakeMinutesString(WORKOUTMAN->GetCurrentWorkout()->m_iMinutes) );
|
||||||
break;
|
break;
|
||||||
case WorkoutDetailsRow_Meter:
|
case WorkoutDetailsRow_Meter:
|
||||||
row.SetOneSharedSelectionIfPresent( MakeMeterString(WORKOUTMAN->m_pCurWorkout->m_iAverageMeter) );
|
row.SetOneSharedSelectionIfPresent( MakeMeterString(WORKOUTMAN->GetCurrentWorkout()->m_iAverageMeter) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditWorkout::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
void ScreenOptionsEditWorkout::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
FIXME
|
||||||
FOREACH_ENUM( WorkoutDetailsRow, i )
|
FOREACH_ENUM( WorkoutDetailsRow, i )
|
||||||
{
|
{
|
||||||
iRow = i;
|
iRow = i;
|
||||||
@@ -120,18 +125,20 @@ void ScreenOptionsEditWorkout::ExportOptions( int iRow, const vector<PlayerNumbe
|
|||||||
{
|
{
|
||||||
DEFAULT_FAIL(iRow);
|
DEFAULT_FAIL(iRow);
|
||||||
case WorkoutDetailsRow_WorkoutProgram:
|
case WorkoutDetailsRow_WorkoutProgram:
|
||||||
WORKOUTMAN->m_pCurWorkout->m_WorkoutProgram = (WorkoutProgram)iIndex;
|
WORKOUTMAN->GetCurrentWorkout()->m_WorkoutProgram = (WorkoutProgram)iIndex;
|
||||||
break;
|
break;
|
||||||
case WorkoutDetailsRow_Minutes:
|
case WorkoutDetailsRow_Minutes:
|
||||||
sscanf( sValue, "%d", &WORKOUTMAN->m_pCurWorkout->m_iMinutes );
|
sscanf( sValue, "%d", &WORKOUTMAN->GetCurrentWorkout()->m_iMinutes );
|
||||||
break;
|
break;
|
||||||
case WorkoutDetailsRow_Meter:
|
case WorkoutDetailsRow_Meter:
|
||||||
WORKOUTMAN->m_pCurWorkout->m_iAverageMeter = iIndex + MIN_METER;
|
WORKOUTMAN->GetCurrentWorkout()->m_iAverageMeter = iIndex + MIN_METER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( "WorkoutChanged" );
|
MESSAGEMAN->Broadcast( "WorkoutChanged" );
|
||||||
|
WORKOUTMAN->UpdateAndSetTrail();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsEditWorkout::GoToNextScreen()
|
void ScreenOptionsEditWorkout::GoToNextScreen()
|
||||||
|
|||||||
@@ -403,8 +403,6 @@ void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
|
|||||||
ScreenOptions::AfterChangeRow( pn );
|
ScreenOptions::AfterChangeRow( pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString YOU_HAVE_MAXIMUM_EDITS_ALLOWED( "ScreenOptionsManageCourses", "You have %d course edits, the maximum number allowed." );
|
|
||||||
static LocalizedString YOU_MUST_DELETE( "ScreenOptionsManageCourses", "You must delete an existing course edit before creating a new course edit." );
|
|
||||||
void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
|
void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
|
||||||
{
|
{
|
||||||
if( IsTransitioning() )
|
if( IsTransitioning() )
|
||||||
@@ -420,15 +418,6 @@ void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( SONGMAN->GetNumEditCourses(ProfileSlot_Machine) >= MAX_EDIT_COURSES_PER_PROFILE )
|
|
||||||
{
|
|
||||||
RString s = ssprintf(
|
|
||||||
YOU_HAVE_MAXIMUM_EDITS_ALLOWED.GetValue() + "\n\n" + YOU_MUST_DELETE.GetValue(),
|
|
||||||
MAX_EDIT_COURSES_PER_PROFILE );
|
|
||||||
ScreenPrompt::Prompt( SM_None, s );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
RString sDefaultName;
|
RString sDefaultName;
|
||||||
RString sThrowAway;
|
RString sThrowAway;
|
||||||
for( int i=1; i<=9999; i++ )
|
for( int i=1; i<=9999; i++ )
|
||||||
|
|||||||
@@ -3,19 +3,24 @@
|
|||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ScreenMiniMenu.h"
|
#include "ScreenMiniMenu.h"
|
||||||
#include "OptionRowHandler.h"
|
#include "OptionRowHandler.h"
|
||||||
#include "WorkoutManager.h"
|
#include "Course.h"
|
||||||
#include "Workout.h"
|
#include "SongManager.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ScreenTextEntry.h"
|
#include "ScreenTextEntry.h"
|
||||||
#include "ScreenPrompt.h"
|
#include "ScreenPrompt.h"
|
||||||
#include "StatsManager.h"
|
#include "StatsManager.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
|
#include "WorkoutManager.h"
|
||||||
|
#include "ProfileManager.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
#include "CourseUtil.h"
|
||||||
|
|
||||||
AutoScreenMessage( SM_BackFromRename )
|
AutoScreenMessage( SM_BackFromRename )
|
||||||
AutoScreenMessage( SM_BackFromDelete )
|
AutoScreenMessage( SM_BackFromDelete )
|
||||||
AutoScreenMessage( SM_BackFromContextMenu )
|
AutoScreenMessage( SM_BackFromContextMenu )
|
||||||
|
|
||||||
|
|
||||||
enum ManageWorkoutsAction
|
enum ManageWorkoutsAction
|
||||||
{
|
{
|
||||||
ManageWorkoutsAction_Choose,
|
ManageWorkoutsAction_Choose,
|
||||||
@@ -53,7 +58,17 @@ void ScreenOptionsManageWorkouts::BeginScreen()
|
|||||||
{
|
{
|
||||||
STATSMAN->Reset();
|
STATSMAN->Reset();
|
||||||
|
|
||||||
WORKOUTMAN->LoadAllFromDisk();
|
|
||||||
|
vector<const Style*> vpStyles;
|
||||||
|
GameManager::GetStylesForGame( GAMESTATE->m_pCurGame, vpStyles );
|
||||||
|
const Style *pStyle = vpStyles[0];
|
||||||
|
GAMESTATE->SetCurrentStyle( pStyle );
|
||||||
|
|
||||||
|
|
||||||
|
// Remember the current course. All Course pointers will be invalidated when we load the machine profile below.
|
||||||
|
CourseID cidLast;
|
||||||
|
cidLast.FromCourse( GAMESTATE->m_pCurCourse );
|
||||||
|
|
||||||
|
|
||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
@@ -71,14 +86,16 @@ void ScreenOptionsManageWorkouts::BeginScreen()
|
|||||||
iIndex++;
|
iIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vpWorkouts = WORKOUTMAN->m_vpAllWorkouts;
|
FlushDirCache();
|
||||||
|
PROFILEMAN->LoadMachineProfileEdits();
|
||||||
|
EditCourseUtil::GetAllEditCourses( m_vpCourses );
|
||||||
|
|
||||||
FOREACH_CONST( Workout*, m_vpWorkouts, p )
|
FOREACH_CONST( Course*, m_vpCourses, p )
|
||||||
{
|
{
|
||||||
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
|
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
|
||||||
OptionRowDefinition &def = vHands.back()->m_Def;
|
OptionRowDefinition &def = vHands.back()->m_Def;
|
||||||
|
|
||||||
def.m_sName = (*p)->m_sName;
|
def.m_sName = (*p)->GetDisplayFullTitle();
|
||||||
def.m_bAllowThemeTitle = false; // not themable
|
def.m_bAllowThemeTitle = false; // not themable
|
||||||
def.m_sExplanationName = "Select Workout";
|
def.m_sExplanationName = "Select Workout";
|
||||||
def.m_vsChoices.clear();
|
def.m_vsChoices.clear();
|
||||||
@@ -92,12 +109,14 @@ void ScreenOptionsManageWorkouts::BeginScreen()
|
|||||||
ScreenOptions::BeginScreen();
|
ScreenOptions::BeginScreen();
|
||||||
|
|
||||||
// select the last chosen course
|
// select the last chosen course
|
||||||
if( WORKOUTMAN->m_pCurWorkout )
|
GAMESTATE->m_pCurCourse.Set( cidLast.ToCourse() );
|
||||||
|
if( GAMESTATE->m_pCurCourse )
|
||||||
{
|
{
|
||||||
vector<Workout*>::const_iterator iter = find( m_vpWorkouts.begin(), m_vpWorkouts.end(), WORKOUTMAN->m_pCurWorkout );
|
EditCourseUtil::UpdateAndSetTrail();
|
||||||
if( iter != m_vpWorkouts.end() )
|
vector<Course*>::const_iterator iter = find( m_vpCourses.begin(), m_vpCourses.end(), GAMESTATE->m_pCurCourse );
|
||||||
|
if( iter != m_vpCourses.end() )
|
||||||
{
|
{
|
||||||
int iIndex = iter - m_vpWorkouts.begin();
|
int iIndex = iter - m_vpCourses.begin();
|
||||||
this->MoveRowAbsolute( PLAYER_1, 1 + iIndex );
|
this->MoveRowAbsolute( PLAYER_1, 1 + iIndex );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,11 +124,11 @@ void ScreenOptionsManageWorkouts::BeginScreen()
|
|||||||
AfterChangeRow( PLAYER_1 );
|
AfterChangeRow( PLAYER_1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString ERROR_RENAMING_WORKOUT ("ScreenOptionsManageWorkouts", "Error renaming workout file.");
|
static LocalizedString ERROR_RENAMING ("ScreenOptionsManageWorkouts", "Error renaming file.");
|
||||||
static LocalizedString ERROR_DELETING_WORKOUT_FILE ("ScreenOptionsManageWorkouts", "Error deleting the workout file '%s'.");
|
static LocalizedString ERROR_DELETING_FILE ("ScreenOptionsManageWorkouts", "Error deleting the file '%s'.");
|
||||||
static LocalizedString THIS_WORKOUT_WILL_BE_LOST ("ScreenOptionsManageWorkouts", "This workout will be lost permanently.");
|
static LocalizedString THIS_WILL_BE_LOST ("ScreenOptionsManageWorkouts", "This file will be lost permanently.");
|
||||||
static LocalizedString CONTINUE_WITH_DELETE ("ScreenOptionsManageWorkouts", "Continue with delete?");
|
static LocalizedString CONTINUE_WITH_DELETE ("ScreenOptionsManageWorkouts", "Continue with delete?");
|
||||||
static LocalizedString ENTER_NAME_FOR_WORKOUT ("ScreenOptionsManageWorkouts", "Enter a name for this workout.");
|
static LocalizedString ENTER_NAME ("ScreenOptionsManageWorkouts", "Enter a name.");
|
||||||
void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
||||||
{
|
{
|
||||||
if( SM == SM_GoToNextScreen )
|
if( SM == SM_GoToNextScreen )
|
||||||
@@ -118,9 +137,14 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
if( iCurRow == 0 ) // "create new"
|
if( iCurRow == 0 ) // "create new"
|
||||||
{
|
{
|
||||||
WORKOUTMAN->m_pCurWorkout = new Workout;
|
/* Allocate the Course now, but don't save the file until the user explicitly chooses Save */
|
||||||
WORKOUTMAN->LoadDefaults( *WORKOUTMAN->m_pCurWorkout );
|
Course *pCourse = new Course;
|
||||||
WORKOUTMAN->m_vpAllWorkouts.push_back( WORKOUTMAN->m_pCurWorkout );
|
EditCourseUtil::LoadDefaults( *pCourse );
|
||||||
|
pCourse->m_LoadedFromProfile = ProfileSlot_Machine;
|
||||||
|
SONGMAN->AddCourse( pCourse );
|
||||||
|
GAMESTATE->m_pCurCourse.Set( pCourse );
|
||||||
|
EditCourseUtil::s_bNewCourseNeedsName = true;
|
||||||
|
EditCourseUtil::UpdateAndSetTrail();
|
||||||
|
|
||||||
SCREENMAN->SetNewScreen( CREATE_NEW_SCREEN );
|
SCREENMAN->SetNewScreen( CREATE_NEW_SCREEN );
|
||||||
return; // don't call base
|
return; // don't call base
|
||||||
@@ -141,10 +165,9 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
||||||
|
|
||||||
Workout *pWorkout = WORKOUTMAN->m_pCurWorkout;
|
if( !EditCourseUtil::RenameAndSave(GAMESTATE->m_pCurCourse, ScreenTextEntry::s_sLastAnswer) )
|
||||||
if( !WORKOUTMAN->RenameAndSave(pWorkout, ScreenTextEntry::s_sLastAnswer) )
|
|
||||||
{
|
{
|
||||||
ScreenPrompt::Prompt( SM_None, ERROR_RENAMING_WORKOUT );
|
ScreenPrompt::Prompt( SM_None, ERROR_RENAMING );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,14 +178,15 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
|
if( ScreenPrompt::s_LastAnswer == ANSWER_YES )
|
||||||
{
|
{
|
||||||
Workout *pWorkout = GetWorkoutWithFocus();
|
Course *pCourse = GetCourseWithFocus();
|
||||||
if( !WORKOUTMAN->RemoveAndDeleteFile( pWorkout ) )
|
if( !EditCourseUtil::RemoveAndDeleteFile( pCourse ) )
|
||||||
{
|
{
|
||||||
ScreenPrompt::Prompt( SM_None, ssprintf(ERROR_DELETING_WORKOUT_FILE.GetValue(),pWorkout->m_sFile.c_str()) );
|
ScreenPrompt::Prompt( SM_None, ssprintf(ERROR_DELETING_FILE.GetValue(),pCourse->m_sPath.c_str()) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WORKOUTMAN->m_pCurWorkout = NULL;
|
GAMESTATE->m_pCurCourse.Set( NULL );
|
||||||
|
GAMESTATE->m_pCurTrail[PLAYER_1].Set( NULL );
|
||||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,9 +198,9 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
case ManageWorkoutsAction_Choose:
|
case ManageWorkoutsAction_Choose:
|
||||||
{
|
{
|
||||||
Workout *p = GetWorkoutWithFocus();
|
GAMESTATE->m_pCurCourse.Set( GetCourseWithFocus() );
|
||||||
WORKOUTMAN->m_pCurWorkout = p;
|
EditCourseUtil::UpdateAndSetTrail();
|
||||||
|
EditCourseUtil::s_bNewCourseNeedsName = false;
|
||||||
ScreenOptions::BeginFadingOut();
|
ScreenOptions::BeginFadingOut();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -184,15 +208,15 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
ScreenTextEntry::TextEntry(
|
ScreenTextEntry::TextEntry(
|
||||||
SM_BackFromRename,
|
SM_BackFromRename,
|
||||||
ENTER_NAME_FOR_WORKOUT,
|
ENTER_NAME,
|
||||||
WORKOUTMAN->m_pCurWorkout->m_sName,
|
GAMESTATE->m_pCurCourse->GetDisplayFullTitle(),
|
||||||
MAX_WORKOUT_NAME_LENGTH,
|
EditCourseUtil::MAX_NAME_LENGTH,
|
||||||
WorkoutManager::ValidateWorkoutName );
|
EditCourseUtil::ValidateEditCourseName );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ManageWorkoutsAction_Delete:
|
case ManageWorkoutsAction_Delete:
|
||||||
{
|
{
|
||||||
ScreenPrompt::Prompt( SM_BackFromDelete, THIS_WORKOUT_WILL_BE_LOST.GetValue()+"\n\n"+CONTINUE_WITH_DELETE.GetValue(), PROMPT_YES_NO, ANSWER_NO );
|
ScreenPrompt::Prompt( SM_BackFromDelete, THIS_WILL_BE_LOST.GetValue()+"\n\n"+CONTINUE_WITH_DELETE.GetValue(), PROMPT_YES_NO, ANSWER_NO );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -212,13 +236,11 @@ void ScreenOptionsManageWorkouts::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
|
|
||||||
void ScreenOptionsManageWorkouts::AfterChangeRow( PlayerNumber pn )
|
void ScreenOptionsManageWorkouts::AfterChangeRow( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
WORKOUTMAN->m_pCurWorkout = GetWorkoutWithFocus();
|
|
||||||
|
|
||||||
ScreenOptions::AfterChangeRow( pn );
|
ScreenOptions::AfterChangeRow( pn );
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString YOU_HAVE_MAX_WORKOUTS( "ScreenOptionsManageWorkouts", "You have %d workouts, the maximum number allowed." );
|
static LocalizedString YOU_HAVE_MAX( "ScreenOptionsManageWorkouts", "You have %d, the maximum number allowed." );
|
||||||
static LocalizedString YOU_MUST_DELETE( "ScreenOptionsManageWorkouts", "You must delete an existing workout before creating a new workout." );
|
static LocalizedString YOU_MUST_DELETE( "ScreenOptionsManageWorkouts", "You must delete an existing before creating a new." );
|
||||||
void ScreenOptionsManageWorkouts::ProcessMenuStart( const InputEventPlus &input )
|
void ScreenOptionsManageWorkouts::ProcessMenuStart( const InputEventPlus &input )
|
||||||
{
|
{
|
||||||
if( IsTransitioning() )
|
if( IsTransitioning() )
|
||||||
@@ -228,9 +250,11 @@ void ScreenOptionsManageWorkouts::ProcessMenuStart( const InputEventPlus &input
|
|||||||
|
|
||||||
if( iCurRow == 0 ) // "create new"
|
if( iCurRow == 0 ) // "create new"
|
||||||
{
|
{
|
||||||
if( WORKOUTMAN->m_vpAllWorkouts.size() >= size_t(MAX_WORKOUTS_PER_PROFILE) )
|
vector<Course*> vpCourses;
|
||||||
|
EditCourseUtil::GetAllEditCourses( vpCourses );
|
||||||
|
if( vpCourses.size() >= (size_t)EditCourseUtil::MAX_PER_PROFILE )
|
||||||
{
|
{
|
||||||
RString s = ssprintf( YOU_HAVE_MAX_WORKOUTS.GetValue()+"\n\n"+YOU_MUST_DELETE.GetValue(), MAX_WORKOUTS_PER_PROFILE );
|
RString s = ssprintf( YOU_HAVE_MAX.GetValue()+"\n\n"+YOU_MUST_DELETE.GetValue(), EditCourseUtil::MAX_PER_PROFILE );
|
||||||
ScreenPrompt::Prompt( SM_None, s );
|
ScreenPrompt::Prompt( SM_None, s );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -267,7 +291,7 @@ void ScreenOptionsManageWorkouts::ExportOptions( int iRow, const vector<PlayerNu
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Workout *ScreenOptionsManageWorkouts::GetWorkoutWithFocus() const
|
Course *ScreenOptionsManageWorkouts::GetCourseWithFocus() const
|
||||||
{
|
{
|
||||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||||
if( iCurRow == 0 )
|
if( iCurRow == 0 )
|
||||||
@@ -277,7 +301,7 @@ Workout *ScreenOptionsManageWorkouts::GetWorkoutWithFocus() const
|
|||||||
|
|
||||||
// a Steps
|
// a Steps
|
||||||
int iStepsIndex = iCurRow - 1;
|
int iStepsIndex = iCurRow - 1;
|
||||||
return m_vpWorkouts[iStepsIndex];
|
return m_vpCourses[iStepsIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "ScreenOptions.h"
|
#include "ScreenOptions.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
class Workout;
|
class Course;
|
||||||
|
|
||||||
class ScreenOptionsManageWorkouts : public ScreenOptions
|
class ScreenOptionsManageWorkouts : public ScreenOptions
|
||||||
{
|
{
|
||||||
@@ -21,9 +21,9 @@ protected:
|
|||||||
virtual void AfterChangeRow( PlayerNumber pn );
|
virtual void AfterChangeRow( PlayerNumber pn );
|
||||||
virtual void ProcessMenuStart( const InputEventPlus &input );
|
virtual void ProcessMenuStart( const InputEventPlus &input );
|
||||||
|
|
||||||
Workout *GetWorkoutWithFocus() const;
|
Course *GetCourseWithFocus() const;
|
||||||
|
|
||||||
vector<Workout*> m_vpWorkouts;
|
vector<Course*> m_vpCourses;
|
||||||
|
|
||||||
ThemeMetric<RString> CREATE_NEW_SCREEN;
|
ThemeMetric<RString> CREATE_NEW_SCREEN;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,18 +23,18 @@
|
|||||||
enum ReviewWorkoutRow
|
enum ReviewWorkoutRow
|
||||||
{
|
{
|
||||||
ReviewWorkoutRow_Play,
|
ReviewWorkoutRow_Play,
|
||||||
ReviewWorkoutRow_EditWorkout,
|
ReviewWorkoutRow_Edit,
|
||||||
ReviewWorkoutRow_EditPlaylist,
|
ReviewWorkoutRow_Shuffle,
|
||||||
ReviewWorkoutRow_Save,
|
ReviewWorkoutRow_Save,
|
||||||
NUM_ReviewWorkoutRow
|
NUM_ReviewWorkoutRow
|
||||||
};
|
};
|
||||||
|
|
||||||
static const MenuRowDef g_MenuRows[] =
|
static const MenuRowDef g_MenuRows[] =
|
||||||
{
|
{
|
||||||
MenuRowDef( -1, "Play", true, EditMode_Practice, true, false, 0, NULL ),
|
MenuRowDef( -1, "Play", true, EditMode_Practice, true, false, 0, NULL ),
|
||||||
MenuRowDef( -1, "Edit Workout", true, EditMode_Practice, true, false, 0, NULL ),
|
MenuRowDef( -1, "Edit Workout", true, EditMode_Practice, true, false, 0, NULL ),
|
||||||
MenuRowDef( -1, "Edit Playlist", true, EditMode_Practice, true, false, 0, NULL ),
|
MenuRowDef( -1, "Shuffle", true, EditMode_Practice, true, false, 0, NULL ),
|
||||||
MenuRowDef( -1, "Save", true, EditMode_Practice, true, false, 0, NULL ),
|
MenuRowDef( -1, "Save", true, EditMode_Practice, true, false, 0, NULL ),
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenOptionsReviewWorkout );
|
REGISTER_SCREEN_CLASS( ScreenOptionsReviewWorkout );
|
||||||
@@ -50,8 +50,7 @@ void ScreenOptionsReviewWorkout::Init()
|
|||||||
|
|
||||||
m_soundSave.Load( THEME->GetPathS(m_sName,"Save") );
|
m_soundSave.Load( THEME->GetPathS(m_sName,"Save") );
|
||||||
PLAY_SCREEN.Load(m_sName,"PlayScreen");
|
PLAY_SCREEN.Load(m_sName,"PlayScreen");
|
||||||
EDIT_WORKOUT_SCREEN.Load(m_sName,"EditWorkoutScreen");
|
EDIT_SCREEN.Load(m_sName,"EditScreen");
|
||||||
EDIT_PLAYLIST_SCREEN.Load(m_sName,"EditPlaylistScreen");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenOptionsReviewWorkout::BeginScreen()
|
void ScreenOptionsReviewWorkout::BeginScreen()
|
||||||
@@ -67,6 +66,9 @@ void ScreenOptionsReviewWorkout::BeginScreen()
|
|||||||
ScreenOptions::InitMenu( vHands );
|
ScreenOptions::InitMenu( vHands );
|
||||||
|
|
||||||
ScreenOptions::BeginScreen();
|
ScreenOptions::BeginScreen();
|
||||||
|
|
||||||
|
// clear the current song in case it's set when we back out from gameplay
|
||||||
|
GAMESTATE->m_pCurSong.Set( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenOptionsReviewWorkout::~ScreenOptionsReviewWorkout()
|
ScreenOptionsReviewWorkout::~ScreenOptionsReviewWorkout()
|
||||||
@@ -98,31 +100,11 @@ void ScreenOptionsReviewWorkout::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
switch( iRow )
|
switch( iRow )
|
||||||
{
|
{
|
||||||
case ReviewWorkoutRow_Play:
|
case ReviewWorkoutRow_Play:
|
||||||
{
|
EditCourseUtil::PrepareForPlay();
|
||||||
Workout *pWorkout = WORKOUTMAN->m_pCurWorkout;
|
SCREENMAN->SetNewScreen( PLAY_SCREEN );
|
||||||
pWorkout->GenerateCourse( *WORKOUTMAN->m_pTempCourse );
|
|
||||||
GAMESTATE->m_pCurSong.Set( NULL ); // CurSong will be set if we back out. Set it back to NULL so that ScreenStage won't show the last song.
|
|
||||||
GAMESTATE->m_pCurCourse.Set( WORKOUTMAN->m_pTempCourse );
|
|
||||||
const Style *pStyle = GameManager::GameAndStringToStyle(GAMESTATE->m_pCurGame,"single");
|
|
||||||
StepsType st = pStyle->m_StepsType;
|
|
||||||
Trail *pTrail = GAMESTATE->m_pCurCourse->GetTrail( st );
|
|
||||||
ASSERT( pTrail );
|
|
||||||
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
|
||||||
|
|
||||||
GAMESTATE->m_PlayMode.Set( PLAY_MODE_ENDLESS );
|
|
||||||
GAMESTATE->m_bSideIsJoined[0] = true;
|
|
||||||
GAMESTATE->SetCurrentStyle( pStyle );
|
|
||||||
|
|
||||||
PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_GoalType = GoalType_Time;
|
|
||||||
PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = pWorkout->m_iMinutes * 60;
|
|
||||||
SCREENMAN->SetNewScreen( PLAY_SCREEN );
|
|
||||||
}
|
|
||||||
return; // handled
|
return; // handled
|
||||||
case ReviewWorkoutRow_EditWorkout:
|
case ReviewWorkoutRow_Edit:
|
||||||
SCREENMAN->SetNewScreen( EDIT_WORKOUT_SCREEN );
|
SCREENMAN->SetNewScreen( EDIT_SCREEN );
|
||||||
return; // handled
|
|
||||||
case ReviewWorkoutRow_EditPlaylist:
|
|
||||||
SCREENMAN->SetNewScreen( EDIT_PLAYLIST_SCREEN );
|
|
||||||
return; // handled
|
return; // handled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -131,11 +113,11 @@ void ScreenOptionsReviewWorkout::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
if( !ScreenTextEntry::s_bCancelledLast )
|
if( !ScreenTextEntry::s_bCancelledLast )
|
||||||
{
|
{
|
||||||
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
|
||||||
if( WORKOUTMAN->RenameAndSave( WORKOUTMAN->m_pCurWorkout, ScreenTextEntry::s_sLastAnswer ) )
|
|
||||||
|
if( EditCourseUtil::RenameAndSave( GAMESTATE->m_pCurCourse, ScreenTextEntry::s_sLastAnswer ) )
|
||||||
{
|
{
|
||||||
m_soundSave.Play();
|
m_soundSave.Play();
|
||||||
SCREENMAN->SystemMessage( WORKOUT_SAVED );
|
SCREENMAN->SystemMessage( WORKOUT_SAVED );
|
||||||
MESSAGEMAN->Broadcast( "WorkoutChanged" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,30 +141,38 @@ void ScreenOptionsReviewWorkout::ProcessMenuStart( const InputEventPlus &input )
|
|||||||
switch( iRow )
|
switch( iRow )
|
||||||
{
|
{
|
||||||
case ReviewWorkoutRow_Play:
|
case ReviewWorkoutRow_Play:
|
||||||
case ReviewWorkoutRow_EditWorkout:
|
case ReviewWorkoutRow_Edit:
|
||||||
case ReviewWorkoutRow_EditPlaylist:
|
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
this->BeginFadingOut();
|
this->BeginFadingOut();
|
||||||
return; // handled
|
return; // handled
|
||||||
|
case ReviewWorkoutRow_Shuffle:
|
||||||
|
{
|
||||||
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
random_shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end() );
|
||||||
|
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_pCurStyle->m_StepsType );
|
||||||
|
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||||
|
SCREENMAN->PlayStartSound();
|
||||||
|
MESSAGEMAN->Broadcast("CurrentCourseChanged");
|
||||||
|
}
|
||||||
|
return; // handled
|
||||||
case ReviewWorkoutRow_Save:
|
case ReviewWorkoutRow_Save:
|
||||||
{
|
{
|
||||||
bool bPromptForName = !WORKOUTMAN->m_pCurWorkout->m_bNameWasSetByUser;
|
bool bPromptForName = EditCourseUtil::s_bNewCourseNeedsName;
|
||||||
if( bPromptForName )
|
if( bPromptForName )
|
||||||
{
|
{
|
||||||
ScreenTextEntry::TextEntry(
|
ScreenTextEntry::TextEntry(
|
||||||
SM_BackFromEnterName,
|
SM_BackFromEnterName,
|
||||||
ENTER_WORKOUT_NAME,
|
ENTER_WORKOUT_NAME,
|
||||||
WORKOUTMAN->m_pCurWorkout->m_sName,
|
GAMESTATE->m_pCurCourse->GetDisplayFullTitle(),
|
||||||
MAX_WORKOUT_NAME_LENGTH,
|
EditCourseUtil::MAX_NAME_LENGTH,
|
||||||
WorkoutManager::ValidateWorkoutName );
|
EditCourseUtil::ValidateEditCourseName );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( WORKOUTMAN->Save( WORKOUTMAN->m_pCurWorkout ) )
|
if( EditCourseUtil::Save( GAMESTATE->m_pCurCourse ) )
|
||||||
{
|
{
|
||||||
m_soundSave.Play();
|
m_soundSave.Play();
|
||||||
SCREENMAN->SystemMessage( WORKOUT_SAVED );
|
SCREENMAN->SystemMessage( WORKOUT_SAVED );
|
||||||
MESSAGEMAN->Broadcast( "WorkoutChanged" );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ private:
|
|||||||
|
|
||||||
RageSound m_soundSave;
|
RageSound m_soundSave;
|
||||||
ThemeMetric<RString> PLAY_SCREEN;
|
ThemeMetric<RString> PLAY_SCREEN;
|
||||||
ThemeMetric<RString> EDIT_WORKOUT_SCREEN;
|
ThemeMetric<RString> EDIT_SCREEN;
|
||||||
ThemeMetric<RString> EDIT_PLAYLIST_SCREEN;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ void ScreenOptionsToggleSongs::BeginScreen()
|
|||||||
|
|
||||||
vector<OptionRowHandler*> vHands;
|
vector<OptionRowHandler*> vHands;
|
||||||
|
|
||||||
const vector<Song *> &apAllSongs = SONGMAN->GetSongs();
|
const vector<Song *> &apAllSongs = SONGMAN->GetAllSongs();
|
||||||
FOREACH_CONST( Song *, apAllSongs , s )
|
FOREACH_CONST( Song *, apAllSongs , s )
|
||||||
{
|
{
|
||||||
Song *pSong = *s;
|
Song *pSong = *s;
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ void SongManager::PreloadSongImages()
|
|||||||
* that we don't need to. */
|
* that we don't need to. */
|
||||||
RageTexturePreloader preload;
|
RageTexturePreloader preload;
|
||||||
|
|
||||||
const vector<Song*> &songs = GetSongs();
|
const vector<Song*> &songs = GetAllSongs();
|
||||||
for( unsigned i = 0; i < songs.size(); ++i )
|
for( unsigned i = 0; i < songs.size(); ++i )
|
||||||
{
|
{
|
||||||
if( !songs[i]->HasBanner() )
|
if( !songs[i]->HasBanner() )
|
||||||
@@ -659,17 +659,6 @@ int SongManager::GetNumCourseGroups() const
|
|||||||
return m_mapCourseGroupToInfo.size();
|
return m_mapCourseGroupToInfo.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SongManager::GetNumEditCourses( ProfileSlot slot ) const
|
|
||||||
{
|
|
||||||
int iNum = 0;
|
|
||||||
FOREACH_CONST( Course*, m_pCourses, p )
|
|
||||||
{
|
|
||||||
if( (*p)->GetLoadedFromProfileSlot() == slot )
|
|
||||||
++iNum;
|
|
||||||
}
|
|
||||||
return iNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
RString SongManager::ShortenGroupName( RString sLongGroupName )
|
RString SongManager::ShortenGroupName( RString sLongGroupName )
|
||||||
{
|
{
|
||||||
static TitleSubst tsub("Groups");
|
static TitleSubst tsub("Groups");
|
||||||
@@ -756,7 +745,7 @@ void SongManager::InitAutogenCourses()
|
|||||||
m_pCourses.push_back( pCourse );
|
m_pCourses.push_back( pCourse );
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Song*> apCourseSongs = GetSongs();
|
vector<Song*> apCourseSongs = GetAllSongs();
|
||||||
|
|
||||||
// Generate "All Songs" endless course.
|
// Generate "All Songs" endless course.
|
||||||
pCourse = new Course;
|
pCourse = new Course;
|
||||||
@@ -769,7 +758,7 @@ void SongManager::InitAutogenCourses()
|
|||||||
/* We normally sort by translit artist. However, display artist is more
|
/* We normally sort by translit artist. However, display artist is more
|
||||||
* consistent. For example, transliterated Japanese names are alternately
|
* consistent. For example, transliterated Japanese names are alternately
|
||||||
* spelled given- and family-name first, but display titles are more consistent. */
|
* spelled given- and family-name first, but display titles are more consistent. */
|
||||||
vector<Song*> apSongs = this->GetSongs();
|
vector<Song*> apSongs = this->GetAllSongs();
|
||||||
SongUtil::SortSongPointerArrayByDisplayArtist( apSongs );
|
SongUtil::SortSongPointerArrayByDisplayArtist( apSongs );
|
||||||
|
|
||||||
RString sCurArtist = "";
|
RString sCurArtist = "";
|
||||||
@@ -984,7 +973,7 @@ void SongManager::SaveEnabledSongsToPref()
|
|||||||
|
|
||||||
// Intentionally drop disabled song entries for songs that aren't currently loaded.
|
// Intentionally drop disabled song entries for songs that aren't currently loaded.
|
||||||
|
|
||||||
const vector<Song*> &apSongs = SONGMAN->GetSongs();
|
const vector<Song*> &apSongs = SONGMAN->GetAllSongs();
|
||||||
FOREACH_CONST( Song *, apSongs, s )
|
FOREACH_CONST( Song *, apSongs, s )
|
||||||
{
|
{
|
||||||
Song *pSong = (*s);
|
Song *pSong = (*s);
|
||||||
@@ -1016,7 +1005,7 @@ void SongManager::LoadEnabledSongsFromPref()
|
|||||||
|
|
||||||
void SongManager::GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot slot ) const
|
void SongManager::GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot slot ) const
|
||||||
{
|
{
|
||||||
const vector<Song*> &vSongs = GetSongs();
|
const vector<Song*> &vSongs = GetAllSongs();
|
||||||
FOREACH_CONST( Song*, vSongs, song )
|
FOREACH_CONST( Song*, vSongs, song )
|
||||||
{
|
{
|
||||||
(*song)->GetStepsLoadedFromProfile( slot, AddTo );
|
(*song)->GetStepsLoadedFromProfile( slot, AddTo );
|
||||||
@@ -1026,7 +1015,7 @@ void SongManager::GetStepsLoadedFromProfile( vector<Steps*> &AddTo, ProfileSlot
|
|||||||
Song *SongManager::GetSongFromSteps( Steps *pSteps ) const
|
Song *SongManager::GetSongFromSteps( Steps *pSteps ) const
|
||||||
{
|
{
|
||||||
ASSERT( pSteps );
|
ASSERT( pSteps );
|
||||||
const vector<Song*> &vSongs = GetSongs();
|
const vector<Song*> &vSongs = GetAllSongs();
|
||||||
FOREACH_CONST( Song*, vSongs, song )
|
FOREACH_CONST( Song*, vSongs, song )
|
||||||
{
|
{
|
||||||
vector<Steps*> vSteps;
|
vector<Steps*> vSteps;
|
||||||
@@ -1759,7 +1748,7 @@ class LunaSongManager: public Luna<SongManager>
|
|||||||
public:
|
public:
|
||||||
static int GetAllSongs( T* p, lua_State *L )
|
static int GetAllSongs( T* p, lua_State *L )
|
||||||
{
|
{
|
||||||
const vector<Song*> &v = p->GetSongs();
|
const vector<Song*> &v = p->GetAllSongs();
|
||||||
LuaHelpers::CreateTableFromArray<Song*>( v, L );
|
LuaHelpers::CreateTableFromArray<Song*>( v, L );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,11 +77,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Lookup
|
// Lookup
|
||||||
const vector<Song*> &GetSongs( const RString &sGroupName = GROUP_ALL ) const;
|
const vector<Song*> &GetSongs( const RString &sGroupName ) const;
|
||||||
|
const vector<Song*> &GetAllSongs() const { return GetSongs(GROUP_ALL); }
|
||||||
void GetPopularSongs( vector<Song*> &AddTo, const RString &sGroupName ) const;
|
void GetPopularSongs( vector<Song*> &AddTo, const RString &sGroupName ) const;
|
||||||
|
const vector<Song*> &GetAllPopularSongs() const { return m_pPopularSongs; }
|
||||||
void GetPreferredSortSongs( vector<Song*> &AddTo ) const;
|
void GetPreferredSortSongs( vector<Song*> &AddTo ) const;
|
||||||
RString SongToPreferredSortSectionName( const Song *pSong ) const;
|
RString SongToPreferredSortSectionName( const Song *pSong ) const;
|
||||||
const vector<Song*> &GetPopularSongs() const { return m_pPopularSongs; }
|
|
||||||
const vector<Course*> &GetPopularCourses( CourseType ct ) const { return m_pPopularCourses[ct]; }
|
const vector<Course*> &GetPopularCourses( CourseType ct ) const { return m_pPopularCourses[ct]; }
|
||||||
Song *FindSong( RString sPath ) const;
|
Song *FindSong( RString sPath ) const;
|
||||||
Song *FindSong( RString sGroup, RString sSong ) const;
|
Song *FindSong( RString sGroup, RString sSong ) const;
|
||||||
@@ -95,7 +96,6 @@ public:
|
|||||||
int GetNumCourses() const;
|
int GetNumCourses() const;
|
||||||
int GetNumAdditionalCourses() const;
|
int GetNumAdditionalCourses() const;
|
||||||
int GetNumCourseGroups() const;
|
int GetNumCourseGroups() const;
|
||||||
int GetNumEditCourses( ProfileSlot slot ) const;
|
|
||||||
Song* GetRandomSong();
|
Song* GetRandomSong();
|
||||||
Course* GetRandomCourse();
|
Course* GetRandomCourse();
|
||||||
|
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ bool SongUtil::ValidateCurrentStepsDescription( const RString &sAnswer, RString
|
|||||||
void SongUtil::GetAllSongGenres( vector<RString> &vsOut )
|
void SongUtil::GetAllSongGenres( vector<RString> &vsOut )
|
||||||
{
|
{
|
||||||
set<RString> genres;
|
set<RString> genres;
|
||||||
FOREACH_CONST( Song*, SONGMAN->GetSongs(), song )
|
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), song )
|
||||||
{
|
{
|
||||||
if( !(*song)->m_sGenre.empty() )
|
if( !(*song)->m_sGenre.empty() )
|
||||||
genres.insert( (*song)->m_sGenre );
|
genres.insert( (*song)->m_sGenre );
|
||||||
|
|||||||
@@ -466,12 +466,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\ScreenOptionsEditProfile.h">
|
RelativePath=".\ScreenOptionsEditProfile.h">
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath=".\ScreenOptionsEditWorkout.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\ScreenOptionsEditWorkout.h">
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath=".\ScreenOptionsExportPackage.cpp">
|
RelativePath=".\ScreenOptionsExportPackage.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
#include "NoteSkinManager.h"
|
#include "NoteSkinManager.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "SongManager.h"
|
#include "SongManager.h"
|
||||||
#include "WorkoutManager.h"
|
|
||||||
#include "CharacterManager.h"
|
#include "CharacterManager.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "AnnouncerManager.h"
|
#include "AnnouncerManager.h"
|
||||||
@@ -260,7 +259,6 @@ void ShutdownGame()
|
|||||||
SAFE_DELETE( UNLOCKMAN );
|
SAFE_DELETE( UNLOCKMAN );
|
||||||
SAFE_DELETE( CRYPTMAN );
|
SAFE_DELETE( CRYPTMAN );
|
||||||
SAFE_DELETE( MEMCARDMAN );
|
SAFE_DELETE( MEMCARDMAN );
|
||||||
SAFE_DELETE( WORKOUTMAN );
|
|
||||||
SAFE_DELETE( SONGMAN );
|
SAFE_DELETE( SONGMAN );
|
||||||
SAFE_DELETE( BANNERCACHE );
|
SAFE_DELETE( BANNERCACHE );
|
||||||
SAFE_DELETE( SONGINDEX );
|
SAFE_DELETE( SONGINDEX );
|
||||||
@@ -1082,7 +1080,6 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
/* depends on SONGINDEX: */
|
/* depends on SONGINDEX: */
|
||||||
SONGMAN = new SongManager;
|
SONGMAN = new SongManager;
|
||||||
WORKOUTMAN = new WorkoutManager;
|
|
||||||
SONGMAN->InitAll( pLoadingWindow ); // this takes a long time
|
SONGMAN->InitAll( pLoadingWindow ); // this takes a long time
|
||||||
CRYPTMAN = new CryptManager; // need to do this before ProfileMan
|
CRYPTMAN = new CryptManager; // need to do this before ProfileMan
|
||||||
if( PREFSMAN->m_bSignProfileData )
|
if( PREFSMAN->m_bSignProfileData )
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers,
|
|||||||
void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
|
void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
|
||||||
{
|
{
|
||||||
// ugly...
|
// ugly...
|
||||||
vector<Song*> vpSongs = SONGMAN->GetSongs();
|
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
|
||||||
vector<Steps*> vpAllSteps;
|
vector<Steps*> vpAllSteps;
|
||||||
map<Steps*,Song*> mapStepsToSong;
|
map<Steps*,Song*> mapStepsToSong;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,24 @@
|
|||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
|
#include "Song.h"
|
||||||
|
|
||||||
|
|
||||||
|
int TrailUtil::GetNumSongs( const Trail *pTrail )
|
||||||
|
{
|
||||||
|
return pTrail->m_vEntries.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
float TrailUtil::GetTotalSeconds( const Trail *pTrail )
|
||||||
|
{
|
||||||
|
float fSecs = 0;
|
||||||
|
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
|
||||||
|
fSecs += e->pSong->m_fMusicLengthSeconds;
|
||||||
|
return fSecs;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void TrailID::FromTrail( const Trail *p )
|
void TrailID::FromTrail( const Trail *p )
|
||||||
{
|
{
|
||||||
if( p == NULL )
|
if( p == NULL )
|
||||||
@@ -84,6 +100,37 @@ bool TrailID::operator<( const TrailID &rhs ) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
int GetNumSongs( lua_State *L )
|
||||||
|
{
|
||||||
|
Trail *pTrail = Luna<Trail>::check( L, 1, true );
|
||||||
|
int iNum = TrailUtil::GetNumSongs( pTrail );
|
||||||
|
LuaHelpers::Push( L, iNum );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int GetTotalSeconds( lua_State *L )
|
||||||
|
{
|
||||||
|
Trail *pTrail = Luna<Trail>::check( L, 1, true );
|
||||||
|
float fSecs = TrailUtil::GetTotalSeconds( pTrail );
|
||||||
|
LuaHelpers::Push( L, fSecs );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const luaL_Reg TrailUtilTable[] =
|
||||||
|
{
|
||||||
|
LIST_METHOD( GetNumSongs ),
|
||||||
|
LIST_METHOD( GetTotalSeconds ),
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
LUA_REGISTER_NAMESPACE( TrailUtil )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2004 Chris Danford
|
* (c) 2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ class Trail;
|
|||||||
class Course;
|
class Course;
|
||||||
class XNode;
|
class XNode;
|
||||||
|
|
||||||
|
namespace TrailUtil
|
||||||
|
{
|
||||||
|
int GetNumSongs( const Trail *pTrail );
|
||||||
|
float GetTotalSeconds( const Trail *pTrail );
|
||||||
|
};
|
||||||
|
|
||||||
class TrailID
|
class TrailID
|
||||||
{
|
{
|
||||||
StepsType st;
|
StepsType st;
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ void UnlockManager::Load()
|
|||||||
|
|
||||||
if( AUTO_LOCK_CHALLENGE_STEPS )
|
if( AUTO_LOCK_CHALLENGE_STEPS )
|
||||||
{
|
{
|
||||||
FOREACH_CONST( Song*, SONGMAN->GetSongs(), s )
|
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), s )
|
||||||
{
|
{
|
||||||
// If no hard steps to play to unlock, skip
|
// If no hard steps to play to unlock, skip
|
||||||
if( SongUtil::GetOneSteps(*s, StepsType_Invalid, Difficulty_Hard) == NULL )
|
if( SongUtil::GetOneSteps(*s, StepsType_Invalid, Difficulty_Hard) == NULL )
|
||||||
|
|||||||
+13
-23
@@ -103,22 +103,10 @@ void Workout::GenerateCourse( Course &out )
|
|||||||
out.m_sMainTitle = "temp";
|
out.m_sMainTitle = "temp";
|
||||||
out.m_bRepeat = true;
|
out.m_bRepeat = true;
|
||||||
|
|
||||||
// Choose a large number of course entries. We may loop if the goal
|
FOREACH( SongID, m_vSongs, s )
|
||||||
// is not yet reached, and it would be bad to play the same sequence
|
|
||||||
// of songs over again.
|
|
||||||
const int iNumCourseEntries = 6*5; // choose a multiple of the intervals above, or else the WorkoutGraph will get out of sync with the actual songs.
|
|
||||||
|
|
||||||
vector<int> viMeter;
|
|
||||||
GetEstimatedMeters( iNumCourseEntries, viMeter );
|
|
||||||
|
|
||||||
for( int i=0; i<iNumCourseEntries; i++ )
|
|
||||||
{
|
{
|
||||||
CourseEntry ce;
|
CourseEntry ce;
|
||||||
|
ce.songID = *s;
|
||||||
ce.songCriteria.m_bUseSongGenreAllowedList = true;
|
|
||||||
ce.songCriteria.m_vsSongGenreAllowedList = m_vsSongGenres;
|
|
||||||
|
|
||||||
ce.stepsCriteria.m_iLowMeter = ce.stepsCriteria.m_iHighMeter = viMeter[i];
|
|
||||||
out.m_vEntries.push_back( ce );
|
out.m_vEntries.push_back( ce );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,16 +136,18 @@ bool Workout::LoadFromFile( RString sFile )
|
|||||||
xml.GetChildValue("AverageMeter",m_iAverageMeter);
|
xml.GetChildValue("AverageMeter",m_iAverageMeter);
|
||||||
CLAMP( m_iAverageMeter, MIN_METER, MAX_METER );
|
CLAMP( m_iAverageMeter, MIN_METER, MAX_METER );
|
||||||
|
|
||||||
XNode *songGenres = xml.GetChild("SongGenres");
|
XNode *songs = xml.GetChild("Songs");
|
||||||
if( songGenres )
|
if( songs )
|
||||||
{
|
{
|
||||||
FOREACH_CONST_Child( songGenres, songGenre )
|
FOREACH_CONST_Child( songs, song )
|
||||||
{
|
{
|
||||||
if( songGenre->GetName() == "SongGenre" )
|
if( song->GetName() == "Song" )
|
||||||
{
|
{
|
||||||
RString s;
|
RString s;
|
||||||
songGenre->GetTextValue( s );
|
song->GetTextValue( s );
|
||||||
m_vsSongGenres.push_back( s );
|
SongID sid;
|
||||||
|
sid.FromString( s );
|
||||||
|
m_vSongs.push_back( sid );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,10 +165,10 @@ bool Workout::SaveToFile( RString sFile )
|
|||||||
xml.AppendChild( "Minutes", m_iMinutes );
|
xml.AppendChild( "Minutes", m_iMinutes );
|
||||||
xml.AppendChild( "AverageMeter", m_iAverageMeter );
|
xml.AppendChild( "AverageMeter", m_iAverageMeter );
|
||||||
|
|
||||||
XNode *songGenres = xml.AppendChild("SongGenres");
|
XNode *songs = xml.AppendChild("Songs");
|
||||||
FOREACH_CONST( RString, m_vsSongGenres, s )
|
FOREACH_CONST( SongID, m_vSongs, s )
|
||||||
{
|
{
|
||||||
songGenres->AppendChild( "SongGenre", *s );
|
songs->AppendChild( "Song", s->ToString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return XmlFileUtil::SaveToFile( &xml, sFile );
|
return XmlFileUtil::SaveToFile( &xml, sFile );
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
WorkoutProgram m_WorkoutProgram;
|
WorkoutProgram m_WorkoutProgram;
|
||||||
int m_iMinutes;
|
int m_iMinutes;
|
||||||
int m_iAverageMeter;
|
int m_iAverageMeter;
|
||||||
vector<RString> m_vsSongGenres;
|
vector<SongID> m_vSongs;
|
||||||
|
|
||||||
int GetEstimatedNumSongs() const;
|
int GetEstimatedNumSongs() const;
|
||||||
static int GetEstimatedNumSongsFromSeconds( float fSeconds );
|
static int GetEstimatedNumSongsFromSeconds( float fSeconds );
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "Workout.h"
|
|
||||||
#include "WorkoutManager.h"
|
|
||||||
#include "StatsManager.h"
|
#include "StatsManager.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
#include "Course.h"
|
||||||
|
#include "Style.h"
|
||||||
|
|
||||||
const int MAX_METERS_TO_SHOW = Workout::GetEstimatedNumSongsFromSeconds( 90 * 60 );
|
const int MAX_METERS_TO_SHOW = 50;
|
||||||
|
|
||||||
REGISTER_ACTOR_CLASS( WorkoutGraph )
|
REGISTER_ACTOR_CLASS( WorkoutGraph )
|
||||||
|
|
||||||
@@ -48,7 +48,10 @@ void WorkoutGraph::SetFromCurrentWorkout()
|
|||||||
|
|
||||||
void WorkoutGraph::SetInternal( int iMinSongsPlayed )
|
void WorkoutGraph::SetInternal( int iMinSongsPlayed )
|
||||||
{
|
{
|
||||||
ASSERT( WORKOUTMAN->m_pCurWorkout );
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||||
|
ASSERT( pCourse );
|
||||||
|
Trail *pTrail = GAMESTATE->m_pCurTrail[PLAYER_1];
|
||||||
|
ASSERT( pTrail );
|
||||||
|
|
||||||
FOREACH( Sprite*, m_vpBars, p )
|
FOREACH( Sprite*, m_vpBars, p )
|
||||||
{
|
{
|
||||||
@@ -57,13 +60,12 @@ void WorkoutGraph::SetInternal( int iMinSongsPlayed )
|
|||||||
}
|
}
|
||||||
m_vpBars.clear();
|
m_vpBars.clear();
|
||||||
|
|
||||||
int iWorkoutEstimatedSongs = WORKOUTMAN->m_pCurWorkout->GetEstimatedNumSongs();
|
|
||||||
int iNumSongsToShow = max( iMinSongsPlayed, iWorkoutEstimatedSongs );
|
|
||||||
vector<int> viMeters;
|
vector<int> viMeters;
|
||||||
WORKOUTMAN->m_pCurWorkout->GetEstimatedMeters( iNumSongsToShow, viMeters );
|
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
|
||||||
|
{
|
||||||
m_iSongsChoppedOffAtBeginning = max( 0, ((int)viMeters.size()) - MAX_METERS_TO_SHOW );
|
ASSERT( e->pSteps );
|
||||||
viMeters.erase( viMeters.begin(), viMeters.begin()+m_iSongsChoppedOffAtBeginning );
|
viMeters.push_back( e->pSteps->GetMeter() );
|
||||||
|
}
|
||||||
|
|
||||||
int iBlocksWide = viMeters.size();
|
int iBlocksWide = viMeters.size();
|
||||||
int iBlocksHigh = MAX_METER;
|
int iBlocksHigh = MAX_METER;
|
||||||
|
|||||||
@@ -8,111 +8,54 @@
|
|||||||
#include "FontCharAliases.h"
|
#include "FontCharAliases.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
#include "Style.h"
|
||||||
|
#include "Profile.h"
|
||||||
|
#include "CourseWriterCRS.h"
|
||||||
|
|
||||||
static const RString WORKOUTS_SUBDIR = "Workouts/";
|
int EditCourseUtil::MAX_NAME_LENGTH = 16;
|
||||||
|
int EditCourseUtil::MAX_PER_PROFILE = 32;
|
||||||
|
bool EditCourseUtil::s_bNewCourseNeedsName = false;
|
||||||
|
|
||||||
WorkoutManager* WORKOUTMAN = NULL; // global and accessable from anywhere in our program
|
bool EditCourseUtil::Save( Course *pCourse )
|
||||||
|
|
||||||
WorkoutManager::WorkoutManager()
|
|
||||||
{
|
{
|
||||||
m_pCurWorkout = NULL;
|
return EditCourseUtil::RenameAndSave( pCourse, pCourse->GetDisplayFullTitle() );
|
||||||
m_pTempCourse = new Course;
|
}
|
||||||
|
|
||||||
// Register with Lua.
|
bool EditCourseUtil::RenameAndSave( Course *pCourse, RString sName )
|
||||||
|
{
|
||||||
|
ASSERT( !sName.empty() );
|
||||||
|
|
||||||
|
EditCourseUtil::s_bNewCourseNeedsName = false;
|
||||||
|
|
||||||
|
RString sNewFilePath = PROFILEMAN->GetProfileDir(ProfileSlot_Machine) + EDIT_COURSES_SUBDIR + sName + ".crs";
|
||||||
|
|
||||||
|
// remove the old file if the name is changing
|
||||||
|
if( !pCourse->m_sPath.empty() && sNewFilePath != pCourse->m_sPath )
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
FILEMAN->Remove( pCourse->m_sPath ); // not fatal if this fails
|
||||||
lua_pushstring( L, "WORKOUTMAN" );
|
FlushDirCache();
|
||||||
this->PushSelf( L );
|
|
||||||
lua_settable(L, LUA_GLOBALSINDEX);
|
|
||||||
LUA->Release( L );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pCourse->m_sMainTitle = sName;
|
||||||
|
pCourse->m_sPath = sNewFilePath;
|
||||||
|
return CourseWriterCRS::Write( *pCourse, pCourse->m_sPath, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkoutManager::~WorkoutManager()
|
bool EditCourseUtil::RemoveAndDeleteFile( Course *pCourse )
|
||||||
{
|
{
|
||||||
// Unregister with Lua.
|
if( !FILEMAN->Remove( pCourse->m_sPath ) )
|
||||||
LUA->UnsetGlobal( "WORKOUTMAN" );
|
|
||||||
|
|
||||||
FOREACH( Workout*, m_vpAllWorkouts, p )
|
|
||||||
SAFE_DELETE( *p );
|
|
||||||
m_vpAllWorkouts.clear();
|
|
||||||
|
|
||||||
SAFE_DELETE( m_pTempCourse );
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkoutManager::LoadAllFromDisk()
|
|
||||||
{
|
|
||||||
m_vpAllWorkouts.clear();
|
|
||||||
vector<RString> vsFiles;
|
|
||||||
GetDirListing( PROFILEMAN->GetProfileDir(ProfileSlot_Machine) + WORKOUTS_SUBDIR + "*.xml", vsFiles, false, true );
|
|
||||||
FOREACH_CONST( RString, vsFiles, s )
|
|
||||||
{
|
|
||||||
Workout *p = new Workout;
|
|
||||||
if( p->LoadFromFile( *s ) )
|
|
||||||
m_vpAllWorkouts.push_back( p );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorkoutManager::LoadDefaults( Workout &out )
|
|
||||||
{
|
|
||||||
out = Workout();
|
|
||||||
|
|
||||||
// pick a default name
|
|
||||||
// XXX: Make this localizable
|
|
||||||
for( int i=0; i<10000; i++ )
|
|
||||||
{
|
|
||||||
out.m_sName = ssprintf("Workout %d", i+1);
|
|
||||||
bool bNameInUse = false;
|
|
||||||
FOREACH_CONST( Workout*, m_vpAllWorkouts, p )
|
|
||||||
{
|
|
||||||
if( out.m_sName == (*p)->m_sName )
|
|
||||||
{
|
|
||||||
bNameInUse = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !bNameInUse )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
SongUtil::GetAllSongGenres( out.m_vsSongGenres );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WorkoutManager::RenameAndSave( Workout *pWorkout, RString sNewName )
|
|
||||||
{
|
|
||||||
pWorkout->m_bNameWasSetByUser = true;
|
|
||||||
ASSERT( !sNewName.empty() );
|
|
||||||
vector<Workout*>::iterator iter = find( m_vpAllWorkouts.begin(), m_vpAllWorkouts.end(), pWorkout );
|
|
||||||
if( iter == m_vpAllWorkouts.end() )
|
|
||||||
return false;
|
|
||||||
pWorkout->m_sName = sNewName;
|
|
||||||
FILEMAN->Remove( pWorkout->m_sFile );
|
|
||||||
FlushDirCache(); // not fatal if this fails
|
|
||||||
pWorkout->m_sFile = PROFILEMAN->GetProfileDir(ProfileSlot_Machine) + WORKOUTS_SUBDIR + pWorkout->m_sName + ".xml";
|
|
||||||
return pWorkout->SaveToFile( pWorkout->m_sFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WorkoutManager::Save( Workout *pWorkout )
|
|
||||||
{
|
|
||||||
ASSERT( !pWorkout->m_sFile.empty() );
|
|
||||||
return pWorkout->SaveToFile( pWorkout->m_sFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WorkoutManager::RemoveAndDeleteFile( Workout *pToDelete )
|
|
||||||
{
|
|
||||||
vector<Workout*>::iterator iter = find( m_vpAllWorkouts.begin(), m_vpAllWorkouts.end(), pToDelete );
|
|
||||||
if( iter == m_vpAllWorkouts.end() )
|
|
||||||
return false;
|
|
||||||
if( !FILEMAN->Remove( pToDelete->m_sFile ) )
|
|
||||||
return false;
|
return false;
|
||||||
FlushDirCache();
|
FlushDirCache();
|
||||||
|
PROFILEMAN->LoadMachineProfile();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString YOU_MUST_SUPPLY_NAME ( "WorkoutManager", "You must supply a name for your workout." );
|
static LocalizedString YOU_MUST_SUPPLY_NAME ( "WorkoutManager", "You must supply a name for your workout." );
|
||||||
static LocalizedString EDIT_NAME_CONFLICTS ( "WorkoutManager", "The name you chose conflicts with another workout. Please use a different name." );
|
static LocalizedString EDIT_NAME_CONFLICTS ( "WorkoutManager", "The name you chose conflicts with another workout. Please use a different name." );
|
||||||
static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "WorkoutManager", "The workout name cannot contain any of the following characters: %s" );
|
static LocalizedString EDIT_NAME_CANNOT_CONTAIN ( "WorkoutManager", "The workout name cannot contain any of the following characters: %s" );
|
||||||
bool WorkoutManager::ValidateWorkoutName( const RString &sAnswer, RString &sErrorOut )
|
bool EditCourseUtil::ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut )
|
||||||
{
|
{
|
||||||
if( sAnswer.empty() )
|
if( sAnswer.empty() )
|
||||||
{
|
{
|
||||||
@@ -127,15 +70,15 @@ bool WorkoutManager::ValidateWorkoutName( const RString &sAnswer, RString &sErro
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Workout *pWorkout = WORKOUTMAN->m_pCurWorkout;
|
// Check for name conflicts
|
||||||
|
vector<Course*> vpCourses;
|
||||||
// Steps name must be unique for this song.
|
EditCourseUtil::GetAllEditCourses( vpCourses );
|
||||||
FOREACH_CONST( Workout*, WORKOUTMAN->m_vpAllWorkouts, p )
|
FOREACH_CONST( Course*, vpCourses, p )
|
||||||
{
|
{
|
||||||
if( pWorkout == *p )
|
if( GAMESTATE->m_pCurCourse == *p )
|
||||||
continue; // don't comepare name against ourself
|
continue; // don't comepare name against ourself
|
||||||
|
|
||||||
if( (*p)->m_sName == sAnswer )
|
if( (*p)->GetDisplayFullTitle() == sAnswer )
|
||||||
{
|
{
|
||||||
sErrorOut = EDIT_NAME_CONFLICTS;
|
sErrorOut = EDIT_NAME_CONFLICTS;
|
||||||
return false;
|
return false;
|
||||||
@@ -145,73 +88,76 @@ bool WorkoutManager::ValidateWorkoutName( const RString &sAnswer, RString &sErro
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkoutManager::GetWorkoutSongsForGenres( const vector<RString> &vsSongGenres, vector<Song*> &vpSongsOut )
|
void EditCourseUtil::UpdateAndSetTrail()
|
||||||
{
|
{
|
||||||
SongCriteria soc;
|
StepsType st = GAMESTATE->m_pCurStyle->m_StepsType;
|
||||||
soc.m_Selectable = SongCriteria::Selectable_Yes;
|
Trail *pTrail = GAMESTATE->m_pCurCourse->GetTrailForceRegenCache( st );
|
||||||
soc.m_bUseSongGenreAllowedList = true;
|
ASSERT( pTrail );
|
||||||
soc.m_vsSongGenreAllowedList = vsSongGenres;
|
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
|
||||||
SongUtil::FilterSongs( soc, SONGMAN->GetSongs(), vpSongsOut );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString SONGS_ENABLED( "WorkoutManager", "%d/%d songs enabled" );
|
void EditCourseUtil::PrepareForPlay()
|
||||||
static RString GetWorkoutSongsOverview()
|
|
||||||
{
|
{
|
||||||
SongCriteria soc;
|
GAMESTATE->m_pCurSong.Set( NULL ); // CurSong will be set if we back out. Set it back to NULL so that ScreenStage won't show the last song.
|
||||||
|
GAMESTATE->m_PlayMode.Set( PLAY_MODE_ENDLESS );
|
||||||
|
GAMESTATE->m_bSideIsJoined[0] = true;
|
||||||
|
|
||||||
Workout defaultWorkout;
|
PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_GoalType = GoalType_Time;
|
||||||
WORKOUTMAN->LoadDefaults( defaultWorkout );
|
Course *pCourse = GAMESTATE->m_pCurCourse;
|
||||||
soc.m_Selectable = SongCriteria::Selectable_Yes;
|
PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = pCourse->m_fGoalSeconds;
|
||||||
vector<Song*> vpAllSongs;
|
|
||||||
WORKOUTMAN->GetWorkoutSongsForGenres( defaultWorkout.m_vsSongGenres, vpAllSongs );
|
|
||||||
|
|
||||||
vector<Song*> vpSelectedSongs;
|
|
||||||
WORKOUTMAN->GetWorkoutSongsForGenres( WORKOUTMAN->m_pCurWorkout->m_vsSongGenres, vpSelectedSongs );
|
|
||||||
|
|
||||||
return ssprintf( SONGS_ENABLED.GetValue(), (int)vpSelectedSongs.size(), (int)vpAllSongs.size() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static RString GetWorkoutSongTitleText()
|
void EditCourseUtil::GetAllEditCourses( vector<Course*> &vpCoursesOut )
|
||||||
{
|
{
|
||||||
vector<RString> vs;
|
vector<Course*> vpCoursesTemp;
|
||||||
FOREACH_CONST( RString, WORKOUTMAN->m_pCurWorkout->m_vsSongGenres, s )
|
SONGMAN->GetAllCourses( vpCoursesTemp, false );
|
||||||
|
FOREACH_CONST( Course*, vpCoursesTemp, c )
|
||||||
{
|
{
|
||||||
RString s2 = *s;
|
if( (*c)->GetLoadedFromProfileSlot() != ProfileSlot_Invalid )
|
||||||
s2.Replace( " ", " " );
|
vpCoursesOut.push_back( *c );
|
||||||
vs.push_back( s2 );
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// show max N to avoid frame rate slowdown
|
void EditCourseUtil::LoadDefaults( Course &out )
|
||||||
if( vs.size() >= 40 )
|
{
|
||||||
|
out = Course();
|
||||||
|
|
||||||
|
out.m_fGoalSeconds = 0;
|
||||||
|
|
||||||
|
// pick a default name
|
||||||
|
// XXX: Make this localizable
|
||||||
|
for( int i=0; i<10000; i++ )
|
||||||
|
{
|
||||||
|
out.m_sMainTitle = ssprintf("Workout %d", i+1);
|
||||||
|
bool bNameInUse = false;
|
||||||
|
|
||||||
|
vector<Course*> vpCourses;
|
||||||
|
EditCourseUtil::GetAllEditCourses( vpCourses );
|
||||||
|
FOREACH_CONST( Course*, vpCourses, p )
|
||||||
|
{
|
||||||
|
if( out.m_sMainTitle == (*p)->m_sMainTitle )
|
||||||
|
{
|
||||||
|
bNameInUse = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !bNameInUse )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString sReturn = join( ", ", vs );
|
vector<Song*> vpSongs;
|
||||||
FontCharAliases::ReplaceMarkers( sReturn );
|
SONGMAN->GetPreferredSortSongs( vpSongs );
|
||||||
return sReturn;
|
for( int i=0; i<(int)vpSongs.size() && i<6; i++ )
|
||||||
|
{
|
||||||
|
CourseEntry ce;
|
||||||
|
ce.songID.FromSong( vpSongs[i] );
|
||||||
|
ce.stepsCriteria.m_difficulty = Difficulty_Easy;
|
||||||
|
out.m_vEntries.push_back( ce );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// lua start
|
|
||||||
#include "LuaBinding.h"
|
|
||||||
|
|
||||||
class LunaWorkoutManager: public Luna<WorkoutManager>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static int GetCurrentWorkout( T* p, lua_State *L ) { if(p->m_pCurWorkout) p->m_pCurWorkout->PushSelf(L); else lua_pushnil(L); return 1; }
|
|
||||||
static int GetWorkoutSongsOverview( T* p, lua_State *L ) { lua_pushstring( L, ::GetWorkoutSongsOverview() ); return 1; }
|
|
||||||
static int GetWorkoutSongTitleText( T* p, lua_State *L ) { lua_pushstring( L, ::GetWorkoutSongTitleText() ); return 1; }
|
|
||||||
|
|
||||||
LunaWorkoutManager()
|
|
||||||
{
|
|
||||||
ADD_METHOD( GetCurrentWorkout );
|
|
||||||
ADD_METHOD( GetWorkoutSongsOverview );
|
|
||||||
ADD_METHOD( GetWorkoutSongTitleText );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
LUA_REGISTER_CLASS( WorkoutManager )
|
|
||||||
// lua end
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Chris Danford
|
* (c) 2003-2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -1,41 +1,26 @@
|
|||||||
#ifndef WorkoutManager_H
|
#ifndef WorkoutManager_H
|
||||||
#define WorkoutManager_H
|
#define WorkoutManager_H
|
||||||
|
|
||||||
struct lua_State;
|
|
||||||
class Song;
|
|
||||||
class Workout;
|
|
||||||
class Course;
|
class Course;
|
||||||
|
|
||||||
const int MAX_WORKOUT_NAME_LENGTH = 16;
|
namespace EditCourseUtil
|
||||||
const int MAX_WORKOUTS_PER_PROFILE = 32;
|
|
||||||
|
|
||||||
class WorkoutManager
|
|
||||||
{
|
{
|
||||||
public:
|
void UpdateAndSetTrail();
|
||||||
WorkoutManager();
|
void PrepareForPlay();
|
||||||
~WorkoutManager();
|
void LoadDefaults( Course &out );
|
||||||
|
bool RemoveAndDeleteFile( Course *pCourse );
|
||||||
|
bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut );
|
||||||
|
void GetAllEditCourses( vector<Course*> &vpCoursesOut );
|
||||||
|
bool Save( Course *pCourse );
|
||||||
|
bool RenameAndSave( Course *pCourse, RString sName );
|
||||||
|
|
||||||
void LoadAllFromDisk();
|
bool ValidateEditCourseNametName( const RString &sAnswer, RString &sErrorOut );
|
||||||
|
|
||||||
void LoadDefaults( Workout &out );
|
extern int MAX_NAME_LENGTH;
|
||||||
bool RenameAndSave( Workout *pToRename, RString sNewName );
|
extern int MAX_PER_PROFILE;
|
||||||
bool Save( Workout *pToRename );
|
extern bool s_bNewCourseNeedsName; // if true, we are working with a Course that has never been named
|
||||||
bool RemoveAndDeleteFile( Workout *pToDelete );
|
|
||||||
|
|
||||||
static bool ValidateWorkoutName( const RString &sAnswer, RString &sErrorOut );
|
|
||||||
|
|
||||||
void GetWorkoutSongsForGenres( const vector<RString> &vsSongGenres, vector<Song*> &vpSongsOut );
|
|
||||||
|
|
||||||
vector<Workout*> m_vpAllWorkouts;
|
|
||||||
Workout *m_pCurWorkout;
|
|
||||||
|
|
||||||
Course *m_pTempCourse;
|
|
||||||
|
|
||||||
// Lua
|
|
||||||
void PushSelf( lua_State *L );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WorkoutManager* WORKOUTMAN; // global and accessable from anywhere in our program
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user