profiles are usable
This commit is contained in:
@@ -1959,6 +1959,7 @@ Player1Profile=
|
||||
Player2Profile=
|
||||
CreateNew=
|
||||
Delete=
|
||||
Rename=
|
||||
|
||||
[ScreenUnlock]
|
||||
UseUnlocksDat=1
|
||||
|
||||
@@ -249,6 +249,7 @@ const int ITEM_NONE = -1;
|
||||
#define RANDOMMOVIES_DIR CString(BASE_PATH "RandomMovies" SLASH)
|
||||
|
||||
|
||||
#define PROFILES_DIR BASE_PATH "Data" SLASH "Profiles" SLASH
|
||||
|
||||
|
||||
//
|
||||
|
||||
@@ -144,5 +144,11 @@ void ModeChoice::Apply( PlayerNumber pn )
|
||||
GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY;
|
||||
|
||||
|
||||
PROFILEMAN->TryLoadProfile( pn );
|
||||
//
|
||||
// We know what players are joined at the time we set the Style
|
||||
//
|
||||
if( style != STYLE_INVALID )
|
||||
{
|
||||
PROFILEMAN->TryLoadProfile( pn );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Steps.h"
|
||||
#include "song.h"
|
||||
#include "Course.h"
|
||||
#include "ProfileManager.h"
|
||||
|
||||
|
||||
// WheelItem stuff
|
||||
@@ -186,8 +187,7 @@ void MusicWheelItem::RefreshGrades()
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !data->m_pSong || // this isn't a song display
|
||||
!GAMESTATE->IsHumanPlayer(p) ||
|
||||
!SONGMAN->IsUsingMemoryCard((PlayerNumber)p) )
|
||||
!GAMESTATE->IsHumanPlayer(p) )
|
||||
{
|
||||
m_GradeDisplay[p].SetDiffuse( RageColor(1,1,1,0) );
|
||||
continue;
|
||||
@@ -198,7 +198,12 @@ void MusicWheelItem::RefreshGrades()
|
||||
dc = GAMESTATE->m_pCurNotes[p]->GetDifficulty();
|
||||
else
|
||||
dc = GAMESTATE->m_PreferredDifficulty[p];
|
||||
const Grade grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (PlayerNumber)p, dc );
|
||||
Grade grade;
|
||||
if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) )
|
||||
grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (MemoryCard)p, dc );
|
||||
else
|
||||
grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), MEMORY_CARD_MACHINE, dc );
|
||||
|
||||
m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade );
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,16 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "IniFile.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "SongManager.h"
|
||||
|
||||
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
|
||||
#define PROFILES_DIR BASE_PATH "Data" SLASH "Profiles" SLASH
|
||||
#define PROFILE_FILE "Profile.ini"
|
||||
|
||||
#define NOTES_SCORES_FILE "NotesScores.dat"
|
||||
#define COURSE_SCORES_FILE "CourseScores.dat"
|
||||
|
||||
ProfileManager::ProfileManager()
|
||||
{
|
||||
@@ -35,22 +38,42 @@ ProfileManager::~ProfileManager()
|
||||
|
||||
}
|
||||
|
||||
void ProfileManager::GetProfileNames( vector<CString> &asNamesOut )
|
||||
void ProfileManager::GetProfiles( vector<CString> &asNamesOut )
|
||||
{
|
||||
// don't pick up the profile named "Machine"
|
||||
GetDirListing( PROFILES_DIR "0*", asNamesOut, true, false );
|
||||
}
|
||||
|
||||
void ProfileManager::GetProfileDisplayNames( vector<CString> &asNamesOut )
|
||||
{
|
||||
CStringArray vsProfiles;
|
||||
GetProfiles( vsProfiles );
|
||||
for( unsigned i=0; i<vsProfiles.size(); i++ )
|
||||
{
|
||||
CString sProfile = vsProfiles[i];
|
||||
|
||||
Profile pro;
|
||||
pro.LoadFromIni( PROFILES_DIR + sProfile + SLASH + PROFILE_FILE );
|
||||
asNamesOut.push_back( pro.m_sDisplayName );
|
||||
}
|
||||
}
|
||||
|
||||
bool ProfileManager::DoesProfileExist( CString sProfile )
|
||||
{
|
||||
vector<CString> vsProfiles;
|
||||
GetProfiles( vsProfiles );
|
||||
|
||||
return find(vsProfiles.begin(), vsProfiles.end(), sProfile) != vsProfiles.end();
|
||||
}
|
||||
|
||||
|
||||
void ProfileManager::TryLoadProfile( PlayerNumber pn )
|
||||
{
|
||||
CString sProfile = PREFSMAN->m_sDefaultProfile[pn];
|
||||
if( sProfile.empty() )
|
||||
return;
|
||||
|
||||
vector<CString> vsProfiles;
|
||||
GetProfileNames( vsProfiles );
|
||||
|
||||
if( find(vsProfiles.begin(), vsProfiles.end(), "sProfile") == vsProfiles.end() )
|
||||
if( !DoesProfileExist(sProfile) )
|
||||
{
|
||||
LOG->Warn( "Default profile '%s' does not exist", sProfile.c_str() );
|
||||
return;
|
||||
@@ -58,11 +81,14 @@ void ProfileManager::TryLoadProfile( PlayerNumber pn )
|
||||
|
||||
m_sProfileDir[pn] = PROFILES_DIR + sProfile + SLASH;
|
||||
|
||||
IniFile ini( m_sProfileDir[pn]+PROFILE_FILE );
|
||||
ini.ReadFile();
|
||||
m_Profile[pn].LoadFromIni( m_sProfileDir[pn]+PROFILE_FILE );
|
||||
|
||||
m_sDisplayName[pn] = ssprintf("No Name");
|
||||
ini.GetValue( "Profile", "DisplayName", m_sDisplayName[pn] );
|
||||
|
||||
//
|
||||
// Load scores into SONGMAN
|
||||
//
|
||||
SONGMAN->ReadNoteScoresFromFile( m_sProfileDir[pn]+NOTES_SCORES_FILE, (MemoryCard)pn );
|
||||
SONGMAN->ReadCourseScoresFromFile( m_sProfileDir[pn]+COURSE_SCORES_FILE, (MemoryCard)pn );
|
||||
}
|
||||
|
||||
void ProfileManager::UnloadProfile( PlayerNumber pn )
|
||||
@@ -70,9 +96,79 @@ void ProfileManager::UnloadProfile( PlayerNumber pn )
|
||||
if( m_sProfileDir[pn].empty() )
|
||||
return;
|
||||
|
||||
IniFile ini( m_sProfileDir[pn]+PROFILE_FILE );
|
||||
m_Profile[pn].WriteToIni( m_sProfileDir[pn]+PROFILE_FILE );
|
||||
|
||||
ini.SetValue( "Profile", "DisplayName", m_sDisplayName[pn] );
|
||||
//
|
||||
// Save scores into SONGMAN
|
||||
//
|
||||
SONGMAN->SaveNoteScoresToFile( m_sProfileDir[pn]+NOTES_SCORES_FILE, (MemoryCard)pn );
|
||||
SONGMAN->SaveCourseScoresToFile( m_sProfileDir[pn]+COURSE_SCORES_FILE, (MemoryCard)pn );
|
||||
}
|
||||
|
||||
CString ProfileManager::GetDisplayName( PlayerNumber pn )
|
||||
{
|
||||
ASSERT(!m_sProfileDir[pn].empty());
|
||||
return m_Profile[pn].m_sDisplayName;
|
||||
}
|
||||
|
||||
bool Profile::LoadFromIni( CString sIniPath )
|
||||
{
|
||||
Init();
|
||||
|
||||
CString sDir, sFName, sExt;
|
||||
splitrelpath( sIniPath, sDir, sFName, sExt );
|
||||
|
||||
CStringArray asBits;
|
||||
split( sDir, SLASH, asBits, true );
|
||||
CString sLastDir = asBits.back(); // this is a number name, e.g. "0000001"
|
||||
|
||||
// Fill in a default value in case ini doesn't have it.
|
||||
m_sDisplayName = ssprintf("Profile%d", atoi(sLastDir));
|
||||
|
||||
|
||||
//
|
||||
// read ini
|
||||
//
|
||||
IniFile ini( sIniPath );
|
||||
if( !ini.ReadFile() )
|
||||
return false;
|
||||
|
||||
ini.GetValue( "Profile", "DisplayName", m_sDisplayName );
|
||||
ini.GetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Profile::WriteToIni( CString sIniPath )
|
||||
{
|
||||
IniFile ini( sIniPath );
|
||||
ini.SetValue( "Profile", "DisplayName", m_sDisplayName );
|
||||
ini.SetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName );
|
||||
ini.WriteFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ProfileManager::CreateProfile( CString sDisplayName )
|
||||
{
|
||||
//
|
||||
// Find a free directory name in the profiles directory
|
||||
//
|
||||
CString sProfile, sDir;
|
||||
for( int i=0; i<1000; i++ )
|
||||
{
|
||||
sProfile = ssprintf("%08d",i);
|
||||
sDir = PROFILES_DIR + sProfile;
|
||||
if( !DoesFileExist(sDir) )
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
CreateDirectories( sDir );
|
||||
|
||||
sDir += SLASH;
|
||||
|
||||
Profile pro;
|
||||
pro.m_sDisplayName = sDisplayName;
|
||||
pro.WriteToIni( sDir + PROFILE_FILE );
|
||||
|
||||
FlushDirCache();
|
||||
}
|
||||
|
||||
@@ -15,18 +15,38 @@
|
||||
|
||||
#include "PlayerNumber.h"
|
||||
|
||||
struct Profile
|
||||
{
|
||||
Profile() { Init(); }
|
||||
void Init()
|
||||
{
|
||||
m_sDisplayName = "";
|
||||
m_sLastUsedHighScoreName = "";
|
||||
}
|
||||
|
||||
bool LoadFromIni( CString sIniPath );
|
||||
bool WriteToIni( CString sIniPath );
|
||||
CString m_sDisplayName;
|
||||
CString m_sLastUsedHighScoreName;
|
||||
};
|
||||
|
||||
class ProfileManager
|
||||
{
|
||||
public:
|
||||
ProfileManager();
|
||||
~ProfileManager();
|
||||
|
||||
void GetProfileNames( vector<CString> &asNamesOut );
|
||||
void CreateProfile( CString sDisplayName );
|
||||
|
||||
bool DoesProfileExist( CString sProfile );
|
||||
|
||||
void GetProfiles( vector<CString> &asProfilesOut );
|
||||
void GetProfileDisplayNames( vector<CString> &asNamesOut );
|
||||
|
||||
void TryLoadProfile( PlayerNumber pn );
|
||||
void UnloadProfile( PlayerNumber pn );
|
||||
|
||||
CString sGetDisplayName( PlayerNumber pn ) { ASSERT(!m_sProfileDir[pn].empty()); return m_sProfileDir[pn]; }
|
||||
CString GetDisplayName( PlayerNumber pn );
|
||||
|
||||
bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); }
|
||||
|
||||
@@ -38,8 +58,7 @@ private:
|
||||
CString m_sProfileDir[NUM_PLAYERS];
|
||||
bool m_bUsingMemoryCard[NUM_PLAYERS];
|
||||
|
||||
// cached from profile.ini
|
||||
CString m_sDisplayName[NUM_PLAYERS];
|
||||
Profile m_Profile[NUM_PLAYERS];
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -363,6 +363,11 @@ bool CreateDirectories( CString Path )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rename( const char *oldname, const char *newname )
|
||||
{
|
||||
return 0 == rename( oldname, newname );
|
||||
}
|
||||
|
||||
#if 0
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo )
|
||||
{
|
||||
|
||||
@@ -201,6 +201,7 @@ CString join(const CString &Deliminator, const CStringArray& Source);
|
||||
|
||||
CString GetCwd();
|
||||
bool CreateDirectories( CString Path );
|
||||
bool Rename( const char *oldname, const char *newname );
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false, bool bReturnPathToo=false );
|
||||
|
||||
unsigned int GetHashForString( CString s );
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "BitmapText.h"
|
||||
#include "Quad.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "ProfileManager.h"
|
||||
|
||||
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -182,6 +183,8 @@ void ScreenSystemLayer::RefreshCreditsMessages()
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) )
|
||||
sText += " " + PROFILEMAN->GetDisplayName((PlayerNumber)p);
|
||||
m_textCreditInfo[p].SetText( sText );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ enum {
|
||||
PO_PLAYER2,
|
||||
PO_CREATE_NEW,
|
||||
PO_DELETE_,
|
||||
PO_RENAME_,
|
||||
NUM_GAMEPLAY_OPTIONS_LINES
|
||||
};
|
||||
|
||||
@@ -33,6 +34,7 @@ OptionRow g_ProfileOptionsLines[NUM_GAMEPLAY_OPTIONS_LINES] = {
|
||||
OptionRow( "Player2\nProfile", true ),
|
||||
OptionRow( "Create\nNew", true, "PRESS START" ),
|
||||
OptionRow( "Delete", true ),
|
||||
OptionRow( "Rename", true ),
|
||||
};
|
||||
|
||||
ScreenProfileOptions::ScreenProfileOptions() :
|
||||
@@ -41,19 +43,20 @@ ScreenProfileOptions::ScreenProfileOptions() :
|
||||
LOG->Trace( "ScreenProfileOptions::ScreenProfileOptions()" );
|
||||
|
||||
g_ProfileOptionsLines[PO_PLAYER1].choices.clear();
|
||||
PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_PLAYER1].choices );
|
||||
if( g_ProfileOptionsLines[PO_PLAYER1].choices.empty() )
|
||||
g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" );
|
||||
g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" );
|
||||
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER1].choices );
|
||||
|
||||
g_ProfileOptionsLines[PO_PLAYER2].choices.clear();
|
||||
PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_PLAYER2].choices );
|
||||
if( g_ProfileOptionsLines[PO_PLAYER2].choices.empty() )
|
||||
g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" );
|
||||
g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" );
|
||||
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER2].choices );
|
||||
|
||||
g_ProfileOptionsLines[PO_DELETE_].choices.clear();
|
||||
PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_DELETE_].choices );
|
||||
if( g_ProfileOptionsLines[PO_DELETE_].choices.empty() )
|
||||
g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" );
|
||||
g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" );
|
||||
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_DELETE_].choices );
|
||||
|
||||
g_ProfileOptionsLines[PO_RENAME_].choices.clear();
|
||||
g_ProfileOptionsLines[PO_RENAME_].choices.push_back( "-NONE-" );
|
||||
PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_RENAME_].choices );
|
||||
|
||||
Init(
|
||||
INPUTMODE_TOGETHER,
|
||||
@@ -67,27 +70,40 @@ ScreenProfileOptions::ScreenProfileOptions() :
|
||||
|
||||
void ScreenProfileOptions::ImportOptions()
|
||||
{
|
||||
vector<CString> vsProfiles;
|
||||
PROFILEMAN->GetProfiles( vsProfiles );
|
||||
|
||||
CStringArray::iterator iter;
|
||||
|
||||
iter = find(
|
||||
g_ProfileOptionsLines[PO_PLAYER1].choices.begin(),
|
||||
g_ProfileOptionsLines[PO_PLAYER1].choices.end(),
|
||||
vsProfiles.begin(),
|
||||
vsProfiles.end(),
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_1] );
|
||||
if( iter != g_ProfileOptionsLines[PO_PLAYER1].choices.end() )
|
||||
m_iSelectedOption[0][PO_PLAYER1] = iter - g_ProfileOptionsLines[PO_PLAYER1].choices.begin();
|
||||
if( iter != vsProfiles.end() )
|
||||
m_iSelectedOption[0][PO_PLAYER1] = iter - vsProfiles.begin() + 1;
|
||||
|
||||
iter = find(
|
||||
g_ProfileOptionsLines[PO_PLAYER2].choices.begin(),
|
||||
g_ProfileOptionsLines[PO_PLAYER2].choices.end(),
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_2] );
|
||||
if( iter != g_ProfileOptionsLines[PO_PLAYER2].choices.end() )
|
||||
m_iSelectedOption[0][PO_PLAYER2] = iter - g_ProfileOptionsLines[PO_PLAYER2].choices.begin();
|
||||
vsProfiles.begin(),
|
||||
vsProfiles.end(),
|
||||
PREFSMAN->m_sDefaultProfile[PO_PLAYER2] );
|
||||
if( iter != vsProfiles.end() )
|
||||
m_iSelectedOption[0][PO_PLAYER2] = iter - vsProfiles.begin() + 1;
|
||||
}
|
||||
|
||||
void ScreenProfileOptions::ExportOptions()
|
||||
{
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_1] = g_ProfileOptionsLines[PO_PLAYER1].choices[m_iSelectedOption[0][PO_PLAYER1]];
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_2] = g_ProfileOptionsLines[PO_PLAYER2].choices[m_iSelectedOption[0][PO_PLAYER2]];
|
||||
vector<CString> vsProfiles;
|
||||
PROFILEMAN->GetProfiles( vsProfiles );
|
||||
|
||||
if( m_iSelectedOption[0][PO_PLAYER1] > 0 )
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_1] = vsProfiles[m_iSelectedOption[0][PO_PLAYER1]-1];
|
||||
else
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_1] = "";
|
||||
|
||||
if( m_iSelectedOption[0][PO_PLAYER2] > 0 )
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_2] = vsProfiles[m_iSelectedOption[0][PO_PLAYER2]-1];
|
||||
else
|
||||
PREFSMAN->m_sDefaultProfile[PLAYER_2] = "";
|
||||
}
|
||||
|
||||
void ScreenProfileOptions::GoToPrevState()
|
||||
@@ -95,8 +111,49 @@ void ScreenProfileOptions::GoToPrevState()
|
||||
SCREENMAN->SetNewScreen( "ScreenOptionsMenu" );
|
||||
}
|
||||
|
||||
void CreateProfile( CString sDisplayName )
|
||||
{
|
||||
PROFILEMAN->CreateProfile( sDisplayName );
|
||||
SCREENMAN->SetNewScreen( "ScreenProfileOptions" );
|
||||
}
|
||||
|
||||
void ScreenProfileOptions::GoToNextState()
|
||||
{
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
GoToPrevState();
|
||||
}
|
||||
|
||||
void ScreenProfileOptions::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
vector<CString> vsProfiles;
|
||||
PROFILEMAN->GetProfiles( vsProfiles );
|
||||
|
||||
switch( GetCurrentRow() )
|
||||
{
|
||||
case PO_CREATE_NEW:
|
||||
SCREENMAN->TextEntry( SM_None, "Enter a profile name", "", CreateProfile );
|
||||
return;
|
||||
case PO_DELETE_:
|
||||
{
|
||||
CString sProfile;
|
||||
if( m_iSelectedOption[0][PO_DELETE_] > 0 )
|
||||
sProfile = vsProfiles[m_iSelectedOption[0][PO_DELETE_]-1];
|
||||
else
|
||||
sProfile = "";
|
||||
}
|
||||
break;
|
||||
case PO_RENAME_:
|
||||
{
|
||||
CString sProfile;
|
||||
if( m_iSelectedOption[0][PO_RENAME_] > 0 )
|
||||
sProfile = vsProfiles[m_iSelectedOption[0][PO_RENAME_]-1];
|
||||
else
|
||||
sProfile = "";
|
||||
|
||||
// SCREENMAN->TextEntry( SM_None, "Enter a profile name", "NewProfile", SetProfile );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ScreenOptions::MenuStart( pn );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ class ScreenProfileOptions : public ScreenOptions
|
||||
public:
|
||||
ScreenProfileOptions();
|
||||
|
||||
virtual void MenuStart( PlayerNumber pn );
|
||||
|
||||
private:
|
||||
void ImportOptions();
|
||||
void ExportOptions();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "RageDisplay.h"
|
||||
#include "RageTextureManager.h"
|
||||
#include "Course.h"
|
||||
#include "ProfileManager.h"
|
||||
|
||||
|
||||
const int NUM_SCORE_DIGITS = 9;
|
||||
@@ -886,8 +887,19 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
||||
// m_BPMDisplay.BeginTweening( 0.2f );
|
||||
// m_BPMDisplay.SetZoomY( 1.2f );
|
||||
|
||||
if( pNotes && SONGMAN->IsUsingMemoryCard(pn) )
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, pNotes->m_MemCardScores[pn].iScore) );
|
||||
if( pNotes )
|
||||
{
|
||||
int iScore;
|
||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||
iScore = pNotes->m_MemCardScores[pn].iScore;
|
||||
else
|
||||
iScore = pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].iScore;
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, 0) );
|
||||
}
|
||||
|
||||
m_DifficultyIcon[pn].SetFromNotes( pn, pNotes );
|
||||
if( pNotes && pNotes->IsAutogen() )
|
||||
|
||||
@@ -56,8 +56,6 @@ ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuesti
|
||||
this->AddChild( &m_textQuestion );
|
||||
|
||||
m_rectAnswerBox.SetDiffuse( RageColor(0.5f,0.5f,1.0f,0.7f) );
|
||||
this->AddChild( &m_rectAnswerBox );
|
||||
|
||||
m_rectAnswerBox.SetXY( ANSWER_X, ANSWER_Y );
|
||||
m_rectAnswerBox.SetZoomX( ANSWER_WIDTH );
|
||||
m_rectAnswerBox.SetZoomY( ANSWER_HEIGHT );
|
||||
|
||||
@@ -1159,7 +1159,7 @@ void Song::RemoveAutoGenNotes()
|
||||
}
|
||||
|
||||
|
||||
Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficulty dc ) const
|
||||
Grade Song::GetGradeForDifficulty( const StyleDef *st, MemoryCard card, Difficulty dc ) const
|
||||
{
|
||||
// return max grade of notes in difficulty class
|
||||
vector<Steps*> aNotes;
|
||||
@@ -1172,7 +1172,7 @@ Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficul
|
||||
{
|
||||
const Steps* pNotes = aNotes[i];
|
||||
if( pNotes->GetDifficulty() == dc )
|
||||
grade = max( grade, pNotes->m_MemCardScores[pn].grade );
|
||||
grade = max( grade, pNotes->m_MemCardScores[card].grade );
|
||||
}
|
||||
return grade;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ SongManager* SONGMAN = NULL; // global and accessable from anywhere in our progr
|
||||
#define SONGS_DIR BASE_PATH "Songs" SLASH
|
||||
#define COURSES_DIR BASE_PATH "Courses" SLASH
|
||||
#define STATS_PATH BASE_PATH "stats.html"
|
||||
const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat";
|
||||
const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat";
|
||||
const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1NotesScores.dat", BASE_PATH "Data" SLASH "Player2NotesScores.dat", BASE_PATH "Data" SLASH "MachineNotesScores.dat" };
|
||||
const CString COURSE_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1CourseScores.dat", BASE_PATH "Data" SLASH "Player2CourseScores.dat", BASE_PATH "Data" SLASH "MachineCourseScores.dat" };
|
||||
const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat";
|
||||
const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat";
|
||||
const CString MACHINE_NOTES_SCORES_FILE = "Data" SLASH "MachineNotesScores.dat";
|
||||
const CString MACHINE_COURSE_SCORES_FILE = "Data" SLASH "MachineCourseScores.dat";
|
||||
const int CATEGORY_RANKING_VERSION = 1;
|
||||
const int COURSE_RANKING_VERSION = 1;
|
||||
const int NOTES_SCORES_VERSION = 2;
|
||||
@@ -122,11 +122,8 @@ void SongManager::SaveMachineScoresToDisk()
|
||||
{
|
||||
SaveCategoryRankingsToFile( CATEGORY_RANKING_FILE );
|
||||
SaveCourseRankingsToFile( COURSE_RANKING_FILE );
|
||||
for( int c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
{
|
||||
SaveNoteScoresToFile( NOTES_SCORES_FILE[c], c );
|
||||
SaveCourseScoresToFile( COURSE_SCORES_FILE[c], c );
|
||||
}
|
||||
SaveNoteScoresToFile( MACHINE_NOTES_SCORES_FILE, MEMORY_CARD_MACHINE );
|
||||
SaveCourseScoresToFile( MACHINE_COURSE_SCORES_FILE, MEMORY_CARD_MACHINE );
|
||||
}
|
||||
|
||||
void SongManager::InitSongsFromDisk( LoadingWindow *ld )
|
||||
@@ -485,18 +482,9 @@ void SongManager::InitMachineScoresFromDisk()
|
||||
|
||||
// category ranking
|
||||
ReadCategoryRankingsFromFile( CATEGORY_RANKING_FILE );
|
||||
|
||||
// course ranking
|
||||
ReadCourseRankingsFromFile( COURSE_RANKING_FILE );
|
||||
|
||||
int c;
|
||||
// notes scores
|
||||
for( c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
ReadNoteScoresFromFile( NOTES_SCORES_FILE[c], c );
|
||||
|
||||
// course scores
|
||||
for( c=0; c<NUM_MEMORY_CARDS; c++ )
|
||||
ReadCourseScoresFromFile( COURSE_SCORES_FILE[c], c );
|
||||
ReadNoteScoresFromFile( MACHINE_NOTES_SCORES_FILE, MEMORY_CARD_MACHINE );
|
||||
ReadCourseScoresFromFile( MACHINE_COURSE_SCORES_FILE, MEMORY_CARD_MACHINE );
|
||||
}
|
||||
|
||||
void SongManager::ReadSM300NoteScores()
|
||||
@@ -1181,12 +1169,6 @@ Course* SongManager::GetCourseFromName( CString sName )
|
||||
}
|
||||
|
||||
|
||||
bool SongManager::IsUsingMemoryCard( PlayerNumber pn )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
struct CategoryScoreToInsert
|
||||
{
|
||||
PlayerNumber pn;
|
||||
|
||||
+12
-16
@@ -89,12 +89,6 @@ public:
|
||||
void InitMachineScoresFromDisk();
|
||||
void SaveMachineScoresToDisk();
|
||||
|
||||
bool MemoryCardIsInserted( PlayerNumber pn );
|
||||
bool IsUsingMemoryCard( PlayerNumber pn );
|
||||
|
||||
void LoadMemoryCardScores( PlayerNumber pn );
|
||||
void SaveMemoryCardScores( PlayerNumber pn );
|
||||
|
||||
struct MachineScore
|
||||
{
|
||||
int iScore;
|
||||
@@ -104,6 +98,18 @@ public:
|
||||
void UpdateBest();
|
||||
|
||||
void UpdateRankingCourses();
|
||||
|
||||
void ReadSM300NoteScores();
|
||||
void ReadNoteScoresFromFile( CString fn, int c );
|
||||
void ReadCourseScoresFromFile( CString fn, int c );
|
||||
void ReadCategoryRankingsFromFile( CString fn );
|
||||
void ReadCourseRankingsFromFile( CString fn );
|
||||
|
||||
void SaveNoteScoresToFile( CString fn, int c );
|
||||
void SaveCourseScoresToFile( CString fn, int c );
|
||||
void SaveCategoryRankingsToFile( CString fn );
|
||||
void SaveCourseRankingsToFile( CString fn );
|
||||
|
||||
protected:
|
||||
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
||||
void LoadDWISongDir( CString sDir );
|
||||
@@ -112,18 +118,8 @@ protected:
|
||||
void SanityCheckGroupDir( CString sDir ) const;
|
||||
void AddGroup( CString sDir, CString sGroupDirName );
|
||||
|
||||
void ReadSM300NoteScores();
|
||||
void ReadNoteScoresFromFile( CString fn, int c );
|
||||
void ReadCourseScoresFromFile( CString fn, int c );
|
||||
void ReadCategoryRankingsFromFile( CString fn );
|
||||
void ReadCourseRankingsFromFile( CString fn );
|
||||
Song *FindSong( CString sGroup, CString sSong );
|
||||
|
||||
void SaveNoteScoresToFile( CString fn, int c );
|
||||
void SaveCourseScoresToFile( CString fn, int c );
|
||||
void SaveCategoryRankingsToFile( CString fn );
|
||||
void SaveCourseRankingsToFile( CString fn );
|
||||
|
||||
void WriteStatsWebPage();
|
||||
|
||||
vector<Song*> m_pSongs; // all songs that can be played
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
@@ -98,6 +98,10 @@ XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\Debug
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
@@ -175,6 +179,10 @@ XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\StepMania___Xbox_Release
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -379,6 +379,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="ScreenPlayerOptions.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenProfileOptions.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenProfileOptions.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenPrompt.cpp">
|
||||
</File>
|
||||
@@ -1831,6 +1837,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath=".\PrefsManager.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ProfileManager.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ProfileManager.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="ScreenManager.cpp">
|
||||
</File>
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
bool IsNew() const;
|
||||
bool IsEasy( StepsType nt ) const;
|
||||
bool HasEdits( StepsType nt ) const;
|
||||
Grade GetGradeForDifficulty( const StyleDef *s, PlayerNumber pn, Difficulty dc ) const;
|
||||
Grade GetGradeForDifficulty( const StyleDef *s, MemoryCard card, Difficulty dc ) const;
|
||||
bool NormallyDisplayed() const;
|
||||
bool RouletteDisplayed() const;
|
||||
int GetNumNotesWithGrade( Grade g ) const;
|
||||
|
||||
Reference in New Issue
Block a user