diff --git a/CMakeLists.txt b/CMakeLists.txt index 36c8901b0..b1e064233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,6 +135,11 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(GBI_UCODE F3DEX_GBI_2) +################################################################################ +# Set CONTROLLERBUTTONS_T +################################################################################ +add_compile_definitions(CONTROLLERBUTTONS_T=uint32_t) + ################################################################################ # Sub-projects ################################################################################ diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index d4bd5405c..75a1ea5e7 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -311,7 +311,7 @@ void InputViewer::DrawElement() { if (CVarGetInteger(CVAR_INPUT_VIEWER("Mod1"), 0)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); - RenderButton("Modifier-1", "Modifier-1 Outline", pads[0].button & BTN_MODIFIER1, scaledBGSize, + RenderButton("Modifier-1", "Modifier-1 Outline", pads[0].button & BTN_CUSTOM_MODIFIER1, scaledBGSize, useGlobalOutlineMode ? buttonOutlineMode : CVarGetInteger(CVAR_INPUT_VIEWER("Mod1OutlineMode"), BUTTON_OUTLINE_NOT_PRESSED)); @@ -320,7 +320,7 @@ void InputViewer::DrawElement() { if (CVarGetInteger(CVAR_INPUT_VIEWER("Mod2"), 0)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); - RenderButton("Modifier-2", "Modifier-2 Outline", pads[0].button & BTN_MODIFIER2, scaledBGSize, + RenderButton("Modifier-2", "Modifier-2 Outline", pads[0].button & BTN_CUSTOM_MODIFIER2, scaledBGSize, useGlobalOutlineMode ? buttonOutlineMode : CVarGetInteger(CVAR_INPUT_VIEWER("Mod2OutlineMode"), BUTTON_OUTLINE_NOT_PRESSED)); diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index a3745ee72..dd2187971 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -21,7 +21,14 @@ void SohInputEditorWindow::InitElement() { mButtonsBitmasks = { BTN_A, BTN_B, BTN_START, BTN_L, BTN_R, BTN_Z, BTN_CUP, BTN_CDOWN, BTN_CLEFT, BTN_CRIGHT }; mDpadBitmasks = { BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT }; - mModifierButtonsBitmasks = { BTN_MODIFIER1, BTN_MODIFIER2 }; + mModifierButtonsBitmasks = { BTN_CUSTOM_MODIFIER1, BTN_CUSTOM_MODIFIER2 }; + mCustomOcarinaButtonsBitmasks = { + BTN_CUSTOM_OCARINA_NOTE_D4, + BTN_CUSTOM_OCARINA_NOTE_F4, + BTN_CUSTOM_OCARINA_NOTE_A4, + BTN_CUSTOM_OCARINA_NOTE_B4, + BTN_CUSTOM_OCARINA_NOTE_D5 + }; addButtonName(BTN_A, "A"); addButtonName(BTN_B, "B"); @@ -220,7 +227,7 @@ void SohInputEditorWindow::DrawInputChip(const char* buttonName, ImVec4 color = ImGui::EndDisabled(); } -void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, uint16_t bitmask) { +void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, N64ButtonMask bitmask) { ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); auto popupId = StringHelper::Sprintf("addButtonMappingPopup##%d-%d", port, bitmask); if (ImGui::Button(StringHelper::Sprintf("%s###addButtonMappingButton%d-%d", ICON_FA_PLUS, port, bitmask).c_str(), @@ -249,7 +256,7 @@ void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, uint16_t } } -void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id) { +void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, N64ButtonMask bitmask, std::string id) { auto mapping = Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) @@ -456,7 +463,7 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_ ImGui::SameLine(0, SCALE_IMGUI_SIZE(4.0f)); } -void SohInputEditorWindow::DrawButtonLine(const char* buttonName, uint8_t port, uint16_t bitmask, +void SohInputEditorWindow::DrawButtonLine(const char* buttonName, uint8_t port, N64ButtonMask bitmask, ImVec4 color = CHIP_COLOR_N64_GREY) { ImGui::NewLine(); ImGui::SameLine(SCALE_IMGUI_SIZE(32.0f)); @@ -1248,7 +1255,7 @@ void SohInputEditorWindow::DrawGyroSection(uint8_t port) { } } -void SohInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks) { +void SohInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks) { std::set allLusDeviceIndices; allLusDeviceIndices.insert(Ship::ShipDeviceIndex::Keyboard); for (auto [lusIndex, mapping] : Ship::Context::GetInstance() @@ -1483,23 +1490,11 @@ namespace TableHelper { } } -typedef uint32_t N64ButtonMask; - void SohInputEditorWindow::addButtonName(N64ButtonMask mask, const char* name) { buttons.push_back(std::make_pair(mask, name)); buttonNames[mask] = std::prev(buttons.end()); } -// Ocarina button maps -static CustomButtonMap ocarinaD5 = {"D5", CVAR_SETTING("CustomOcarina.D5Button"), BTN_CUP}; -static CustomButtonMap ocarinaB4 = {"B4", CVAR_SETTING("CustomOcarina.B4Button"), BTN_CLEFT}; -static CustomButtonMap ocarinaA4 = {"A4", CVAR_SETTING("CustomOcarina.A4Button"), BTN_CRIGHT}; -static CustomButtonMap ocarinaF4 = {"F4", CVAR_SETTING("CustomOcarina.F4Button"), BTN_CDOWN}; -static CustomButtonMap ocarinaD4 = {"D4", CVAR_SETTING("CustomOcarina.D4Button"), BTN_A}; -static CustomButtonMap ocarinaSongDisable = {"Disable songs", CVAR_SETTING("CustomOcarina.DisableButton"), BTN_L}; -static CustomButtonMap ocarinaSharp = {"Pitch up", CVAR_SETTING("CustomOcarina.SharpButton"), BTN_R}; -static CustomButtonMap ocarinaFlat = {"Pitch down", CVAR_SETTING("CustomOcarina.FlatButton"), BTN_Z}; - // Draw a button mapping setting consisting of a padded label and button dropdown. // excludedButtons indicates which buttons are unavailable to choose from. void SohInputEditorWindow::DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons) { @@ -1538,73 +1533,35 @@ void SohInputEditorWindow::DrawMapping(CustomButtonMap& mapping, float labelWidt } void SohInputEditorWindow::DrawOcarinaControlPanel() { - if (!ImGui::BeginTable("tableCustomOcarinaControls", 1, PANEL_TABLE_FLAGS)) { - return; - } - - ImGui::TableSetupColumn("Custom Ocarina Controls", PANEL_TABLE_COLUMN_FLAGS | ImGuiTableColumnFlags_WidthStretch); - TableHelper::InitHeader(false); - ImVec2 cursor = ImGui::GetCursorPos(); - ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); + ImGui::SetCursorPos(ImVec2(cursor.x + 24, cursor.y + 5)); + UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", CVAR_SETTING("CustomOcarina.Enabled")); - if (CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0) == 1) { - if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) { - float labelWidth; - N64ButtonMask disableMask = BTN_B; - if (CVarGetInteger(CVAR_SETTING("OcarinaControl.Dpad"), 0)) { - disableMask |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; - } - - ImGui::TableSetupColumn("Notes##CustomOcarinaNotes", PANEL_TABLE_COLUMN_FLAGS); - ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS); - TableHelper::InitHeader(false); - - Ship::GuiWindow::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail()); - labelWidth = ImGui::CalcTextSize("D5").x + 10; - DrawMapping(ocarinaD5, labelWidth, disableMask); - DrawMapping(ocarinaB4, labelWidth, disableMask); - DrawMapping(ocarinaA4, labelWidth, disableMask); - DrawMapping(ocarinaF4, labelWidth, disableMask); - DrawMapping(ocarinaD4, labelWidth, disableMask); - ImGui::Dummy(ImVec2(0, 5)); - float cursorY = ImGui::GetCursorPosY(); - Ship::GuiWindow::EndGroupPanel(0); - - TableHelper::NextCol(); - - Ship::GuiWindow::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail()); - labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10; - DrawMapping(ocarinaSongDisable, labelWidth, disableMask); - DrawMapping(ocarinaSharp, labelWidth, disableMask); - DrawMapping(ocarinaFlat, labelWidth, disableMask); - Ship::GuiWindow::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2); - - ImGui::EndTable(); - } - } else { - UIWidgets::Spacer(0); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); - ImGui::TextWrapped("To modify the main ocarina controls, select the \"Customize Ocarina Controls\" checkbox."); - UIWidgets::Spacer(0); + if (!CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { + ImGui::BeginDisabled(); } - Ship::GuiWindow::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail()); - if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) { - ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS); - ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS); - TableHelper::InitHeader(false); - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); - UIWidgets::EnhancementCheckbox("Play with D-pad", CVAR_SETTING("OcarinaControl.Dpad")); - TableHelper::NextCol(); - UIWidgets::EnhancementCheckbox("Play with camera stick", CVAR_SETTING("OcarinaControl.RStick")); - UIWidgets::Spacer(0); - ImGui::EndTable(); - } - Ship::GuiWindow::EndGroupPanel(0); + ImGui::AlignTextToFramePadding(); + ImGui::BulletText("Notes"); + DrawButtonLine("A (D4)", 0, BTN_CUSTOM_OCARINA_NOTE_D4); + DrawButtonLine(ICON_FA_ARROW_DOWN " (F4)", 0, BTN_CUSTOM_OCARINA_NOTE_F4); + DrawButtonLine(ICON_FA_ARROW_RIGHT " (A4)", 0, BTN_CUSTOM_OCARINA_NOTE_A4); + DrawButtonLine(ICON_FA_ARROW_LEFT " (B4)", 0, BTN_CUSTOM_OCARINA_NOTE_B4); + DrawButtonLine(ICON_FA_ARROW_UP " (D5)", 0, BTN_CUSTOM_OCARINA_NOTE_D5); - ImGui::EndTable(); + ImGui::AlignTextToFramePadding(); + ImGui::BulletText("Disable song detection"); + DrawButtonLine(ICON_FA_BAN, 0, BTN_CUSTOM_OCARINA_DISABLE_SONGS); + + ImGui::AlignTextToFramePadding(); + ImGui::BulletText("Pitch"); + DrawButtonLine(ICON_FA_ARROW_UP, 0, BTN_CUSTOM_OCARINA_PITCH_UP); + DrawButtonLine(ICON_FA_ARROW_DOWN, 0, BTN_CUSTOM_OCARINA_PITCH_DOWN); + + if (!CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { + ImGui::EndDisabled(); + } } void SohInputEditorWindow::DrawCameraControlPanel() { @@ -1673,48 +1630,21 @@ void SohInputEditorWindow::DrawDpadControlPanel() { ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); Ship::GuiWindow::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail()); UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", CVAR_SETTING("DPadOnPause")); - UIWidgets::Tooltip("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n" - "To make the cursor only move a single space no matter how long a direction is held, manually set gSettings.DpadHoldChange to 0"); + UIWidgets::Tooltip("Navigate Pause with the D-pad\nIf used with \"D-pad as Equip Items\", you must hold C-Up to equip instead of navigate"); UIWidgets::PaddedEnhancementCheckbox("D-pad Support in Text Boxes", CVAR_SETTING("DpadInText")); - UIWidgets::Tooltip("Navigate choices in text boxes, shop item selection, and the file select / name entry screens with the D-pad\n" - "To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gSettings.DpadHoldChange to 0"); - UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", CVAR_SETTING("DpadEquips")); - UIWidgets::Tooltip("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate"); - Ship::GuiWindow::EndGroupPanel(0); -} + UIWidgets::Tooltip("Navigate choices in text boxes, shop item selection, and the file select / name entry screens with the D-pad"); -void SohInputEditorWindow::DrawMiscControlPanel() { - ImVec2 cursor = ImGui::GetCursorPos(); - ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - Ship::GuiWindow::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(CVAR_SETTING("PauseAnyCursor"), cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY); - UIWidgets::Tooltip("Allows the cursor on the pause menu to be over any slot. Sometimes required in rando to select " - "certain items."); - UIWidgets::Spacer(0); - ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); - UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", CVAR_SETTING("WalkModifier.Enabled"), true, false); - UIWidgets::Tooltip("Hold the assigned button to change the maximum walking or swimming speed"); - if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0)) { - UIWidgets::Spacer(5); - Ship::GuiWindow::BeginGroupPanel("Speed Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", CVAR_SETTING("WalkModifier.SpeedToggle"), true, false); - Ship::GuiWindow::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", CVAR_SETTING("WalkModifier.DoesntChangeJump"), true, false); - UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", CVAR_SETTING("WalkModifier.Mapping1"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); - UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", CVAR_SETTING("WalkModifier.Mapping2"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); - Ship::GuiWindow::EndGroupPanel(0); - Ship::GuiWindow::BeginGroupPanel("Swim Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", CVAR_SETTING("WalkModifier.SwimMapping1"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); - UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", CVAR_SETTING("WalkModifier.SwimMapping2"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); - Ship::GuiWindow::EndGroupPanel(0); - Ship::GuiWindow::EndGroupPanel(0); + if (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CVarGetInteger(CVAR_SETTING("DpadInText"), 0)) { + ImGui::BeginDisabled(); } - ImGui::EndDisabled(); - UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", CVAR_SETTING("NaviOnL")); - UIWidgets::Tooltip("Speak to Navi with L but enter first-person camera with C-Up"); + + UIWidgets::PaddedEnhancementCheckbox("D-pad hold change", CVAR_SETTING("DpadHoldChange"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip("The cursor will only move a single space no matter how long a D-pad direction is held"); + + if (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CVarGetInteger(CVAR_SETTING("DpadInText"), 0)) { + ImGui::EndDisabled(); + } + Ship::GuiWindow::EndGroupPanel(0); } @@ -1862,20 +1792,47 @@ void SohInputEditorWindow::DrawLinkTab() { if (ImGui::CollapsingHeader("Modifier Buttons")) { DrawButtonDeviceIcons(portIndex, mModifierButtonsBitmasks); - DrawButtonLine("M1", portIndex, BTN_MODIFIER1); - DrawButtonLine("M2", portIndex, BTN_MODIFIER2); + DrawButtonLine("M1", portIndex, BTN_CUSTOM_MODIFIER1); + DrawButtonLine("M2", portIndex, BTN_CUSTOM_MODIFIER2); + + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); + UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", CVAR_SETTING("WalkModifier.Enabled"), true, false); + UIWidgets::Tooltip("Hold the assigned button to change the maximum walking or swimming speed"); + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0)) { + UIWidgets::Spacer(5); + Ship::GuiWindow::BeginGroupPanel("Speed Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", + CVAR_SETTING("WalkModifier.SpeedToggle"), true, false); + Ship::GuiWindow::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", + CVAR_SETTING("WalkModifier.DoesntChangeJump"), true, false); + UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", + CVAR_SETTING("WalkModifier.Mapping1"), 0.0f, 5.0f, "", 1.0f, + true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", + CVAR_SETTING("WalkModifier.Mapping2"), 0.0f, 5.0f, "", 1.0f, + true, true, false, true); + Ship::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::BeginGroupPanel("Swim Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", + CVAR_SETTING("WalkModifier.SwimMapping1"), 0.0f, 5.0f, "", 1.0f, + true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", + CVAR_SETTING("WalkModifier.SwimMapping2"), 0.0f, 5.0f, "", 1.0f, + true, true, false, true); + Ship::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); + } + ImGui::EndDisabled(); } else { DrawButtonDeviceIcons(portIndex, mModifierButtonsBitmasks); } if (ImGui::CollapsingHeader("Ocarina Controls")) { - ImGui::PopStyleColor(); - ImGui::PopStyleColor(); - ImGui::PopStyleColor(); + DrawButtonDeviceIcons(portIndex, mCustomOcarinaButtonsBitmasks); DrawOcarinaControlPanel(); - ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.133f, 0.133f, 0.133f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); + } else { + DrawButtonDeviceIcons(portIndex, mCustomOcarinaButtonsBitmasks); } if (ImGui::CollapsingHeader("Camera Controls")) { @@ -1898,16 +1855,6 @@ void SohInputEditorWindow::DrawLinkTab() { ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); } - if (ImGui::CollapsingHeader("Miscellaneous Controls")) { - ImGui::PopStyleColor(); - ImGui::PopStyleColor(); - ImGui::PopStyleColor(); - DrawMiscControlPanel(); - ImGui::PushStyleColor(ImGuiCol_Header, ImVec4(0.133f, 0.133f, 0.133f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_HeaderHovered, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); - ImGui::PushStyleColor(ImGuiCol_HeaderActive, ImVec4(0.0f, 0.0f, 0.0f, 1.0f)); - } - ImGui::PopStyleColor(); ImGui::PopStyleColor(); ImGui::PopStyleColor(); diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.h b/soh/soh/Enhancements/controls/SohInputEditorWindow.h index aa2c3f4f4..1b38e8f28 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.h +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.h @@ -12,7 +12,7 @@ #include #include -typedef uint32_t N64ButtonMask; +typedef CONTROLLERBUTTONS_T N64ButtonMask; typedef struct { const char* label; @@ -40,9 +40,9 @@ class SohInputEditorWindow : public Ship::GuiWindow { private: void DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, Ship::Direction direction, ImVec4 color); - void DrawButtonLine(const char* buttonName, uint8_t port, uint16_t bitmask, ImVec4 color); - void DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id); - void DrawButtonLineAddMappingButton(uint8_t port, uint16_t bitmask); + void DrawButtonLine(const char* buttonName, uint8_t port, N64ButtonMask bitmask, ImVec4 color); + void DrawButtonLineEditMappingButton(uint8_t port, N64ButtonMask bitmask, std::string id); + void DrawButtonLineAddMappingButton(uint8_t port, N64ButtonMask bitmask); void DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction, std::string id); void DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction); @@ -69,7 +69,6 @@ class SohInputEditorWindow : public Ship::GuiWindow { void DrawOcarinaControlPanel(); void DrawCameraControlPanel(); void DrawDpadControlPanel(); - void DrawMiscControlPanel(); int32_t mGameInputBlockTimer; int32_t mMappingInputBlockTimer; @@ -77,7 +76,7 @@ class SohInputEditorWindow : public Ship::GuiWindow { std::shared_ptr mRumbleMappingToTest; // mBitmaskToMappingIds[port][bitmask] = { id0, id1, ... } - std::unordered_map>> mBitmaskToMappingIds; + std::unordered_map>> mBitmaskToMappingIds; // mStickDirectionToMappingIds[port][stick][direction] = { id0, id1, ... } std::unordered_map mButtonsBitmasks; - std::set mDpadBitmasks; - std::set mModifierButtonsBitmasks; - void DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks); + std::set mButtonsBitmasks; + std::set mDpadBitmasks; + std::set mModifierButtonsBitmasks; + std::set mCustomOcarinaButtonsBitmasks; + void DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks); void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick); void DrawRumbleDeviceIcons(uint8_t portIndex); void DrawGyroDeviceIcons(uint8_t portIndex); diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index deb4ce8f5..4f54e4645 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1277,7 +1277,7 @@ void Draw_Placements(){ C_Button_Dropdown("C Button Down position", "tablecdbtn", "C Button Down settings", "C Button Down", CVAR_COSMETIC("HUD.CDownButton"), CVAR_COSMETIC("HUD.CDownButton.PosType"), 0.87f); C_Button_Dropdown("C Button Left position", "tableclbtn", "C Button Left settings", "C Button Left", CVAR_COSMETIC("HUD.CLeftButton"), CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0.87f); C_Button_Dropdown("C Button Right position", "tablecrbtn", "C Button Right settings", "C Button Right", CVAR_COSMETIC("HUD.CRightButton"), CVAR_COSMETIC("HUD.CRightButton.PosType"), 0.87f); - if (CVarGetInteger(CVAR_SETTING("DpadEquips"),0) && ImGui::CollapsingHeader("DPad items position")) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) && ImGui::CollapsingHeader("DPad items position")) { if (ImGui::BeginTable("tabledpaditems", 1, FlagsTable)) { ImGui::TableSetupColumn("DPad items settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 930515ab6..7c767ec12 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -1735,7 +1735,7 @@ void DrawPlayerTab() { ImGui::SameLine(); ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL); - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0)) { ImGui::NewLine(); ImGui::Text("Current D-pad Equips"); ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 98c5eead1..834432605 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -65,10 +65,10 @@ const std::vector enhancementsCvars = { CVAR_SETTING("DpadInText"), CVAR_SETTING("OcarinaControl.Dpad"), CVAR_SETTING("OcarinaControl.RStick"), - CVAR_SETTING("DpadEquips"), - CVAR_SETTING("PauseAnyCursor"), + CVAR_ENHANCEMENT("DpadEquips"), + CVAR_ENHANCEMENT("PauseAnyCursor"), CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), - CVAR_SETTING("NaviOnL"), + CVAR_ENHANCEMENT("NaviOnL"), CVAR_SETTING("FreeLook.InvertXAxis"), CVAR_SETTING("FreeLook.InvertYAxis"), CVAR_SETTING("Controls.RightStickAim"), @@ -551,7 +551,7 @@ const std::vector vanillaPlusPresetEntries = { // Play Ocarina with Right Stick PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming @@ -622,7 +622,7 @@ const std::vector enhancedPresetEntries = { // Play Ocarina with Right Stick PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming @@ -754,7 +754,7 @@ const std::vector randomizerPresetEntries = { // Play Ocarina with Right Stick PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming @@ -925,7 +925,7 @@ const std::vector spockRacePresetEntries = { PRESET_ENTRY_S32(CVAR_SETTING("DpadInText"), 1), PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.Dpad"), 1), PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), - PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), @@ -941,7 +941,7 @@ const std::vector spockRacePresetEntries = { PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), - PRESET_ENTRY_S32(CVAR_SETTING("PauseAnyCursor"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseAnyCursor"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), @@ -1037,7 +1037,7 @@ const std::vector spockRaceNoLogicPresetEntries = { PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 5), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoForcedNavi"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32(CVAR_SETTING("PauseAnyCursor"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseAnyCursor"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), 1), diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index b7f45f076..79065258c 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -330,7 +330,18 @@ OTRGlobals::OTRGlobals() { prevAltAssets = CVarGetInteger(CVAR_ENHANCEMENT("AltAssets"), 0); context->GetResourceManager()->SetAltAssetsEnabled(prevAltAssets); - context->InitControlDeck({BTN_MODIFIER1, BTN_MODIFIER2}); + context->InitControlDeck({ + BTN_CUSTOM_MODIFIER1, + BTN_CUSTOM_MODIFIER2, + BTN_CUSTOM_OCARINA_NOTE_D4, + BTN_CUSTOM_OCARINA_NOTE_F4, + BTN_CUSTOM_OCARINA_NOTE_A4, + BTN_CUSTOM_OCARINA_NOTE_B4, + BTN_CUSTOM_OCARINA_NOTE_D5, + BTN_CUSTOM_OCARINA_DISABLE_SONGS, + BTN_CUSTOM_OCARINA_PITCH_UP, + BTN_CUSTOM_OCARINA_PITCH_DOWN, + }); context->GetControlDeck()->SetSinglePlayerMappingMode(true); context->InitCrashHandler(); diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index fefcaff70..b1607c6c3 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -12,8 +12,17 @@ #define GAME_PLATFORM_N64 0 #define GAME_PLATFORM_GC 1 -#define BTN_MODIFIER1 0x00040 -#define BTN_MODIFIER2 0x00080 +#define BTN_CUSTOM_MODIFIER1 0x0040 +#define BTN_CUSTOM_MODIFIER2 0x0080 + +#define BTN_CUSTOM_OCARINA_NOTE_D4 ((CONTROLLERBUTTONS_T)0x00010000) +#define BTN_CUSTOM_OCARINA_NOTE_F4 ((CONTROLLERBUTTONS_T)0x00020000) +#define BTN_CUSTOM_OCARINA_NOTE_A4 ((CONTROLLERBUTTONS_T)0x00040000) +#define BTN_CUSTOM_OCARINA_NOTE_B4 ((CONTROLLERBUTTONS_T)0x00080000) +#define BTN_CUSTOM_OCARINA_NOTE_D5 ((CONTROLLERBUTTONS_T)0x00100000) +#define BTN_CUSTOM_OCARINA_DISABLE_SONGS ((CONTROLLERBUTTONS_T)0x00200000) +#define BTN_CUSTOM_OCARINA_PITCH_UP ((CONTROLLERBUTTONS_T)0x00400000) +#define BTN_CUSTOM_OCARINA_PITCH_DOWN ((CONTROLLERBUTTONS_T)0x00800000) #ifdef __cplusplus #include diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 3e8201b9d..b75708209 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -766,6 +766,9 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Items")) { + UIWidgets::PaddedEnhancementCheckbox("Equip Items on D-pad", CVAR_ENHANCEMENT("DpadEquips"), true, false); + UIWidgets::Tooltip("Equip items and equipment on the D-pad\nIf used with \"D-pad on Pause Screen\", you " + "must hold C-Up to equip instead of navigate"); UIWidgets::PaddedEnhancementCheckbox("Instant Putaway", CVAR_ENHANCEMENT("InstantPutaway"), true, false); UIWidgets::Tooltip("Allow Link to put items away without having to wait around"); UIWidgets::PaddedEnhancementCheckbox("Instant Boomerang Recall", CVAR_ENHANCEMENT("FastBoomerang"), true, false); @@ -1139,6 +1142,10 @@ void DrawEnhancementsMenu() { UIWidgets::EnhancementCheckbox("Visual Stone of Agony", CVAR_ENHANCEMENT("VisualAgony")); UIWidgets::Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); + static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" }; + UIWidgets::PaddedText("Allow the cursor to be on any slot", true, false); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("PauseAnyCursor"), cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY); + UIWidgets::Tooltip("Allows the cursor on the pause menu to be over any slot. Sometimes required in rando to select certain items."); UIWidgets::PaddedEnhancementCheckbox("Assignable Tunics and Boots", CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), true, false); UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), true, false); @@ -1166,6 +1173,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Allows dogs to follow you anywhere you go, even if you leave the market"); UIWidgets::PaddedEnhancementCheckbox("Don't require input for Credits sequence", CVAR_ENHANCEMENT("NoInputForCredits"), true, false); UIWidgets::Tooltip("Removes the input requirement on textboxes after defeating Ganon, allowing Credits sequence to continue to progress"); + UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", CVAR_ENHANCEMENT("NaviOnL"), true, false); + UIWidgets::Tooltip("Speak to Navi with L but enter first-person camera with C-Up"); // Blue Fire Arrows bool forceEnableBlueFireArrows = IS_RANDO && diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 76fe3e6a7..7a64a2b54 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1252,20 +1252,14 @@ void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); s32 Audio_SetGanonDistVol(u8 targetVol); void Audio_PlayFanfare_Rando(GetItemEntry getItem); -// Right stick as virtual C buttons -#define RSTICK_UP 0x100000 -#define RSTICK_DOWN 0x200000 -#define RSTICK_LEFT 0x400000 -#define RSTICK_RIGHT 0x800000 - // Function originally not called, so repurposing for control mapping -void Audio_OcaUpdateBtnMap(bool customControls, bool dpad, bool rStick) { +void Audio_OcaUpdateBtnMap(bool customControls) { if (customControls) { - sOcarinaD5BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D5Button"), BTN_CUP); - sOcarinaB4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.B4Button"), BTN_CLEFT); - sOcarinaA4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.A4Button"), BTN_CRIGHT); - sOcarinaF4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.F4Button"), BTN_CDOWN); - sOcarinaD4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D4Button"), BTN_A); + sOcarinaD5BtnMap = BTN_CUSTOM_OCARINA_NOTE_D5; + sOcarinaB4BtnMap = BTN_CUSTOM_OCARINA_NOTE_B4; + sOcarinaA4BtnMap = BTN_CUSTOM_OCARINA_NOTE_A4; + sOcarinaF4BtnMap = BTN_CUSTOM_OCARINA_NOTE_F4; + sOcarinaD4BtnMap = BTN_CUSTOM_OCARINA_NOTE_D4; } else { sOcarinaD5BtnMap = BTN_CUP; sOcarinaB4BtnMap = BTN_CLEFT; @@ -1274,20 +1268,6 @@ void Audio_OcaUpdateBtnMap(bool customControls, bool dpad, bool rStick) { sOcarinaD4BtnMap = BTN_A; } - if (dpad) { - sOcarinaD5BtnMap |= BTN_DUP; - sOcarinaB4BtnMap |= BTN_DLEFT; - sOcarinaA4BtnMap |= BTN_DRIGHT; - sOcarinaF4BtnMap |= BTN_DDOWN; - } - - if (rStick) { - sOcarinaD5BtnMap |= RSTICK_UP; - sOcarinaB4BtnMap |= RSTICK_LEFT; - sOcarinaA4BtnMap |= RSTICK_RIGHT; - sOcarinaF4BtnMap |= RSTICK_DOWN; - } - sOcarinaAllowedBtnMask = ( sOcarinaD5BtnMap | sOcarinaB4BtnMap | @@ -1308,22 +1288,6 @@ void Audio_GetOcaInput(void) { sPrevOcarinaBtnPress = sp18; sCurOcaStick.x = input->rel.stick_x; sCurOcaStick.y = input->rel.stick_y; - - s8 rstick_x = input->cur.right_stick_x; - s8 rstick_y = input->cur.right_stick_y; - const s8 sensitivity = 64; - if (rstick_x > sensitivity) { - sCurOcarinaBtnPress |= RSTICK_RIGHT; - } - if (rstick_x < -sensitivity) { - sCurOcarinaBtnPress |= RSTICK_LEFT; - } - if (rstick_y > sensitivity) { - sCurOcarinaBtnPress |= RSTICK_UP; - } - if (rstick_y < -sensitivity) { - sCurOcarinaBtnPress |= RSTICK_DOWN; - } } f32 Audio_OcaAdjStick(s8 inp) { @@ -1543,7 +1507,7 @@ void func_800ED200(void) { u32 disableSongBtnMap; if (CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { - disableSongBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.DisableButton"), BTN_L); + disableSongBtnMap = BTN_CUSTOM_OCARINA_DISABLE_SONGS; } else { disableSongBtnMap = BTN_L; } @@ -1605,8 +1569,6 @@ void func_800ED200(void) { void func_800ED458(s32 arg0) { u32 phi_v1_2; bool customControls = CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0); - bool dpad = CVarGetInteger(CVAR_SETTING("OcarinaControl.Dpad"), 0); - bool rStick = CVarGetInteger(CVAR_SETTING("OcarinaControl.RStick"), 0); if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) { sOcarinaDropInputTimer--; @@ -1627,7 +1589,7 @@ void func_800ED458(s32 arg0) { D_8016BA18 &= phi_v1_2; } - Audio_OcaUpdateBtnMap(customControls, dpad, rStick); + Audio_OcaUpdateBtnMap(customControls); if (D_8016BA18 & sOcarinaD4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D4, true)) { osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaD4BtnMap); sCurOcarinaBtnVal = 2; @@ -1652,7 +1614,7 @@ void func_800ED458(s32 arg0) { u32 noteSharpBtnMap; if (customControls) { - noteSharpBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.SharpButton"), BTN_R); + noteSharpBtnMap = BTN_CUSTOM_OCARINA_PITCH_UP; } else { noteSharpBtnMap = BTN_R; } @@ -1663,7 +1625,7 @@ void func_800ED458(s32 arg0) { u32 noteFlatBtnMap; if (customControls) { - noteFlatBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.FlatButton"), BTN_Z); + noteFlatBtnMap = BTN_CUSTOM_OCARINA_PITCH_DOWN; } else { noteFlatBtnMap = BTN_Z; } diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 0a2b91406..29f7430eb 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3692,7 +3692,8 @@ void Interface_UpdateMagicBar(PlayState* play) { (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { bool hasLens = false; - for (int buttonIndex = 1; buttonIndex < (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; buttonIndex++) { + for (int buttonIndex = 1; buttonIndex < (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; + buttonIndex++) { if (gSaveContext.equips.buttonItems[buttonIndex] == ITEM_LENS) { hasLens = true; break; @@ -5727,7 +5728,7 @@ void Interface_Draw(PlayState* play) { Interface_DrawAmmoCount(play, 3, interfaceCtx->cRightAlpha); } - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { // DPad is only greyed-out when all 4 DPad directions are too uint16_t dpadAlpha = MAX(MAX(MAX(interfaceCtx->dpadUpAlpha, interfaceCtx->dpadDownAlpha), interfaceCtx->dpadLeftAlpha), diff --git a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 80457e5fb..13fc51959 100644 --- a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -258,7 +258,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y); sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z); u16 buttonsToCheck = BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true, diff --git a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c index 0c30fcf17..f0097b5bd 100644 --- a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c +++ b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c @@ -689,7 +689,7 @@ void EnPartner_Update(Actor* thisx, PlayState* play) { uint16_t partnerButtons[7] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT}; uint8_t buttonMax = 3; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonMax = ARRAY_COUNT(gSaveContext.equips.cButtonSlots); } diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index b179f2427..bddbfa656 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -2213,7 +2213,7 @@ s32 Player_ItemIsItemAction(s32 item1, s32 itemAction) { } s32 Player_GetItemOnButton(PlayState* play, s32 index) { - if (index >= ((CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) ? 8 : 4)) { + if (index >= ((CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) ? 8 : 4)) { return ITEM_NONE; } else if (play->bombchuBowlingStatus != 0) { return (play->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; @@ -2254,7 +2254,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON; bool hasOnDpad = false; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { for (int buttonIndex = 0; buttonIndex < 4; buttonIndex++) { hasOnDpad |= Player_ItemIsItemAction(DPAD_ITEM(buttonIndex), maskItemAction); } @@ -2269,7 +2269,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)) && !func_8008F128(this)) { if (this->itemAction >= PLAYER_IA_FISHING_POLE) { bool hasOnDpad = false; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { for (int buttonIndex = 0; buttonIndex < 4; buttonIndex++) { hasOnDpad |= Player_ItemIsInUse(this, DPAD_ITEM(buttonIndex)); } @@ -2660,7 +2660,7 @@ int func_80834E44(PlayState* play) { int func_80834E7C(PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } return (play->shootingGalleryStatus != 0) && @@ -5634,7 +5634,7 @@ s32 Player_ActionChange_4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; } - if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger(CVAR_SETTING("NaviOnL"), 0) ? BTN_L : BTN_CUP) && !sp28) { + if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0) ? BTN_L : BTN_CUP) && !sp28) { return 0; } @@ -5683,7 +5683,7 @@ s32 Player_ActionChange_0(Player* this, PlayState* play) { if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (this->unk_664->naviEnemyId != 0xFF))) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; - } else if ((this->naviTextId == 0 || CVarGetInteger(CVAR_SETTING("NaviOnL"), 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && + } else if ((this->naviTextId == 0 || CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); @@ -6540,9 +6540,9 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } else { - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER1)) { maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER2)) { maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } @@ -6921,7 +6921,7 @@ s32 func_8083EAF0(Player* this, Actor* actor) { s32 Player_ActionChange_9(Player* this, PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->heldActor != NULL) && @@ -8286,9 +8286,9 @@ void Player_Action_80842180(Player* this, PlayState* play) { sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } else { - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER1)) { sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER2)) { sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } @@ -9066,7 +9066,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && @@ -9846,7 +9846,7 @@ void Player_Action_80846260(Player* this, PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (this->av2.actionVar2 == 0) { @@ -11645,10 +11645,10 @@ void Player_Update(Actor* thisx, PlayState* play) { } if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0) && CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0)) { - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_MODIFIER1)) { + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_CUSTOM_MODIFIER1)) { gWalkSpeedToggle1 = !gWalkSpeedToggle1; } - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_MODIFIER2)) { + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_CUSTOM_MODIFIER2)) { gWalkSpeedToggle2 = !gWalkSpeedToggle2; } } @@ -12101,9 +12101,9 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { } // sControlInput is NULL to prevent inputs while surfacing after obtaining an underwater item so we want to ignore it for that case } else if (sControlInput != NULL) { - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER1)) { swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping1"), 1.0f); - } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { + } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_CUSTOM_MODIFIER2)) { swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping2"), 1.0f); } } @@ -12252,7 +12252,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->csAction != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 116ad0c3c..73c965176 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -214,8 +214,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { s16 cursorY; s16 oldCursorPoint; bool dpad = (CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - bool pauseAnyCursor = (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + bool pauseAnyCursor = (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); OPEN_DISPS(play->state.gfxCtx); @@ -552,7 +552,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 3214de005..6023282c7 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -423,8 +423,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { s16 oldCursorPoint; s16 moveCursorResult; bool dpad = (CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - bool pauseAnyCursor = pauseCtx->cursorSpecialPos == 0 && ((CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON)); + bool pauseAnyCursor = pauseCtx->cursorSpecialPos == 0 && ((CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON)); OPEN_DISPS(play->state.gfxCtx); @@ -677,7 +677,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { KaleidoScope_HandleItemCycles(play); u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT; - if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (CHECK_BTN_ANY(input->press.button, buttonsToCheck)) { @@ -811,7 +811,7 @@ void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, pauseCtx->equipTargetCBtn = 1; } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { pauseCtx->equipTargetCBtn = 2; - } else if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0)) { + } else if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0)) { if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { pauseCtx->equipTargetCBtn = 3; } else if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 8b88c4171..47bb73d5c 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2067,8 +2067,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { } } else { bool pauseAnyCursor = - (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); if (!pauseCtx->pageIndex && (!pauseAnyCursor || (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE))) { // pageIndex == PAUSE_ITEM pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = WREG(49 + gSaveContext.language); @@ -2205,8 +2205,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { void KaleidoScope_UpdateNamePanel(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; u16 sp2A; - bool pauseAnyCursor = (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + bool pauseAnyCursor = (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_ENHANCEMENT("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->cursorSpecialPos != 0))) { @@ -2874,7 +2874,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { for (phi_t3 = 1; phi_t3 < ARRAY_COUNT(gSaveContext.equips.buttonItems); phi_t3++, phi_t2 += 4) { if (gSaveContext.equips.cButtonSlots[phi_t3 - 1] != ITEM_NONE && - ((phi_t3 < 4) || CVarGetInteger(CVAR_SETTING("DpadEquips"), 0))) { + ((phi_t3 < 4) || CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0))) { phi_t4 = gSaveContext.equips.cButtonSlots[phi_t3 - 1] * 4; pauseCtx->itemVtx[phi_t2 + 0].v.ob[0] = pauseCtx->itemVtx[phi_t2 + 2].v.ob[0] =