From 75717e8f6540e79df0e7ad200ec27e2671afff80 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Wed, 20 Aug 2025 21:00:06 -0400 Subject: [PATCH 1/4] Audit platinums --- src/d_netcmd.c | 1 + src/p_setup.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ src/p_setup.h | 1 + 3 files changed, 63 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 090c7edaf..75bd50915 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -542,6 +542,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("stopmovie", Command_StopMovie_f); COM_AddDebugCommand("minigen", M_MinimapGenerate); COM_AddDebugCommand("dumprrautomedaltimes", Command_dumprrautomedaltimes); + COM_AddDebugCommand("platinums", Command_Platinums); #ifdef SRB2_CONFIG_ENABLE_WEBM_MOVIES M_AVRecorder_AddCommands(); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4115ec71a..43da65825 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9501,6 +9501,67 @@ void Command_dumprrautomedaltimes(void) fclose(out); } +void Command_Platinums(void) +{ + srb2::Vector platinums; + + for (INT32 j = 0; j < nummapheaders; j++) + { + mapheader_t *map = mapheaderinfo[j]; + + if (map == NULL || map->ghostCount < 1) + continue; + + // Gather staff ghost times + srb2::Vector stafftimes; + for (int i = 0; i < map->ghostCount; i++) + { + tic_t time = map->ghostBrief[i]->time; + if (time <= 0) + { + continue; + } + + stafftimes.push_back(map->ghostBrief[i]->time); + } + + if (stafftimes.empty()) + { + continue; + } + + std::sort(stafftimes.begin(), stafftimes.end()); + + for (int i = 0; i < map->ghostCount; i++) + { + tic_t time = map->ghostBrief[i]->time; + if (time == stafftimes.at(0)) + { + tic_t delta = map->automedaltime[1] - map->automedaltime[0]; + + CONS_Printf("%s: %s (-%s)\n", map->lumpname, map->ghostBrief[i]->name, va("%d\"%02d", + G_TicsToSeconds(delta), + G_TicsToCentiseconds(delta)) + ); + platinums.push_back(map->ghostBrief[i]->name); + break; + } + } + } + + std::unordered_map frequency; + + for (const auto& platinum : platinums) + { + frequency[platinum]++; + } + + for (const auto& pair : frequency) + { + CONS_Printf("%s: %d\n", pair.first.c_str(), pair.second); + } +} + // // Add a wadfile to the active wad files, // replace sounds, musics, patches, textures, sprites and maps diff --git a/src/p_setup.h b/src/p_setup.h index a9839e3f8..7233f885f 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -162,6 +162,7 @@ void P_DeleteHeaderFollowers(UINT16 i); void P_ReloadRings(void); void Command_dumprrautomedaltimes(void); +void Command_Platinums(void); #ifdef __cplusplus } // extern "C" From d4cbcab1cbac9fd9a7389ad7bc020ad5cd10c113 Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Mon, 25 Aug 2025 15:27:02 -0400 Subject: [PATCH 2/4] Platinum breakdown by author --- src/p_setup.cpp | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 43da65825..640e91a6b 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9558,7 +9558,50 @@ void Command_Platinums(void) for (const auto& pair : frequency) { - CONS_Printf("%s: %d\n", pair.first.c_str(), pair.second); + CONS_Printf("%s: %d - ", pair.first.c_str(), pair.second); + + for (INT32 j = 0; j < nummapheaders; j++) + { + mapheader_t *map = mapheaderinfo[j]; + + if (map == NULL || map->ghostCount < 1) + continue; + + // Gather staff ghost times + srb2::Vector stafftimes; + for (int i = 0; i < map->ghostCount; i++) + { + tic_t time = map->ghostBrief[i]->time; + if (time <= 0) + { + continue; + } + + stafftimes.push_back(map->ghostBrief[i]->time); + } + + if (stafftimes.empty()) + { + continue; + } + + std::sort(stafftimes.begin(), stafftimes.end()); + + for (int i = 0; i < map->ghostCount; i++) + { + if (strcmp(pair.first.c_str(), map->ghostBrief[i]->name)) + break; + + tic_t time = map->ghostBrief[i]->time; + if (time == stafftimes.at(0)) + { + CONS_Printf("%s, ", map->lumpname); + break; + } + } + } + + CONS_Printf("\n"); } } From 25417e96ebc349690774adfdda3b1e8bcfe7354e Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Tue, 2 Sep 2025 06:31:10 -0400 Subject: [PATCH 3/4] Print all ghosts for any map along with their gaps --- src/p_setup.cpp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 640e91a6b..d51e4a4e1 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9512,8 +9512,7 @@ void Command_Platinums(void) if (map == NULL || map->ghostCount < 1) continue; - // Gather staff ghost times - srb2::Vector stafftimes; + srb2::Vector> stafftimes; for (int i = 0; i < map->ghostCount; i++) { tic_t time = map->ghostBrief[i]->time; @@ -9522,7 +9521,7 @@ void Command_Platinums(void) continue; } - stafftimes.push_back(map->ghostBrief[i]->time); + stafftimes.push_back(std::make_pair(map->ghostBrief[i]->time, map->ghostBrief[i]->name)); } if (stafftimes.empty()) @@ -9530,23 +9529,32 @@ void Command_Platinums(void) continue; } - std::sort(stafftimes.begin(), stafftimes.end()); + std::sort(stafftimes.begin(), stafftimes.end(), [](auto &left, auto &right) { + return left.first < right.first; + }); - for (int i = 0; i < map->ghostCount; i++) + CONS_Printf("%s: ", map->lumpname); + + tic_t platinumtime = UINT32_MAX; + + for (auto &stafftime : stafftimes) { - tic_t time = map->ghostBrief[i]->time; - if (time == stafftimes.at(0)) + if (stafftime == stafftimes[0]) { - tic_t delta = map->automedaltime[1] - map->automedaltime[0]; - - CONS_Printf("%s: %s (-%s)\n", map->lumpname, map->ghostBrief[i]->name, va("%d\"%02d", - G_TicsToSeconds(delta), - G_TicsToCentiseconds(delta)) - ); - platinums.push_back(map->ghostBrief[i]->name); - break; + CONS_Printf("%s (%02d:%02d:%02d)", stafftime.second.c_str(), + G_TicsToMinutes(stafftime.first, true), G_TicsToSeconds(stafftime.first), G_TicsToCentiseconds(stafftime.first)); + platinumtime = stafftime.first; + } + else + { + CONS_Printf(", %s (+%d:%02d)", stafftime.second.c_str(), + G_TicsToSeconds(stafftime.first - platinumtime), G_TicsToCentiseconds(stafftime.first - platinumtime)); } } + + CONS_Printf("\n"); + + platinums.push_back(stafftimes[0].second); } std::unordered_map frequency; From fcd9f5cfafdf15fe38bc45d64ee9a3fb07379eef Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Wed, 3 Sep 2025 15:17:37 -0400 Subject: [PATCH 4/4] Track duplicates --- src/p_setup.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d51e4a4e1..29674930d 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -9537,6 +9537,8 @@ void Command_Platinums(void) tic_t platinumtime = UINT32_MAX; + std::unordered_map names; + for (auto &stafftime : stafftimes) { if (stafftime == stafftimes[0]) @@ -9550,6 +9552,12 @@ void Command_Platinums(void) CONS_Printf(", %s (+%d:%02d)", stafftime.second.c_str(), G_TicsToSeconds(stafftime.first - platinumtime), G_TicsToCentiseconds(stafftime.first - platinumtime)); } + + names[stafftime.second]++; + if (names[stafftime.second] > 1) + { + CONS_Printf(" (DUPLICATE)"); + } } CONS_Printf("\n");