31 explicit Event(
const char *pszName) : mName(pszName) {
75 GemHitEvent(
int nPlayer,
int nTrack,
int nGemTick,
int nButtonTick,
float fSlopMs)
76 :
Event(
"gem_hit"), mPlayer(nPlayer), mTrack(nTrack), mGemTick(nGemTick),
77 mButtonTick(nButtonTick), mSlopMs(fSlopMs) {
99 unsigned char mPlayer;
100 unsigned char mTrack;
122 GemMissEvent(
int nPlayer,
int nTrack,
int nGemTick,
int nButtonTick,
float fSlopMs)
123 :
Event(
"gem_miss"), mPlayer(nPlayer), mTrack(nTrack), mGemTick(nGemTick),
124 mButtonTick(nButtonTick), mSlopMs(fSlopMs) {
146 unsigned char mPlayer;
147 unsigned char mTrack;
168 :
Event(
"gem_pass"), mPlayer(nPlayer), mTrack(nTrack), mTick(nTick) {
190 unsigned char mPlayer;
211 :
Event(
"change_track"), mPlayer(nPlayer), mOldTrack(nOldTrack), mNewTrack(nNewTrack),
234 unsigned char mPlayer;
235 signed char mOldTrack;
236 signed char mNewTrack;
256 :
Event(
"capture_track"), mPlayer(nPlayer), mTrack(nTrack), mTick(nTick),
279 unsigned char mPlayer;
280 unsigned char mTrack;
282 unsigned char mNumBars;
337 AxeEvent(
int nPlayer,
int nTrack,
int nTick,
int nStart)
338 :
Event(
"axe"), mPlayer(nPlayer), mTrack(nTrack), mTick(nTick), mStart(nStart) {
360 unsigned char mPlayer;
361 unsigned char mTrack;
382 :
Event(
"scratch"), mPlayer(nPlayer), mTrack(nTrack), mTick(nTick), mStart(nStart) {
404 unsigned char mPlayer;
405 unsigned char mTrack;
425 :
Event(
"catch_powerup"), mPlayer(nPlayer), mTick(nTick), mType(nType) {
447 unsigned char mPlayer;
467 :
Event(
"deploy_powerup"), mPlayer(nPlayer), mTick(nTick), mType(nType) {
489 unsigned char mPlayer;
509 :
Event(
"lose_solo_game"), mTick(nTick), mScore(nScore), mProgress(fProgress) {
552 :
Event(
"win_solo_game"), mScore(nScore), mEnergized(fEnergized),
553 mFullMixBars(nFullMixBars), mBestStreak(nBestStreak) {
600 :
Event(
"end_multi_game"), mScores{nScore0, nScore1, nScore2, nScore3} {
639 :
Event(
"player_aborted"), mPlayer(nPlayer), mTick(nTick) {
661 unsigned char mPlayer;
756 void Begin([[maybe_unused]]
int nNumTracks, [[maybe_unused]]
int nNumBars) {
777 void GemHit(
int nTrack,
int nGemTick,
int nButtonTick,
float fSlopMs);
789 void GemMiss(
int nTrack,
int nGemTick,
int nButtonTick,
float fSlopMs);
935 void WinSoloGame(
int nScore,
int nFullMixBars,
int nBestStreak,
float fEnergized);
967 void Juice(
float fValue,
int nTick);
980 static String FormatField(
const String &name,
const char *pszValue,
bool bQuoted);
991 static String FormatField(
const String &name,
int nValue);
1002 static String FormatField(
const String &name,
bool bValue);
1011 static void AppendTimestamp(
String &text);
1019 void WriteSessionLog();
1021 std::vector<int> mPlayerTracks;
1022 std::vector<int> mTrackPlayers;
1025 std::vector<std::unique_ptr<Event>> mEvents;
1026 const char *mLogName;
1029 std::unique_ptr<StatsMemcardUser> mMemcardUser;
Receiver of the outcome of the memory card work MCManager runs.
Definition memcarduser.h:19
AxeEvent(int nPlayer, int nTrack, int nTick, int nStart)
Construct the event.
Definition stats.h:337
String ToString() const override
Format the player, the track, the tick, and whether the freestyle starts.
~AxeEvent() override
Release the event.
Definition stats.h:347
~CaptureTrackEvent() override
Release the event.
Definition stats.h:266
String ToString() const override
Format the player, the track, the tick, and the bars.
CaptureTrackEvent(int nPlayer, int nTrack, int nTick, int nNumBars)
Construct the event.
Definition stats.h:255
~CatchPowerupEvent() override
Release the event.
Definition stats.h:434
CatchPowerupEvent(int nPlayer, int nTick, int nType)
Construct the event.
Definition stats.h:424
String ToString() const override
Format the player, the tick, and the kind of power-up.
String ToString() const override
Format the player, the two tracks, and the tick.
~ChangeTrackEvent() override
Release the event.
Definition stats.h:221
ChangeTrackEvent(int nPlayer, int nOldTrack, int nTick, int nNewTrack)
Construct the event.
Definition stats.h:210
String ToString() const override
Format the tick.
CompleteStageEvent(int nTick)
Construct the event.
Definition stats.h:297
~CompleteStageEvent() override
Release the event.
Definition stats.h:306
String ToString() const override
Format the player, the tick, and the kind of power-up.
DeployPowerupEvent(int nPlayer, int nTick, int nType)
Construct the event.
Definition stats.h:466
~DeployPowerupEvent() override
Release the event.
Definition stats.h:476
~EndMultiGameEvent() override
Release the event.
Definition stats.h:609
String ToString() const override
Format the four scores.
EndMultiGameEvent(int nScore0, int nScore1, int nScore2, int nScore3)
Construct the event.
Definition stats.h:599
static constexpr int kNumScores
Number of scores the event records.
Definition stats.h:589
const char * GetName() const
Definition stats.h:51
virtual ~Event()
Release the event.
Definition stats.h:40
Event(const char *pszName)
Construct an event.
Definition stats.h:31
virtual String ToString() const =0
Format the fields of the event.
String ToString() const override
Format the player, the track, the two ticks, and the slop.
~GemHitEvent() override
Release the event.
Definition stats.h:86
GemHitEvent(int nPlayer, int nTrack, int nGemTick, int nButtonTick, float fSlopMs)
Construct the event.
Definition stats.h:75
~GemMissEvent() override
Release the event.
Definition stats.h:133
String ToString() const override
Format the player, the track, and the press, and the nearest gem when the slop is not 0.
GemMissEvent(int nPlayer, int nTrack, int nGemTick, int nButtonTick, float fSlopMs)
Construct the event.
Definition stats.h:122
String ToString() const override
Format the player, the track, and the tick.
~GemPassEvent() override
Release the event.
Definition stats.h:177
GemPassEvent(int nPlayer, int nTrack, int nTick)
Construct the event.
Definition stats.h:167
String ToString() const override
Format the juice and the tick.
~JuiceEvent() override
Release the event.
Definition stats.h:687
JuiceEvent(float fValue, int nTick)
Construct the event.
Definition stats.h:678
~LoseSoloGameEvent() override
Release the event.
Definition stats.h:518
String ToString() const override
Format the tick, the score, and the fraction played.
LoseSoloGameEvent(int nTick, int nScore, float fProgress)
Construct the event.
Definition stats.h:508
String ToString() const override
Format the player and the tick.
~PlayerAbortedEvent() override
Release the event.
Definition stats.h:648
PlayerAbortedEvent(int nPlayer, int nTick)
Construct the event.
Definition stats.h:638
ScratchEvent(int nPlayer, int nTrack, int nTick, int nStart)
Construct the event.
Definition stats.h:381
~ScratchEvent() override
Release the event.
Definition stats.h:391
String ToString() const override
Format the player, the track, the tick, and whether the scratch starts.
Receiver of the result of saving the log to a memory card.
Definition stats.h:709
void OnFileSaved(int nStatus) override
Empty the log once the memory card task ends.
WinSoloGameEvent(int nScore, float fEnergized, int nFullMixBars, int nBestStreak)
Construct the event.
Definition stats.h:551
String ToString() const override
Format the score, the fraction energized, the full mix bars, and the longest streak.
~WinSoloGameEvent() override
Release the event.
Definition stats.h:562
Log of the gameplay events of one session, written as text to a file or a memory card when the sessio...
Definition stats.h:17
static Stats * shared()
Report the single instance, constructing it on first use.
void LoseSoloGame(int nTick, int nScore, float fProgress)
Record a lost solo song.
void GemHit(int nTrack, int nGemTick, int nButtonTick, float fSlopMs)
Record a caught gem.
void CompleteStage(int nTick)
Record the end of a section.
void ChangeTrack(int nPlayer, int nTrack, int nTick)
Record a player moving to another track.
void AxeEnd(int nTrack, int nTick)
Record the end of a guitar freestyle.
void EndMultiGame(int nScore0, int nScore1, int nScore2, int nScore3)
Record the end of a multiplayer song.
void AxeBegin(int nTrack, int nTick)
Record the start of a guitar freestyle.
void PlayerAborted(int nPlayer, int nTick)
Record a player who left the song.
void GemMiss(int nTrack, int nGemTick, int nButtonTick, float fSlopMs)
Record a press that missed the nearest gem.
void CaptureTrack(int nTrack, int nTick, int nNumBars)
Record a captured phrase.
void ScratchEnd(int nTrack, int nTick)
Record the end of a scratch.
void SetTrackPlayer(int nTrack, int nPlayer)
Record which player plays a track.
void Begin(int nNumTracks, int nNumBars)
Start the log of a song.
Definition stats.h:756
void Juice(float fValue, int nTick)
Record a new value of the juice meter.
void WinSoloGame(int nScore, int nFullMixBars, int nBestStreak, float fEnergized)
Record a won solo song.
void DeployPowerup(int nPlayer, int nTick, int nType)
Record a deployed power-up.
void GemMiss(int nTrack, int nButtonTick)
Record a press with no gem near it.
void ScratchBegin(int nTrack, int nTick)
Record the start of a scratch.
void End()
End the session, write the log, and release the events.
void CatchPowerup(int nPlayer, int nTick, int nType)
Record a caught power-up.
Stats()
Construct an inactive log.
void GemPass(int nTrack, int nTick)
Record a gem that passed without a press on a track that has a player.
Growable text buffer that is also a PrnStream.
Definition string.h:19
Stats * TheStats
The session log, Stats::shared() as the unit's static initialiser stored it.