Skip to content

Commit

Permalink
sketches for future player rating recalcs
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Dec 6, 2016
1 parent ad5b0ff commit a1f4df8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
48 changes: 48 additions & 0 deletions src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Game.h"
#include "CharacterManager.h"
#include "Character.h"
#include "MinaCalc.h"

#include <algorithm>

Expand Down Expand Up @@ -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<HighScore>& 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<HighScore>& 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<int>& nerv = nd.GetNonEmptyRowVector();
vector<float> 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<float> invector) const {
if (invector.size() == 0)
Expand Down
4 changes: 3 additions & 1 deletion src/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<float>) const;

/* Grabbing the highscores here and having lua invoke this results in unhandled exception errors
Expand Down
2 changes: 2 additions & 0 deletions src/StatsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
1 change: 1 addition & 0 deletions stepmania.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a1f4df8

Please sign in to comment.