Etterna 0.74.4
Loading...
Searching...
No Matches
PlayerStageStats.h
1#ifndef PlayerStageStats_H
2#define PlayerStageStats_H
3
4#include "Grade.h"
5#include "Etterna/Models/HighScore/HighScore.h"
6#include "Etterna/Models/NoteData/NoteDataStructures.h"
7#include "PlayerNumber.h"
8#include "RadarValues.h"
9#include "NoteTypes.h"
10#include <map>
11
12class Steps;
13class Style;
14struct lua_State;
15
19{
20 public:
22 PlayerStageStats() { InternalInit(); }
23 void InternalInit();
24 void Init(PlayerNumber pn);
25 void Init(MultiPlayer pn);
26
27 std::vector<NoteInfo> serializednd;
28
32 void AddStats(const PlayerStageStats& other); // accumulate
33
34 static auto GetGrade(float p) -> Grade;
35 [[nodiscard]] auto GetGrade() const -> Grade;
36 static auto MakePercentScore(int iActual, int iPossible) -> float;
37 static auto FormatPercentScore(float fPercentScore) -> std::string;
38 // Calculate the difficulty rating for a specific score obtained by a player
39 // - Mina
40 auto GetWifeGrade() -> Grade;
41 [[nodiscard]] auto CalcSSR(float ssrpercent) const -> std::vector<float>;
42 void GenerateValidationKeys(HighScore& hs) const;
43 [[nodiscard]] auto GetPercentDancePoints() const -> float;
44 [[nodiscard]] auto GetWifeScore() const -> float;
45 [[nodiscard]] auto GetCurWifeScore() const -> float;
46 [[nodiscard]] auto GetMaxWifeScore() const -> float;
47 [[nodiscard]] auto GetTimingScale() const -> float;
48 [[nodiscard]] auto GetInputDataVector() const -> std::vector<InputDataEvent>;
49 [[nodiscard]] auto GetMissDataVector() const
50 -> std::vector<MissReplayResult>;
51 [[nodiscard]] auto GetOffsetVector() const -> std::vector<float>;
52 [[nodiscard]] auto GetNoteRowVector() const -> std::vector<int>;
53 [[nodiscard]] auto GetTrackVector() const -> std::vector<int>;
54 [[nodiscard]] auto GetTapNoteTypeVector() const -> std::vector<TapNoteType>;
55 [[nodiscard]] auto GetHoldReplayDataVector() const
56 -> std::vector<HoldReplayResult>;
57 [[nodiscard]] auto GetMineReplayDataVector() const
58 -> std::vector<MineReplayResult>;
59 [[nodiscard]] auto GetCurMaxPercentDancePoints() const -> float;
60
61 [[nodiscard]] auto GetLessonScoreActual() const -> int;
62 [[nodiscard]] auto GetLessonScoreNeeded() const -> int;
63 void ResetScoreForLesson();
64
65 bool m_for_multiplayer{};
66 PlayerNumber m_player_number;
67 MultiPlayer m_multiplayer_number;
68 const Style* m_pStyle{};
69
70 bool m_bJoined{};
71 bool m_bPlayerCanAchieveFullCombo{};
72 std::vector<Steps*> m_vpPossibleSteps;
73 int m_iStepsPlayed{}; // how many of m_vpPossibleStepshow many of
74 // m_vpPossibleSteps were played
75
83 bool m_bFailed{};
84
85 int m_iPossibleDancePoints{};
86 int m_iCurPossibleDancePoints{};
87 int m_iActualDancePoints{};
88 int m_iPossibleGradePoints{};
89 float m_fWifeScore{};
90 float CurWifeScore{};
91 float MaxWifeScore{};
92 float m_fTimingScale{};
93 std::vector<MineReplayResult> m_vMineReplayData;
94 std::vector<HoldReplayResult> m_vHoldReplayData;
95 std::vector<float> m_vOffsetVector;
96 std::vector<int> m_vNoteRowVector;
97 std::vector<TapNoteType> m_vTapNoteTypeVector;
98 std::vector<int> m_vTrackVector;
99 std::vector<InputDataEvent> InputData;
100 std::vector<MissReplayResult> m_vNoteMissVector;
101 int m_iTapNoteScores[NUM_TapNoteScore]{};
102 int m_iHoldNoteScores[NUM_HoldNoteScore]{};
104 unsigned int m_iCurCombo{};
106 unsigned int m_iMaxCombo{};
108 unsigned int m_iCurMissCombo{};
109 int m_iCurScoreMultiplier{};
111 unsigned int m_iScore{};
114 unsigned int m_iCurMaxScore{};
116 unsigned int m_iMaxScore{};
117
123 RadarValues m_radarActual;
133
134 // workout
135 float m_iNumControllerSteps{};
136
137 bool everusedautoplay{};
138 bool filegotmines{}; // this needs to be set before any notedata transforms
139 bool filegotholds{};
140 bool gaveuplikeadumbass{}; // flag 'giving up' status so i can flag it as
141 // failing so i dont have to remove the feature
142 // entirely -mina
143 bool usedDoubleSetup{};
144
145 std::map<float, float> m_fLifeRecord;
146 void SetLifeRecordAt(float fLife, float fStepsSecond);
147 void GetLifeRecord(float* fLifeOut,
148 int iNumSamples,
149 float fStepsEndSecond) const;
150 [[nodiscard]] auto GetLifeRecordAt(float fStepsSecond) const -> float;
151 [[nodiscard]] auto GetLifeRecordLerpAt(float fStepsSecond) const -> float;
152 [[nodiscard]] auto GetCurrentLife() const -> float;
153
154 std::map<float, float> WifeRecord;
155 void SetWifeRecordAt(float Wife, float fStepsSecond);
156 void GetWifeRecord(float* WifeOut,
157 int iNumSamples,
158 float fStepsEndSecond) const;
159 [[nodiscard]] auto GetWifeRecordAt(float fStepsSecond) const -> float;
160 [[nodiscard]] auto GetWifeRecordLerpAt(float fStepsSecond) const -> float;
161
162 struct Combo_t
163 {
164 // Update GetComboList in PlayerStageStats.cpp when adding new members
165 // that should be visible from the Lua side.
170 float m_fStartSecond{ 0 };
175 float m_fSizeSeconds{ 0 };
176
178 int m_cnt{ 0 };
179
185 int m_rollover{ 0 };
186
190 [[nodiscard]] auto GetStageCnt() const -> int
191 {
192 return m_cnt - m_rollover;
193 }
194
195 Combo_t() = default;
196 [[nodiscard]] auto IsZero() const -> bool { return m_fStartSecond < 0; }
197 };
198 std::vector<Combo_t> m_ComboList;
199 float m_fFirstSecond{};
200 float m_fLastSecond{};
201
202 [[nodiscard]] auto GetComboAtStartOfStage() const -> int;
203 [[nodiscard]] auto FullComboOfScore(TapNoteScore tnsAllGreaterOrEqual) const
204 -> bool;
205 [[nodiscard]] auto FullCombo() const -> bool
206 {
207 return FullComboOfScore(TNS_W3);
208 }
209 [[nodiscard]] auto GetBestFullComboTapNoteScore() const -> TapNoteScore;
210 [[nodiscard]] auto SingleDigitsOfScore(
211 TapNoteScore tnsAllGreaterOrEqual) const -> bool;
212 [[nodiscard]] auto OneOfScore(TapNoteScore tnsAllGreaterOrEqual) const
213 -> bool;
214 [[nodiscard]] auto GetTotalTaps() const -> int;
215 [[nodiscard]] auto GetPercentageOfTaps(TapNoteScore tns) const -> float;
216 void UpdateComboList(float fSecond, bool rollover);
217 [[nodiscard]] auto GetMaxCombo() const -> Combo_t;
218
219 int m_iPersonalHighScoreIndex{};
220 int m_iMachineHighScoreIndex{};
221 bool m_bDisqualified{};
222 [[nodiscard]] auto IsDisqualified() const -> bool;
223
224 void UnloadReplayData(); // i don't really trust the deconstructors here,
225 // also prefer flexibility in this -mina
226 HighScore m_HighScore;
227 float m_fPlayedSeconds{};
228
229 // Lua
230 void PushSelf(lua_State* L);
231};
232
233#endif
Contains statistics for one stage of play - either one song, or a whole course.
Definition PlayerStageStats.h:19
void AddStats(const PlayerStageStats &other)
Add stats from one PlayerStageStats to another.
Definition PlayerStageStats.cpp:114
unsigned int m_iCurMissCombo
The Player's current miss combo.
Definition PlayerStageStats.h:108
unsigned int m_iCurCombo
The Player's current combo.
Definition PlayerStageStats.h:104
int m_iSongsPlayed
How many songs were played by the Player?
Definition PlayerStageStats.h:127
unsigned int m_iMaxScore
The maximum score the Player can get this goaround.
Definition PlayerStageStats.h:116
unsigned int m_iMaxCombo
The Player's max combo.
Definition PlayerStageStats.h:106
float m_fLifeRemainingSeconds
How many seconds were left for the Player?
Definition PlayerStageStats.h:132
int m_iSongsPassed
How many songs were passed by the Player?
Definition PlayerStageStats.h:125
RadarValues m_radarPossible
The possible RadarValues for a song.
Definition PlayerStageStats.h:122
unsigned int m_iCurMaxScore
The theoretically highest score the Player could have at this point.
Definition PlayerStageStats.h:114
bool m_bFailed
Have the Players failed at any point during the song?
Definition PlayerStageStats.h:83
PlayerStageStats()
Set up the PlayerStageStats with default values.
Definition PlayerStageStats.h:22
unsigned int m_iScore
The player's current score.
Definition PlayerStageStats.h:111
Holds note information for a Song.
Definition Steps.h:42
Definition Style.h:22
The high score that is earned by a player.
Definition HighScore.h:18
Definition ReplayConstantsAndTypes.h:143
Definition ReplayConstantsAndTypes.h:39
Definition ReplayConstantsAndTypes.h:106
Definition ReplayConstantsAndTypes.h:118
Definition PlayerStageStats.h:163
auto GetStageCnt() const -> int
Retrieve the size of the combo that came from this song.
Definition PlayerStageStats.h:190
Cached song statistics.
Definition RadarValues.h:14