Add Total Checks to Check/Item Trackers - devrando edition (#4292)

* Fix fmt in savestates

* Check Tracker Totals
This commit is contained in:
aMannus 2024-08-16 00:39:50 +02:00 committed by GitHub
commit 6ea8823de1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 59 additions and 0 deletions

View file

@ -138,6 +138,8 @@ u32 areasSpoiled = 0;
bool showVOrMQ;
s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)"
s8 areaCheckTotals[RCAREA_INVALID];
uint16_t totalChecks = 0;
uint16_t totalChecksGotten = 0;
bool optCollapseAll; // A bool that will collapse all checks once
bool optExpandAll; // A bool that will expand all checks once
RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK;
@ -260,6 +262,24 @@ void TrySetAreas() {
}
}
void CalculateTotals() {
totalChecks = 0;
totalChecksGotten = 0;
for (uint8_t i = 0; i < RCAREA_INVALID; i++) {
totalChecks += areaCheckTotals[i];
totalChecksGotten += areaChecksGotten[i];
}
}
uint16_t GetTotalChecks() {
return totalChecks;
}
uint16_t GetTotalChecksGotten() {
return totalChecksGotten;
}
void RecalculateAreaTotals() {
for (auto [rcArea, checks] : checksByArea) {
if (rcArea == RCAREA_INVALID) {
@ -278,6 +298,9 @@ void RecalculateAreaTotals() {
}
}
}
totalChecks = 0;
totalChecksGotten = 0;
}
void SetCheckCollected(RandomizerCheck rc) {
@ -957,6 +980,10 @@ void CheckTrackerWindow::DrawElement() {
UIWidgets::PaddedSeparator();
ImGui::Text("Total Checks: %d / %d", totalChecksGotten, totalChecks);
UIWidgets::PaddedSeparator();
//Checks Section Lead-in
ImGui::TableNextRow();
ImGui::TableNextColumn();
@ -1349,6 +1376,8 @@ void UpdateOrdering(RandomizerCheckArea rcArea) {
if(checksByArea.contains(rcArea)) {
std::sort(checksByArea.find(rcArea)->second.begin(), checksByArea.find(rcArea)->second.end(), CompareChecks);
}
CalculateTotals();
}
bool IsEoDCheck(RandomizerCheckType type) {