mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-16 15:20:11 -05:00
Add Total Checks to Check/Item Trackers - devrando edition (#4292)
* Fix fmt in savestates * Check Tracker Totals
This commit is contained in:
parent
bfba2a180a
commit
6ea8823de1
@ -138,6 +138,8 @@ u32 areasSpoiled = 0;
|
|||||||
bool showVOrMQ;
|
bool showVOrMQ;
|
||||||
s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)"
|
s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)"
|
||||||
s8 areaCheckTotals[RCAREA_INVALID];
|
s8 areaCheckTotals[RCAREA_INVALID];
|
||||||
|
uint16_t totalChecks = 0;
|
||||||
|
uint16_t totalChecksGotten = 0;
|
||||||
bool optCollapseAll; // A bool that will collapse all checks once
|
bool optCollapseAll; // A bool that will collapse all checks once
|
||||||
bool optExpandAll; // A bool that will expand all checks once
|
bool optExpandAll; // A bool that will expand all checks once
|
||||||
RandomizerCheck lastLocationChecked = RC_UNKNOWN_CHECK;
|
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() {
|
void RecalculateAreaTotals() {
|
||||||
for (auto [rcArea, checks] : checksByArea) {
|
for (auto [rcArea, checks] : checksByArea) {
|
||||||
if (rcArea == RCAREA_INVALID) {
|
if (rcArea == RCAREA_INVALID) {
|
||||||
@ -278,6 +298,9 @@ void RecalculateAreaTotals() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalChecks = 0;
|
||||||
|
totalChecksGotten = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCheckCollected(RandomizerCheck rc) {
|
void SetCheckCollected(RandomizerCheck rc) {
|
||||||
@ -957,6 +980,10 @@ void CheckTrackerWindow::DrawElement() {
|
|||||||
|
|
||||||
UIWidgets::PaddedSeparator();
|
UIWidgets::PaddedSeparator();
|
||||||
|
|
||||||
|
ImGui::Text("Total Checks: %d / %d", totalChecksGotten, totalChecks);
|
||||||
|
|
||||||
|
UIWidgets::PaddedSeparator();
|
||||||
|
|
||||||
//Checks Section Lead-in
|
//Checks Section Lead-in
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
@ -1349,6 +1376,8 @@ void UpdateOrdering(RandomizerCheckArea rcArea) {
|
|||||||
if(checksByArea.contains(rcArea)) {
|
if(checksByArea.contains(rcArea)) {
|
||||||
std::sort(checksByArea.find(rcArea)->second.begin(), checksByArea.find(rcArea)->second.end(), CompareChecks);
|
std::sort(checksByArea.find(rcArea)->second.begin(), checksByArea.find(rcArea)->second.end(), CompareChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalculateTotals();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEoDCheck(RandomizerCheckType type) {
|
bool IsEoDCheck(RandomizerCheckType type) {
|
||||||
|
@ -51,6 +51,8 @@ bool IsCheckShuffled(RandomizerCheck rc);
|
|||||||
void InitTrackerData(bool isDebug);
|
void InitTrackerData(bool isDebug);
|
||||||
RandomizerCheckArea GetCheckArea();
|
RandomizerCheckArea GetCheckArea();
|
||||||
void UpdateCheck(uint32_t, RandomizerCheckTrackerData);
|
void UpdateCheck(uint32_t, RandomizerCheckTrackerData);
|
||||||
|
uint16_t GetTotalChecks();
|
||||||
|
uint16_t GetTotalChecksGotten();
|
||||||
bool IsAreaSpoiled(RandomizerCheckArea rcArea);
|
bool IsAreaSpoiled(RandomizerCheckArea rcArea);
|
||||||
void SetAreaSpoiled(RandomizerCheckArea rcArea);
|
void SetAreaSpoiled(RandomizerCheckArea rcArea);
|
||||||
} // namespace CheckTracker
|
} // namespace CheckTracker
|
||||||
|
@ -316,6 +316,11 @@ typedef enum {
|
|||||||
SECTION_DISPLAY_EXTENDED_SEPARATE
|
SECTION_DISPLAY_EXTENDED_SEPARATE
|
||||||
} ItemTrackerExtendedDisplayType;
|
} ItemTrackerExtendedDisplayType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SECTION_DISPLAY_MINIMAL_HIDDEN,
|
||||||
|
SECTION_DISPLAY_MINIMAL_SEPARATE
|
||||||
|
} ItemTrackerMinimalDisplayType;
|
||||||
|
|
||||||
struct ItemTrackerNumbers {
|
struct ItemTrackerNumbers {
|
||||||
int currentCapacity;
|
int currentCapacity;
|
||||||
int maxCapacity;
|
int maxCapacity;
|
||||||
@ -911,6 +916,16 @@ void DrawNotes(bool resizeable = false) {
|
|||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawTotalChecks() {
|
||||||
|
uint16_t totalChecks = CheckTracker::GetTotalChecks();
|
||||||
|
uint16_t totalChecksGotten = CheckTracker::GetTotalChecksGotten();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
ImGui::SetWindowFontScale(2.5);
|
||||||
|
ImGui::Text("Checks: %d/%d", totalChecksGotten, totalChecks);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
|
||||||
// Windowing stuff
|
// Windowing stuff
|
||||||
ImVec4 ChromaKeyBackground = { 0, 0, 0, 0 }; // Float value, 1 = 255 in rgb value.
|
ImVec4 ChromaKeyBackground = { 0, 0, 0, 0 }; // Float value, 1 = 255 in rgb value.
|
||||||
void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
|
void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
|
||||||
@ -1313,6 +1328,14 @@ void ItemTrackerWindow::DrawElement() {
|
|||||||
DrawNotes(true);
|
DrawNotes(true);
|
||||||
EndFloatingWindows();
|
EndFloatingWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CVarGetInteger("gTrackers.ItemTracker.TotalChecks.DisplayType", SECTION_DISPLAY_MINIMAL_HIDDEN) ==
|
||||||
|
SECTION_DISPLAY_MINIMAL_SEPARATE) {
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver);
|
||||||
|
BeginFloatingWindows("Total Checks");
|
||||||
|
DrawTotalChecks();
|
||||||
|
EndFloatingWindows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1324,6 +1347,7 @@ static const char* displayModes[2] = { "Always", "Combo Button Hold" };
|
|||||||
static const char* buttons[14] = { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
static const char* buttons[14] = { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
|
||||||
static const char* displayTypes[3] = { "Hidden", "Main Window", "Separate" };
|
static const char* displayTypes[3] = { "Hidden", "Main Window", "Separate" };
|
||||||
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Separate" };
|
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Separate" };
|
||||||
|
static const char* minimalDisplayTypes[2] = { "Hidden", "Separate" };
|
||||||
|
|
||||||
void ItemTrackerSettingsWindow::DrawElement() {
|
void ItemTrackerSettingsWindow::DrawElement() {
|
||||||
ImGui::SetNextWindowSize(ImVec2(733, 472), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(733, 472), ImGuiCond_FirstUseEver);
|
||||||
@ -1459,6 +1483,10 @@ void ItemTrackerSettingsWindow::DrawElement() {
|
|||||||
shouldUpdateVectors = true;
|
shouldUpdateVectors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Total Checks", "gTrackers.ItemTracker.TotalChecks.DisplayType", minimalDisplayTypes, SECTION_DISPLAY_MINIMAL_HIDDEN)) {
|
||||||
|
shouldUpdateVectors = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
|
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
|
||||||
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, SECTION_DISPLAY_HIDDEN)) {
|
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, SECTION_DISPLAY_HIDDEN)) {
|
||||||
shouldUpdateVectors = true;
|
shouldUpdateVectors = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user