Cleanup of ImGui code (#2576)

* Change sliders to have +/- buttons by default

* Remove unnecessary margin setting

* Add +/- buttons to remaining sliders and fix some broken UI

* Update EnhancementComboBox to not need array size

* Remove redundant widgets from randomizer

* Miscellaneous fixes

* Fix Switch build break

* Consolidate disabled styling in widgets

* Simplify widget logic

* Merge with most recent PRs

* Fix audio fanfare and sound effect sliders mixup

* Fix sliders being one button too wide

* Fix sliders being too long

* Fix sliders being too long on console
This commit is contained in:
Josh Bodner 2023-04-01 13:10:49 -07:00 committed by GitHub
parent 2aa7c71eac
commit 21d82e7c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 654 additions and 839 deletions

View File

@ -2226,7 +2226,6 @@ typedef enum {
/* 0x00 */ PAUSE_ANY_CURSOR_RANDO_ONLY,
/* 0x01 */ PAUSE_ANY_CURSOR_ALWAYS_ON,
/* 0x02 */ PAUSE_ANY_CURSOR_ALWAYS_OFF,
/* 0x03 */ PAUSE_ANY_CURSOR_MAX
} PauseCursorAnySlotOptions;
#define ROM_FILE(name) \

View File

@ -366,8 +366,10 @@ void DrawSfxEditor(bool& open) {
"is loaded to the main sequence player (does not apply to fanfares or enemy BGM)."
);
ImGui::SameLine();
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
UIWidgets::EnhancementSliderInt("Overlay Duration: %d seconds", "##SeqNameOverlayDuration",
"gSeqNameOverlayDuration", 1, 10, "", 5, true);
"gSeqNameOverlayDuration", 1, 10, "", 5);
ImGui::PopItemWidth();
ImGui::NewLine();
UIWidgets::PaddedSeparator();
UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects.");

View File

@ -136,6 +136,7 @@ namespace GameControlEditor {
}
if (ImGui::Selectable(i->second, i->first == currentButton)) {
CVarSetInteger(mapping.cVarName, i->first);
SohImGui::RequestCvarSaveOnNextTick();
}
}
ImGui::EndCombo();
@ -209,6 +210,7 @@ namespace GameControlEditor {
UIWidgets::EnhancementCheckbox("Play with D-pad", "gDpadOcarina");
TableHelper::NextCol();
UIWidgets::EnhancementCheckbox("Play with camera stick", "gRStickOcarina");
UIWidgets::Spacer(0);
ImGui::EndTable();
}
SohImGui::EndGroupPanel();
@ -236,21 +238,20 @@ namespace GameControlEditor {
DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
DrawHelpIcon("Inverts the Camera X Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", "gInvertAimingYAxis");
DrawHelpIcon("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false);
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %d %%", "##FirstPersonSensitivity Horizontal",
"gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true);
"gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true);
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %d %%", "##FirstPersonSensitivity Vertical",
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true);
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
} else {
CVarSetFloat("gFirstPersonCameraSensitivity", 1.0f);
}
UIWidgets::Spacer(0);
SohImGui::EndGroupPanel();
UIWidgets::Spacer(0);
@ -263,14 +264,15 @@ namespace GameControlEditor {
DrawHelpIcon("Inverts the Camera X Axis in:\n-Free camera");
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
DrawHelpIcon("Inverts the Camera Y Axis in:\n-Free camera");
+ UIWidgets::EnhancementSliderFloat("Third-Person Horizontal Sensitivity: %d %%", "##ThirdPersonSensitivity Horizontal",
+ "gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true);
+ UIWidgets::EnhancementSliderFloat("Third-Person Vertical Sensitivity: %d %%", "##ThirdPersonSensitivity Vertical",
+ "gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true);
UIWidgets::EnhancementSliderInt("Camera Distance: %d", "##CamDist",
"gFreeCameraDistMax", 100, 900, "", 185, true);
UIWidgets::EnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",
"gFreeCameraTransitionSpeed", 0, 900, "", 25, true);
UIWidgets::Spacer(0);
+ UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %d %%", "##ThirdPersonSensitivity Horizontal",
+ "gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
+ UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %d %%", "##ThirdPersonSensitivity Vertical",
+ "gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Camera Distance: %d", "##CamDist",
"gFreeCameraDistMax", 100, 900, "", 185, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed",
"gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true);
SohImGui::EndGroupPanel();
}
@ -303,7 +305,7 @@ namespace GameControlEditor {
SohImGui::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
UIWidgets::PaddedText("Allow the cursor to be on any slot");
static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" };
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_MAX, PAUSE_ANY_CURSOR_RANDO_ONLY);
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY);
DrawHelpIcon("Allows the cursor on the pause menu to be over any slot. Sometimes required in rando to select "
"certain items.");
UIWidgets::Spacer(0);
@ -313,8 +315,8 @@ namespace GameControlEditor {
UIWidgets::Spacer(5);
SohImGui::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
UIWidgets::EnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true);
UIWidgets::EnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true);
UIWidgets::PaddedEnhancementSliderFloat("Modifier 1: %d %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
UIWidgets::PaddedEnhancementSliderFloat("Modifier 2: %d %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
SohImGui::EndGroupPanel();
}
UIWidgets::Spacer(0);

View File

@ -317,11 +317,12 @@ static std::map<std::string, CosmeticOption> cosmeticOptions = {
COSMETIC_OPTION("NPC_IronKnuckles", "Iron Knuckles", GROUP_NPC, ImVec4(245, 255, 205, 255), false, true, false),
};
const char* MarginCvarList[] {
static const char* MarginCvarList[] {
"gHearts", "gHeartsCount", "gMagicBar", "gVSOA", "gBBtn", "gABtn", "gStartBtn",
"gCBtnU", "gCBtnD", "gCBtnL", "gCBtnR", "gDPad", "gMinimap",
"gSKC", "gRC", "gCarrots", "gTimers", "gAS", "gTCM", "gTCB"
};
static const char* MarginCvarNonAnchor[]{ "gCarrots", "gTimers", "gAS", "gTCM","gTCB" };
ImVec4 GetRandomValue(int MaximumPossible){
ImVec4 NewColor;
@ -345,24 +346,26 @@ void SetMarginAll(const char* ButtonName, bool SetActivated) {
if (ImGui::Button(ButtonName)) {
u8 arrayLength = sizeof(MarginCvarList) / sizeof(*MarginCvarList);
//MarginCvarNonAnchor is an array that list every element that has No anchor by default, because if that the case this function will not touch it with pose type 0.
const char* MarginCvarNonAnchor[] { "gCarrots", "gTimers", "gAS", "gTCM","gTCB" };
u8 arrayLengthNonMargin = sizeof(MarginCvarNonAnchor) / sizeof(*MarginCvarNonAnchor);
for (u8 s = 0; s < arrayLength; s++) {
std::string cvarName = MarginCvarList[s];
std::string cvarPosType = cvarName+"PosType";
std::string cvarNameMargins = cvarName+"UseMargins";
if (CVarGetInteger(cvarPosType.c_str(),0) <= 2 && SetActivated) { //Our element is not Hidden or Non anchor
for(int i = 0; i < arrayLengthNonMargin; i++){
if(MarginCvarNonAnchor[i] == cvarName && CVarGetInteger(cvarPosType.c_str(),0) == 0){ //Our element is both in original position and do not have anchor by default so we skip it.
CVarSetInteger(cvarNameMargins.c_str(), false); //force set off
} else if(MarginCvarNonAnchor[i] == cvarName && CVarGetInteger(cvarPosType.c_str(),0) != 0){ //Our element is not in original position regarless it has no anchor by default since player made it anchored we can toggle margins
CVarSetInteger(cvarNameMargins.c_str(), SetActivated);
} else if(MarginCvarNonAnchor[i] != cvarName){ //Our elements has an anchor by default so regarless of it's position right now that okay to toggle margins.
CVarSetInteger(cvarNameMargins.c_str(), SetActivated);
const char* cvarName = MarginCvarList[s];
const char* cvarPosType = std::string(cvarName).append("PosType").c_str();
const char* cvarNameMargins = std::string(cvarName).append("UseMargins").c_str();
if (CVarGetInteger(cvarPosType,0) <= 2 && SetActivated) { //Our element is not Hidden or Non anchor
for (int i = 0; i < arrayLengthNonMargin; i++){
if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType, 0) == 0)) { //Our element is both in original position and do not have anchor by default so we skip it.
CVarSetInteger(cvarNameMargins, false); //force set off
}
else if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType, 0) != 0)) { //Our element is not in original position regarless it has no anchor by default since player made it anchored we can toggle margins
CVarSetInteger(cvarNameMargins, SetActivated);
}
else if (strcmp(cvarName, MarginCvarNonAnchor[i]) != 0) { //Our elements has an anchor by default so regarless of it's position right now that okay to toggle margins.
CVarSetInteger(cvarNameMargins, SetActivated);
}
}
} else { //Since the user requested to turn all margin off no need to do any check there.
CVarSetInteger(cvarNameMargins.c_str(), SetActivated);
}
else { //Since the user requested to turn all margin off no need to do any check there.
CVarSetInteger(cvarNameMargins, SetActivated);
}
}
}
@ -371,11 +374,11 @@ void ResetPositionAll() {
if (ImGui::Button("Reset all positions")) {
u8 arrayLength = sizeof(MarginCvarList) / sizeof(*MarginCvarList);
for (u8 s = 0; s < arrayLength; s++) {
std::string cvarName = MarginCvarList[s];
std::string cvarPosType = cvarName+"PosType";
std::string cvarNameMargins = cvarName+"UseMargins";
CVarSetInteger(cvarPosType.c_str(), 0);
CVarSetInteger(cvarNameMargins.c_str(), false); //Turn margin off to everythings as that original position.
const char* cvarName = MarginCvarList[s];
const char* cvarPosType = std::string(cvarName).append("PosType").c_str();
const char* cvarNameMargins = std::string(cvarName).append("UseMargins").c_str();
CVarSetInteger(cvarPosType, 0);
CVarSetInteger(cvarNameMargins, false); //Turn margin off to everythings as that original position.
}
}
}
@ -1092,30 +1095,30 @@ void DrawPositionSlider(const std::string CvarName, int MinY, int MaxY, int MinX
std::string PosYCvar = CvarName+"PosY";
std::string InvisibleLabelX = "##"+PosXCvar;
std::string InvisibleLabelY = "##"+PosYCvar;
UIWidgets::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0, true);
UIWidgets::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0);
UIWidgets::Tooltip("This slider is used to move Up and Down your elements.");
UIWidgets::EnhancementSliderInt("Left <-> Right : %d", InvisibleLabelX.c_str(), PosXCvar.c_str(), MinX, MaxX, "", 0, true);
UIWidgets::EnhancementSliderInt("Left <-> Right : %d", InvisibleLabelX.c_str(), PosXCvar.c_str(), MinX, MaxX, "", 0);
UIWidgets::Tooltip("This slider is used to move Left and Right your elements.");
}
void DrawScaleSlider(const std::string CvarName,float DefaultValue){
std::string InvisibleLabel = "##"+CvarName;
std::string CvarLabel = CvarName+"Scale";
//Disabled for now. feature not done and several fixes needed to be merged.
//UIWidgets::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true,true);
//UIWidgets::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true);
}
void Draw_Placements(){
if (ImGui::BeginTable("tableMargins", 1, FlagsTable)) {
ImGui::TableSetupColumn("General margins settings", FlagsCell, TablesCellsWidth);
Table_InitHeader();
UIWidgets::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0, true);
UIWidgets::EnhancementSliderInt("Right: %dx", "##UIMARGINR", "gHUDMargin_R", (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", "gHUDMargin_B", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true);
UIWidgets::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0);
UIWidgets::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0);
UIWidgets::EnhancementSliderInt("Right: %dx", "##UIMARGINR", "gHUDMargin_R", (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0);
UIWidgets::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", "gHUDMargin_B", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0);
SetMarginAll("All margins on",true);
UIWidgets::Tooltip("Set most of the element to use margin\nSome elements with default position will not be affected\nElements without Archor or Hidden will not be turned on");
UIWidgets::Tooltip("Set most of the elements to use margins\nSome elements with default position will not be affected\nElements without Anchor or Hidden will not be turned on");
ImGui::SameLine();
SetMarginAll("All margins off",false);
UIWidgets::Tooltip("Set all of the element to not use margin");
UIWidgets::Tooltip("Set all of the elements to not use margins");
ImGui::SameLine();
ResetPositionAll();
UIWidgets::Tooltip("Revert every element to use their original position and no margins");
@ -1130,7 +1133,7 @@ void Draw_Placements(){
DrawPositionsRadioBoxes("gHeartsCount");
DrawPositionSlider("gHeartsCount",-22,ImGui::GetWindowViewport()->Size.y,-125,ImGui::GetWindowViewport()->Size.x);
DrawScaleSlider("gHeartsCount",0.7f);
UIWidgets::EnhancementSliderInt("Heart line length : %d", "##HeartLineLength", "gHeartsLineLength", 0, 20, "", 10, true);
UIWidgets::EnhancementSliderInt("Heart line length : %d", "##HeartLineLength", "gHeartsLineLength", 0, 20, "", 10);
UIWidgets::Tooltip("This will set the length of a row of hearts. Set to 0 for unlimited length.");
ImGui::NewLine();
ImGui::EndTable();
@ -1659,7 +1662,7 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
}
}
const char* colorSchemes[2] = {
static const char* colorSchemes[2] = {
"N64",
"Gamecube",
};
@ -1678,7 +1681,7 @@ void DrawCosmeticsEditor(bool& open) {
ImGui::Text("Color Scheme");
ImGui::SameLine();
UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, 2, 0);
UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, 0);
UIWidgets::EnhancementCheckbox("Advanced Mode", "gCosmetics.AdvancedMode");
if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) {
if (ImGui::Button("Lock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) {
@ -1754,7 +1757,7 @@ void DrawCosmeticsEditor(bool& open) {
DrawCosmeticGroup(GROUP_ARROWS);
DrawCosmeticGroup(GROUP_SPIN_ATTACK);
DrawCosmeticGroup(GROUP_TRAILS);
if (UIWidgets::EnhancementSliderInt("Trails Duration: %d", "##Trails_Duration", "gCosmetics.Trails_Duration.Value", 2, 20, "", 4, false)) {
if (UIWidgets::EnhancementSliderInt("Trails Duration: %d", "##Trails_Duration", "gCosmetics.Trails_Duration.Value", 2, 20, "", 4)) {
CVarSetInteger("gCosmetics.Trails_Duration.Changed", 1);
}
ImGui::SameLine();

View File

@ -285,12 +285,10 @@ static bool TakeAmmoHandler(std::shared_ptr<Ship::Console> Console, const std::v
}
const static std::map<std::string, uint16_t> bottleItems{
{ "green_potion", ITEM_POTION_GREEN },
{ "red_potion", ITEM_POTION_RED },
{ "blue_potion", ITEM_POTION_BLUE },
{ "milk", ITEM_MILK }, { "half_milk", ITEM_MILK_HALF }, { "fairy", ITEM_FAIRY },
{ "bugs", ITEM_BUG }, { "fish", ITEM_FISH }, { "poe", ITEM_POE },
{ "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO },
{ "green_potion", ITEM_POTION_GREEN }, { "red_potion", ITEM_POTION_RED }, { "blue_potion", ITEM_POTION_BLUE },
{ "milk", ITEM_MILK }, { "half_milk", ITEM_MILK_HALF }, { "fairy", ITEM_FAIRY },
{ "bugs", ITEM_BUG }, { "fish", ITEM_FISH }, { "poe", ITEM_POE },
{ "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO },
};
static bool BottleHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
@ -418,7 +416,7 @@ static bool ReloadHandler(std::shared_ptr<Ship::Console> Console, const std::vec
}
const static std::map<std::string, uint16_t> fw_options {
{ "clear", 0}, {"warp", 1}, {"nackup", 2}
{ "clear", 0}, {"warp", 1}, {"backup", 2}
};
static bool FWHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
@ -1430,13 +1428,13 @@ void DebugConsole_Init(void) {
}});
CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor_id", Ship::ArgumentType::NUMBER },
{ "data", Ship::ArgumentType::NUMBER },
{ "x", Ship::ArgumentType::PLAYER_POS, true },
{ "y", Ship::ArgumentType::PLAYER_POS, true },
{ "z", Ship::ArgumentType::PLAYER_POS, true },
{ "rx", Ship::ArgumentType::PLAYER_ROT, true },
{ "ry", Ship::ArgumentType::PLAYER_ROT, true },
{ "rz", Ship::ArgumentType::PLAYER_ROT, true }
{ "data", Ship::ArgumentType::NUMBER },
{ "x", Ship::ArgumentType::PLAYER_POS, true },
{ "y", Ship::ArgumentType::PLAYER_POS, true },
{ "z", Ship::ArgumentType::PLAYER_POS, true },
{ "rx", Ship::ArgumentType::PLAYER_ROT, true },
{ "ry", Ship::ArgumentType::PLAYER_ROT, true },
{ "rz", Ship::ArgumentType::PLAYER_ROT, true }
}});
CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", {

View File

@ -18,7 +18,7 @@ extern PlayState* gPlayState;
enum class ColRenderSetting { Disabled, Solid, Transparent };
std::vector<std::string> ColRenderSettingNames = {
static const char* ColRenderSettingNames[] = {
"Disabled",
"Solid",
"Transparent",
@ -64,10 +64,10 @@ void DrawColViewerWindow(bool& open) {
}
UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled");
UIWidgets::EnhancementCombo("Scene", "gColViewerScene", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Bg Actors", "gColViewerBgActors", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Col Check", "gColViewerColCheck", ColRenderSettingNames);
UIWidgets::EnhancementCombo("Waterbox", "gColViewerWaterbox", ColRenderSettingNames);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames, 0);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames, 0);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames, 0);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames, 0);
UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal");
UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring "

View File

@ -323,7 +323,7 @@ void DrawStatsTracker(bool& open) {
ImGui::Text("Display Mode");
ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
UIWidgets::EnhancementCombobox("gGameplayStatsMode", gameplayStatsModeOptions, 3, 0);
UIWidgets::EnhancementCombobox("gGameplayStatsMode", gameplayStatsModeOptions, 0);
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");

View File

@ -105,7 +105,7 @@ static const char* frenchRupeeNames[36] = {
};
Randomizer::Randomizer() {
for (auto [randomizerCheck, rcObject] : RandomizerCheckObjects::GetAllRCObjects()) {
for (auto& [randomizerCheck, rcObject] : RandomizerCheckObjects::GetAllRCObjects()) {
SpoilerfileCheckNameToEnum[rcObject.rcSpoilerName] = rcObject.rc;
checkFromActorMultimap.emplace(std::make_tuple((s16)rcObject.actorId, (s16)rcObject.sceneId, rcObject.actorParams), rcObject);
}
@ -165,46 +165,47 @@ std::unordered_map<std::string, SceneID> spoilerFileDungeonToScene = {
{ "Ganon's Castle", SCENE_GANONTIKA }
};
std::unordered_map<s16, s16>
getItemIdToItemId = { { GI_BOW, ITEM_BOW },
{ GI_ARROW_FIRE, ITEM_ARROW_FIRE },
{ GI_DINS_FIRE, ITEM_DINS_FIRE },
{ GI_SLINGSHOT, ITEM_SLINGSHOT },
{ GI_OCARINA_FAIRY, ITEM_OCARINA_FAIRY },
{ GI_OCARINA_OOT, ITEM_OCARINA_TIME },
{ GI_HOOKSHOT, ITEM_HOOKSHOT },
{ GI_LONGSHOT, ITEM_LONGSHOT },
{ GI_ARROW_ICE, ITEM_ARROW_ICE },
{ GI_FARORES_WIND, ITEM_FARORES_WIND },
{ GI_BOOMERANG, ITEM_BOOMERANG },
{ GI_LENS, ITEM_LENS },
{ GI_HAMMER, ITEM_HAMMER },
{ GI_ARROW_LIGHT, ITEM_ARROW_LIGHT },
{ GI_NAYRUS_LOVE, ITEM_NAYRUS_LOVE },
{ GI_BOTTLE, ITEM_BOTTLE },
{ GI_POTION_RED, ITEM_POTION_RED },
{ GI_POTION_GREEN, ITEM_POTION_GREEN },
{ GI_POTION_BLUE, ITEM_POTION_BLUE },
{ GI_FAIRY, ITEM_FAIRY },
{ GI_FISH, ITEM_FISH },
{ GI_MILK_BOTTLE, ITEM_MILK_BOTTLE },
{ GI_LETTER_RUTO, ITEM_LETTER_RUTO },
{ GI_BLUE_FIRE, ITEM_BLUE_FIRE },
{ GI_BUGS, ITEM_BUG },
{ GI_BIG_POE, ITEM_BIG_POE },
{ GI_POE, ITEM_POE },
{ GI_WEIRD_EGG, ITEM_WEIRD_EGG },
{ GI_LETTER_ZELDA, ITEM_LETTER_ZELDA },
{ GI_POCKET_EGG, ITEM_POCKET_EGG },
{ GI_COJIRO, ITEM_COJIRO },
{ GI_ODD_MUSHROOM, ITEM_ODD_MUSHROOM },
{ GI_ODD_POTION, ITEM_ODD_POTION },
{ GI_SAW, ITEM_SAW },
{ GI_SWORD_BROKEN, ITEM_SWORD_BROKEN },
{ GI_PRESCRIPTION, ITEM_PRESCRIPTION },
{ GI_FROG, ITEM_FROG },
{ GI_EYEDROPS, ITEM_EYEDROPS },
{ GI_CLAIM_CHECK, ITEM_CLAIM_CHECK } };
std::unordered_map<s16, s16> getItemIdToItemId = {
{ GI_BOW, ITEM_BOW },
{ GI_ARROW_FIRE, ITEM_ARROW_FIRE },
{ GI_DINS_FIRE, ITEM_DINS_FIRE },
{ GI_SLINGSHOT, ITEM_SLINGSHOT },
{ GI_OCARINA_FAIRY, ITEM_OCARINA_FAIRY },
{ GI_OCARINA_OOT, ITEM_OCARINA_TIME },
{ GI_HOOKSHOT, ITEM_HOOKSHOT },
{ GI_LONGSHOT, ITEM_LONGSHOT },
{ GI_ARROW_ICE, ITEM_ARROW_ICE },
{ GI_FARORES_WIND, ITEM_FARORES_WIND },
{ GI_BOOMERANG, ITEM_BOOMERANG },
{ GI_LENS, ITEM_LENS },
{ GI_HAMMER, ITEM_HAMMER },
{ GI_ARROW_LIGHT, ITEM_ARROW_LIGHT },
{ GI_NAYRUS_LOVE, ITEM_NAYRUS_LOVE },
{ GI_BOTTLE, ITEM_BOTTLE },
{ GI_POTION_RED, ITEM_POTION_RED },
{ GI_POTION_GREEN, ITEM_POTION_GREEN },
{ GI_POTION_BLUE, ITEM_POTION_BLUE },
{ GI_FAIRY, ITEM_FAIRY },
{ GI_FISH, ITEM_FISH },
{ GI_MILK_BOTTLE, ITEM_MILK_BOTTLE },
{ GI_LETTER_RUTO, ITEM_LETTER_RUTO },
{ GI_BLUE_FIRE, ITEM_BLUE_FIRE },
{ GI_BUGS, ITEM_BUG },
{ GI_BIG_POE, ITEM_BIG_POE },
{ GI_POE, ITEM_POE },
{ GI_WEIRD_EGG, ITEM_WEIRD_EGG },
{ GI_LETTER_ZELDA, ITEM_LETTER_ZELDA },
{ GI_POCKET_EGG, ITEM_POCKET_EGG },
{ GI_COJIRO, ITEM_COJIRO },
{ GI_ODD_MUSHROOM, ITEM_ODD_MUSHROOM },
{ GI_ODD_POTION, ITEM_ODD_POTION },
{ GI_SAW, ITEM_SAW },
{ GI_SWORD_BROKEN, ITEM_SWORD_BROKEN },
{ GI_PRESCRIPTION, ITEM_PRESCRIPTION },
{ GI_FROG, ITEM_FROG },
{ GI_EYEDROPS, ITEM_EYEDROPS },
{ GI_CLAIM_CHECK, ITEM_CLAIM_CHECK }
};
std::unordered_map<std::string, RandomizerSettingKey> SpoilerfileSettingNameToEnum = {
{ "Detailed Logic Settings:Logic", RSK_LOGIC_RULES },
@ -368,7 +369,7 @@ void Randomizer::LoadRandomizerSettings(const char* spoilerFileName) {
ParseRandomizerSettingsFile(spoilerFileName);
}
for(auto randoSetting : gSaveContext.randoSettings) {
for(auto& randoSetting : gSaveContext.randoSettings) {
this->randoSettings[randoSetting.key] = randoSetting.value;
}
}
@ -403,7 +404,7 @@ void Randomizer::LoadHintLocations(const char* spoilerFileName) {
this->ganonHintText = gSaveContext.ganonHintText;
this->ganonText = gSaveContext.ganonText;
for (auto hintLocation : gSaveContext.hintLocations) {
for (const auto& hintLocation : gSaveContext.hintLocations) {
if(hintLocation.check == RC_LINKS_POCKET) break;
this->hintLocations[hintLocation.check] = hintLocation.hintText;
CustomMessageManager::Instance->CreateMessage(
@ -602,7 +603,7 @@ void Randomizer::LoadItemLocations(const char* spoilerFileName, bool silent) {
ParseItemLocationsFile(spoilerFileName, silent);
}
for (auto itemLocation : gSaveContext.itemLocations) {
for (auto& itemLocation : gSaveContext.itemLocations) {
this->itemLocations[itemLocation.check] = itemLocation.get;
}
@ -3030,7 +3031,7 @@ void GenerateRandomizerImgui(std::string seed = "") {
RandomizerCheckObjects::UpdateImGuiVisibility();
// Remove excludes for locations that are no longer allowed to be excluded
for (auto [randomizerCheck, rcObject] : RandomizerCheckObjects::GetAllRCObjects()) {
for (auto& [randomizerCheck, rcObject] : RandomizerCheckObjects::GetAllRCObjects()) {
auto elfound = excludedLocations.find(rcObject.rc);
if (!rcObject.visibleInImgui && elfound != excludedLocations.end()) {
excludedLocations.erase(elfound);
@ -3075,8 +3076,8 @@ void DrawRandoEditor(bool& open) {
static const char* randoDoorOfTime[3] = { "Closed", "Song only", "Open" };
static const char* randoZorasFountain[3] = { "Closed", "Closed as child", "Open" };
static const char* randoGerudoFortress[3] = { "Normal", "Fast", "Open" };
static const char* randoRainbowBridge[8] = { "Vanilla", "Always open", "Stones", "Medallions",
"Dungeon rewards", "Dungeons", "Tokens", "Greg" };
static const char* randoRainbowBridge[8] = { "Vanilla", "Always open", "Stones", "Medallions",
"Dungeon rewards", "Dungeons", "Tokens", "Greg" };
static const char* randoGanonsTrial[3] = { "Skip", "Set Number", "Random Number" };
static const char* randoMqDungeons[3] = { "None", "Set Number", "Random Number" };
@ -3132,8 +3133,9 @@ void DrawRandoEditor(bool& open) {
}
bool disableEditingRandoSettings = CVarGetInteger("gRandoGenerating", 0) || CVarGetInteger("gOnFileSelectNameEntry", 0);
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f));
if (disableEditingRandoSettings) {
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
DrawPresetSelector(PRESET_TYPE_RANDOMIZER);
@ -3207,7 +3209,7 @@ void DrawRandoEditor(bool& open) {
"Open - Mido no longer blocks the path to the Deku Tree. Kokiri "
"boy no longer blocks the path out of the forest."
);
UIWidgets::EnhancementCombobox("gRandomizeForest", randoForest, RO_FOREST_MAX, RO_FOREST_CLOSED);
UIWidgets::EnhancementCombobox("gRandomizeForest", randoForest, RO_FOREST_CLOSED);
UIWidgets::PaddedSeparator();
@ -3220,7 +3222,7 @@ void DrawRandoEditor(bool& open) {
"Open - The gate is always open. The happy mask shop "
"will open immediately after obtaining Zelda's letter."
);
UIWidgets::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, RO_KAK_GATE_MAX, RO_KAK_GATE_CLOSED);
UIWidgets::EnhancementCombobox("gRandomizeKakarikoGate", randoKakarikoGate, RO_KAK_GATE_CLOSED);
UIWidgets::PaddedSeparator();
@ -3235,7 +3237,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Open - The Door of Time is permanently open with no requirements."
);
UIWidgets::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, RO_DOOROFTIME_MAX, RO_DOOROFTIME_CLOSED);
UIWidgets::EnhancementCombobox("gRandomizeDoorOfTime", randoDoorOfTime, RO_DOOROFTIME_CLOSED);
UIWidgets::PaddedSeparator();
@ -3252,7 +3254,7 @@ void DrawRandoEditor(bool& open) {
"Open - King Zora has already mweeped out of the way in both "
"time periods. Ruto's Letter is removed from the item pool."
);
UIWidgets::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, RO_ZF_MAX, RO_ZF_CLOSED);
UIWidgets::EnhancementCombobox("gRandomizeZorasFountain", randoZorasFountain, RO_ZF_CLOSED);
UIWidgets::PaddedSeparator();
@ -3277,7 +3279,7 @@ void DrawRandoEditor(bool& open) {
"Starting as adult means you start with the Master Sword in your inventory.\n"
"The child option is forcefully set if it would conflict with other options."
);
UIWidgets::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, RO_AGE_MAX, RO_AGE_CHILD, disableRandoStartingAge, disableRandoStartingAgeText, RO_AGE_CHILD);
UIWidgets::EnhancementCombobox("gRandomizeStartingAge", randoStartingAge, RO_AGE_CHILD, disableRandoStartingAge, disableRandoStartingAgeText, RO_AGE_CHILD);
UIWidgets::PaddedSeparator();
@ -3293,7 +3295,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Open - The bridge is repaired from the start."
);
UIWidgets::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, RO_GF_MAX, RO_GF_NORMAL);
UIWidgets::EnhancementCombobox("gRandomizeGerudoFortress", randoGerudoFortress, RO_GF_NORMAL);
UIWidgets::PaddedSeparator();
@ -3322,7 +3324,7 @@ void DrawRandoEditor(bool& open) {
"Greg - Find Greg the Green Rupee."
);
UIWidgets::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, RO_BRIDGE_MAX, RO_BRIDGE_VANILLA);
UIWidgets::EnhancementCombobox("gRandomizeRainbowBridge", randoRainbowBridge, RO_BRIDGE_VANILLA);
ImGui::PopItemWidth();
switch (CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) {
case RO_BRIDGE_ALWAYS_OPEN:
@ -3330,29 +3332,24 @@ void DrawRandoEditor(bool& open) {
case RO_BRIDGE_VANILLA:
break;
case RO_BRIDGE_STONES:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Stone Count: %d", "##RandoStoneCount",
"gRandomizeStoneCount", 1, 3, "", 3, true);
UIWidgets::PaddedEnhancementSliderInt("Stone Count: %d", "##RandoStoneCount",
"gRandomizeStoneCount", 1, 3, "", 3, true, true, false);
break;
case RO_BRIDGE_MEDALLIONS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount",
"gRandomizeMedallionCount", 1, 6, "", 6, true);
UIWidgets::PaddedEnhancementSliderInt("Medallion Count: %d", "##RandoMedallionCount",
"gRandomizeMedallionCount", 1, 6, "", 6, true, true, false);
break;
case RO_BRIDGE_DUNGEON_REWARDS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Reward Count: %d", "##RandoRewardCount",
"gRandomizeRewardCount", 1, 9, "", 9, true);
UIWidgets::PaddedEnhancementSliderInt("Reward Count: %d", "##RandoRewardCount",
"gRandomizeRewardCount", 1, 9, "", 9, true, true, false);
break;
case RO_BRIDGE_DUNGEONS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount",
"gRandomizeDungeonCount", 1, 8, "", 8, true);
UIWidgets::PaddedEnhancementSliderInt("Dungeon Count: %d", "##RandoDungeonCount",
"gRandomizeDungeonCount", 1, 8, "", 8, true, true, false);
break;
case RO_BRIDGE_TOKENS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Token Count: %d", "##RandoTokenCount",
"gRandomizeTokenCount", 1, 100, "", 100, true);
UIWidgets::PaddedEnhancementSliderInt("Token Count: %d", "##RandoTokenCount",
"gRandomizeTokenCount", 1, 100, "", 100, true, true, false);
break;
case RO_BRIDGE_GREG:
break;
@ -3373,12 +3370,11 @@ void DrawRandoEditor(bool& open) {
"\n"
"Random Number - A Random number and set of trials will be required."
);
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, RO_GANONS_TRIALS_MAX, RO_GANONS_TRIALS_SET_NUMBER);
UIWidgets::EnhancementCombobox("gRandomizeGanonTrial", randoGanonsTrial, RO_GANONS_TRIALS_SET_NUMBER);
ImGui::PopItemWidth();
if (CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER) == RO_GANONS_TRIALS_SET_NUMBER) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
"gRandomizeGanonTrialCount", 1, 6, "", 6, true);
UIWidgets::PaddedEnhancementSliderInt("Ganon's Trial Count: %d", "##RandoTrialCount",
"gRandomizeGanonTrialCount", 1, 6, "", 6, true, true, false);
UIWidgets::InsertHelpHoverText("Set the number of trials required to enter Ganon's Tower.");
}
@ -3397,12 +3393,11 @@ void DrawRandoEditor(bool& open) {
"\n"
"Random Number - A Random number and set of dungeons will be their Master Quest varieties."
);
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, RO_MQ_DUNGEONS_MAX, RO_MQ_DUNGEONS_NONE);
UIWidgets::EnhancementCombobox("gRandomizeMqDungeons", randoMqDungeons, RO_MQ_DUNGEONS_NONE);
ImGui::PopItemWidth();
if (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Master Quest Dungeon Count: %d", "##RandoMqDungeonCount",
"gRandomizeMqDungeonCount", 1, 12, "", CVarGetInteger("gRandomizeMqDungeonCount", 12), true);
UIWidgets::PaddedEnhancementSliderInt("Master Quest Dungeon Count: %d", "##RandoMqDungeonCount",
"gRandomizeMqDungeonCount", 1, 12, "", CVarGetInteger("gRandomizeMqDungeonCount", 12), true, true, false);
}
}
@ -3427,7 +3422,7 @@ void DrawRandoEditor(bool& open) {
"- Bottom of the Well will be open for adult after playing Song of Storms to the Windmill guy as child.\n"
"- Gerudo Training Ground will be open for child after adult has paid to open the gate once."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleDungeonsEntrances", randoShuffleDungeonsEntrances, RO_DUNGEON_ENTRANCE_SHUFFLE_MAX, RO_DUNGEON_ENTRANCE_SHUFFLE_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleDungeonsEntrances", randoShuffleDungeonsEntrances, RO_DUNGEON_ENTRANCE_SHUFFLE_OFF);
UIWidgets::PaddedSeparator();
@ -3440,7 +3435,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Full - Shuffle the entrances of all boss rooms together. Child may be expected to defeat Phantom Ganon and/or Bongo Bongo."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleBossEntrances", randoShuffleBossEntrances, RO_BOSS_ROOM_ENTRANCE_SHUFFLE_MAX, RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleBossEntrances", randoShuffleBossEntrances, RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF);
UIWidgets::PaddedSeparator();
@ -3468,7 +3463,7 @@ void DrawRandoEditor(bool& open) {
"- Temple of Time\n"
"- Kakariko Potion Shop"
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleInteriorsEntrances", randoShuffleInteriorsEntrances, RO_INTERIOR_ENTRANCE_SHUFFLE_MAX, RO_INTERIOR_ENTRANCE_SHUFFLE_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleInteriorsEntrances", randoShuffleInteriorsEntrances, RO_INTERIOR_ENTRANCE_SHUFFLE_OFF);
UIWidgets::PaddedSeparator();
@ -3600,7 +3595,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Songs can appear at any location."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleSongs", randoShuffleSongs, RO_SONG_SHUFFLE_MAX, RO_SONG_SHUFFLE_SONG_LOCATIONS);
UIWidgets::EnhancementCombobox("gRandomizeShuffleSongs", randoShuffleSongs, RO_SONG_SHUFFLE_SONG_LOCATIONS);
UIWidgets::PaddedSeparator();
@ -3618,11 +3613,9 @@ void DrawRandoEditor(bool& open) {
"\n"
"All Tokens - Shuffle all 100 GS tokens."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleTokens", randoTokensanity, RO_TOKENSANITY_MAX, RO_TOKENSANITY_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleTokens", randoTokensanity, RO_TOKENSANITY_OFF);
ImGui::Dummy(ImVec2(0,0));
UIWidgets::EnhancementCheckbox("Nighttime GS expect Sun's Song", "gRandomizeGsExpectSunsSong");
UIWidgets::PaddedEnhancementCheckbox("Nighttime GS expect Sun's Song", "gRandomizeGsExpectSunsSong", true, false);
UIWidgets::InsertHelpHoverText(
"All Golden Skulltulas that require nighttime to appear will only be "
"expected to be collected after getting Sun's Song."
@ -3710,7 +3703,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Random - Vanilla shop items will be shuffled among different shops, and each shop will contain a random number(1-4) of non-vanilla shop items.\n"
);
UIWidgets::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, RO_SHOPSANITY_MAX, RO_SHOPSANITY_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShopsanity", randoShopsanity, RO_SHOPSANITY_OFF);
// Shopsanity Prices
switch (CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF)) {
@ -3725,7 +3718,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"X Wallet - Randomized between 5 and the wallet's max size, in multiples of 5"
);
UIWidgets::EnhancementCombobox("gRandomizeShopsanityPrices", randoShopsanityPrices, RO_SHOPSANITY_PRICE_MAX, RO_SHOPSANITY_PRICE_BALANCED);
UIWidgets::EnhancementCombobox("gRandomizeShopsanityPrices", randoShopsanityPrices, RO_SHOPSANITY_PRICE_BALANCED);
UIWidgets::EnhancementCheckbox(Settings::ShopsanityPricesAffordable.GetName().c_str(), "gRandomizeShopsanityPricesAffordable",
CVarGetInteger("gRandomizeShopsanityPrices", RO_SHOPSANITY_PRICE_BALANCED) == RO_SHOPSANITY_PRICE_BALANCED,
"This can only apply to a wallet range.");
@ -3747,7 +3740,7 @@ void DrawRandoEditor(bool& open) {
"Expensive - Scrubs will be shuffled and their item will cost the vanilla price.\n"
"\n"
"Random - Scrubs will be shuffled and their item will cost will be between 0-95 rupees.\n");
UIWidgets::EnhancementCombobox("gRandomizeShuffleScrubs", randoShuffleScrubs, RO_SCRUBS_MAX, RO_SCRUBS_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleScrubs", randoShuffleScrubs, RO_SCRUBS_OFF);
UIWidgets::PaddedSeparator();
@ -3774,7 +3767,7 @@ void DrawRandoEditor(bool& open) {
"On (no hints) - Salesmen will be included but won't tell you what you'll get.\n"
"On (with hints) - Salesmen will be included and you'll know what you're buying."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleMerchants", randoShuffleMerchants, RO_SHUFFLE_MERCHANTS_MAX, RO_SHUFFLE_MERCHANTS_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleMerchants", randoShuffleMerchants, RO_SHUFFLE_MERCHANTS_OFF);
UIWidgets::PaddedSeparator();
@ -3810,7 +3803,7 @@ void DrawRandoEditor(bool& open) {
// Forcefully enabled if Ganon's Boss Key is on the cursed man
bool forceEnable100GSShuffle =
(CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) == RO_GANON_BOSS_KEY_KAK_TOKENS);
const char* disable100GSRewardText = "This option is forcefully enabled because \"Ganon's Boss Key\" is set to \"100 GS Reward.\"";
static const char* disable100GSRewardText = "This option is forcefully enabled because \"Ganon's Boss Key\" is set to \"100 GS Reward.\"";
UIWidgets::EnhancementCheckbox(Settings::Shuffle100GSReward.GetName().c_str(), "gRandomizeShuffle100GSReward",
forceEnable100GSShuffle, disable100GSRewardText, UIWidgets::CheckboxGraphics::Checkmark);
UIWidgets::InsertHelpHoverText(
@ -3845,7 +3838,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Spiritual stones and medallions can appear anywhere."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, RO_DUNGEON_REWARDS_MAX, RO_DUNGEON_REWARDS_END_OF_DUNGEON);
UIWidgets::EnhancementCombobox("gRandomizeShuffleDungeonReward", randoShuffleDungeonRewards, RO_DUNGEON_REWARDS_END_OF_DUNGEON);
UIWidgets::PaddedSeparator();
@ -3864,7 +3857,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Maps & Compasses can appear anywhere in the world."
);
UIWidgets::EnhancementCombobox("gRandomizeStartingMapsCompasses", randoShuffleMapsAndCompasses, RO_DUNGEON_ITEM_LOC_MAX, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::EnhancementCombobox("gRandomizeStartingMapsCompasses", randoShuffleMapsAndCompasses, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::PaddedSeparator();
@ -3885,7 +3878,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Small Keys can appear anywhere in the world."
);
UIWidgets::EnhancementCombobox("gRandomizeKeysanity", randoShuffleSmallKeys, RO_DUNGEON_ITEM_LOC_MAX, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::EnhancementCombobox("gRandomizeKeysanity", randoShuffleSmallKeys, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::PaddedSeparator();
@ -3902,13 +3895,12 @@ void DrawRandoEditor(bool& open) {
"\n"
"Selection - Hand select which dungeons will have their keys replaced with keyrings."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleKeyRings", randoShuffleKeyRings, RO_KEYRINGS_MAX, RO_KEYRINGS_OFF);
UIWidgets::EnhancementCombobox("gRandomizeShuffleKeyRings", randoShuffleKeyRings, RO_KEYRINGS_OFF);
ImGui::PopItemWidth();
switch (CVarGetInteger("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF)) {
case RO_KEYRINGS_COUNT:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Key Ring Count: %d", "##RandomizeShuffleKeyRingsRandomCount",
"gRandomizeShuffleKeyRingsRandomCount", 1, 8, "", 8, true);
UIWidgets::PaddedEnhancementSliderInt("Key Ring Count: %d", "##RandomizeShuffleKeyRingsRandomCount",
"gRandomizeShuffleKeyRingsRandomCount", 1, 8, "", 8, true, true, false);
break;
case RO_KEYRINGS_SELECTION:
UIWidgets::EnhancementCheckbox("Forest Temple##RandomizeShuffleKeyRings", "gRandomizeShuffleKeyRingsForestTemple");
@ -3938,7 +3930,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Thieve's Hideout Keys can appear anywhere in the world."
);
UIWidgets::EnhancementCombobox("gRandomizeGerudoKeys", randoShuffleGerudoFortressKeys, RO_GERUDO_KEYS_MAX, RO_GERUDO_KEYS_VANILLA);
UIWidgets::EnhancementCombobox("gRandomizeGerudoKeys", randoShuffleGerudoFortressKeys, RO_GERUDO_KEYS_VANILLA);
UIWidgets::PaddedSeparator();
@ -3957,7 +3949,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Anywhere - Boss Keys can appear anywhere in the world."
);
UIWidgets::EnhancementCombobox("gRandomizeBossKeysanity", randoShuffleBossKeys, RO_DUNGEON_ITEM_LOC_MAX, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::EnhancementCombobox("gRandomizeBossKeysanity", randoShuffleBossKeys, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON);
UIWidgets::PaddedSeparator();
@ -3986,33 +3978,28 @@ void DrawRandoEditor(bool& open) {
"\n"
"100 GS Reward - Ganon's Boss Key will be awarded by the cursed rich man after you collect 100 Gold Skulltula Tokens."
);
UIWidgets::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, RO_GANON_BOSS_KEY_MAX, RO_GANON_BOSS_KEY_VANILLA);
UIWidgets::EnhancementCombobox("gRandomizeShuffleGanonBossKey", randoShuffleGanonsBossKey, RO_GANON_BOSS_KEY_VANILLA);
ImGui::PopItemWidth();
switch (CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA)) {
case RO_GANON_BOSS_KEY_LACS_MEDALLIONS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Medallion Count: %d", "##RandoLacsMedallionCount",
"gRandomizeLacsMedallionCount", 1, 6, "", 6, true);
UIWidgets::PaddedEnhancementSliderInt("Medallion Count: %d", "##RandoLacsMedallionCount",
"gRandomizeLacsMedallionCount", 1, 6, "", 6, true, true, false);
break;
case RO_GANON_BOSS_KEY_LACS_STONES:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Stone Count: %d", "##RandoLacsStoneCount",
"gRandomizeLacsStoneCount", 1, 3, "", 3, true);
UIWidgets::PaddedEnhancementSliderInt("Stone Count: %d", "##RandoLacsStoneCount",
"gRandomizeLacsStoneCount", 1, 3, "", 3, true, true, false);
break;
case RO_GANON_BOSS_KEY_LACS_REWARDS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Reward Count: %d", "##RandoLacsRewardCount",
"gRandomizeLacsRewardCount", 1, 9, "", 9, true);
UIWidgets::PaddedEnhancementSliderInt("Reward Count: %d", "##RandoLacsRewardCount",
"gRandomizeLacsRewardCount", 1, 9, "", 9, true, true, false);
break;
case RO_GANON_BOSS_KEY_LACS_DUNGEONS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Dungeon Count: %d", "##RandoLacsDungeonCount",
"gRandomizeLacsDungeonCount", 1, 8, "", 8, true);
UIWidgets::PaddedEnhancementSliderInt("Dungeon Count: %d", "##RandoLacsDungeonCount",
"gRandomizeLacsDungeonCount", 1, 8, "", 8, true, true, false);
break;
case RO_GANON_BOSS_KEY_LACS_TOKENS:
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::EnhancementSliderInt("Token Count: %d", "##RandoLacsTokenCount",
"gRandomizeLacsTokenCount", 1, 100, "", 100, true);
UIWidgets::PaddedEnhancementSliderInt("Token Count: %d", "##RandoLacsTokenCount",
"gRandomizeLacsTokenCount", 1, 100, "", 100, true, true, false);
break;
default:
break;
@ -4046,17 +4033,19 @@ void DrawRandoEditor(bool& open) {
ImGui::BeginChild("ChildTimeSavers", ImVec2(0, -8));
// Cuccos to return
UIWidgets::EnhancementSliderInt("Cuccos to return: %d", "##RandoCuccosToReturn",
"gRandomizeCuccosToReturn", 0, 7, "", 7, true);
int cuccos = CVarGetInteger("gRandomizeCuccosToReturn", 7);
ImGui::Text("Cuccos to return: %d", cuccos);
UIWidgets::InsertHelpHoverText("The amount of cuccos needed to claim the reward from Anju the cucco lady");
ImGui::SameLine();
UIWidgets::EnhancementSliderInt("", "##RandoCuccosToReturn", "gRandomizeCuccosToReturn", 0, 7, "", 7);
UIWidgets::PaddedSeparator();
// Big Poe Target Count
UIWidgets::EnhancementSliderInt("Big Poe Target Count: %d", "##RandoBigPoeTargetCount",
"gRandomizeBigPoeTargetCount", 1, 10, "", 10, true);
int poes = CVarGetInteger("gRandomizeBigPoeTargetCount", 10);
ImGui::Text("Big Poe Target Count: %d", poes);
UIWidgets::InsertHelpHoverText("The Poe collector will give a reward for turning in this many Big Poes.");
ImGui::SameLine();
UIWidgets::EnhancementSliderInt("", "##RandoBigPoeTargetCount", "gRandomizeBigPoeTargetCount", 1, 10, "", 10);
UIWidgets::PaddedSeparator();
// Skip child stealth
@ -4124,7 +4113,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Minimal - Most excess items are removed."
);
UIWidgets::EnhancementCombobox("gRandomizeItemPool", randoItemPool, RO_ITEM_POOL_MAX, RO_ITEM_POOL_BALANCED);
UIWidgets::EnhancementCombobox("gRandomizeItemPool", randoItemPool, RO_ITEM_POOL_BALANCED);
UIWidgets::PaddedSeparator();
// Ice Traps
@ -4143,7 +4132,7 @@ void DrawRandoEditor(bool& open) {
"Onslaught - All junk items will be replaced by Ice Traps, even those "
"in the base pool."
);
UIWidgets::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, RO_ICE_TRAPS_MAX, RO_ICE_TRAPS_NORMAL);
UIWidgets::EnhancementCombobox("gRandomizeIceTraps", randoIceTraps, RO_ICE_TRAPS_NORMAL);
UIWidgets::PaddedSeparator();
@ -4161,10 +4150,10 @@ void DrawRandoEditor(bool& open) {
"Need Stone of Agony - Hints are only available after obtaining the Stone of Agony.\n"
"\n"
"Need Mask of Truth - Hints are only available whilst wearing the Mask of Truth.\n");
UIWidgets::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, RO_GOSSIP_STONES_MAX, RO_GOSSIP_STONES_NEED_NOTHING);
UIWidgets::EnhancementCombobox("gRandomizeGossipStoneHints", randoGossipStoneHints, RO_GOSSIP_STONES_NEED_NOTHING);
if (CVarGetInteger("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING) != RO_GOSSIP_STONES_NONE) {
// Hint Clarity
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
ImGui::Indent();
ImGui::Text(Settings::ClearerHints.GetName().c_str());
UIWidgets::InsertHelpHoverText(
@ -4179,10 +4168,10 @@ void DrawRandoEditor(bool& open) {
"Clear - Hints are clearly written and are unique for each item.\n"
"Ex: Kokiri Sword > the Kokiri Sword"
);
UIWidgets::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, RO_HINT_CLARITY_MAX, RO_HINT_CLARITY_CLEAR);
UIWidgets::EnhancementCombobox("gRandomizeHintClarity", randoHintClarity, RO_HINT_CLARITY_CLEAR);
// Hint Distribution
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
ImGui::Text(Settings::HintDistribution.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Sets how many hints will be useful.\n"
@ -4195,7 +4184,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"Very Strong - Many powerful hints."
);
UIWidgets::EnhancementCombobox("gRandomizeHintDistribution", randoHintDistribution, RO_HINT_DIST_MAX, RO_HINT_DIST_BALANCED);
UIWidgets::EnhancementCombobox("gRandomizeHintDistribution", randoHintDistribution, RO_HINT_DIST_BALANCED);
ImGui::Unindent();
}
@ -4325,9 +4314,9 @@ void DrawRandoEditor(bool& open) {
locationSearch.Draw();
ImGui::BeginChild("ChildIncludedLocations", ImVec2(0, -8));
for (auto [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
for (auto& [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
bool hasItems = false;
for (auto [randomizerCheck, rcObject] : rcObjects) {
for (auto& [randomizerCheck, rcObject] : rcObjects) {
if (rcObject->visibleInImgui && !excludedLocations.count(rcObject->rc) &&
locationSearch.PassFilter(rcObject->rcSpoilerName.c_str())) {
@ -4339,7 +4328,7 @@ void DrawRandoEditor(bool& open) {
if (hasItems) {
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) {
for (auto [randomizerCheck, rcObject] : rcObjects) {
for (auto& [randomizerCheck, rcObject] : rcObjects) {
if (rcObject->visibleInImgui && !excludedLocations.count(rcObject->rc) &&
locationSearch.PassFilter(rcObject->rcSpoilerName.c_str())) {
@ -4369,9 +4358,9 @@ void DrawRandoEditor(bool& open) {
window->DC.CurrLineTextBaseOffset = 0.0f;
ImGui::BeginChild("ChildExcludedLocations", ImVec2(0, -8));
for (auto [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
for (auto& [rcArea, rcObjects] : RandomizerCheckObjects::GetAllRCObjectsByArea()) {
bool hasItems = false;
for (auto [randomizerCheck, rcObject] : rcObjects) {
for (auto& [randomizerCheck, rcObject] : rcObjects) {
if (rcObject->visibleInImgui && excludedLocations.count(rcObject->rc)) {
hasItems = true;
break;
@ -4381,7 +4370,7 @@ void DrawRandoEditor(bool& open) {
if (hasItems) {
ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode(RandomizerCheckObjects::GetRCAreaName(rcArea).c_str())) {
for (auto [randomizerCheck, rcObject] : rcObjects) {
for (auto& [randomizerCheck, rcObject] : rcObjects) {
auto elfound = excludedLocations.find(rcObject->rc);
if (rcObject->visibleInImgui && elfound != excludedLocations.end()) {
if (ImGui::ArrowButton(std::to_string(rcObject->rc).c_str(), ImGuiDir_Left)) {
@ -4426,7 +4415,7 @@ void DrawRandoEditor(bool& open) {
"\n"
"No logic - Item placement is completely random. MAY BE IMPOSSIBLE TO BEAT."
);
UIWidgets::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, RO_LOGIC_MAX, RO_LOGIC_GLITCHLESS);
UIWidgets::EnhancementCombobox("gRandomizeLogicRules", randoLogicRules, RO_LOGIC_GLITCHLESS);
if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) {
ImGui::SameLine();
UIWidgets::EnhancementCheckbox(Settings::LocationsReachable.GetName().c_str(), "gRandomizeAllLocationsReachable", false, "", UIWidgets::CheckboxGraphics::Cross, RO_GENERIC_ON);
@ -4502,7 +4491,7 @@ void DrawRandoEditor(bool& open) {
// TODO: Show this but disabled when we have options for disabled Comboboxes.
if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
ImGui::Text(Settings::LinksPocketItem.GetName().c_str());
UIWidgets::EnhancementCombobox("gRandomizeLinksPocket", randoLinksPocket, RO_LINKS_POCKET_MAX, RO_LINKS_POCKET_DUNGEON_REWARD);
UIWidgets::EnhancementCombobox("gRandomizeLinksPocket", randoLinksPocket, RO_LINKS_POCKET_DUNGEON_REWARD);
UIWidgets::PaddedSeparator();
}
@ -4526,7 +4515,7 @@ void DrawRandoEditor(bool& open) {
UIWidgets::EnhancementCheckbox(Settings::StartingConsumables.GetName().c_str(),
"gRandomizeStartingConsumables");
UIWidgets::PaddedSeparator();
UIWidgets::EnhancementSliderInt("Gold Skulltula Tokens: %d", "##RandoStartingSkulltulaToken", "gRandomizeStartingSkulltulaToken", 0, 100, "", 0, true);
UIWidgets::EnhancementSliderInt("Gold Skulltula Tokens: %d", "##RandoStartingSkulltulaToken", "gRandomizeStartingSkulltulaToken", 0, 100, "", 0);
UIWidgets::PaddedSeparator();
ImGui::EndChild();
@ -4586,8 +4575,10 @@ void DrawRandoEditor(bool& open) {
ImGui::EndTabBar();
}
ImGui::PopItemFlag();
ImGui::PopStyleVar();
if (disableEditingRandoSettings) {
UIWidgets::ReEnableComponent("");
}
ImGui::End();
}
@ -4686,7 +4677,7 @@ CustomMessageEntry Randomizer::GetCursedSkullMessage(s16 params) {
return messageEntry;
}
const char* mapGetItemHints[3][2] = {
static const char* mapGetItemHints[3][2] = {
{ " It's ordinary.", " It's masterful!" },
{ "&Sieht aus wie immer.", " &Man kann darauf die Worte&%r\"Master Quest\"%w entziffern..." },
{ "&Elle vous semble %rordinaire%w.", "&Étrange... les mots %r\"Master&Quest\"%w sont gravés dessus." },

View File

@ -1105,21 +1105,18 @@ typedef enum {
typedef enum {
RO_GENERIC_OFF,
RO_GENERIC_ON,
RO_GENERIC_ON_OFF_MAX,
} RandoOptionGenericOffOn;
// no/yes
typedef enum {
RO_GENERIC_NO,
RO_GENERIC_YES,
RO_GENERIC_NO_YES_MAX,
} RandoOptionGenericNoYes;
// don't skip/skip
typedef enum {
RO_GENERIC_DONT_SKIP,
RO_GENERIC_SKIP,
RO_GENERIC_SKIP_MAX,
} RandoOptionGenericSkip;
//Forest settings (closed, closed deku, open)
@ -1127,7 +1124,6 @@ typedef enum {
RO_FOREST_CLOSED,
RO_FOREST_CLOSED_DEKU,
RO_FOREST_OPEN,
RO_FOREST_MAX,
} RandoOptionForest;
//Door of Time settings (closed, song only, open)
@ -1135,7 +1131,6 @@ typedef enum {
RO_DOOROFTIME_CLOSED,
RO_DOOROFTIME_SONGONLY,
RO_DOOROFTIME_OPEN,
RO_DOOROFTIME_MAX,
} RandoOptionDoorOfTime;
//Zora's Fountain settings (closed, closed as child, open)
@ -1143,7 +1138,6 @@ typedef enum {
RO_ZF_CLOSED,
RO_ZF_CLOSED_CHILD,
RO_ZF_OPEN,
RO_ZF_MAX,
} RandoOptionZorasFountain;
//Starting Age settings (child, adult, random)
@ -1151,7 +1145,6 @@ typedef enum {
RO_AGE_CHILD,
RO_AGE_ADULT,
RO_AGE_RANDOM,
RO_AGE_MAX,
} RandoOptionStartingAge;
//Gerudo Fortress settings (normal, fast, open)
@ -1159,14 +1152,12 @@ typedef enum {
RO_GF_NORMAL,
RO_GF_FAST,
RO_GF_OPEN,
RO_GF_MAX,
} RandoOptionGerudoFortress;
//Kakariko Gate settings (closed/open)
typedef enum {
RO_KAK_GATE_CLOSED,
RO_KAK_GATE_OPEN,
RO_KAK_GATE_MAX,
} RandoOptionKakarikoGate;
//Rainbow Bridge settings (vanilla, always open, stones, medallions, dungeon rewards, dungeons, tokens)
@ -1179,7 +1170,6 @@ typedef enum {
RO_BRIDGE_DUNGEONS,
RO_BRIDGE_TOKENS,
RO_BRIDGE_GREG,
RO_BRIDGE_MAX,
} RandoOptionRainbowBridge;
//Shopsanity settings (off, 0-4 items, random)
@ -1191,7 +1181,6 @@ typedef enum {
RO_SHOPSANITY_THREE_ITEMS,
RO_SHOPSANITY_FOUR_ITEMS,
RO_SHOPSANITY_RANDOM,
RO_SHOPSANITY_MAX,
} RandoOptionShopsanity;
//Shopsanity price ranges
@ -1201,7 +1190,6 @@ typedef enum {
RO_SHOPSANITY_PRICE_ADULT,
RO_SHOPSANITY_PRICE_GIANT,
RO_SHOPSANITY_PRICE_TYCOON,
RO_SHOPSANITY_PRICE_MAX,
} RandoOptionShopsanityPrices;
//Scrubsanity settings (off, affordable, expensive, random)
@ -1210,7 +1198,6 @@ typedef enum {
RO_SCRUBS_AFFORDABLE,
RO_SCRUBS_EXPENSIVE,
RO_SCRUBS_RANDOM,
RO_SCRUBS_MAX,
} RandoOptionScrubsanity;
//Ammo drop settings (on, "on+bombchu", off)
@ -1218,7 +1205,6 @@ typedef enum {
RO_AMMO_DROPS_ON,
RO_AMMO_DROPS_ON_PLUS_BOMBCHU,
RO_AMMO_DROPS_OFF,
RO_AMMO_DROPS_MAX,
} RandoOptionAmmoDrops;
//Any Dungeon Item (start with, vanilla, own dungeon, any dungeon,
@ -1230,7 +1216,6 @@ typedef enum {
RO_DUNGEON_ITEM_LOC_ANY_DUNGEON,
RO_DUNGEON_ITEM_LOC_OVERWORLD,
RO_DUNGEON_ITEM_LOC_ANYWHERE,
RO_DUNGEON_ITEM_LOC_MAX,
} RandoOptionDungeonItemLocation;
//Dungeon reward settings
@ -1239,7 +1224,6 @@ typedef enum {
RO_DUNGEON_REWARDS_ANY_DUNGEON,
RO_DUNGEON_REWARDS_OVERWORLD,
RO_DUNGEON_REWARDS_ANYWHERE,
RO_DUNGEON_REWARDS_MAX,
} RandoOptionDungeonRewards;
//Keyring Settings
@ -1248,7 +1232,6 @@ typedef enum {
RO_KEYRINGS_RANDOM,
RO_KEYRINGS_COUNT,
RO_KEYRINGS_SELECTION,
RO_KEYRINGS_MAX,
} RandoOptionKeyrings;
//Ganon's Boss Key Settings (vanilla, own dungeon, start with,
@ -1267,7 +1250,6 @@ typedef enum {
RO_GANON_BOSS_KEY_LACS_DUNGEONS,
RO_GANON_BOSS_KEY_LACS_TOKENS,
RO_GANON_BOSS_KEY_KAK_TOKENS,
RO_GANON_BOSS_KEY_MAX,
} RandoOptionGanonsBossKey;
//Ganon's Trials
@ -1275,7 +1257,6 @@ typedef enum {
RO_GANONS_TRIALS_SKIP,
RO_GANONS_TRIALS_SET_NUMBER,
RO_GANONS_TRIALS_RANDOM_NUMBER,
RO_GANONS_TRIALS_MAX,
} RandoOptionGanonsTrials;
//Shuffle Dungeon Entrance Settings (Off, on, plus ganon)
@ -1283,7 +1264,6 @@ typedef enum {
RO_DUNGEON_ENTRANCE_SHUFFLE_OFF,
RO_DUNGEON_ENTRANCE_SHUFFLE_ON,
RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON,
RO_DUNGEON_ENTRANCE_SHUFFLE_MAX,
} RandoOptionDungeonEntranceShuffle;
//Shuffle Boss Room Entrance Settings (Off, Age Restricted, Full)
@ -1291,7 +1271,6 @@ typedef enum {
RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF,
RO_BOSS_ROOM_ENTRANCE_SHUFFLE_AGE_RESTRICTED,
RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL,
RO_BOSS_ROOM_ENTRANCE_SHUFFLE_MAX,
} RandoOptionBossRoomEntranceShuffle;
//Shuffle Interior Entrance Settings (Off, simple, all)
@ -1299,7 +1278,6 @@ typedef enum {
RO_INTERIOR_ENTRANCE_SHUFFLE_OFF,
RO_INTERIOR_ENTRANCE_SHUFFLE_SIMPLE,
RO_INTERIOR_ENTRANCE_SHUFFLE_ALL,
RO_INTERIOR_ENTRANCE_SHUFFLE_MAX,
} RandoOptionInteriorEntranceShuffle;
//Song shuffle Settings (Song locations, Dungeon rewards, anywhere)
@ -1307,7 +1285,6 @@ typedef enum {
RO_SONG_SHUFFLE_SONG_LOCATIONS,
RO_SONG_SHUFFLE_DUNGEON_REWARDS,
RO_SONG_SHUFFLE_ANYWHERE,
RO_SONG_SHUFFLE_MAX,
} RandoOptionSongShuffle;
//Shuffle Merchants Settings (Off, On no hint, on with wint)
@ -1315,14 +1292,12 @@ typedef enum {
RO_SHUFFLE_MERCHANTS_OFF,
RO_SHUFFLE_MERCHANTS_ON_NO_HINT,
RO_SHUFFLE_MERCHANTS_ON_HINT,
RO_SHUFFLE_MERCHANTS_MAX,
} RandoOptionShuffleMerchants;
//Starting Ocarina Settings (off, fairy)
typedef enum {
RO_STARTING_OCARINA_OFF,
RO_STARTING_OCARINA_FAIRY,
RO_STARTING_OCARINA_MAX,
} RandoOptionStartingOcarina;
//Item Pool Settings
@ -1331,7 +1306,6 @@ typedef enum {
RO_ITEM_POOL_BALANCED,
RO_ITEM_POOL_SCARCE,
RO_ITEM_POOL_MINIMAL,
RO_ITEM_POOL_MAX,
} RandoOptionItemPool;
//Ice Trap Settings
@ -1341,7 +1315,6 @@ typedef enum {
RO_ICE_TRAPS_EXTRA,
RO_ICE_TRAPS_MAYHEM,
RO_ICE_TRAPS_ONSLAUGHT,
RO_ICE_TRAPS_MAX,
} RandoOptionIceTraps;
//Gossip Stone Hint Settings (no hints, needs nothing,
@ -1351,7 +1324,6 @@ typedef enum {
RO_GOSSIP_STONES_NEED_NOTHING,
RO_GOSSIP_STONES_NEED_TRUTH,
RO_GOSSIP_STONES_NEED_STONE,
RO_GOSSIP_STONES_MAX,
} RandoOptionGossipStones;
//Hint Clarity Settings (obscure, ambiguous, clear)
@ -1359,7 +1331,6 @@ typedef enum {
RO_HINT_CLARITY_OBSCURE,
RO_HINT_CLARITY_AMBIGUOUS,
RO_HINT_CLARITY_CLEAR,
RO_HINT_CLARITY_MAX,
} RandoOptionHintClarity;
//Hint Distribution Settings (useless, balanced, strong, very strong)
@ -1368,7 +1339,6 @@ typedef enum {
RO_HINT_DIST_BALANCED,
RO_HINT_DIST_STRONG,
RO_HINT_DIST_VERY_STRONG,
RO_HINT_DIST_MAX,
} RandoOptionHintDistribution;
//Gerudo Fortress Key Settings (vanilla, any dungeon, overworld,
@ -1378,7 +1348,6 @@ typedef enum {
RO_GERUDO_KEYS_ANY_DUNGEON,
RO_GERUDO_KEYS_OVERWORLD,
RO_GERUDO_KEYS_ANYWHERE,
RO_GERUDO_KEYS_MAX,
} RandoOptionGerudoKeys;
//Tokensanity settings (off, dungeons, overworld, all)
@ -1387,7 +1356,6 @@ typedef enum {
RO_TOKENSANITY_DUNGEONS,
RO_TOKENSANITY_OVERWORLD,
RO_TOKENSANITY_ALL,
RO_TOKENSANITY_MAX,
} RandoOptionTokensanity;
//Link's Pocket Settings (dungeon reward, advancement, anything, nothing)
@ -1396,14 +1364,12 @@ typedef enum {
RO_LINKS_POCKET_ADVANCEMENT,
RO_LINKS_POCKET_ANYTHING,
RO_LINKS_POCKET_NOTHING,
RO_LINKS_POCKET_MAX,
} RandoOptionLinksPocket;
// Logic (glitchless/no logic)
typedef enum {
RO_LOGIC_GLITCHLESS,
RO_LOGIC_NO_LOGIC,
RO_LOGIC_MAX,
} RandoOptionLogic;
// MQ Dungeons
@ -1411,7 +1377,6 @@ typedef enum {
RO_MQ_DUNGEONS_NONE,
RO_MQ_DUNGEONS_SET_NUMBER,
RO_MQ_DUNGEONS_RANDOM_NUMBER,
RO_MQ_DUNGEONS_MAX,
} RandoOptionMQDungeons;
typedef enum {

View File

@ -891,7 +891,7 @@ static std::set<std::string> rainbowCVars = {
int hue = 0;
void RainbowTick() {
float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f));
for (auto cvar : rainbowCVars) {
for (auto& cvar : rainbowCVars) {
if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0)
continue;
@ -956,10 +956,10 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
const char* windowType[] = { "Floating", "Window" };
const char* displayType[] = { "Always", "Combo Button Hold" };
const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
static const char* windowType[] = { "Floating", "Window" };
static const char* displayType[] = { "Always", "Combo Button Hold" };
static const char* buttonStrings[] = { "A Button", "B Button", "C-Up", "C-Down", "C-Left", "C-Right", "L Button",
"Z Button", "R Button", "Start", "D-Up", "D-Down", "D-Left", "D-Right" };
void DrawCheckTrackerOptions(bool& open) {
if (!open) {
CVarSetInteger("gCheckTrackerSettingsEnabled", 0);
@ -990,23 +990,14 @@ void DrawCheckTrackerOptions(bool& open) {
}
ImGui::PopItemWidth();
ImGui::Text("Window Type");
ImGui::SameLine();
UIWidgets::EnhancementCombobox("gCheckTrackerWindowType", windowType, 2, 1);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gCheckTrackerWindowType", windowType, 1);
if (CVarGetInteger("gCheckTrackerWindowType", 1) == 0) {
UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode");
UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused");
ImGui::Text("Display Mode");
ImGui::SameLine();
UIWidgets::EnhancementCombobox("gCheckTrackerDisplayType", displayType, 2, 0);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gCheckTrackerDisplayType", displayType, 0);
if (CVarGetInteger("gCheckTrackerDisplayType", 0) > 0) {
ImGui::Text("Combo Button 1");
ImGui::SameLine();
UIWidgets::EnhancementCombobox("gCheckTrackerComboButton1", buttonStrings, 14, 6);
ImGui::Text("Combo Button 2");
ImGui::SameLine();
UIWidgets::EnhancementCombobox("gCheckTrackerComboButton2", buttonStrings, 14, 8);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gCheckTrackerComboButton1", buttonStrings, 6);
UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gCheckTrackerComboButton2", buttonStrings, 8);
}
}
UIWidgets::EnhancementCheckbox("Performance mode", "gCheckTrackerOptionPerformanceMode");

View File

@ -758,47 +758,6 @@ std::vector<ItemTrackerItem> GetDungeonItemsVector(std::vector<ItemTrackerDungeo
return dungeonItems;
}
/* TODO: These need to be moved to a common imgui file */
void LabeledComboBoxRightAligned(const char* label, const char* cvar, std::vector<std::string> options, s32 defaultValue) {
s32 currentValue = CVarGetInteger(cvar, defaultValue);
std::string hiddenLabel = "##" + std::string(cvar);
ImGui::Text(label);
#ifdef __WIIU__
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (ImGui::CalcTextSize(options[currentValue].c_str()).x * 1.0f + 40.0f));
ImGui::PushItemWidth((ImGui::CalcTextSize(options[currentValue].c_str()).x * 1.0f) + 60.0f);
#else
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (ImGui::CalcTextSize(options[currentValue].c_str()).x * 1.0f + 20.0f));
ImGui::PushItemWidth((ImGui::CalcTextSize(options[currentValue].c_str()).x * 1.0f) + 30.0f);
#endif
if (ImGui::BeginCombo(hiddenLabel.c_str(), options[currentValue].c_str())) {
for (int i = 0; i < options.size(); i++) {
if (ImGui::Selectable(options[i].c_str())) {
CVarSetInteger(cvar, i);
SohImGui::RequestCvarSaveOnNextTick();
shouldUpdateVectors = true;
}
}
ImGui::EndCombo();
}
ImGui::PopItemWidth();
}
void PaddedEnhancementCheckbox(const char* text, const char* cvarName, s32 defaultValue = 0, bool padTop = true, bool padBottom = true) {
if (padTop) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
}
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
if (ImGui::Checkbox(text, &val)) {
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
shouldUpdateVectors = true;
}
if (padBottom) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
}
}
/* ****************************************************** */
void UpdateVectors() {
@ -990,8 +949,13 @@ void DrawItemTracker(bool& open) {
}
}
const char* itemTrackerCapacityTrackOptions[5] = { "No Numbers", "Current Capacity", "Current Ammo", "Current Capacity / Max Capacity", "Current Ammo / Current Capacity" };
const char* itemTrackerKeyTrackOptions[3] = { "Collected / Max", "Current / Collected / Max", "Current / Max" };
static const char* itemTrackerCapacityTrackOptions[5] = { "No Numbers", "Current Capacity", "Current Ammo", "Current Capacity / Max Capacity", "Current Ammo / Current Capacity" };
static const char* itemTrackerKeyTrackOptions[3] = { "Collected / Max", "Current / Collected / Max", "Current / Max" };
static const char* windowTypes[2] = { "Floating", "Window" };
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", "Seperate" };
static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Seperate" };
void DrawItemTrackerOptions(bool& open) {
if (!open) {
@ -1025,53 +989,89 @@ void DrawItemTrackerOptions(bool& open) {
}
ImGui::PopItemWidth();
LabeledComboBoxRightAligned("Window Type", "gItemTrackerWindowType", { "Floating", "Window" }, 0);
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gItemTrackerWindowType", windowTypes, 0)) {
shouldUpdateVectors = true;
}
if (CVarGetInteger("gItemTrackerWindowType", 0) == 0) {
PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode", 0);
PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused", 0);
LabeledComboBoxRightAligned("Display Mode", "gItemTrackerDisplayType", { "Always", "Combo Button Hold" }, 0);
if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode")) {
shouldUpdateVectors = true;
}
if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused")) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gItemTrackerDisplayType", displayModes, 0)) {
shouldUpdateVectors = true;
}
if (CVarGetInteger("gItemTrackerDisplayType", 0) > 0) {
LabeledComboBoxRightAligned("Combo Button 1", "gItemTrackerComboButton1", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 6);
LabeledComboBoxRightAligned("Combo Button 2", "gItemTrackerComboButton2", { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }, 8);
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gItemTrackerComboButton1", buttons, 6)) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gItemTrackerComboButton2", buttons, 8)) {
shouldUpdateVectors = true;
}
}
}
UIWidgets::PaddedSeparator();
UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gItemTrackerIconSize", 25, 128, "", 36, true);
UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12, true);
UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gItemTrackerIconSize", 25, 128, "", 36);
UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12);
ImGui::Text("Ammo/Capacity Tracking");
UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, 5, 1);
UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, 1);
UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking."
"\n\nNote: items without capacity upgrades will track ammo even in capacity mode");
if (CVarGetInteger("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) {
PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft", 0);
if (UIWidgets::PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft")) {
shouldUpdateVectors = true;
}
}
ImGui::Text("Key Count Tracking");
UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, 3, 0);
UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, 0);
UIWidgets::InsertHelpHoverText("Customize what numbers are shown for key tracking.");
ImGui::TableNextColumn();
LabeledComboBoxRightAligned("Inventory", "gItemTrackerInventoryItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
LabeledComboBoxRightAligned("Equipment", "gItemTrackerEquipmentItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
LabeledComboBoxRightAligned("Misc", "gItemTrackerMiscItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
LabeledComboBoxRightAligned("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", 1);
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", "gItemTrackerInventoryItemsDisplayType", displayTypes, 1)) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", "gItemTrackerEquipmentItemsDisplayType", displayTypes, 1)) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", "gItemTrackerMiscItemsDisplayType", displayTypes, 1)) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", displayTypes, 1)) {
shouldUpdateVectors = true;
}
if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) {
if (UIWidgets::PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
shouldUpdateVectors = true;
}
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", "gItemTrackerSongsDisplayType", displayTypes, 1)) {
shouldUpdateVectors = true;
}
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", displayTypes, 0)) {
shouldUpdateVectors = true;
}
LabeledComboBoxRightAligned("Songs", "gItemTrackerSongsDisplayType", { "Hidden", "Main Window", "Seperate" }, 1);
LabeledComboBoxRightAligned("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) != 0) {
if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) {
PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", 1);
if (UIWidgets::PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
shouldUpdateVectors = true;
}
}
if (UIWidgets::PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
shouldUpdateVectors = true;
}
PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", 1);
}
LabeledComboBoxRightAligned("Greg", "gItemTrackerGregDisplayType", { "Hidden", "Main Window", "Misc Window", "Seperate" }, 0);
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", "gItemTrackerGregDisplayType", extendedDisplayTypes, 0)) {
shouldUpdateVectors = true;
}
if (CVarGetInteger("gItemTrackerDisplayType", 0) != 1) {
LabeledComboBoxRightAligned("Personal notes", "gItemTrackerNotesDisplayType", { "Hidden", "Main Window", "Seperate" }, 0);
if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", "gItemTrackerNotesDisplayType", displayTypes, 0)) {
shouldUpdateVectors = true;
}
}
ImGui::PopStyleVar(1);

View File

@ -61,19 +61,24 @@ namespace GameMenuBar {
// MARK: - Properties
const char* powers[9] = {
"Vanilla (1x)",
"Double (2x)",
"Quadruple (4x)",
"Octuple (8x)",
"Hexadecuple (16x)",
"Duotrigintuple (32x)",
"Quattuorsexagintuple (64x)",
"Octoviginticentuple (128x)",
"Hexaquinquagintiducentuple (256x)"
};
const char* bonkDamageValues[8] = {
static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
static const char* allPowers[9] = {
"Vanilla (1x)",
"Double (2x)",
"Quadruple (4x)",
"Octuple (8x)",
"Foolish (16x)",
"Ridiculous (32x)",
"Merciless (64x)",
"Pure Torture (128x)",
"OHKO (256x)" };
static const char* subPowers[8] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6], allPowers[7] };
static const char* subSubPowers[7] = { allPowers[0], allPowers[1], allPowers[2], allPowers[3], allPowers[4], allPowers[5], allPowers[6] };
static const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" };
static const char* autosaveLabels[6] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
static const char* FastFileSelect[5] = { "File N.1", "File N.2", "File N.3", "Zelda Map Select (require OoT Debug Mode)", "File select" };
static const char* bonkDamageValues[8] = {
"No Damage",
"0.25 Heart",
"0.5 Heart",
@ -94,23 +99,11 @@ namespace GameMenuBar {
return buttonText;
}
void BindAudioSlider(const char* name, const char* key, float defaultValue, SeqPlayers playerId) {
float value = CVarGetFloat(key, defaultValue);
ImGui::Text(name, static_cast<int>(100 * value));
if (ImGui::SliderFloat((std::string("##") + key).c_str(), &value, 0.0f, 1.0f, "")) {
const float volume = floorf(value * 100) / 100;
CVarSetFloat(key, volume);
SohImGui::RequestCvarSaveOnNextTick();
Audio_SetGameVolume(playerId, volume);
}
}
void UpdateAudio() {
Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1));
Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1));
Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gSFXMusicVolume", 1));
Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gFanfareVolume", 1));
Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f));
Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f));
Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f));
Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f));
}
// MARK: - Delegates
@ -124,23 +117,26 @@ namespace GameMenuBar {
if (ImGui::BeginMenu("Settings"))
{
if (ImGui::BeginMenu("Audio")) {
UIWidgets::EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true);
UIWidgets::Spacer(0);
BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", 1.0f, SEQ_BGM_MAIN);
UIWidgets::Spacer(0);
BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", 1.0f, SEQ_BGM_SUB);
UIWidgets::Spacer(0);
BindAudioSlider("Sound Effects Volume: %d %%", "gSFXMusicVolume", 1.0f, SEQ_SFX);
UIWidgets::Spacer(0);
BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", 1.0f, SEQ_FANFARE);
UIWidgets::PaddedEnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true);
if (UIWidgets::PaddedEnhancementSliderFloat("Main Music Volume: %d %%", "##Main_Music_Vol", "gMainMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) {
Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f));
}
if (UIWidgets::PaddedEnhancementSliderFloat("Sub Music Volume: %d %%", "##Sub_Music_Vol", "gSubMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) {
Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f));
}
if (UIWidgets::PaddedEnhancementSliderFloat("Sound Effects Volume: %d %%", "##Sound_Effect_Vol", "gSFXMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) {
Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f));
}
if (UIWidgets::PaddedEnhancementSliderFloat("Fanfare Volume: %d %%", "##Fanfare_Vol", "gFanfareVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) {
Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f));
}
ImGui::Text("Audio API (Needs reload)");
auto audioBackends = SohImGui::GetAvailableAudioBackends();
auto currentAudioBackend = SohImGui::GetCurrentAudioBackend();
if (audioBackends.size() <= 1) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) {
for (uint8_t i = 0; i < audioBackends.size(); i++) {
@ -152,8 +148,7 @@ namespace GameMenuBar {
ImGui::EndCombo();
}
if (audioBackends.size() <= 1) {
ImGui::PopItemFlag();
ImGui::PopStyleVar(1);
UIWidgets::ReEnableComponent("");
}
ImGui::EndMenu();
@ -180,18 +175,12 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", "gControlNav");
UIWidgets::Tooltip("Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar");
#endif
UIWidgets::EnhancementCheckbox("Show Inputs", "gInputEnabled");
UIWidgets::PaddedEnhancementCheckbox("Show Inputs", "gInputEnabled", true, false);
UIWidgets::Tooltip("Shows currently pressed inputs on the bottom right of the screen");
UIWidgets::Spacer(0);
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 20.0f);
UIWidgets::EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
UIWidgets::PaddedEnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false, true, true, false);
UIWidgets::Tooltip("Sets the on screen size of the displayed inputs from the Show Inputs setting");
ImGui::PopItemWidth();
UIWidgets::Spacer(0);
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 20.0f);
UIWidgets::EnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, false);
UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, true, true, false);
UIWidgets::Tooltip("Buffers your inputs to be executed a specified amount of frames later");
ImGui::PopItemWidth();
ImGui::EndMenu();
}
@ -200,67 +189,20 @@ namespace GameMenuBar {
if (ImGui::BeginMenu("Graphics")) {
#ifndef __APPLE__
UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true, true);
UIWidgets::EnhancementSliderFloat("Internal Resolution: %d %%", "##IMul", "gInternalResolution", 0.5f, 2.0f, "", 1.0f, true);
UIWidgets::Tooltip("Multiplies your output resolution by the value inputted, as a more intensive but effective form of anti-aliasing");
SohImGui::SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1));
#endif
#ifndef __WIIU__
UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, false, true, false);
UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, false);
UIWidgets::Tooltip("Activates multi-sample anti-aliasing when above 1x up to 8x for 8 samples for every pixel");
SohImGui::SetMSAALevel(CVarGetInteger("gMSAAValue", 1));
#endif
if (SohImGui::WindowBackend() == SohImGui::Backend::DX11)
{
const char* cvar = "gExtraLatencyThreshold";
int val = CVarGetInteger(cvar, 80);
val = fmax(fmin(val, 360), 0);
int fps = val;
UIWidgets::Spacer(0);
if (fps == 0)
{
ImGui::Text("Jitter fix: Off");
}
else
{
ImGui::Text("Jitter fix: >= %d FPS", fps);
}
std::string MinusBTNELT = " - ##ExtraLatencyThreshold";
std::string PlusBTNELT = " + ##ExtraLatencyThreshold";
if (ImGui::Button(MinusBTNELT.c_str())) {
val--;
CVarSetInteger(cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
#ifdef __SWITCH__
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 110.0f);
#elif defined(__WIIU__)
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2);
#else
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f);
#endif
if (ImGui::SliderInt("##ExtraLatencyThreshold", &val, 0, 360, "", ImGuiSliderFlags_AlwaysClamp))
{
CVarSetInteger(cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::PopItemWidth();
if (SohImGui::WindowBackend() == SohImGui::Backend::DX11) {
UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS",
"##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false);
UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time.");
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNELT.c_str())) {
val++;
CVarSetInteger(cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
}
UIWidgets::Spacer(0);
}
ImGui::Text("Renderer API (Needs reload)");
@ -268,8 +210,7 @@ namespace GameMenuBar {
auto currentRenderingBackend = SohImGui::GetCurrentRenderingBackend();
if (renderingBackends.size() <= 1) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) {
for (uint8_t i = 0; i < renderingBackends.size(); i++) {
@ -281,8 +222,7 @@ namespace GameMenuBar {
ImGui::EndCombo();
}
if (renderingBackends.size() <= 1) {
ImGui::PopItemFlag();
ImGui::PopStyleVar(1);
UIWidgets::ReEnableComponent("");
}
if (SohImGui::SupportsWindowedFullscreen()) {
@ -296,8 +236,12 @@ namespace GameMenuBar {
EXPERIMENTAL();
// If more filters are added to LUS, make sure to add them to the filters list here
ImGui::Text("Texture Filter (Needs reload)");
UIWidgets::EnhancementCombobox("gTextureFilter", SohImGui::GetSupportedTextureFilters(), 3, 0);
const char* filters[] = { SohImGui::GetSupportedTextureFilters()[0],
SohImGui::GetSupportedTextureFilters()[1],
SohImGui::GetSupportedTextureFilters()[2] };
UIWidgets::EnhancementCombobox("gTextureFilter", filters, 0);
UIWidgets::Spacer(0);
@ -349,15 +293,15 @@ namespace GameMenuBar {
{
if (ImGui::BeginMenu("Time Savers"))
{
UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, false, false, true);
UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, false, false, true);
UIWidgets::EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3);
UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3, true, false, true);
UIWidgets::Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword");
UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, false, false, true);
UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, false, false, true);
UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, true, false, true);
UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, true, false, true);
UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", true, false);
UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks");
UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName");
UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false);
UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name");
UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false);
UIWidgets::Tooltip("Prevent forced Navi conversations");
@ -366,7 +310,11 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false);
UIWidgets::Tooltip("Kick open every chest");
UIWidgets::PaddedText("Chest size & texture matches contents", true, false);
const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only"};
if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 0)) {
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) {
CVarSetInteger("gChestSizeDependsStoneOfAgony", 0);
}
}
UIWidgets::Tooltip(
"Chest sizes and textures are changed to help identify the item inside.\n"
" - Major items: Large gold chests\n"
@ -376,11 +324,6 @@ namespace GameMenuBar {
" - Boss keys: Vanilla size and texture\n"
" - Skulltula Tokens: Small skulltula chest\n"
);
if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 4, 0)) {
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) {
CVarSetInteger("gChestSizeDependsStoneOfAgony", 0);
}
}
if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) > 0) {
UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false);
UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony.");
@ -394,7 +337,7 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false);
bool forceSkipScarecrow = gSaveContext.n64ddFlag &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_SCARECROWS_SONG);
const char* forceSkipScarecrowText =
static const char* forceSkipScarecrowText =
"This setting is forcefully enabled because a savefile\nwith \"Skip Scarecrow Song\" is loaded";
UIWidgets::Tooltip("Skip the part where the Ocarina playback is called when you play a song");
UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false,
@ -425,8 +368,7 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput", true, false);
UIWidgets::Tooltip("Prevent dropping inputs when playing the ocarina quickly");
UIWidgets::PaddedText("Bunny Hood Effect", true, false);
const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run"};
UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, 3, 0);
UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, 0);
UIWidgets::Tooltip(
"Wearing the Bunny Hood grants a speed increase like in Majora's Mask. The longer jump option is not accounted for in randomizer logic.\n\n"
"Also disables NPC's reactions to wearing the Bunny Hood."
@ -453,43 +395,43 @@ namespace GameMenuBar {
if (ImGui::BeginMenu("Difficulty Options"))
{
ImGui::Text("Damage Multiplier");
UIWidgets::EnhancementCombobox("gDamageMul", powers, 9, 0);
UIWidgets::EnhancementCombobox("gDamageMul", allPowers, 0);
UIWidgets::Tooltip(
"Modifies all sources of damage not affected by other sliders\n\
2x: Can survive all common attacks from the start of the game\n\
4x: Dies in 1 hit to any substantial attack from the start of the game\n\
8x: Can only survive trivial damage from the start of the game\n\
16x: Can survive all common attacks with max health without double defense\n\
32x: Can survive all common attacks with max health and double defense\n\
64x: Can survive trivial damage with max health without double defense\n\
128x: Can survive trivial damage with max health and double defense\n\
256x: Cannot survive damage"
"Modifies all sources of damage not affected by other sliders\n"
"2x: Can survive all common attacks from the start of the game\n"
"4x: Dies in 1 hit to any substantial attack from the start of the game\n"
"8x: Can only survive trivial damage from the start of the game\n"
"16x: Can survive all common attacks with max health without double defense\n"
"32x: Can survive all common attacks with max health and double defense\n"
"64x: Can survive trivial damage with max health without double defense\n"
"128x: Can survive trivial damage with max health and double defense\n"
"256x: Cannot survive damage"
);
UIWidgets::PaddedText("Fall Damage Multiplier", true, false);
UIWidgets::EnhancementCombobox("gFallDamageMul", powers, 8, 0);
UIWidgets::EnhancementCombobox("gFallDamageMul", subPowers, 0);
UIWidgets::Tooltip(
"Modifies all fall damage\n\
2x: Can survive all fall damage from the start of the game\n\
4x: Can only survive short fall damage from the start of the game\n\
8x: Cannot survive any fall damage from the start of the game\n\
16x: Can survive all fall damage with max health without double defense\n\
32x: Can survive all fall damage with max health and double defense\n\
64x: Can survive short fall damage with double defense\n\
128x: Cannot survive fall damage"
"Modifies all fall damage\n"
"2x: Can survive all fall damage from the start of the game\n"
"4x: Can only survive short fall damage from the start of the game\n"
"8x: Cannot survive any fall damage from the start of the game\n"
"16x: Can survive all fall damage with max health without double defense\n"
"32x: Can survive all fall damage with max health and double defense\n"
"64x: Can survive short fall damage with double defense\n"
"128x: Cannot survive fall damage"
);
UIWidgets::PaddedText("Void Damage Multiplier", true, false);
UIWidgets::EnhancementCombobox("gVoidDamageMul", powers, 7, 0);
UIWidgets::EnhancementCombobox("gVoidDamageMul", subSubPowers, 0);
UIWidgets::Tooltip(
"Modifies damage taken after falling into a void\n\
2x: Can survive void damage from the start of the game\n\
4x: Cannot survive void damage from the start of the game\n\
8x: Can survive void damage twice with max health without double defense\n\
16x: Can survive void damage with max health without double defense\n\
32x: Can survive void damage with max health and double defense\n\
64x: Cannot survive void damage"
"Modifies damage taken after falling into a void\n"
"2x: Can survive void damage from the start of the game\n"
"4x: Cannot survive void damage from the start of the game\n"
"8x: Can survive void damage twice with max health without double defense\n"
"16x: Can survive void damage with max health without double defense\n"
"32x: Can survive void damage with max health and double defense\n"
"64x: Cannot survive void damage"
);
UIWidgets::PaddedText("Bonk Damage Multiplier", true, false);
UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, 8, 0);
UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, 0);
UIWidgets::Tooltip("Modifies damage taken after bonking.");
UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false);
UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts");
@ -497,7 +439,7 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");
bool forceEnableBombchuDrops = gSaveContext.n64ddFlag &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1;
const char* forceEnableBombchuDropsText =
static const char* forceEnableBombchuDropsText =
"This setting is forcefully enabled because a savefile\nwith \"Enable Bombchu Drops\" is loaded.";
UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false,
forceEnableBombchuDrops, forceEnableBombchuDropsText, UIWidgets::CheckboxGraphics::Checkmark);
@ -516,7 +458,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect");
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions");
bool disabledRedPotion = !CVarGetInteger("gRedPotionEffect", 0);
const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off";
static const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion);
UIWidgets::Tooltip("Changes the amount of health restored by Red Potions");
UIWidgets::EnhancementCheckbox("Red Potion Percent Restore", "gRedPercentRestore", disabledRedPotion, disabledTooltipRedPotion);
@ -527,7 +469,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect");
UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions");
bool disabledGreenPotion = !CVarGetInteger("gGreenPotionEffect", 0);
const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off";
static const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion);
UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96");
UIWidgets::EnhancementCheckbox("Green Potion Percent Restore", "gGreenPercentRestore", disabledGreenPotion, disabledTooltipGreenPotion);
@ -538,7 +480,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects");
UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions");
bool disabledBluePotion = !CVarGetInteger("gBluePotionEffects", 0);
const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off";
static const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off";
UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion);
UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions");
UIWidgets::EnhancementCheckbox("Blue Potion Health Percent Restore", "gBlueHealthPercentRestore", disabledBluePotion, disabledTooltipBluePotion);
@ -556,7 +498,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect");
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk");
bool disabledMilk = !CVarGetInteger("gMilkEffect", 0);
const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off";
static const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk);
UIWidgets::Tooltip("Changes the amount of health restored by Milk");
UIWidgets::EnhancementCheckbox("Milk Percent Restore", "gMilkPercentRestore", disabledMilk, disabledTooltipMilk);
@ -567,7 +509,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk);
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk.");
bool disabledHalfMilk = disabledMilk || !CVarGetInteger("gSeparateHalfMilkEffect", 0);
const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off";
static const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk);
UIWidgets::Tooltip("Changes the amount of health restored by Half Milk");
UIWidgets::EnhancementCheckbox("Half Milk Percent Restore", "gHalfMilkPercentRestore", disabledHalfMilk, disabledTooltipHalfMilk);
@ -578,7 +520,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect");
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies");
bool disabledFairy = !CVarGetInteger("gFairyEffect", 0);
const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off";
static const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy);
UIWidgets::Tooltip("Changes the amount of health restored by Fairies");
UIWidgets::EnhancementCheckbox("Fairy Percent Restore", "gFairyPercentRestore", disabledFairy, disabledTooltipFairy);
@ -589,7 +531,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect");
UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals");
bool disabledFairyRevive = !CVarGetInteger("gFairyReviveEffect", 0);
const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off";
static const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off";
UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive);
UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals");
UIWidgets::EnhancementCheckbox("Fairy Revive Percent Restore", "gFairyRevivePercentRestore", disabledFairyRevive, disabledTooltipFairyRevive);
@ -604,14 +546,14 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery");
UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior");
bool disabled = !CVarGetInteger("gCustomizeShootingGallery", 0);
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Skips the shooting gallery minigame");
UIWidgets::PaddedEnhancementCheckbox("No Rupee Randomization", "gConstantAdultGallery", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Forces the rupee order to not be randomized as adult, making it the same as chlid");
UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", "gChildShootingGalleryAmmunition", 10, 30, "", 15, false, true, false, disabled, disabledTooltip);
UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", "gChildShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as a child");
UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", "gAdultShootingGalleryAmmunition", 10, 30, "", 15, false, true, false, disabled, disabledTooltip);
UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", "gAdultShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as an adult");
ImGui::EndMenu();
}
@ -622,12 +564,12 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling");
UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior");
bool disabled = CVarGetInteger("gCustomizeBombchuBowling", 0) == 0;
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame");
UIWidgets::PaddedEnhancementCheckbox("Remove Big Cucco", "gBombchuBowlingNoBigCucco", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Prevents the big cucco from appearing in the bombchu bowling minigame");
UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", "gBombchuBowlingAmmunition", 3, 20, "", 10, false, true, false, disabled, disabledTooltip);
UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", "gBombchuBowlingAmmunition", 3, 20, "", 10, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The number of bombchus available at the start of the bombchu bowling minigame");
ImGui::EndMenu();
}
@ -638,16 +580,16 @@ namespace GameMenuBar {
UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing");
UIWidgets::Tooltip("Turn on/off changes to the fishing behavior");
bool disabled = !CVarGetInteger("gCustomizeFishing", 0);
const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off";
UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("All fish will be caught instantly");
UIWidgets::PaddedEnhancementCheckbox("Guarantee Bite", "gGuaranteeFishingBite", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("When a line is stable, guarantee bite. Otherwise use default logic");
UIWidgets::PaddedEnhancementCheckbox("Fish Never Escape", "gFishNeverEscape", true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Once a hook has been set, fish will never let go while being reeled in.");
UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", "gChildMinimumWeightFish", 3, 10, "", 10, false, true, false, disabled, disabledTooltip);
UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", "gChildMinimumWeightFish", 3, 10, "", 10, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The minimum weight for the unique fishing reward as a child");
UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", "gAdultMinimumWeightFish", 6, 13, "", 13, false, true, false, disabled, disabledTooltip);
UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", "gAdultMinimumWeightFish", 6, 13, "", 13, true, true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult");
ImGui::EndMenu();
}
@ -656,7 +598,7 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false);
UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0.");
UIWidgets::PaddedEnhancementSliderInt("Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, false, true, false,
UIWidgets::PaddedEnhancementSliderInt("Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false,
!CVarGetInteger("gRupeeDash", 0), "This option is disabled because \"Rupee Dash Mode\" is turned off");
UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode");
@ -701,7 +643,7 @@ namespace GameMenuBar {
// Blue Fire Arrows
bool forceEnableBlueFireArrows = gSaveContext.n64ddFlag &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BLUE_FIRE_ARROWS);
const char* forceEnableBlueFireArrowsText =
static const char* forceEnableBlueFireArrowsText =
"This setting is forcefully enabled because a savefile\nwith \"Blue Fire Arrows\" is loaded.";
UIWidgets::PaddedEnhancementCheckbox("Blue Fire Arrows", "gBlueFireArrows", true, false,
forceEnableBlueFireArrows, forceEnableBlueFireArrowsText, UIWidgets::CheckboxGraphics::Checkmark);
@ -710,7 +652,7 @@ namespace GameMenuBar {
// Sunlight Arrows
bool forceEnableSunLightArrows = gSaveContext.n64ddFlag &&
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SUNLIGHT_ARROWS);
const char* forceEnableSunLightArrowsText =
static const char* forceEnableSunLightArrowsText =
"This setting is forcefully enabled because a savefile\nwith \"Sunlight Arrows\" is loaded.";
UIWidgets::PaddedEnhancementCheckbox("Sunlight Arrows", "gSunlightArrows", true, false,
forceEnableSunLightArrows, forceEnableSunLightArrowsText, UIWidgets::CheckboxGraphics::Checkmark);
@ -736,7 +678,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3);
UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down");
if (CVarGetInteger("gPauseLiveLinkRotation", 0) != 0) {
UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "");
UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "", 1);
}
UIWidgets::PaddedSeparator();
ImGui::Text("Static loop");
@ -764,7 +706,7 @@ namespace GameMenuBar {
UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17);
UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)");
if (CVarGetInteger("gPauseLiveLink", 0) >= 16) {
UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0, true);
UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0);
}
ImGui::EndMenu();
@ -782,8 +724,7 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon", true, false);
UIWidgets::Tooltip("Always shows dungeon entrance icons on the minimap");
UIWidgets::PaddedText("Fix Vanishing Paths", true, false);
const char* zFightingOptions[3] = { "Disabled", "Consistent Vanish", "No Vanish" };
UIWidgets::EnhancementCombobox("gDirtPathFix", zFightingOptions, 3, 0);
UIWidgets::EnhancementCombobox("gDirtPathFix", zFightingOptions, 0);
UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n"
"Consistent: Certain paths vanish the same way in all resolutions\n"
"No Vanish: Paths do not vanish, Link seems to sink in to some paths\n"
@ -863,9 +804,8 @@ namespace GameMenuBar {
// Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility
UIWidgets::PaddedText("Autosave", false, true);
const char* autosaveLabels[] = { "Off", "New Location + Major Item", "New Location + Any Item", "New Location", "Major Item", "Any Item" };
UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, (sizeof(autosaveLabels) / sizeof(autosaveLabels[0])), CVarGetInteger("gAutosave", 0));
UIWidgets::Tooltip("Automatically save the game every time a new area is entered and/or item is obtained\n"
UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, 0);
UIWidgets::Tooltip("Automatically save the game when changing locations and/or obtaining items\n"
"Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)");
UIWidgets::Spacer(0);
@ -907,107 +847,86 @@ namespace GameMenuBar {
EXPERIMENTAL();
const char* fps_cvar = "gInterpolationFPS";
{
int minFps = 20;
int maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate();
int val = OTRGlobals::Instance->GetInterpolationFPS();
val = fmax(fmin(val, maxFps), 20);
{ // FPS Slider
const int minFps = 20;
const int maxFps = Ship::Window::GetInstance()->GetCurrentRefreshRate();
int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps);
#ifdef __WIIU__
// only support divisors of 60 on the Wii U
val = 60 / (60 / val);
#endif
if (currentFps > 60) {
currentFps = 60;
}
else {
currentFps = 60 / (60 / currentFps);
}
int fps = val;
if (fps == 20)
{
int fpsSlider = 1;
if (currentFps == 20) {
ImGui::Text("Frame interpolation: Off");
}
else {
ImGui::Text("Frame interpolation: %d FPS", currentFps);
if (currentFps == 30) {
fpsSlider = 2;
}
else { // currentFps == 60
fpsSlider = 3;
}
}
else
{
ImGui::Text("Frame interpolation: %d FPS", fps);
}
if (CVarGetInteger("gMatchRefreshRate", 0)) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
std::string MinusBTNFPSI = " - ##FPSInterpolation";
std::string PlusBTNFPSI = " + ##FPSInterpolation";
if (ImGui::Button(MinusBTNFPSI.c_str())) {
#ifdef __WIIU__
if (val >= 60) val = 30;
else val = 20;
#else
val--;
#endif
CVarSetInteger(fps_cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
if (ImGui::Button(" - ##WiiUFPS")) {
fpsSlider--;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
#ifdef __SWITCH__
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 110.0f);
#elif defined(__WIIU__)
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2);
#else
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f);
#endif
if (ImGui::SliderInt("##FPSInterpolation", &val, minFps, maxFps, "", ImGuiSliderFlags_AlwaysClamp))
{
#ifdef __WIIU__
// only support divisors of 60 on the Wii U
val = 60 / (60 / val);
#endif
if (val > 360)
{
val = 360;
}
else if (val < 20)
{
val = 20;
}
CVarSetInteger(fps_cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
ImGui::SliderInt("##WiiUFPSSlider", &fpsSlider, 1, 3, "", ImGuiSliderFlags_AlwaysClamp);
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(" + ##WiiUFPS")) {
fpsSlider++;
}
ImGui::PopItemWidth();
if (CVarGetInteger("gMatchRefreshRate", 0)) {
UIWidgets::ReEnableComponent("");
}
if (fpsSlider > 3) {
fpsSlider = 3;
}
else if (fpsSlider < 1) {
fpsSlider = 1;
}
if (fpsSlider == 1) {
currentFps = 20;
}
else if (fpsSlider == 2) {
currentFps = 30;
}
else if (fpsSlider == 3) {
currentFps = 60;
}
CVarSetInteger("gInterpolationFPS", currentFps);
SohImGui::RequestCvarSaveOnNextTick();
#else
UIWidgets::EnhancementSliderInt((currentFps == 20) ? "Frame interpolation: Off" : "Frame interpolation: %d FPS",
"##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, CVarGetInteger("gMatchRefreshRate", 0));
#endif
UIWidgets::Tooltip("Interpolate extra frames to get smoother graphics\n"
"Set to match your monitor's refresh rate, or a divisor of it\n"
"A higher target FPS than your monitor's refresh rate will just waste resources, "
"and might give a worse result.\n"
"A higher target FPS than your monitor's refresh rate will just waste resources, and might give a worse result.\n"
"For consistent input lag, set this value and your monitor's refresh rate to a multiple of 20\n"
"Ctrl+Click for keyboard input");
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNFPSI.c_str())) {
#ifdef __WIIU__
if (val <= 20) val = 30;
else val = 60;
#else
val++;
#endif
CVarSetInteger(fps_cvar, val);
SohImGui::RequestCvarSaveOnNextTick();
}
if (CVarGetInteger("gMatchRefreshRate", 0)) {
ImGui::PopItemFlag();
ImGui::PopStyleVar(1);
}
}
} // END FPS Slider
UIWidgets::Spacer(0);
UIWidgets::EnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate");
UIWidgets::PaddedEnhancementCheckbox("Match Refresh Rate", "gMatchRefreshRate", true, false);
UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate");
UIWidgets::Spacer(0);
UIWidgets::EnhancementCheckbox("Disable LOD", "gDisableLOD");
UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false);
UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance");
if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) {
if (CVarGetInteger("gDisableDrawDistance", 0) == 0) {
@ -1024,19 +943,10 @@ namespace GameMenuBar {
#ifdef __SWITCH__
UIWidgets::Spacer(0);
int slot = CVarGetInteger("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK);
ImGui::Text("Switch performance mode");
if (ImGui::BeginCombo("##perf", SWITCH_CPU_PROFILES[slot])) {
for (int sId = 0; sId <= Ship::SwitchProfiles::POWERSAVINGM3; sId++) {
if (ImGui::Selectable(SWITCH_CPU_PROFILES[sId], sId == slot)) {
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[sId]);
CVarSetInteger("gSwitchPerfMode", sId);
Ship::Switch::ApplyOverclock();
SohImGui::RequestCvarSaveOnNextTick();
}
}
ImGui::EndCombo();
if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)Ship::SwitchProfiles::STOCK)) {
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK)]);
Ship::Switch::ApplyOverclock();
}
#endif
@ -1098,8 +1008,7 @@ namespace GameMenuBar {
static int32_t lastBetaQuestWorld = betaQuestWorld;
if (!isBetaQuestEnabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false);
@ -1152,15 +1061,14 @@ namespace GameMenuBar {
}
if (!isBetaQuestEnabled) {
ImGui::PopItemFlag();
ImGui::PopStyleVar(1);
UIWidgets::ReEnableComponent("");
}
}
if (ImGui::Button("Change Age")) {
CVarSetInteger("gSwitchAge", 1);
}
UIWidgets::Tooltip("Switches links age and reloads the area.");
UIWidgets::Tooltip("Switches Link's age and reloads the area.");
ImGui::EndMenu();
}
@ -1176,15 +1084,8 @@ namespace GameMenuBar {
UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false);
UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu");
if (CVarGetInteger("gSkipLogoTitle", 0)) {
const char* FastFileSelect[5] = {
"File N.1",
"File N.2",
"File N.3",
"Zelda Map Select (require OoT Debug Mode)",
"File select",
};
ImGui::Text("Loading :");
UIWidgets::EnhancementCombobox("gSaveFileID", FastFileSelect, 5, 0);
UIWidgets::EnhancementCombobox("gSaveFileID", FastFileSelect, 0);
};
UIWidgets::PaddedEnhancementCheckbox("Hide Build Info", "gHideBuildInfo", true, false);
UIWidgets::Tooltip("Hides the game version and build details in the boot logo start screen");
@ -1272,7 +1173,7 @@ namespace GameMenuBar {
SohImGui::RequestCvarSaveOnNextTick();
SohImGui::EnableWindow("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0));
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gItemTrackerEnabled", 0);
@ -1280,7 +1181,7 @@ namespace GameMenuBar {
SohImGui::RequestCvarSaveOnNextTick();
SohImGui::EnableWindow("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0));
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gItemTrackerSettingsEnabled", 0);
@ -1288,7 +1189,7 @@ namespace GameMenuBar {
SohImGui::RequestCvarSaveOnNextTick();
SohImGui::EnableWindow("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0));
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gEntranceTrackerEnabled", 0);
@ -1296,7 +1197,7 @@ namespace GameMenuBar {
SohImGui::RequestCvarSaveOnNextTick();
SohImGui::EnableWindow("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0));
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gCheckTrackerEnabled", 0);
@ -1304,7 +1205,7 @@ namespace GameMenuBar {
SohImGui::RequestCvarSaveOnNextTick();
SohImGui::EnableWindow("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0));
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize))
{
bool currentValue = CVarGetInteger("gCheckTrackerSettingsEnabled", 0);
@ -1345,7 +1246,7 @@ namespace GameMenuBar {
disableKeyColors = false;
}
const char* disableKeyColorsText =
static const char* disableKeyColorsText =
"This setting is disabled because a savefile is loaded without any key\n"
"shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\"";
@ -1375,7 +1276,7 @@ namespace GameMenuBar {
CrowdControl::Instance->Disable();
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
UIWidgets::Spacer(0);
#endif
UIWidgets::EnhancementCheckbox("Enemy Randomizer", "gRandomizedEnemies");
@ -1387,7 +1288,7 @@ namespace GameMenuBar {
if (CVarGetInteger("gRandomizedEnemies", 0)) {
bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile.";
static const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile.";
UIWidgets::PaddedEnhancementCheckbox("Seeded Enemy Spawns", "gSeededRandomizedEnemies", true, false, disableSeededEnemies, disableSeededEnemiesText);
UIWidgets::Tooltip(

View File

@ -51,22 +51,6 @@ namespace UIWidgets {
return WrappedText(text.c_str(), charactersPerLine);
}
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha)
{
Color_RGBA8 defaultColors;
defaultColors.r = default_colors.x;
defaultColors.g = default_colors.y;
defaultColors.b = default_colors.z;
defaultColors.a = default_colors.w;
Color_RGBA8 cvarColor = CVarGetColor(cvarname, defaultColors);
ColorArray.x = cvarColor.r / 255.0;
ColorArray.y = cvarColor.g / 255.0;
ColorArray.z = cvarColor.b / 255.0;
ColorArray.w = cvarColor.a / 255.0;
}
void SetLastItemHoverText(const std::string& text) {
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
@ -118,13 +102,9 @@ namespace UIWidgets {
}
void PaddedSeparator(bool padTop, bool padBottom, float extraVerticalTopPadding, float extraVerticalBottomPadding) {
if (padTop)
Spacer(0);
if (padTop) Spacer(0);
ImGui::Separator();
if (padBottom)
Spacer(0);
if (padBottom) Spacer(0);
}
void RenderCross(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz) {
@ -143,8 +123,9 @@ namespace UIWidgets {
bool CustomCheckbox(const char* label, bool* v, bool disabled, CheckboxGraphics disabledGraphic) {
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
if (window->SkipItems) {
return false;
}
ImGuiContext& g = *GImGui;
const ImGuiStyle& style = g.Style;
@ -187,21 +168,37 @@ namespace UIWidgets {
}
ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
if (g.LogEnabled)
if (g.LogEnabled) {
ImGui::LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
if (label_size.x > 0.0f)
}
if (label_size.x > 0.0f) {
ImGui::RenderText(label_pos, label);
}
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
return pressed;
}
void ReEnableComponent(const char* disabledTooltipText) {
// End of disable region of previous component
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
}
void DisableComponent(const float alpha) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
}
bool EnhancementCheckbox(const char* text, const char* cvarName, bool disabled, const char* disabledTooltipText, CheckboxGraphics disabledGraphic, bool defaultValue) {
bool changed = false;
if (disabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
bool val = (bool)CVarGetInteger(cvarName, defaultValue);
if (CustomCheckbox(text, &val, disabled, disabledGraphic)) {
CVarSetInteger(cvarName, val);
@ -210,60 +207,39 @@ namespace UIWidgets {
}
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
ReEnableComponent(disabledTooltipText);
}
return changed;
}
bool PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText, CheckboxGraphics disabledGraphic, bool defaultValue) {
bool changed = false;
ImGui::BeginGroup();
if (padTop) Spacer(0);
if (EnhancementCheckbox(text, cvarName, disabled, disabledTooltipText, disabledGraphic, defaultValue)) {
changed = true;
}
bool changed = EnhancementCheckbox(text, cvarName, disabled, disabledTooltipText, disabledGraphic, defaultValue);
if (padBottom) Spacer(0);
ImGui::EndGroup();
return changed;
}
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue) {
if (ImGui::BeginCombo(name.c_str(), items[static_cast<int>(CVarGetInteger(cvarName, defaultValue))].c_str())) {
for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) {
if (ImGui::Selectable(items[settingIndex].c_str())) {
CVarSetInteger(cvarName, settingIndex);
SohImGui::RequestCvarSaveOnNextTick();
}
}
ImGui::EndCombo();
}
}
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
bool EnhancementCombobox(const char* cvarName, std::span<const char*, std::dynamic_extent> comboArray, uint8_t defaultIndex, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
bool changed = false;
if (FirstTimeValue <= 0) {
FirstTimeValue = 0;
if (defaultIndex <= 0) {
defaultIndex = 0;
}
if (disabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
uint8_t selected = CVarGetInteger(name, FirstTimeValue);
uint8_t DefaultValue = selected;
std::string comboName = std::string("##") + std::string(name);
if (ImGui::BeginCombo(comboName.c_str(), ComboArray[DefaultValue])) {
for (uint8_t i = 0; i < arraySize; i++) {
if (strlen(ComboArray[i]) > 1) {
if (ImGui::Selectable(ComboArray[i], i == selected)) {
CVarSetInteger(name, i);
uint8_t selected = CVarGetInteger(cvarName, defaultIndex);
std::string comboName = std::string("##") + std::string(cvarName);
if (ImGui::BeginCombo(comboName.c_str(), comboArray[selected])) {
for (uint8_t i = 0; i < comboArray.size(); i++) {
if (strlen(comboArray[i]) > 1) {
if (ImGui::Selectable(comboArray[i], i == selected)) {
CVarSetInteger(cvarName, i);
selected = i;
changed = true;
SohImGui::RequestCvarSaveOnNextTick();
@ -274,14 +250,10 @@ namespace UIWidgets {
}
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
ReEnableComponent(disabledTooltipText);
if (disabledValue >= 0 && selected != disabledValue) {
CVarSetInteger(name, disabledValue);
CVarSetInteger(cvarName, disabledValue);
changed = true;
SohImGui::RequestCvarSaveOnNextTick();
}
@ -290,120 +262,89 @@ namespace UIWidgets {
return changed;
}
bool LabeledRightAlignedEnhancementCombobox(const char* label, const char* cvarName, std::span<const char*, std::dynamic_extent> comboArray, uint8_t defaultIndex, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
ImGui::Text(label);
s32 currentValue = CVarGetInteger(cvarName, defaultIndex);
#ifdef __WIIU__
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (ImGui::CalcTextSize(comboArray[currentValue]).x + 40.0f));
ImGui::PushItemWidth(ImGui::CalcTextSize(comboArray[currentValue]).x + 60.0f);
#else
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (ImGui::CalcTextSize(comboArray[currentValue]).x + 20.0f));
ImGui::PushItemWidth(ImGui::CalcTextSize(comboArray[currentValue]).x + 30.0f);
#endif
bool changed = EnhancementCombobox(cvarName, comboArray, defaultIndex, disabled, disabledTooltipText, disabledValue);
ImGui::PopItemWidth();
return changed;
}
void PaddedText(const char* text, bool padTop, bool padBottom) {
if (padTop)
Spacer(0);
if (padTop) Spacer(0);
ImGui::Text("%s", text);
if (padBottom)
Spacer(0);
}
void DisableComponentSwitch(const char* disabledTooltipText, const float alpha) {
// End of disable region of previous component
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
// Start of disable region of next component
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
if (padBottom) Spacer(0);
}
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool disabled, const char* disabledTooltipText) {
bool changed = false;
int val = CVarGetInteger(cvarName, defaultValue);
float alpha;
if (disabled) {
alpha = ImGui::GetStyle().Alpha * 0.5f;
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
ImGui::Text(text, val);
Spacer(0);
if (disabled) {
DisableComponentSwitch(disabledTooltipText, alpha);
}
if(PlusMinusButton) {
std::string MinusBTNName = " - ##";
MinusBTNName += cvarName;
ImGui::BeginGroup();
if (PlusMinusButton) {
std::string MinusBTNName = " - ##" + std::string(cvarName);
if (ImGui::Button(MinusBTNName.c_str())) {
val--;
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
}
if (disabled) {
DisableComponentSwitch(disabledTooltipText, alpha);
}
}
if (PlusMinusButton) {
#ifdef __SWITCH__
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 110.0f);
#elif defined(__WIIU__)
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2);
#else
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f);
#endif
}
if (ImGui::SliderInt(id, &val, min, max, format))
ImGui::PushItemWidth(std::min((ImGui::GetContentRegionAvail().x - (PlusMinusButton ? sliderButtonWidth : 0.0f)), maxSliderWidth));
if (ImGui::SliderInt(id, &val, min, max, format, ImGuiSliderFlags_AlwaysClamp))
{
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
ImGui::PopItemWidth();
if (PlusMinusButton) {
ImGui::PopItemWidth();
}
if(PlusMinusButton) {
if (disabled) {
DisableComponentSwitch(disabledTooltipText, alpha);
}
std::string PlusBTNName = " + ##";
PlusBTNName += cvarName;
std::string PlusBTNName = " + ##" + std::string(cvarName);
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNName.c_str())) {
val++;
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
}
ImGui::EndGroup();
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
ReEnableComponent(disabledTooltipText);
}
if (val < min)
{
if (val < min) {
val = min;
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
if (val > max)
{
if (val > max) {
val = max;
changed = true;
}
if (changed) {
CVarSetInteger(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
return changed;
@ -414,8 +355,7 @@ namespace UIWidgets {
float val = CVarGetFloat(cvarName, defaultValue);
if (disabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
}
if (!isPercentage) {
@ -424,93 +364,90 @@ namespace UIWidgets {
ImGui::Text(text, static_cast<int>(100 * val));
}
Spacer(0);
if(PlusMinusButton) {
std::string MinusBTNName = " - ##";
MinusBTNName += cvarName;
ImGui::BeginGroup();
if (PlusMinusButton) {
std::string MinusBTNName = " - ##" + std::string(cvarName);
if (ImGui::Button(MinusBTNName.c_str())) {
if (!isPercentage) {
val -= 0.1f;
} else {
if (isPercentage) {
val -= 0.01f;
} else {
val -= 0.1f;
}
CVarSetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
}
if (PlusMinusButton) {
#ifdef __SWITCH__
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 110.0f);
#elif defined(__WIIU__)
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f * 2);
#else
ImGui::PushItemWidth(ImGui::GetWindowSize().x - 79.0f);
#endif
}
if (ImGui::SliderFloat(id, &val, min, max, format)) {
ImGui::PushItemWidth(std::min((ImGui::GetContentRegionAvail().x - (PlusMinusButton ? sliderButtonWidth : 0.0f)), maxSliderWidth));
if (ImGui::SliderFloat(id, &val, min, max, format, ImGuiSliderFlags_AlwaysClamp)) {
if (isPercentage) {
CVarSetFloat(cvarName, roundf(val * 100) / 100);
} else {
CVarSetFloat(cvarName, val);
val = roundf(val * 100) / 100;
}
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
ImGui::PopItemWidth();
if (PlusMinusButton) {
ImGui::PopItemWidth();
}
if(PlusMinusButton) {
std::string PlusBTNName = " + ##";
PlusBTNName += cvarName;
std::string PlusBTNName = " + ##" + std::string(cvarName);
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(PlusBTNName.c_str())) {
if (!isPercentage) {
val += 0.1f;
} else {
if (isPercentage) {
val += 0.01f;
} else {
val += 0.1f;
}
CVarSetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
}
ImGui::EndGroup();
if (disabled) {
ImGui::PopStyleVar(1);
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && strcmp(disabledTooltipText, "") != 0) {
ImGui::SetTooltip("%s", disabledTooltipText);
}
ImGui::PopItemFlag();
ReEnableComponent(disabledTooltipText);
}
if (val < min) {
val = min;
CVarSetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
if (val > max) {
val = max;
changed = true;
}
if (changed) {
CVarSetFloat(cvarName, val);
SohImGui::RequestCvarSaveOnNextTick();
changed = true;
}
return changed;
}
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText) {
if (padTop)
Spacer(0);
bool PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue, bool PlusMinusButton, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText) {
bool changed = false;
ImGui::BeginGroup();
if (padTop) Spacer(0);
EnhancementSliderInt(text, id, cvarName, min, max, format, defaultValue, PlusMinusButton, disabled, disabledTooltipText);
changed = EnhancementSliderInt(text, id, cvarName, min, max, format, defaultValue, PlusMinusButton, disabled, disabledTooltipText);
if (padBottom)
Spacer(0);
if (padBottom) Spacer(0);
ImGui::EndGroup();
return changed;
}
bool PaddedEnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText) {
bool changed = false;
ImGui::BeginGroup();
if (padTop) Spacer(0);
changed = EnhancementSliderFloat(text, id, cvarName, min, max, format, defaultValue, isPercentage, PlusMinusButton, disabled, disabledTooltipText);
if (padBottom) Spacer(0);
ImGui::EndGroup();
return changed;
}
bool EnhancementRadioButton(const char* text, const char* cvarName, int id) {
@ -524,9 +461,7 @@ namespace UIWidgets {
EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER);
EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA);
*/
std::string make_invisible = "##";
make_invisible += text;
make_invisible += cvarName;
std::string make_invisible = "##" + std::string(text) + std::string(cvarName);
bool ret = false;
int val = CVarGetInteger(cvarName, 0);
@ -543,12 +478,8 @@ namespace UIWidgets {
bool DrawResetColorButton(const char* cvarName, ImVec4* colors, ImVec4 defaultcolors, bool has_alpha) {
bool changed = false;
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "Reset";
MakeInvisible += "##";
MakeInvisible += cvarName;
MakeInvisible += "Reset";
std::string Cvar_RBM = std::string(cvarName) + "RBM";
std::string MakeInvisible = "Reset##" + std::string(cvarName) + "Reset";
if (ImGui::Button(MakeInvisible.c_str())) {
colors->x = defaultcolors.x;
colors->y = defaultcolors.y;
@ -573,13 +504,8 @@ namespace UIWidgets {
bool DrawRandomizeColorButton(const char* cvarName, ImVec4* colors) {
bool changed = false;
Color_RGBA8 NewColors = {0,0,0,255};
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "##";
MakeInvisible += cvarName;
MakeInvisible += "Random";
std::string FullName = "Random";
FullName += MakeInvisible;
std::string Cvar_RBM = std::string(cvarName) + "RBM";
std::string FullName = "Random##" + std::string(cvarName) + "Random";
if (ImGui::Button(FullName.c_str())) {
#if defined(__SWITCH__) || defined(__WIIU__)
srand(time(NULL));
@ -601,8 +527,7 @@ namespace UIWidgets {
}
void DrawLockColorCheckbox(const char* cvarName) {
std::string Cvar_Lock = cvarName;
Cvar_Lock += "Lock";
std::string Cvar_Lock = std::string(cvarName) + "Lock";
s32 lock = CVarGetInteger(Cvar_Lock.c_str(), 0);
std::string FullName = "Lock##" + Cvar_Lock;
EnhancementCheckbox(FullName.c_str(), Cvar_Lock.c_str());
@ -610,17 +535,28 @@ namespace UIWidgets {
}
void RainbowColor(const char* cvarName, ImVec4* colors) {
std::string Cvar_RBM = cvarName;
Cvar_RBM += "RBM";
std::string MakeInvisible = "Rainbow";
MakeInvisible += "##";
MakeInvisible += cvarName;
MakeInvisible += "Rainbow";
std::string Cvar_RBM = std::string(cvarName) + "RBM";
std::string MakeInvisible = "Rainbow##" + std::string(cvarName) + "Rainbow";
EnhancementCheckbox(MakeInvisible.c_str(), Cvar_RBM.c_str());
Tooltip("Cycles through colors on a timer\nOverwrites previously chosen color");
}
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha) {
Color_RGBA8 defaultColors;
defaultColors.r = default_colors.x;
defaultColors.g = default_colors.y;
defaultColors.b = default_colors.z;
defaultColors.a = default_colors.w;
Color_RGBA8 cvarColor = CVarGetColor(cvarname, defaultColors);
ColorArray.x = cvarColor.r / 255.0;
ColorArray.y = cvarColor.g / 255.0;
ColorArray.z = cvarColor.b / 255.0;
ColorArray.w = cvarColor.a / 255.0;
}
bool EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow, bool has_alpha, bool TitleSameLine) {
bool changed = false;
LoadPickersColors(ColorRGBA, cvarName, default_colors, has_alpha);

View File

@ -10,6 +10,7 @@
#include <string>
#include <vector>
#include <span>
#include <stdint.h>
#include <ImGui/imgui.h>
@ -40,6 +41,14 @@ namespace UIWidgets {
Checkmark,
None
};
constexpr float maxSliderWidth = 260.0f;
#ifdef __SWITCH__
constexpr float sliderButtonWidth = 42.0f;
#elif defined(__WIIU__)
constexpr float sliderButtonWidth = 60.0f;
#else
constexpr float sliderButtonWidth = 30.0f;
#endif
char* WrappedText(const char* text, unsigned int charactersPerLine = 60);
char* WrappedText(const std::string& text, unsigned int charactersPerLine);
@ -52,19 +61,37 @@ namespace UIWidgets {
void Tooltip(const char* text);
void Spacer(float height);
void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f);
void RenderCross(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz);
bool CustomCheckbox(const char* label, bool* v, bool disabled, CheckboxGraphics disabledGraphic);
void ReEnableComponent(const char* disabledTooltipText);
void DisableComponent(const float alpha);
bool EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross, bool defaultValue = false);
bool PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", CheckboxGraphics disabledGraphic = CheckboxGraphics::Cross, bool defaultValue = false);
void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector<std::string>& items, int defaultValue = 0);
bool EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue, bool disabled = false, const char* disabledTooltipText = "", uint8_t disabledValue = -1);
bool EnhancementCombobox(const char* cvarName, std::span<const char*, std::dynamic_extent> comboArray, uint8_t defaultIndex, bool disabled = false, const char* disabledTooltipText = "", uint8_t disabledValue = -1);
bool LabeledRightAlignedEnhancementCombobox(const char* label, const char* cvarName, std::span<const char*, std::dynamic_extent> comboArray, uint8_t defaultIndex, bool disabled = false, const char* disabledTooltipText = "", uint8_t disabledValue = -1);
void PaddedText(const char* text, bool padTop = true, bool padBottom = true);
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool disabled = false, const char* disabledTooltipText = "");
void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "");
bool EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = false, bool disabled = false, const char* disabledTooltipText = "");
bool EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = true, bool disabled = false, const char* disabledTooltipText = "");
bool PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = true, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "");
bool EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = true, bool disabled = false, const char* disabledTooltipText = "");
bool PaddedEnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = true, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "");
bool EnhancementRadioButton(const char* text, const char* cvarName, int id);
bool EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false);
bool DrawResetColorButton(const char* cvarName, ImVec4* colors, ImVec4 defaultcolors, bool has_alpha);
bool DrawRandomizeColorButton(const char* cvarName, ImVec4* colors);
void DrawLockColorCheckbox(const char* cvarName);
void RainbowColor(const char* cvarName, ImVec4* colors);
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha);
bool EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha = false, bool TitleSameLine = false);
void DrawFlagArray32(const std::string& name, uint32_t& flags);
void DrawFlagArray16(const std::string& name, uint16_t& flags);
void DrawFlagArray8(const std::string& name, uint8_t& flags);