mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-03-03 02:01:47 -05:00
Merge controller menus (#3860)
* Merge controller menus * Re-run Build * Update SohInputEditorWindow.h * Update soh/soh/Enhancements/controls/SohInputEditorWindow.cpp Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * pin switch devkit docker image --------- Co-authored-by: Garrett Cox <garrettjcox@gmail.com> Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com>
This commit is contained in:
parent
775d3e68b7
commit
961b2626ad
2
.github/workflows/generate-builds.yml
vendored
2
.github/workflows/generate-builds.yml
vendored
@ -180,7 +180,7 @@ jobs:
|
||||
needs: generate-soh-otr
|
||||
runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }}
|
||||
container:
|
||||
image: devkitpro/devkita64:latest
|
||||
image: devkitpro/devkita64:20240120
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
@ -1,361 +0,0 @@
|
||||
#include "GameControlEditor.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <variables.h>
|
||||
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
#include <ImGui/imgui.h>
|
||||
#include <ImGui/imgui_internal.h>
|
||||
#include <libultraship/bridge.h>
|
||||
#include <libultraship/libultra/controller.h>
|
||||
#include <Utils/StringHelper.h>
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
#include "../../UIWidgets.hpp"
|
||||
|
||||
namespace GameControlEditor {
|
||||
const ImGuiTableFlags PANEL_TABLE_FLAGS =
|
||||
ImGuiTableFlags_BordersH |
|
||||
ImGuiTableFlags_BordersV;
|
||||
const ImGuiTableColumnFlags PANEL_TABLE_COLUMN_FLAGS =
|
||||
ImGuiTableColumnFlags_IndentEnable |
|
||||
ImGuiTableColumnFlags_NoSort;
|
||||
|
||||
namespace TableHelper {
|
||||
void InitHeader(bool has_header = true) {
|
||||
if (has_header) {
|
||||
ImGui::TableHeadersRow();
|
||||
}
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding(); //This is to adjust Vertical pos of item in a cell to be normlized.
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
|
||||
void NextCol() {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
|
||||
void NextLine() {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawHelpIcon(const std::string& helptext) {
|
||||
// place the ? button to the most of the right side of the cell it is using.
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 22);
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - 15);
|
||||
ImGui::SmallButton("?");
|
||||
UIWidgets::Tooltip(helptext.c_str());
|
||||
}
|
||||
|
||||
typedef uint32_t N64ButtonMask;
|
||||
|
||||
// Used together for an incomplete linked hash map implementation in order to
|
||||
// map button masks to their names and original mapping on N64
|
||||
static std::list<std::pair<N64ButtonMask, const char*>> buttons;
|
||||
static std::unordered_map<N64ButtonMask, decltype(buttons)::iterator> buttonNames;
|
||||
|
||||
void addButtonName(N64ButtonMask mask, const char* name) {
|
||||
buttons.push_back(std::make_pair(mask, name));
|
||||
buttonNames[mask] = std::prev(buttons.end());
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char* label;
|
||||
const char* cVarName;
|
||||
N64ButtonMask defaultBtn;
|
||||
} CustomButtonMap;
|
||||
|
||||
// Ocarina button maps
|
||||
static CustomButtonMap ocarinaD5 = {"D5", "gOcarinaD5BtnMap", BTN_CUP};
|
||||
static CustomButtonMap ocarinaB4 = {"B4", "gOcarinaB4BtnMap", BTN_CLEFT};
|
||||
static CustomButtonMap ocarinaA4 = {"A4", "gOcarinaA4BtnMap", BTN_CRIGHT};
|
||||
static CustomButtonMap ocarinaF4 = {"F4", "gOcarinaF4BtnMap", BTN_CDOWN};
|
||||
static CustomButtonMap ocarinaD4 = {"D4", "gOcarinaD4BtnMap", BTN_A};
|
||||
static CustomButtonMap ocarinaSongDisable = {"Disable songs", "gOcarinaDisableBtnMap", BTN_L};
|
||||
static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R};
|
||||
static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", BTN_Z};
|
||||
|
||||
void GameControlEditorWindow::InitElement() {
|
||||
addButtonName(BTN_A, "A");
|
||||
addButtonName(BTN_B, "B");
|
||||
addButtonName(BTN_CUP, "C Up");
|
||||
addButtonName(BTN_CDOWN, "C Down");
|
||||
addButtonName(BTN_CLEFT, "C Left");
|
||||
addButtonName(BTN_CRIGHT, "C Right");
|
||||
addButtonName(BTN_L, "L");
|
||||
addButtonName(BTN_Z, "Z");
|
||||
addButtonName(BTN_R, "R");
|
||||
addButtonName(BTN_START, "Start");
|
||||
addButtonName(BTN_DUP, "D-pad up");
|
||||
addButtonName(BTN_DDOWN, "D-pad down");
|
||||
addButtonName(BTN_DLEFT, "D-pad left");
|
||||
addButtonName(BTN_DRIGHT, "D-pad right");
|
||||
addButtonName(0, "None");
|
||||
}
|
||||
|
||||
// Draw a button mapping setting consisting of a padded label and button dropdown.
|
||||
// excludedButtons indicates which buttons are unavailable to choose from.
|
||||
void DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons) {
|
||||
N64ButtonMask currentButton = CVarGetInteger(mapping.cVarName, mapping.defaultBtn);
|
||||
|
||||
const char* preview;
|
||||
if (buttonNames.contains(currentButton)) {
|
||||
preview = buttonNames[currentButton]->second;
|
||||
} else {
|
||||
preview = "Unknown";
|
||||
}
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
ImVec2 cursorPos = ImGui::GetCursorPos();
|
||||
ImVec2 textSize = ImGui::CalcTextSize(mapping.label);
|
||||
ImGui::SetCursorPosY(cursorPos.y + textSize.y / 4);
|
||||
ImGui::SetCursorPosX(cursorPos.x + abs(textSize.x - labelWidth));
|
||||
ImGui::Text("%s", mapping.label);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(cursorPos.y);
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||
if (ImGui::BeginCombo(StringHelper::Sprintf("##%s", mapping.cVarName).c_str(), preview)) {
|
||||
for (auto i = buttons.begin(); i != buttons.end(); i++) {
|
||||
if ((i->first & excludedButtons) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
||||
CVarSetInteger(mapping.cVarName, i->first);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
UIWidgets::Spacer(0);
|
||||
}
|
||||
|
||||
void DrawOcarinaControlPanel(GameControlEditorWindow* window) {
|
||||
if (!ImGui::CollapsingHeader("Ocarina Controls")) {
|
||||
return;
|
||||
}
|
||||
|
||||
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));
|
||||
UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
|
||||
|
||||
if (CVarGetInteger("gCustomOcarinaControls", 0) == 1) {
|
||||
if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) {
|
||||
float labelWidth;
|
||||
N64ButtonMask disableMask = BTN_B;
|
||||
if (CVarGetInteger("gDpadOcarina", 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);
|
||||
|
||||
window->BeginGroupPanelPublic("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();
|
||||
window->EndGroupPanelPublic(0);
|
||||
|
||||
TableHelper::NextCol();
|
||||
|
||||
window->BeginGroupPanelPublic("Modifiers", ImGui::GetContentRegionAvail());
|
||||
labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10;
|
||||
DrawMapping(ocarinaSongDisable, labelWidth, disableMask);
|
||||
DrawMapping(ocarinaSharp, labelWidth, disableMask);
|
||||
DrawMapping(ocarinaFlat, labelWidth, disableMask);
|
||||
window->EndGroupPanelPublic(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);
|
||||
}
|
||||
|
||||
window->BeginGroupPanelPublic("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", "gDpadOcarina");
|
||||
TableHelper::NextCol();
|
||||
UIWidgets::EnhancementCheckbox("Play with camera stick", "gRStickOcarina");
|
||||
UIWidgets::Spacer(0);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
window->EndGroupPanelPublic(0);
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
void DrawCameraControlPanel(GameControlEditorWindow* window) {
|
||||
if (!ImGui::CollapsingHeader("Camera Controls")) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
window->BeginGroupPanelPublic("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
|
||||
DrawHelpIcon("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
if (CVarGetInteger("gRightStickAiming", 0)) {
|
||||
UIWidgets::PaddedEnhancementCheckbox("Allow moving while in first person mode", "gMoveWhileFirstPerson");
|
||||
DrawHelpIcon("Changes the left stick to move the player while in first person mode");
|
||||
}
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
|
||||
DrawHelpIcon("Inverts the Camera X Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", "gInvertAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
DrawHelpIcon("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", "gInvertShieldAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
DrawHelpIcon("Inverts the Shield Aiming Y Axis");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", "gInvertShieldAimingXAxis");
|
||||
DrawHelpIcon("Inverts the Shield Aiming X Axis");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Z-Weapon Aiming Y Axis", "gInvertZAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
DrawHelpIcon("Inverts the Camera Y Axis in:\n-Z-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
|
||||
DrawHelpIcon("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
|
||||
if (UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false)) {
|
||||
if (!CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
|
||||
CVarClear("gFirstPersonCameraSensitivityX");
|
||||
CVarClear("gFirstPersonCameraSensitivityY");
|
||||
}
|
||||
}
|
||||
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
|
||||
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %.0f %%", "##FirstPersonSensitivity Horizontal",
|
||||
"gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true);
|
||||
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %.0f %%", "##FirstPersonSensitivity Vertical",
|
||||
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
|
||||
}
|
||||
UIWidgets::Spacer(0);
|
||||
window->EndGroupPanelPublic(0);
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
window->BeginGroupPanelPublic("Third-Person Camera", ImGui::GetContentRegionAvail());
|
||||
|
||||
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera");
|
||||
DrawHelpIcon("Enables free camera control\nNote: You must remap C buttons off of the right stick in the "
|
||||
"controller config menu, and map the camera stick to the right stick.");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
|
||||
DrawHelpIcon("Inverts the Camera X Axis in:\n-Free camera");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
DrawHelpIcon("Inverts the Camera Y Axis in:\n-Free camera");
|
||||
UIWidgets::Spacer(0);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %.0f %%", "##ThirdPersonSensitivity Horizontal",
|
||||
"gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %.0f %%", "##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);
|
||||
window->EndGroupPanelPublic(0);
|
||||
}
|
||||
|
||||
void DrawDpadControlPanel(GameControlEditorWindow* window) {
|
||||
if (!ImGui::CollapsingHeader("D-Pad Controls")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImVec2 cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
window->BeginGroupPanelPublic("D-Pad Options", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause");
|
||||
DrawHelpIcon("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 gDpadHoldChange to 0");
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad Support in Text Boxes", "gDpadText");
|
||||
DrawHelpIcon("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 gDpadHoldChange to 0");
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
|
||||
DrawHelpIcon("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");
|
||||
window->EndGroupPanelPublic(0);
|
||||
}
|
||||
|
||||
void DrawMiscControlPanel(GameControlEditorWindow* window) {
|
||||
if (!ImGui::CollapsingHeader("Miscellaneous Controls")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImVec2 cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
window->BeginGroupPanelPublic("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_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);
|
||||
ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0));
|
||||
UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", "gEnableWalkModify", true, false);
|
||||
DrawHelpIcon("Hold the assigned button to change the maximum walking or swimming speed\nTo change the assigned button, go into the Ports tabs above");
|
||||
if (CVarGetInteger("gEnableWalkModify", 0)) {
|
||||
UIWidgets::Spacer(5);
|
||||
window->BeginGroupPanelPublic("Speed Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
||||
window->BeginGroupPanelPublic("Walk Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", "gWalkModifierDoesntChangeJump", true, false);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
window->EndGroupPanelPublic(0);
|
||||
window->BeginGroupPanelPublic("Swim Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", "gSwimModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", "gSwimModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
window->EndGroupPanelPublic(0);
|
||||
window->EndGroupPanelPublic(0);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
UIWidgets::Spacer(0);
|
||||
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
|
||||
DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up");
|
||||
window->EndGroupPanelPublic(0);
|
||||
}
|
||||
|
||||
|
||||
void GameControlEditorWindow::DrawElement() {
|
||||
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
|
||||
if (ImGui::Begin("Game Controls Configuration", &mIsVisible)) {
|
||||
DrawOcarinaControlPanel(this);
|
||||
DrawCameraControlPanel(this);
|
||||
DrawDpadControlPanel(this);
|
||||
DrawMiscControlPanel(this);
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void GameControlEditorWindow::BeginGroupPanelPublic(const char* name, const ImVec2& size) {
|
||||
BeginGroupPanel(name, size);
|
||||
}
|
||||
|
||||
void GameControlEditorWindow::EndGroupPanelPublic(float minHeight) {
|
||||
EndGroupPanel(minHeight);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <libultraship/libultraship.h>
|
||||
|
||||
namespace GameControlEditor {
|
||||
class GameControlEditorWindow : public LUS::GuiWindow {
|
||||
public:
|
||||
using LUS::GuiWindow::GuiWindow;
|
||||
|
||||
void BeginGroupPanelPublic(const char* name, const ImVec2& size);
|
||||
void EndGroupPanelPublic(float minHeight);
|
||||
|
||||
void InitElement() override;
|
||||
void DrawElement() override;
|
||||
void UpdateElement() override {};
|
||||
};
|
||||
|
||||
static int CurrentPort = 0;
|
||||
static int BtnReading = -1;
|
||||
|
||||
} // namespace GameControlEditor
|
@ -22,6 +22,22 @@ 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 };
|
||||
|
||||
addButtonName(BTN_A, "A");
|
||||
addButtonName(BTN_B, "B");
|
||||
addButtonName(BTN_CUP, "C Up");
|
||||
addButtonName(BTN_CDOWN, "C Down");
|
||||
addButtonName(BTN_CLEFT, "C Left");
|
||||
addButtonName(BTN_CRIGHT, "C Right");
|
||||
addButtonName(BTN_L, "L");
|
||||
addButtonName(BTN_Z, "Z");
|
||||
addButtonName(BTN_R, "R");
|
||||
addButtonName(BTN_START, "Start");
|
||||
addButtonName(BTN_DUP, "D-pad up");
|
||||
addButtonName(BTN_DDOWN, "D-pad down");
|
||||
addButtonName(BTN_DLEFT, "D-pad left");
|
||||
addButtonName(BTN_DRIGHT, "D-pad right");
|
||||
addButtonName(0, "None");
|
||||
}
|
||||
|
||||
#define INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID 95237929
|
||||
@ -1017,14 +1033,6 @@ void SohInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) {
|
||||
}
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawHelpIcon(const std::string& helptext) {
|
||||
// place the ? button to the most of the right side of the cell it is using.
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() - SCALE_IMGUI_SIZE(22));
|
||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + ImGui::GetContentRegionAvail().x - SCALE_IMGUI_SIZE(15));
|
||||
ImGui::SmallButton("?");
|
||||
UIWidgets::Tooltip(helptext.c_str());
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawLEDSection(uint8_t port) {
|
||||
for (auto [id, mapping] :
|
||||
LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->GetAllLEDMappings()) {
|
||||
@ -1063,11 +1071,11 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) {
|
||||
};
|
||||
UIWidgets::PaddedText("Source");
|
||||
UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL);
|
||||
DrawHelpIcon("Health\n- Red when health critical (13-20% depending on max health)\n- Yellow when "
|
||||
"health < 40%. Green otherwise.\n\n"
|
||||
"Tunics: colors will mirror currently equipped tunic, whether original or the current "
|
||||
"values in Cosmetics Editor.\n\n"
|
||||
"Custom: single, solid color");
|
||||
UIWidgets::Tooltip("Health\n- Red when health critical (13-20% depending on max health)\n- Yellow when "
|
||||
"health < 40%. Green otherwise.\n\n"
|
||||
"Tunics: colors will mirror currently equipped tunic, whether original or the current "
|
||||
"values in Cosmetics Editor.\n\n"
|
||||
"Custom: single, solid color");
|
||||
if (CVarGetInteger("gLedColorSource", 1) == LED_SOURCE_CUSTOM) {
|
||||
UIWidgets::Spacer(3);
|
||||
auto port1Color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 });
|
||||
@ -1087,12 +1095,12 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) {
|
||||
}
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Brightness: %.1f %%", "##LED_Brightness", "gLedBrightness", 0.0f,
|
||||
1.0f, "", 1.0f, true, true);
|
||||
DrawHelpIcon("Sets the brightness of controller LEDs. 0% brightness = LEDs off.");
|
||||
UIWidgets::Tooltip("Sets the brightness of controller LEDs. 0% brightness = LEDs off.");
|
||||
UIWidgets::PaddedEnhancementCheckbox(
|
||||
"Critical Health Override", "gLedCriticalOverride", true, true,
|
||||
CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH,
|
||||
"Override redundant for health source.", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
DrawHelpIcon("Shows red color when health is critical, otherwise displays according to color source.");
|
||||
UIWidgets::Tooltip("Shows red color when health is critical, otherwise displays according to color source.");
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
@ -1430,6 +1438,273 @@ void SohInputEditorWindow::DrawLEDDeviceIcons(uint8_t portIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
const ImGuiTableFlags PANEL_TABLE_FLAGS =
|
||||
ImGuiTableFlags_BordersH |
|
||||
ImGuiTableFlags_BordersV;
|
||||
const ImGuiTableColumnFlags PANEL_TABLE_COLUMN_FLAGS =
|
||||
ImGuiTableColumnFlags_IndentEnable |
|
||||
ImGuiTableColumnFlags_NoSort;
|
||||
|
||||
namespace TableHelper {
|
||||
void InitHeader(bool has_header = true) {
|
||||
if (has_header) {
|
||||
ImGui::TableHeadersRow();
|
||||
}
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding(); //This is to adjust Vertical pos of item in a cell to be normlized.
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
|
||||
void NextCol() {
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
|
||||
void NextLine() {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
}
|
||||
}
|
||||
|
||||
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", "gOcarinaD5BtnMap", BTN_CUP};
|
||||
static CustomButtonMap ocarinaB4 = {"B4", "gOcarinaB4BtnMap", BTN_CLEFT};
|
||||
static CustomButtonMap ocarinaA4 = {"A4", "gOcarinaA4BtnMap", BTN_CRIGHT};
|
||||
static CustomButtonMap ocarinaF4 = {"F4", "gOcarinaF4BtnMap", BTN_CDOWN};
|
||||
static CustomButtonMap ocarinaD4 = {"D4", "gOcarinaD4BtnMap", BTN_A};
|
||||
static CustomButtonMap ocarinaSongDisable = {"Disable songs", "gOcarinaDisableBtnMap", BTN_L};
|
||||
static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R};
|
||||
static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", 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) {
|
||||
N64ButtonMask currentButton = CVarGetInteger(mapping.cVarName, mapping.defaultBtn);
|
||||
|
||||
const char* preview;
|
||||
if (buttonNames.contains(currentButton)) {
|
||||
preview = buttonNames[currentButton]->second;
|
||||
} else {
|
||||
preview = "Unknown";
|
||||
}
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
ImVec2 cursorPos = ImGui::GetCursorPos();
|
||||
ImVec2 textSize = ImGui::CalcTextSize(mapping.label);
|
||||
ImGui::SetCursorPosY(cursorPos.y + textSize.y / 4);
|
||||
ImGui::SetCursorPosX(cursorPos.x + abs(textSize.x - labelWidth));
|
||||
ImGui::Text("%s", mapping.label);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetCursorPosY(cursorPos.y);
|
||||
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||
if (ImGui::BeginCombo(StringHelper::Sprintf("##%s", mapping.cVarName).c_str(), preview)) {
|
||||
for (auto i = buttons.begin(); i != buttons.end(); i++) {
|
||||
if ((i->first & excludedButtons) != 0) {
|
||||
continue;
|
||||
}
|
||||
if (ImGui::Selectable(i->second, i->first == currentButton)) {
|
||||
CVarSetInteger(mapping.cVarName, i->first);
|
||||
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
UIWidgets::Spacer(0);
|
||||
}
|
||||
|
||||
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));
|
||||
UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls");
|
||||
|
||||
if (CVarGetInteger("gCustomOcarinaControls", 0) == 1) {
|
||||
if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) {
|
||||
float labelWidth;
|
||||
N64ButtonMask disableMask = BTN_B;
|
||||
if (CVarGetInteger("gDpadOcarina", 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);
|
||||
|
||||
LUS::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();
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
|
||||
TableHelper::NextCol();
|
||||
|
||||
LUS::GuiWindow::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail());
|
||||
labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10;
|
||||
DrawMapping(ocarinaSongDisable, labelWidth, disableMask);
|
||||
DrawMapping(ocarinaSharp, labelWidth, disableMask);
|
||||
DrawMapping(ocarinaFlat, labelWidth, disableMask);
|
||||
LUS::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);
|
||||
}
|
||||
|
||||
LUS::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", "gDpadOcarina");
|
||||
TableHelper::NextCol();
|
||||
UIWidgets::EnhancementCheckbox("Play with camera stick", "gRStickOcarina");
|
||||
UIWidgets::Spacer(0);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawCameraControlPanel() {
|
||||
ImVec2 cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
LUS::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
|
||||
UIWidgets::Tooltip("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
if (CVarGetInteger("gRightStickAiming", 0)) {
|
||||
UIWidgets::PaddedEnhancementCheckbox("Allow moving while in first person mode", "gMoveWhileFirstPerson");
|
||||
UIWidgets::Tooltip("Changes the left stick to move the player while in first person mode");
|
||||
}
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis");
|
||||
UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", "gInvertAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", "gInvertShieldAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
UIWidgets::Tooltip("Inverts the Shield Aiming Y Axis");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", "gInvertShieldAimingXAxis");
|
||||
UIWidgets::Tooltip("Inverts the Shield Aiming X Axis");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Z-Weapon Aiming Y Axis", "gInvertZAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Z-Weapon Aiming");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson");
|
||||
UIWidgets::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
|
||||
if (UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false)) {
|
||||
if (!CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
|
||||
CVarClear("gFirstPersonCameraSensitivityX");
|
||||
CVarClear("gFirstPersonCameraSensitivityY");
|
||||
}
|
||||
}
|
||||
if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) {
|
||||
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %.0f %%", "##FirstPersonSensitivity Horizontal",
|
||||
"gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true);
|
||||
UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %.0f %%", "##FirstPersonSensitivity Vertical",
|
||||
"gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true);
|
||||
}
|
||||
UIWidgets::Spacer(0);
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
|
||||
UIWidgets::Spacer(0);
|
||||
cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
LUS::GuiWindow::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail());
|
||||
|
||||
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera");
|
||||
UIWidgets::Tooltip("Enables free camera control\nNote: You must remap C buttons off of the right stick in the "
|
||||
"controller config menu, and map the camera stick to the right stick.");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
|
||||
UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-Free camera");
|
||||
UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true);
|
||||
UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Free camera");
|
||||
UIWidgets::Spacer(0);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %.0f %%", "##ThirdPersonSensitivity Horizontal",
|
||||
"gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %.0f %%", "##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);
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawDpadControlPanel() {
|
||||
ImVec2 cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
LUS::GuiWindow::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause");
|
||||
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 gDpadHoldChange to 0");
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad Support in Text Boxes", "gDpadText");
|
||||
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 gDpadHoldChange to 0");
|
||||
UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips");
|
||||
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");
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawMiscControlPanel() {
|
||||
ImVec2 cursor = ImGui::GetCursorPos();
|
||||
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||
LUS::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("gPauseAnyCursor", 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("gDisableChangingSettings", 0));
|
||||
UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", "gEnableWalkModify", true, false);
|
||||
UIWidgets::Tooltip("Hold the assigned button to change the maximum walking or swimming speed");
|
||||
if (CVarGetInteger("gEnableWalkModify", 0)) {
|
||||
UIWidgets::Spacer(5);
|
||||
LUS::GuiWindow::BeginGroupPanel("Speed Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false);
|
||||
LUS::GuiWindow::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", "gWalkModifierDoesntChangeJump", true, false);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
LUS::GuiWindow::BeginGroupPanel("Swim Modifier", ImGui::GetContentRegionAvail());
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", "gSwimModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", "gSwimModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true);
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
UIWidgets::Spacer(0);
|
||||
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
|
||||
UIWidgets::Tooltip("Speak to Navi with L but enter first-person camera with C-Up");
|
||||
LUS::GuiWindow::EndGroupPanel(0);
|
||||
}
|
||||
|
||||
void SohInputEditorWindow::DrawLinkTab() {
|
||||
uint8_t portIndex = 0;
|
||||
if (ImGui::BeginTabItem(StringHelper::Sprintf("Link (P1)###port%d", portIndex).c_str())) {
|
||||
@ -1516,6 +1791,46 @@ void SohInputEditorWindow::DrawLinkTab() {
|
||||
DrawButtonDeviceIcons(portIndex, mModifierButtonsBitmasks);
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Ocarina Controls")) {
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
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));
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("Camera Controls")) {
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
DrawCameraControlPanel();
|
||||
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));
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("D-Pad Controls")) {
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::PopStyleColor();
|
||||
DrawDpadControlPanel();
|
||||
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));
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -10,6 +10,15 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
typedef uint32_t N64ButtonMask;
|
||||
|
||||
typedef struct {
|
||||
const char* label;
|
||||
const char* cVarName;
|
||||
N64ButtonMask defaultBtn;
|
||||
} CustomButtonMap;
|
||||
|
||||
class SohInputEditorWindow : public LUS::GuiWindow {
|
||||
public:
|
||||
@ -51,6 +60,17 @@ class SohInputEditorWindow : public LUS::GuiWindow {
|
||||
void DrawRemoveGyroMappingButton(uint8_t port, std::string id);
|
||||
void DrawAddGyroMappingButton(uint8_t port);
|
||||
|
||||
// Used together for an incomplete linked hash map implementation in order to
|
||||
// map button masks to their names and original mapping on N64
|
||||
std::list<std::pair<N64ButtonMask, const char*>> buttons;
|
||||
std::unordered_map<N64ButtonMask, decltype(buttons)::iterator> buttonNames;
|
||||
void addButtonName(N64ButtonMask mask, const char* name);
|
||||
void DrawMapping(CustomButtonMap& mapping, float labelWidth, N64ButtonMask excludedButtons);
|
||||
void DrawOcarinaControlPanel();
|
||||
void DrawCameraControlPanel();
|
||||
void DrawDpadControlPanel();
|
||||
void DrawMiscControlPanel();
|
||||
|
||||
int32_t mGameInputBlockTimer;
|
||||
int32_t mMappingInputBlockTimer;
|
||||
int32_t mRumbleTimer;
|
||||
@ -84,6 +104,4 @@ class SohInputEditorWindow : public LUS::GuiWindow {
|
||||
bool mInputEditorPopupOpen;
|
||||
void DrawSetDefaultsButton(uint8_t portIndex);
|
||||
void DrawClearAllButton(uint8_t portIndex);
|
||||
|
||||
void DrawHelpIcon(const std::string& helptext);
|
||||
};
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <dr_libs/wav.h>
|
||||
#include <AudioPlayer.h>
|
||||
#include "Enhancements/speechsynthesizer/SpeechSynthesizer.h"
|
||||
#include "Enhancements/controls/GameControlEditor.h"
|
||||
#include "Enhancements/controls/SohInputEditorWindow.h"
|
||||
#include "Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
#include "Enhancements/audio/AudioCollection.h"
|
||||
|
@ -116,7 +116,6 @@ namespace SohGui {
|
||||
std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
|
||||
|
||||
std::shared_ptr<AudioEditor> mAudioEditorWindow;
|
||||
std::shared_ptr<GameControlEditor::GameControlEditorWindow> mGameControlEditorWindow;
|
||||
std::shared_ptr<CosmeticsEditorWindow> mCosmeticsEditorWindow;
|
||||
std::shared_ptr<ActorViewerWindow> mActorViewerWindow;
|
||||
std::shared_ptr<ColViewerWindow> mColViewerWindow;
|
||||
@ -164,8 +163,6 @@ namespace SohGui {
|
||||
|
||||
mAudioEditorWindow = std::make_shared<AudioEditor>("gAudioEditor.WindowOpen", "Audio Editor");
|
||||
gui->AddGuiWindow(mAudioEditorWindow);
|
||||
mGameControlEditorWindow = std::make_shared<GameControlEditor::GameControlEditorWindow>("gGameControlEditorEnabled", "Game Control Editor");
|
||||
gui->AddGuiWindow(mGameControlEditorWindow);
|
||||
mCosmeticsEditorWindow = std::make_shared<CosmeticsEditorWindow>("gCosmeticsEditorEnabled", "Cosmetics Editor");
|
||||
gui->AddGuiWindow(mCosmeticsEditorWindow);
|
||||
mActorViewerWindow = std::make_shared<ActorViewerWindow>("gActorViewerEnabled", "Actor Viewer");
|
||||
@ -211,7 +208,6 @@ namespace SohGui {
|
||||
mColViewerWindow = nullptr;
|
||||
mActorViewerWindow = nullptr;
|
||||
mCosmeticsEditorWindow = nullptr;
|
||||
mGameControlEditorWindow = nullptr;
|
||||
mAudioEditorWindow = nullptr;
|
||||
mInputEditorWindow = nullptr;
|
||||
mStatsWindow = nullptr;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include "SohMenuBar.h"
|
||||
#include "Enhancements/audio/AudioEditor.h"
|
||||
#include "Enhancements/controls/GameControlEditor.h"
|
||||
#include "Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
#include "Enhancements/debugger/actorViewer.h"
|
||||
#include "Enhancements/debugger/colViewer.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
|
||||
#include "Enhancements/audio/AudioEditor.h"
|
||||
#include "Enhancements/controls/GameControlEditor.h"
|
||||
#include "Enhancements/cosmetics/CosmeticsEditor.h"
|
||||
#include "Enhancements/debugger/actorViewer.h"
|
||||
#include "Enhancements/debugger/colViewer.h"
|
||||
@ -180,7 +179,6 @@ void DrawShipMenu() {
|
||||
}
|
||||
|
||||
extern std::shared_ptr<LUS::GuiWindow> mInputEditorWindow;
|
||||
extern std::shared_ptr<GameControlEditor::GameControlEditorWindow> mGameControlEditorWindow;
|
||||
extern std::shared_ptr<AdvancedResolutionSettings::AdvancedResolutionSettingsWindow> mAdvancedResolutionSettingsWindow;
|
||||
|
||||
void DrawSettingsMenu() {
|
||||
@ -241,11 +239,6 @@ void DrawSettingsMenu() {
|
||||
mInputEditorWindow->ToggleVisibility();
|
||||
}
|
||||
}
|
||||
if (mGameControlEditorWindow) {
|
||||
if (ImGui::Button(GetWindowButtonText("Additional Controller Options", CVarGetInteger("gGameControlEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) {
|
||||
mGameControlEditorWindow->ToggleVisibility();
|
||||
}
|
||||
}
|
||||
UIWidgets::PaddedSeparator();
|
||||
ImGui::PopStyleColor(1);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user