From df526ed9399504fbacfb841df0e037fea80203c3 Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Wed, 28 Dec 2016 12:01:23 -0500 Subject: [PATCH] finish enum on skillsets --- extern/MinaCalc/MinaCalc.lib | Bin 150688 -> 150536 bytes src/GameConstantsAndTypes.cpp | 20 ++++++++ src/GameConstantsAndTypes.h | 4 ++ src/HighScore.cpp | 71 +++++++++----------------- src/HighScore.h | 5 -- src/Profile.cpp | 92 ++++++++++++++++------------------ src/Profile.h | 7 +-- src/StageStats.cpp | 8 +-- src/StatsManager.cpp | 2 +- 9 files changed, 98 insertions(+), 111 deletions(-) diff --git a/extern/MinaCalc/MinaCalc.lib b/extern/MinaCalc/MinaCalc.lib index 0053c14d90a9e10bbf7e56ad71128f54bc6dab49..a33eea014409d362abbf24f43ebb116bfa630402 100644 GIT binary patch delta 4159 zcmcJSdsJ0b9>;(Cz&UV1gG`uFMC=^mYHA|BNJPx=fs)?L)XKzXuW3e2GqXloljQ^T zlE3hPfq?SX@^RDaqYyQfLIpIJjpL||ubGywN{h;LzIz{+&HOWKxt4R*y8C>7-|yc0 z?8k5K1x0zT1-Y*5=*;f%@ee1q`>!YdR@Aju_paR(j}IZDwL}XW?)ES9Zg+Tx{bkdhxxRvSw$n`Vx zi5eCXrKV{z?|DP&FIQRVcOt3> z#kg$frxDHJl*N{j+nLCGNHtia5p{Zq=qP&^TiShHS8-YipsGkG{aE8}1n)fA& z@5|GcnnrKnIEDHPz{Sd64%+JYyMgB&{1zCIB0Du=Qi%FHm=2tpB3B~hUCi%wgg5)K zC)+e!j}UDbpw_4mquV}!=xHv@wv5FCF^Pe4*dfx`gK+X7E<%&#gV1DvY06odhQX#OrybfHMfhVHpL)+U#1JII5H+*{I2{qz4pD7>21X23 zZKTs}C=zw3aJxZMEA@Xtt#1BD}9#^98aiW8~4&nt+ z$p|H0MbBY;6JqBli0&CFMPuAZEcr-Y|GsJ1z~N7-s)bJyZR5fmOaBVAk@w|T#<5XE z-;ClbIi_}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(+37{?Q~USr;{@RB^x zlx@*gcXcP%w8ZgFID1;6S$oFnXQHp!8qM|3T*GZGnk~7LPqoB}NxWvOC$MDO1hWR) zVk^fVt!}B+J!*CNR`-O}J!y4MTV0XWt+l%HPEKfa%LvSGV_^IC%{PlKo^~=;oCxHe z^x67;5r%IzJ&MQd2uGbB5BZMM2W*4hGv$29ZTLk|G1~V6qt0fDK|?fkhdQV)nL%x! z@PO~@r+W3(OxJ7(Ax^ju8y_+Qj>5J)4rIwQ^F^Yyv=~r`mtFAmwW6DqhZ`?Uxs=Us zBRbCK;J4!4$a$QHUyRKXpft1|DN&S^d65m5LnuiFJPSfVTRClO%$Jni7$;|nwTO^1Rv7G zfv~>T8nt8Mhm4fo!UIQcZ_yMbJ~Sd@#TA28fp&Trev8(DqJ!gNMVJ`S3kBHe4k&M^ zs9j6MR9mpzCGrGD(cI=J>2A>+CcX)t9VR}r_x;4owi}Z>VjR0pU=xEwM~Y=q#26bB z#rQ#2m>Czs-^V1iTs^_#iDFwXr&VbNGCTz}it<3)&3wzzb{MV6B368C98MN9kk&a~ zB-t`!%q;jY&o#9uogKAB+M*BKoP;ZiJ~P!3<=(z zAX&9ypELR zTxDEPQ6c!mU}Ivv@E8g8qW{>W8Y=|vBeGG#(uFz8ax4XJBMKAhd#kR4vt~|K5!N-$ zXsH)Yqr6^38%OKK@Bst$|EB)ze#98m0Cx}EqS%<$fWam-pr{oMVz}n|rvLTEwgwc_ zth6tn8Albl8{s{=F>a5M(FkvPBebSU+XvPZ+D*;S{xK|JuCcfo+WpPYwn8(i6@9F{H;%s3Vf1Se zBQ~~(=)tdUv1a@!x?ir(F~i#;1`l}mQou1Y;CwKvMSQyXr~gk8wqRAppendChild( "Score", iScore ); pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "WifeScore", fWifeScore); - pNode->AppendChild( "SSR", fSSR); - pNode->AppendChild( "SSRSpeed", fSSRSpeed); - pNode->AppendChild( "SSRStam", fSSRStam); - pNode->AppendChild( "SSRJack", fSSRJack); - pNode->AppendChild( "SSRTechnical", fSSRTechnical); pNode->AppendChild( "Rate", fMusicRate); pNode->AppendChild( "JudgeScale", fJudgeScale); pNode->AppendChild( "Offsets", OffsetsToString(vOffsetVector)); @@ -227,14 +216,21 @@ XNode *HighScoreImpl::CreateNode() const pNode->AppendChild( "PlayerGuid", sPlayerGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "ProductID", iProductID ); + XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" ); FOREACH_ENUM( TapNoteScore, tns ) if( tns != TNS_None ) // HACK: don't save meaningless "none" count pTapNoteScores->AppendChild( TapNoteScoreToString(tns), iTapNoteScores[tns] ); + XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" ); FOREACH_ENUM( HoldNoteScore, hns ) if( hns != HNS_None ) // HACK: don't save meaningless "none" count pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); + + XNode* pSkillsetSSRs = pNode->AppendChild( "SkillsetsSSRs" ); + FOREACH_ENUM( Skillset, ss ) + pSkillsetSSRs->AppendChild(SkillsetToString(ss), fSkillsetSSRs[ss]); + pNode->AppendChild( radarValues.CreateNode(bWriteSimpleValues, bWriteComplexValues) ); pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); pNode->AppendChild( "Disqualified", bDisqualified); @@ -256,11 +252,6 @@ void HighScoreImpl::LoadFromNode(const XNode *pNode) pNode->GetChildValue("Score", iScore); pNode->GetChildValue("PercentDP", fPercentDP); pNode->GetChildValue("WifeScore", fWifeScore); - pNode->GetChildValue("SSR", fSSR); - pNode->GetChildValue("SSRSpeed", fSSRSpeed); - pNode->GetChildValue("SSRStam", fSSRStam); - pNode->GetChildValue("SSRJack", fSSRJack); - pNode->GetChildValue("SSRTechnical", fSSRTechnical); pNode->GetChildValue("Rate", fMusicRate); pNode->GetChildValue("JudgeScale", fJudgeScale); pNode->GetChildValue("Offsets", s); vOffsetVector = OffsetsToVector(s); @@ -285,14 +276,22 @@ void HighScoreImpl::LoadFromNode(const XNode *pNode) pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); pNode->GetChildValue( "MachineGuid", sMachineGuid ); pNode->GetChildValue( "ProductID", iProductID ); + const XNode* pTapNoteScores = pNode->GetChild( "TapNoteScores" ); if( pTapNoteScores ) FOREACH_ENUM( TapNoteScore, tns ) pTapNoteScores->GetChildValue( TapNoteScoreToString(tns), iTapNoteScores[tns] ); + const XNode* pHoldNoteScores = pNode->GetChild( "HoldNoteScores" ); - if( pHoldNoteScores ) - FOREACH_ENUM( HoldNoteScore, hns ) - pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); + if (pHoldNoteScores) + FOREACH_ENUM(HoldNoteScore, hns) + pHoldNoteScores->GetChildValue(HoldNoteScoreToString(hns), iHoldNoteScores[hns]); + + const XNode* pSkillsetSSRs = pNode->GetChild("SkillsetSSRs"); + if (pSkillsetSSRs) + FOREACH_ENUM(Skillset, ss) + pSkillsetSSRs->GetChildValue(SkillsetToString(ss), fSkillsetSSRs[ss]); + const XNode* pRadarValues = pNode->GetChild( "RadarValues" ); if( pRadarValues ) radarValues.LoadFromNode( pRadarValues ); @@ -353,6 +352,7 @@ RString HighScore::GetMachineGuid() const { return m_Impl->sMachineGuid; } int HighScore::GetProductID() const { return m_Impl->iProductID; } int HighScore::GetTapNoteScore( TapNoteScore tns ) const { return m_Impl->iTapNoteScores[tns]; } int HighScore::GetHoldNoteScore( HoldNoteScore hns ) const { return m_Impl->iHoldNoteScores[hns]; } +float HighScore::GetSkillsetSSR(Skillset ss) const { return m_Impl->fSkillsetSSRs[ss]; } const RadarValues &HighScore::GetRadarValues() const { return m_Impl->radarValues; } float HighScore::GetLifeRemainingSeconds() const { return m_Impl->fLifeRemainingSeconds; } bool HighScore::GetDisqualified() const { return m_Impl->bDisqualified; } @@ -367,11 +367,6 @@ void HighScore::SetStageAward( StageAward a ) { m_Impl->stageAward = a; } void HighScore::SetPeakComboAward( PeakComboAward a ) { m_Impl->peakComboAward = a; } void HighScore::SetPercentDP( float f ) { m_Impl->fPercentDP = f; } void HighScore::SetWifeScore(float f) {m_Impl->fWifeScore = f;} -void HighScore::SetSSR(float f) { m_Impl->fSSR = f; } -void HighScore::SetSSRSpeed(float f) { m_Impl->fSSRSpeed = f; } -void HighScore::SetSSRStam(float f) { m_Impl->fSSRStam = f; } -void HighScore::SetSSRJack(float f) { m_Impl->fSSRJack = f; } -void HighScore::SetSSRTechnical(float f) { m_Impl->fSSRTechnical = f; } void HighScore::SetMusicRate(float f) { m_Impl->fMusicRate = f; } void HighScore::SetJudgeScale(float f) { m_Impl->fJudgeScale = f; } void HighScore::SetOffsetVector(vector v) { m_Impl->vOffsetVector = v; } @@ -384,6 +379,7 @@ void HighScore::SetMachineGuid( const RString &s ) { m_Impl->sMachineGuid = s; } void HighScore::SetProductID( int i ) { m_Impl->iProductID = i; } void HighScore::SetTapNoteScore( TapNoteScore tns, int i ) { m_Impl->iTapNoteScores[tns] = i; } void HighScore::SetHoldNoteScore( HoldNoteScore hns, int i ) { m_Impl->iHoldNoteScores[hns] = i; } +void HighScore::SetSkillsetSSR(Skillset ss, float ssr) { m_Impl->fSkillsetSSRs[ss] = ssr; } void HighScore::SetRadarValues( const RadarValues &rv ) { m_Impl->radarValues = rv; } void HighScore::SetLifeRemainingSeconds( float f ) { m_Impl->fLifeRemainingSeconds = f; } void HighScore::SetDisqualified( bool b ) { m_Impl->bDisqualified = b; } @@ -729,25 +725,6 @@ float HighScore::ConvertDpToWife() { return estpoints / maxpoints; } -// Deal with this better later - mina -float HighScore::GetSkillsetSSR(Skillset ss) const { - if (ss == Skill_Overall) - return m_Impl->fSSR; - else if (ss == Skill_Speed) - return m_Impl->fSSRSpeed; - else if (ss == Skill_Stamina) - return m_Impl->fSSRStam; - else if (ss == Skill_Jack) - return m_Impl->fSSRJack; - else if (ss == Skill_Technical) - return m_Impl->fSSRTechnical; - return 0.f; -} - -void HighScore::SetSkillsetSSR(Skillset ss, float ssr) { - -} - // lua start #include "LuaBinding.h" diff --git a/src/HighScore.h b/src/HighScore.h index b56569b866..2691faec8b 100644 --- a/src/HighScore.h +++ b/src/HighScore.h @@ -78,11 +78,6 @@ struct HighScore void SetScore( unsigned int iScore ); void SetPercentDP( float f ); void SetWifeScore(float f); - void SetSSR(float f); - void SetSSRSpeed(float f); - void SetSSRStam(float f); - void SetSSRJack(float f); - void SetSSRTechnical(float f); void SetMusicRate(float f); void SetJudgeScale(float f); void SetOffsetVector(vector v); diff --git a/src/Profile.cpp b/src/Profile.cpp index 200055c712..6f2fffdff4 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -158,10 +158,6 @@ void Profile::InitGeneralData() m_iTotalHands = 0; m_iTotalLifts = 0; m_fPlayerRating = 0.f; - m_fPlayerSpeedRating = 0.f; - m_fPlayerStamRating = 0.f; - m_fPlayerJackRating = 0.f; - m_fPlayerTechnicalRating = 0.f; FOREACH_ENUM( PlayMode, i ) m_iNumSongsPlayedByPlayMode[i] = 0; @@ -173,6 +169,7 @@ void Profile::InitGeneralData() m_iNumTotalSongsPlayed = 0; ZERO( m_iNumStagesPassedByPlayMode ); ZERO( m_iNumStagesPassedByGrade ); + ZERO( m_fPlayerSkillsets ); m_UserTable.Unset(); } @@ -1502,10 +1499,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const pGeneralDataNode->AppendChild( "TotalHands", m_iTotalHands ); pGeneralDataNode->AppendChild( "TotalLifts", m_iTotalLifts ); pGeneralDataNode->AppendChild( "PlayerRating", m_fPlayerRating); - pGeneralDataNode->AppendChild( "PlayerSpeedRating", m_fPlayerSpeedRating); - pGeneralDataNode->AppendChild( "PlayerStamRating", m_fPlayerStamRating); - pGeneralDataNode->AppendChild( "PlayerJackRating", m_fPlayerJackRating); - pGeneralDataNode->AppendChild( "PlayerTechnicalRating", m_fPlayerTechnicalRating); // Keep declared variables in a very local scope so they aren't // accidentally used where they're not intended. There's a lot of @@ -1518,9 +1511,15 @@ XNode* Profile::SaveGeneralDataCreateNode() const } { - XNode* Favorites = pGeneralDataNode->AppendChild("Favorites"); + XNode* pFavorites = pGeneralDataNode->AppendChild("Favorites"); FOREACH_CONST(RString, FavoritedCharts, it) - Favorites->AppendChild(*it); + pFavorites->AppendChild(*it); + } + + { + XNode* pPlayerSkillsets = pGeneralDataNode->AppendChild("PlayerSkillsets"); + FOREACH_ENUM(Skillset, ss) + pPlayerSkillsets->AppendChild(SkillsetToString(ss), m_fPlayerSkillsets[ss]); } { @@ -1705,10 +1704,6 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNode->GetChildValue( "TotalHands", m_iTotalHands ); pNode->GetChildValue( "TotalLifts", m_iTotalLifts ); pNode->GetChildValue( "PlayerRating", m_fPlayerRating); - pNode->GetChildValue( "PlayerSpeedRating", m_fPlayerSpeedRating); - pNode->GetChildValue( "PlayerStamRating", m_fPlayerStamRating); - pNode->GetChildValue( "PlayerJackRating", m_fPlayerJackRating); - pNode->GetChildValue( "PlayerTechnicalRating", m_fPlayerTechnicalRating); { const XNode* pDefaultModifiers = pNode->GetChild("DefaultModifiers"); @@ -1722,14 +1717,22 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) } { - const XNode* Favorites = pNode->GetChild("Favorites"); - if (Favorites) { - FOREACH_CONST_Child(Favorites, ck) + const XNode* pFavorites = pNode->GetChild("Favorites"); + if (pFavorites) { + FOREACH_CONST_Child(pFavorites, ck) FavoritedCharts.push_back(ck->GetName()); SONGMAN->SetFavoritedStatus(FavoritedCharts); } } + { + const XNode* pPlayerSkillsets = pNode->GetChild("PlayerSkillsets"); + if (pPlayerSkillsets) { + FOREACH_ENUM(Skillset, ss) + pPlayerSkillsets->GetChildValue(SkillsetToString(ss), m_fPlayerSkillsets[ss]); + } + } + { const XNode* pUnlocks = pNode->GetChild("Unlocks"); if( pUnlocks ) @@ -2079,8 +2082,8 @@ float Profile::GetWifePBByKey(RString key) { } // also finish dealing with this later - mina -void Profile::CalcPlayerRating(float& overall, float& speed, float& stam, float& jack, float& technical) const { - vector> demskillas(5); +void Profile::CalcPlayerRating(float& prating, float* pskillsets) const { + vector demskillas[NUM_Skillset]; FOREACHM_CONST(SongID, HighScoresForASong, m_SongHighScores, i) { const SongID& id = i->first; // skip files that can't be loaded since we can't verify their ssrs - mina @@ -2097,17 +2100,15 @@ void Profile::CalcPlayerRating(float& overall, float& speed, float& stam, float& } } + // overall should probably be ignored + float skillsetsum = 0.f; + FOREACH_ENUM(Skillset, ss) { + pskillsets[ss] = AggregateScores(demskillas[ss], 0.f, 10.24f, 1)*0.95f; + CLAMP(pskillsets[ss], 0.f, 100.f); + skillsetsum += pskillsets[ss]; + } - speed = AggregateScores(demskillas[1], 0.f, 10.24f, 1)*0.95f; - stam = AggregateScores(demskillas[2], 0.f, 10.24f, 1)*0.95f; - jack = AggregateScores(demskillas[3], 0.f, 10.24f, 1)*0.95f; - technical = AggregateScores(demskillas[4], 0.f, 10.24f, 1)*0.95f; - CLAMP(speed, 0.f, 100.f); - CLAMP(stam, 0.f, 100.f); - CLAMP(jack, 0.f, 100.f); - CLAMP(technical, 0.f, 100.f); - - overall = (speed + stam + jack + technical) / 4.f; + prating = skillsetsum / NUM_Skillset; } void Profile::ResetSSRs(bool OnlyOld) { @@ -2124,11 +2125,8 @@ void Profile::ResetSSRs(bool OnlyOld) { if (OnlyOld && hsv[i].GetSSRCalcVersion() == GetCalcVersion()) continue; - hsv[i].SetSSR(0.f); - hsv[i].SetSSRSpeed(0.f); - hsv[i].SetSSRStam(0.f); - hsv[i].SetSSRJack(0.f); - hsv[i].SetSSRTechnical(0.f); + FOREACH_ENUM(Skillset, ss) + hsv[i].SetSkillsetSSR(ss, 0.f); } } } @@ -2150,7 +2148,8 @@ void Profile::RecalculateSSRs(bool OnlyOld) { for (size_t i = 0; i < hsv.size(); i++) { float wifescore = hsv[i].GetWifeScore(); if (wifescore == 0.f || hsv[i].GetGrade() == Grade_Failed) - hsv[i].SetSSR(0.f); + FOREACH_ENUM(Skillset, ss) + hsv[i].SetSkillsetSSR(ss, 0.f); else { if (OnlyOld && hsv[i].GetSSRCalcVersion() == 1.f) continue; @@ -2175,12 +2174,9 @@ void Profile::RecalculateSSRs(bool OnlyOld) { for (size_t i = 0; i < nerv.size(); i++) etaner.emplace_back(td->GetElapsedTimeFromBeatNoOffset(NoteRowToBeat(nerv[i]))); - vector isthisworking = MinaSDCalc(nd, etaner, musicrate, wifescore, 1.f, td->HasWarps()); - hsv[i].SetSSR(isthisworking[0]); - hsv[i].SetSSRSpeed(isthisworking[1]); - hsv[i].SetSSRStam(isthisworking[2]); - hsv[i].SetSSRJack(isthisworking[3]); - hsv[i].SetSSRTechnical(isthisworking[4]); + vector recalcSSR = MinaSDCalc(nd, etaner, musicrate, wifescore, 1.f, td->HasWarps()); + FOREACH_ENUM(Skillset, ss) + hsv[i].SetSkillsetSSR(ss, recalcSSR[ss]); hsv[i].SetSSRCalcVersion(GetCalcVersion()); } } @@ -3027,10 +3023,6 @@ class LunaProfile : public Luna static int GetTotalCaloriesBurned( T* p, lua_State *L ) { lua_pushnumber(L, p->m_fTotalCaloriesBurned ); return 1; } static int GetDisplayTotalCaloriesBurned( T* p, lua_State *L ) { lua_pushstring(L, p->GetDisplayTotalCaloriesBurned() ); return 1; } static int GetPlayerRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerRating); return 1; } - static int GetPlayerSpeedRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerSpeedRating); return 1; } - static int GetPlayerStamRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerStamRating); return 1; } - static int GetPlayerJackRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerJackRating); return 1; } - static int GetPlayerTechnicalRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerTechnicalRating); return 1; } static int GetMostPopularSong( T* p, lua_State *L ) { Song *p2 = p->GetMostPopularSong(); @@ -3100,6 +3092,11 @@ class LunaProfile : public Luna lua_pushnumber(L, p->GetTopSSRValue(IArg(1), IArg(2)) ); return 1; } + static int GetPlayerSkillsetRating(T* p, lua_State *L) { + Skillset lel = static_cast(IArg(1) - 1); + lua_pushnumber(L, p->m_fPlayerSkillsets[lel]); + return 1; + } DEFINE_METHOD( GetGUID, m_sGuid ); LunaProfile() @@ -3173,10 +3170,7 @@ class LunaProfile : public Luna ADD_METHOD( GetLastPlayedCourse ); ADD_METHOD( GetGUID ); ADD_METHOD( GetPlayerRating ); - ADD_METHOD( GetPlayerSpeedRating ); - ADD_METHOD( GetPlayerStamRating ); - ADD_METHOD( GetPlayerJackRating ); - ADD_METHOD( GetPlayerTechnicalRating ); + ADD_METHOD( GetPlayerSkillsetRating ); ADD_METHOD( GetNumFaves ); ADD_METHOD( GetTopSSRValue ); ADD_METHOD( GetTopSSRSongName ); diff --git a/src/Profile.h b/src/Profile.h index a8911d2dde..f17dcae830 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -221,10 +221,7 @@ class Profile int m_iTotalHands; int m_iTotalLifts; float m_fPlayerRating; - float m_fPlayerSpeedRating; - float m_fPlayerStamRating; - float m_fPlayerJackRating; - float m_fPlayerTechnicalRating; + float m_fPlayerSkillsets[NUM_Skillset]; /** @brief Is this a brand new profile? */ bool m_bNewProfile; set m_UnlockedEntryIDs; @@ -321,7 +318,7 @@ class Profile const HighScoreList& GetCategoryHighScoreList( StepsType st, RankingCategory rc ) const; int GetCategoryNumTimesPlayed( StepsType st ) const; void IncrementCategoryPlayCount( StepsType st, RankingCategory rc ); - void CalcPlayerRating(float& overall, float& speed, float& stam, float& jack, float& technical) const; + void CalcPlayerRating(float& prating, float* pskillsets) const; void ResetSSRs(bool OnlyOld); void RecalculateSSRs(bool OnlyOld); float AggregateScores(vector& invector, float rating, float res, int iter) const; diff --git a/src/StageStats.cpp b/src/StageStats.cpp index 9dc15a407b..5bf9f96c39 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -143,11 +143,11 @@ static HighScore FillInHighScore( const PlayerStageStats &pss, const PlayerState hs.SetScore( pss.m_iScore ); hs.SetPercentDP( pss.GetPercentDancePoints() ); hs.SetWifeScore( pss.GetWifeScore()); + vector dakine = pss.CalcSSR(); - hs.SetSSR( dakine[0]); - hs.SetSSRSpeed(dakine[1]); - hs.SetSSRStam(dakine[2]); - hs.SetSSRJack(dakine[3]); + FOREACH_ENUM(Skillset, ss) + hs.SetSkillsetSSR(ss, dakine[ss]); + hs.SetMusicRate( GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate); hs.SetJudgeScale( pss.GetTimingScale()); hs.SetOffsetVector( pss.GetOffsetVector()); diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 589cc72a66..44af4639cc 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -145,7 +145,7 @@ void AddPlayerStatsToProfile( Profile *pProfile, const StageStats &ss, PlayerNum if (!pProfile->IsMachine()) { pProfile->ResetSSRs(true); pProfile->RecalculateSSRs(true); - pProfile->CalcPlayerRating(pProfile->m_fPlayerRating, pProfile->m_fPlayerSpeedRating, pProfile->m_fPlayerStamRating, pProfile->m_fPlayerJackRating, pProfile->m_fPlayerTechnicalRating); + pProfile->CalcPlayerRating(pProfile->m_fPlayerRating, pProfile->m_fPlayerSkillsets); } }