Skip to content

Commit

Permalink
InputManager: add sensitivity bypass & deadzone options
Browse files Browse the repository at this point in the history
  • Loading branch information
emoose committed Jan 10, 2025
1 parent 9478197 commit 924c206
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/input_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ class InputManager
uint32_t switch_previous;
uint32_t switch_overlay;

// user settings
bool BypassGameSensitivity = false;

public:
~InputManager()
{
Expand Down Expand Up @@ -510,7 +513,7 @@ class InputManager
continue;

volumes[i] = vol;
if (i == 0)
if (i == 0 && !BypassGameSensitivity)
{
int cur = ceil(volumes[i].currentValue * 127.0f);
int prev = ceil(volumes[i].previousValue * 127.0f);
Expand Down Expand Up @@ -843,6 +846,8 @@ class InputManager
ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_AlwaysAutoResize))
{
ImGui::Text("Note: settings here currently aren't saved, fix soon.");

if (ImGui::BeginTable("Controllers", 2, ImGuiTableFlags_Borders))
{
ImGui::TableSetupColumn("Detected Controllers");
Expand Down Expand Up @@ -1075,6 +1080,14 @@ class InputManager
}
}

int deadzonePercent = Settings::SteeringDeadZone * 100.f;
if (ImGui::SliderInt("Steering Deadzone", &deadzonePercent, 5, 20, "%d%%"))
Settings::SteeringDeadZone = float(deadzonePercent) / 100.f;

ImGui::Checkbox("Bypass Sensitivity", &BypassGameSensitivity);
if(ImGui::IsItemHovered())
ImGui::SetTooltip("Passes steering input to the game directly, allows for more sensitive controls");

if (ImGui::Button("Return to game"))
dialogOpen = false;
ImGui::SameLine();
Expand All @@ -1088,6 +1101,8 @@ class InputManager
}
else
{
Settings::SteeringDeadZone = 0.2f;
BypassGameSensitivity = false;
setupDefaultBindings();
if (auto* controller = primary_gamepad())
setupGamepad(controller);
Expand Down
2 changes: 2 additions & 0 deletions src/overlay/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ class GlobalsWindow : public OverlayWindow
if (ImGui::Button("Open Draw Distance Debugger"))
Game::DrawDistanceDebugEnabled = true;

#ifdef _DEBUG
if (ImGui::Button("Open Binding Dialog"))
Overlay::IsBindingDialogActive = true;
#endif

ImGui::Separator();
ImGui::Text("Gameplay");
Expand Down

0 comments on commit 924c206

Please sign in to comment.