Skip to content

Commit

Permalink
Tentatively add Enforced Unmodded analog option
Browse files Browse the repository at this point in the history
Its main flaw is that if your aim is slighty off when aiming, say, directly forwards, then you will only be going 99% forwards, limiting your speed. It is hidden in the menu for the moment
  • Loading branch information
thearst3rd committed Mar 3, 2024
1 parent 4a015fb commit e6507a5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
16 changes: 16 additions & 0 deletions engine/source/platformWin32/winDirectInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,22 @@ void DInputManager::processXInput(void)
mXInputStateNew[i].state.Gamepad.sThumbLX = 32767 * lx;
mXInputStateNew[i].state.Gamepad.sThumbLY = 32767 * ly;
break;
case 3:
// Enforce Unmodded
lx = (mXInputStateNew[i].state.Gamepad.sThumbLX / 32767.0f);
ly = (mXInputStateNew[i].state.Gamepad.sThumbLY / 32767.0f);

hypot = mSqrt(lx * lx + ly * ly);
if (hypot > 1.0f)
{
ang = mAtan(ly, lx);
lx = mCos(ang);
ly = mSin(ang);

mXInputStateNew[i].state.Gamepad.sThumbLX = 32767 * lx;
mXInputStateNew[i].state.Gamepad.sThumbLY = 32767 * ly;
}
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion game/common/local/englishStrings.inf
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ $Text::InvY = "Camera Y-Axis";
$Text::MouseSensitivity = "Mouse Sensitivity";
$Text::InvOnOff = "Normal\tInverted";
$Text::AnalogRange = "Analog Stick Range";
$Text::AnalogRangeValues = "Normal\tModded\t8-way";
$Text::AnalogRangeValues = "Normal\tModded\t8-way\tEnforce Unmodded";
$Text::CenterCam = "Auto Center Camera";
$Text::OptionOffOn = "Off\tOn";
$Text::VideoOptions = "Video Options";
Expand Down
9 changes: 9 additions & 0 deletions game/marble/client/ui/inputAndSoundOptionsGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ function inputAndSoundOptionsList::onOptionChange(%this, %increase)
$pref::Input::MouseSensitivity = mClamp((%val+2) * 0.05, 0.1, 1) * 0.01;
case 5:
// analog range
// Enforce Unmodded is flawed atm, so skip over that
if (%val == 3)
{
if (%increase)
%val = 0;
else
%val = 2;
%this.setOptionIndex(5, %val);
}
$pref::Input::AnalogRange = %val;
case 6:
// auto center camera
Expand Down

0 comments on commit e6507a5

Please sign in to comment.