ControllerEmu: Remove support for the "Square Stick" option
It was only used for really old joypads which we really don't want to support. If users have these joypads, they should look into using something at the OS level, as games shouldn't need to have this transformation; it should be done by the OS and driver.
This commit is contained in:
parent
07c4925059
commit
f2d4f10fc9
|
@ -140,8 +140,6 @@ ControllerEmu::AnalogStick::AnalogStick(const char* const _name) : ControlGroup(
|
|||
|
||||
settings.emplace_back(new Setting(_trans("Radius"), 0.7f, 0, 100));
|
||||
settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
|
||||
settings.emplace_back(new Setting(_trans("Square Stick"), 0));
|
||||
|
||||
}
|
||||
|
||||
ControllerEmu::Buttons::Buttons(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_BUTTONS)
|
||||
|
|
|
@ -37,7 +37,6 @@ enum
|
|||
{
|
||||
SETTING_RADIUS,
|
||||
SETTING_DEADZONE,
|
||||
SETTING_SQUARE,
|
||||
};
|
||||
|
||||
const char* const named_directions[] =
|
||||
|
@ -132,7 +131,6 @@ public:
|
|||
|
||||
ControlState radius = settings[SETTING_RADIUS]->value;
|
||||
ControlState deadzone = settings[SETTING_DEADZONE]->value;
|
||||
ControlState square = settings[SETTING_SQUARE]->value;
|
||||
ControlState m = controls[4]->control_ref->State();
|
||||
|
||||
// modifier code
|
||||
|
@ -142,32 +140,18 @@ public:
|
|||
xx = (fabsf(xx)>deadzone) * sign(xx) * (m + deadzone/2);
|
||||
}
|
||||
|
||||
// deadzone / square stick code
|
||||
if (radius != 1 || deadzone || square)
|
||||
if (radius != 1 || deadzone)
|
||||
{
|
||||
// this section might be all wrong, but its working good enough, I think
|
||||
|
||||
ControlState ang = atan2(yy, xx);
|
||||
ControlState ang_sin = sin(ang);
|
||||
ControlState ang_cos = cos(ang);
|
||||
|
||||
// the amt a full square stick would have at current angle
|
||||
ControlState square_full = std::min(ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2);
|
||||
|
||||
// the amt a full stick would have that was ( user setting squareness) at current angle
|
||||
// I think this is more like a pointed circle rather than a rounded square like it should be
|
||||
ControlState stick_full = (1 + (square_full - 1) * square);
|
||||
|
||||
ControlState dist = sqrt(xx*xx + yy*yy);
|
||||
|
||||
// dead zone code
|
||||
dist = std::max(0.0f, dist - deadzone * stick_full);
|
||||
dist = std::max(0.0f, dist - deadzone);
|
||||
dist /= (1 - deadzone);
|
||||
|
||||
// square stick code
|
||||
ControlState amt = dist / stick_full;
|
||||
dist -= ((square_full - 1) * amt * square);
|
||||
|
||||
// radius
|
||||
dist *= radius;
|
||||
|
||||
|
|
Loading…
Reference in New Issue