Add statistic for time looking at statistics

This commit is contained in:
Eidolon 2024-02-29 19:21:23 -06:00
parent c22d6d75db
commit 0cd5a662ce
5 changed files with 13 additions and 1 deletions

View file

@ -52,6 +52,7 @@ void srb2::save_ng_gamedata()
ng.playtime.special = gamedata->modeplaytime[GDGT_SPECIAL];
ng.playtime.custom = gamedata->modeplaytime[GDGT_CUSTOM];
ng.playtime.menus = gamedata->totalmenutime;
ng.playtime.statistics = gamedata->totaltimestaringatstatistics;
ng.rings.total = gamedata->totalrings;
ng.playtime.tumble = gamedata->totaltumbletime;
ng.rounds.race = gamedata->roundsplayed[GDGT_RACE];
@ -434,6 +435,7 @@ void srb2::load_ng_gamedata()
gamedata->modeplaytime[GDGT_SPECIAL] = js.playtime.special;
gamedata->modeplaytime[GDGT_CUSTOM] = js.playtime.custom;
gamedata->totalmenutime = js.playtime.menus;
gamedata->totaltimestaringatstatistics = js.playtime.statistics;
gamedata->totalrings = js.rings.total;
gamedata->totaltumbletime = js.playtime.tumble;
gamedata->roundsplayed[GDGT_RACE] = js.rounds.race;

View file

@ -33,6 +33,7 @@ struct GamedataPlaytimeJson final
uint32_t special;
uint32_t custom;
uint32_t menus;
uint32_t statistics;
uint32_t tumble;
NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(
@ -44,6 +45,7 @@ struct GamedataPlaytimeJson final
special,
custom,
menus,
statistics,
tumble
)
};

View file

@ -655,6 +655,7 @@ void M_ClearStats(void)
for (i = 0; i < GDGT_MAX; ++i)
gamedata->modeplaytime[i] = 0;
gamedata->totalmenutime = 0;
gamedata->totaltimestaringatstatistics = 0;
gamedata->totalrings = 0;
gamedata->totaltumbletime = 0;
for (i = 0; i < GDGT_MAX; ++i)

View file

@ -371,6 +371,7 @@ struct gamedata_t
UINT32 totalplaytime;
UINT32 modeplaytime[GDGT_MAX];
UINT32 totalmenutime;
UINT32 totaltimestaringatstatistics;
UINT32 roundsplayed[GDGT_MAX];
UINT32 totalrings;
UINT32 totaltumbletime;

View file

@ -23,6 +23,12 @@
extern consvar_t cv_debugchallenges;
#endif
static void M_StatisticsTicker(void)
{
// the funny
gamedata->totaltimestaringatstatistics++;
}
menuitem_t MISC_ChallengesStatsDummyMenu[] =
{
{IT_STRING | IT_CALL, "Back", NULL, NULL, {.routine = M_GoBack}, 0, 0},
@ -60,7 +66,7 @@ menu_t MISC_StatisticsDef = {
98, 0,
M_DrawStatistics,
M_DrawExtrasBack,
NULL,
M_StatisticsTicker,
NULL,
NULL,
M_StatisticsInputs,