diff --git a/src/Profile.cpp b/src/Profile.cpp index 68b0871314..e7d906fe6a 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -25,6 +25,7 @@ #include "Game.h" #include "CharacterManager.h" #include "Character.h" +#include "MinaCalc.h" #include @@ -2041,6 +2042,53 @@ float Profile::CalcPlayerRating() const { return scoreagg(vSSR); } +void Profile::ResetAllSSRs() { + FOREACHM(SongID, HighScoresForASong, m_SongHighScores, i) { + const SongID& id = i->first; + HighScoresForASong& hsfas = i->second; + FOREACHM(StepsID, HighScoresForASteps, hsfas.m_StepsHighScores, j) { + HighScoresForASteps& zz = j->second; + vector& hsv = zz.hsl.vHighScores; + for (size_t i = 0; i < hsv.size(); i++) + hsv[i].SetSSR(0.f); + } + } + m_fPlayerRating = 0.f; +} + +// should prolly generalize some of the stuff here - mina +void Profile::RecalculateAllSSRs() { + FOREACHM(SongID, HighScoresForASong, m_SongHighScores, i) { + const SongID& id = i->first; + HighScoresForASong& hsfas = i->second; + FOREACHM(StepsID, HighScoresForASteps, hsfas.m_StepsHighScores, j) { + HighScoresForASteps& zz = j->second; + vector& hsv = zz.hsl.vHighScores; + for (size_t i = 0; i < hsv.size(); i++) { + float wifescore = hsv[i].GetWifeScore(); + if (wifescore < 0.9f || hsv[i].GetGrade() == Grade_Failed) + hsv[i].SetSSR(0.f); + else { + Song* psong = id.ToSong(); + Steps* psteps= j->first.ToSteps(psong, false); + + NoteData& nd = psteps->GetNoteData(); + TimingData* td = psteps->GetTimingData(); + float musicrate = hsv[i].GetMusicRate(); + + vector& nerv = nd.GetNonEmptyRowVector(); + vector etaner; + + for (size_t i = 0; i < nerv.size(); i++) + etaner.push_back(td->GetElapsedTimeFromBeatNoOffset(NoteRowToBeat(nerv[i]))); + + hsv[i].SetSSR(MinaSDCalc(nd, etaner, musicrate, wifescore, 1.f, td->HasWarps())[0]); + } + } + } + } +} + // nonlinear plsszz - mina float Profile::scoreagg(vector invector) const { if (invector.size() == 0) diff --git a/src/Profile.h b/src/Profile.h index cbba1d3c26..3d69ca8803 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -51,7 +51,7 @@ extern const RString LASTGOOD_SUBDIR; // extern const RString RIVAL_SUBDIR; /** @brief The max number of characters that can be used in a profile. */ -const unsigned int PROFILE_MAX_DISPLAY_NAME_LENGTH = 32; +const unsigned int PROFILE_MAX_DISPLAY_NAME_LENGTH = 64; class Style; @@ -313,6 +313,8 @@ class Profile int GetCategoryNumTimesPlayed( StepsType st ) const; void IncrementCategoryPlayCount( StepsType st, RankingCategory rc ); float CalcPlayerRating() const; + void ResetAllSSRs(); + void RecalculateAllSSRs(); float scoreagg(vector) const; /* Grabbing the highscores here and having lua invoke this results in unhandled exception errors diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 3f9cfcbac6..7e6e2d6388 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -142,6 +142,8 @@ void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNum pProfile->m_iNumStagesPassedByGrade[ss.m_player[pn].GetGrade()] ++; } + //pProfile->ResetAllSSRs(); + //pProfile->RecalculateAllSSRs(); pProfile->m_fPlayerRating = pProfile->CalcPlayerRating(); } diff --git a/stepmania.nsi b/stepmania.nsi index 0593332d15..950c955143 100644 --- a/stepmania.nsi +++ b/stepmania.nsi @@ -400,6 +400,7 @@ Section "Main Section" SecMain File /r /x CVS /x .svn "Songs\Etterna*" ; remove and install themes + RMDir /r "$INSTDIR\Themes\Til Death" RMDir /r "$INSTDIR\Themes\_fallback" RMDir /r "$INSTDIR\Themes\_portKit-sm4" RMDir /r "$INSTDIR\Themes\default"