From 25417e96ebc349690774adfdda3b1e8bcfe7354e Mon Sep 17 00:00:00 2001 From: Antonio Martinez Date: Tue, 2 Sep 2025 06:31:10 -0400 Subject: [PATCH] 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;