Skip to content

Commit

Permalink
Add Item Tracker entry for player speed
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Jan 31, 2024
1 parent cc6a833 commit 36fcf3f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ typedef enum {
SECTION_DISPLAY_EXTENDED_SEPARATE
} ItemTrackerExtendedDisplayType;

typedef enum {
SECTION_DISPLAY_MINIMAL_HIDDEN,
SECTION_DISPLAY_MINIMAL_SEPARATE
} ItemTrackerMinimalDisplayType;

struct ItemTrackerNumbers {
int currentCapacity;
int maxCapacity;
Expand Down Expand Up @@ -739,6 +744,14 @@ void DrawNotes(bool resizeable = false) {
ImGui::EndGroup();
}

void DrawPlayerSpeed() {
ImGui::BeginGroup();
uint32_t playerSpeed = CVarGetInteger("gFasterOnButtonPressesSpeed", 0);
ImGui::SetWindowFontScale(4.0);
ImGui::Text("CURRENT SPEED: %d%%", playerSpeed);
ImGui::EndGroup();
}

// Windowing stuff
ImVec4 ChromaKeyBackground = { 0, 0, 0, 0 }; // Float value, 1 = 255 in rgb value.
void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) {
Expand Down Expand Up @@ -1062,6 +1075,13 @@ void ItemTrackerWindow::DrawElement() {
DrawNotes(true);
EndFloatingWindows();
}

if (CVarGetInteger("gItemTrackerPlayerSpeedDisplayType", SECTION_DISPLAY_MINIMAL_HIDDEN) == SECTION_DISPLAY_MINIMAL_SEPARATE) {
ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver);
BeginFloatingWindows("Player Speed");
DrawPlayerSpeed();
EndFloatingWindows();
}
}
}

Expand All @@ -1073,6 +1093,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* displayTypes[3] = { "Hidden", "Main Window", "Separate" };
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Separate" };
static const char* minimalDisplayTypes[2] = { "Hidden", "Separate" };

void ItemTrackerSettingsWindow::DrawElement() {
ImGui::SetNextWindowSize(ImVec2(733, 472), ImGuiCond_FirstUseEver);
Expand Down Expand Up @@ -1201,6 +1222,10 @@ void ItemTrackerSettingsWindow::DrawElement() {
}
}

if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Player Speed", "gItemTrackerPlayerSpeedDisplayType", minimalDisplayTypes, SECTION_DISPLAY_MINIMAL_HIDDEN)) {
shouldUpdateVectors = true;
}

ImGui::PopStyleVar(1);
ImGui::EndTable();

Expand Down

0 comments on commit 36fcf3f

Please sign in to comment.