Skip to content

Rando settings streamline #3391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b5c08f7
Removes cvarSettings map.
leggettc18 Nov 7, 2023
c64bf4f
Early version of ImGui Render function
leggettc18 Nov 8, 2023
d6ee47c
Implementation of Checkbox and Combobox rendering.
leggettc18 Nov 8, 2023
e49fef6
Auto-render entire first tab of Randomizer Settings
leggettc18 Nov 8, 2023
de53d95
Switch remaining tabs to auto-render
leggettc18 Nov 8, 2023
eba7afd
Implements disabling options
leggettc18 Nov 9, 2023
087ba09
Cleanup/Documentation
leggettc18 Nov 9, 2023
c4c06c5
Auto-render entire table columns
leggettc18 Nov 10, 2023
94d5405
Implement OptionGroup rendering for "Sections"
leggettc18 Nov 10, 2023
63157fd
Automates the rendering of tables in the Settings window.
leggettc18 Nov 11, 2023
c726b83
Adds ability for option groups to have descriptions,
leggettc18 Nov 11, 2023
3105142
Fix as many IDE warnings as possible in option.h/cpp
leggettc18 Nov 11, 2023
b3a571c
Fixes some simple bugs
leggettc18 Nov 12, 2023
cedc899
fix another small oopsie
leggettc18 Nov 12, 2023
15508c5
Fixes parsing some of the option changes
leggettc18 Nov 13, 2023
365be15
Merge branch 'develop-rando' of https://github.com/HarbourMasters/Shi…
leggettc18 Nov 21, 2023
abc89a8
Fix bug with status of skip child stealth
leggettc18 Nov 28, 2023
4e1c11a
Renames the Settings::Setting function to GetOption
leggettc18 Nov 28, 2023
da37154
Add `Settings` pointer as a member of `RandomizerSettingsWindow`.
leggettc18 Nov 28, 2023
f4a9d72
Replaces ctx->GetOption with direct access to mOptions
leggettc18 Nov 29, 2023
a5bcfe7
Merge branch 'develop-rando' into rando-settings-streamline
leggettc18 Dec 6, 2023
dded8eb
Implements a few IDE/Linter suggestions
leggettc18 Dec 6, 2023
e2e1a44
Merge branch 'develop-rando' into rando-settings-streamline
leggettc18 Dec 10, 2023
130a390
Merge branch 'develop-rando' into rando-settings-streamline
leggettc18 Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup/Documentation
  • Loading branch information
leggettc18 committed Nov 17, 2023
commit 087ba09c2a0d50c77dce4cd13c0ff38dd0ba5f75
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/randomizer/3drando/playthrough.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int Playthrough_Init(uint32_t seed, std::set<RandomizerCheck> excludedLocations,
ctx->HintReset();
Areas::AccessReset();

ctx->GetSettings()->UpdateSettings(excludedLocations, enabledTricks);
ctx->GetSettings()->FinalizeSettings(excludedLocations, enabledTricks);
// once the settings have been finalized turn them into a string for hashing
std::string settingsStr;
for (const Rando::OptionGroup& optionGroup : ctx->GetSettings()->GetOptionGroups()) {
Expand Down
45 changes: 10 additions & 35 deletions soh/soh/Enhancements/randomizer/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,34 +129,6 @@ bool Option::IsCategory(OptionCategory category) const {
return category == this->category;
}

// Automatically adds newlines to break up text longer than a specified number of characters
// Manually included newlines will still be respected and reset the line length
// If line is midword when it hits the limit, text should break at the last encountered space
char* WrappedText(const char* text, unsigned int charactersPerLine) {
std::string newText(text);
const size_t tipLength = newText.length();
int lastSpace = -1;
int currentLineLength = 0;
for (unsigned int currentCharacter = 0; currentCharacter < tipLength; currentCharacter++) {
if (newText[currentCharacter] == '\n') {
currentLineLength = 0;
lastSpace = -1;
continue;
} else if (newText[currentCharacter] == ' ') {
lastSpace = currentCharacter;
}

if ((currentLineLength >= charactersPerLine) && (lastSpace >= 0)) {
newText[lastSpace] = '\n';
currentLineLength = currentCharacter - lastSpace - 1;
lastSpace = -1;
}
currentLineLength++;
}

return strdup(newText.c_str());
}

void Option::RenderImGui() const {
ImGui::BeginGroup();
switch (widgetType) {
Expand Down Expand Up @@ -218,6 +190,11 @@ void Option::RenderCombobox() const {
}
ImGui::Text("%s", name.c_str());
uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption);
if (selected >= options.size()) {
selected--;
CVarSetInteger(cvarName.c_str(), selected);
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
if (!description.empty()) {
UIWidgets::InsertHelpHoverText(description.c_str());
}
Expand Down Expand Up @@ -296,25 +273,23 @@ void Option::RenderSlider() const {
}
}

OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, OptionGroupType groupType, bool printInSpoiler,
OptionGroupType containsType)
OptionGroup::OptionGroup(std::string name, std::vector<Option*> options, OptionGroupType groupType, bool printInSpoiler)
: mName(std::move(name)), mOptions(std::move(options)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler),
mContainsType(containsType) {
mContainsType(OptionGroupType::DEFAULT) {
}

OptionGroup::OptionGroup(std::string name, std::vector<OptionGroup*> subGroups, OptionGroupType groupType,
bool printInSpoiler, OptionGroupType containsType)
bool printInSpoiler)
: mName(std::move(name)), mSubGroups(std::move(subGroups)), mGroupType(groupType), mPrintInSpoiler(printInSpoiler),
mContainsType(containsType) {
mContainsType(OptionGroupType::SUBGROUP) {
}

OptionGroup OptionGroup::SubGroup(std::string name, std::vector<Option*> options, bool printInSpoiler) {
return OptionGroup(std::move(name), std::move(options), OptionGroupType::SUBGROUP, printInSpoiler);
}

OptionGroup OptionGroup::SubGroup(std::string name, std::vector<OptionGroup*> subGroups, bool printInSpoiler) {
return OptionGroup(std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, printInSpoiler,
OptionGroupType::SUBGROUP);
return OptionGroup(std::move(name), std::move(subGroups), OptionGroupType::SUBGROUP, printInSpoiler);
}

const std::string& OptionGroup::GetName() const {
Expand Down
Loading