Print all ghosts for any map along with their gaps

This commit is contained in:
Antonio Martinez 2025-09-02 06:31:10 -04:00
parent d4cbcab1cb
commit 25417e96eb

View file

@ -9512,8 +9512,7 @@ void Command_Platinums(void)
if (map == NULL || map->ghostCount < 1) if (map == NULL || map->ghostCount < 1)
continue; continue;
// Gather staff ghost times srb2::Vector<std::pair<tic_t, std::string>> stafftimes;
srb2::Vector<tic_t> stafftimes;
for (int i = 0; i < map->ghostCount; i++) for (int i = 0; i < map->ghostCount; i++)
{ {
tic_t time = map->ghostBrief[i]->time; tic_t time = map->ghostBrief[i]->time;
@ -9522,7 +9521,7 @@ void Command_Platinums(void)
continue; 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()) if (stafftimes.empty())
@ -9530,23 +9529,32 @@ void Command_Platinums(void)
continue; 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 (stafftime == stafftimes[0])
if (time == stafftimes.at(0))
{ {
tic_t delta = map->automedaltime[1] - map->automedaltime[0]; CONS_Printf("%s (%02d:%02d:%02d)", stafftime.second.c_str(),
G_TicsToMinutes(stafftime.first, true), G_TicsToSeconds(stafftime.first), G_TicsToCentiseconds(stafftime.first));
CONS_Printf("%s: %s (-%s)\n", map->lumpname, map->ghostBrief[i]->name, va("%d\"%02d", platinumtime = stafftime.first;
G_TicsToSeconds(delta), }
G_TicsToCentiseconds(delta)) else
); {
platinums.push_back(map->ghostBrief[i]->name); CONS_Printf(", %s (+%d:%02d)", stafftime.second.c_str(),
break; G_TicsToSeconds(stafftime.first - platinumtime), G_TicsToCentiseconds(stafftime.first - platinumtime));
} }
} }
CONS_Printf("\n");
platinums.push_back(stafftimes[0].second);
} }
std::unordered_map<std::string, int> frequency; std::unordered_map<std::string, int> frequency;