mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
ControllerEmu: Always convert to polar coordinates and back
Most users will have something in the radius or deadzone fields, so don't bother filtering out 'extra' work. This also lets us clean up the modifier implementation.
This commit is contained in:
parent
f2d4f10fc9
commit
c29d5ff989
@ -140,8 +140,6 @@ public:
|
||||
xx = (fabsf(xx)>deadzone) * sign(xx) * (m + deadzone/2);
|
||||
}
|
||||
|
||||
if (radius != 1 || deadzone)
|
||||
{
|
||||
ControlState ang = atan2(yy, xx);
|
||||
ControlState ang_sin = sin(ang);
|
||||
ControlState ang_cos = cos(ang);
|
||||
@ -157,7 +155,6 @@ public:
|
||||
|
||||
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
||||
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
||||
}
|
||||
|
||||
*y = C(yy * range + base);
|
||||
*x = C(xx * range + base);
|
||||
@ -292,8 +289,6 @@ public:
|
||||
}
|
||||
|
||||
// deadzone / circle stick code
|
||||
if (deadzone || circle)
|
||||
{
|
||||
// this section might be all wrong, but its working good enough, I think
|
||||
|
||||
ControlState ang = atan2(yy, xx);
|
||||
@ -319,7 +314,6 @@ public:
|
||||
|
||||
yy = std::max(-1.0f, std::min(1.0f, ang_sin * dist));
|
||||
xx = std::max(-1.0f, std::min(1.0f, ang_cos * dist));
|
||||
}
|
||||
|
||||
// this is kinda silly here
|
||||
// gui being open will make this happen 2x as fast, o well
|
||||
|
Loading…
Reference in New Issue
Block a user