InputCommon: Use value of "Modifier" button "Range" setting rather than always applying 50%.

Make "Clear" button reset "Modifier" "Range" settings to 50%.
This commit is contained in:
Jordan Woyak
2022-01-04 14:09:50 -06:00
parent 953eb49cd8
commit 78a9bdf04a
7 changed files with 33 additions and 15 deletions

View File

@ -40,9 +40,7 @@ AnalogStick::ReshapeData AnalogStick::GetReshapableState(bool adjusted) const
if (!adjusted)
return {x, y};
const ControlState modifier = controls[4]->GetState();
return Reshape(x, y, modifier);
return Reshape(x, y, GetModifierInput()->GetState());
}
AnalogStick::StateData AnalogStick::GetState() const
@ -55,6 +53,11 @@ ControlState AnalogStick::GetGateRadiusAtAngle(double ang) const
return m_stick_gate->GetRadiusAtAngle(ang);
}
Control* AnalogStick::GetModifierInput() const
{
return controls[4].get();
}
OctagonAnalogStick::OctagonAnalogStick(const char* name_, ControlState gate_radius)
: OctagonAnalogStick(name_, name_, gate_radius)
{

View File

@ -23,6 +23,8 @@ public:
StateData GetState() const;
private:
Control* GetModifierInput() const override;
std::unique_ptr<StickGate> m_stick_gate;
};

View File

@ -50,9 +50,7 @@ Tilt::ReshapeData Tilt::GetReshapableState(bool adjusted) const
if (!adjusted)
return {x, y};
const ControlState modifier = controls[4]->GetState();
return Reshape(x, y, modifier);
return Reshape(x, y, GetModifierInput()->GetState());
}
Tilt::StateData Tilt::GetState() const
@ -76,4 +74,9 @@ ControlState Tilt::GetMaxRotationalVelocity() const
return m_max_rotational_velocity.GetValue() * MathUtil::TAU;
}
Control* Tilt::GetModifierInput() const
{
return controls[4].get();
}
} // namespace ControllerEmu

View File

@ -31,6 +31,8 @@ public:
ControlState GetMaxRotationalVelocity() const;
private:
Control* GetModifierInput() const override;
SettingValue<double> m_max_angle_setting;
SettingValue<double> m_max_rotational_velocity;
};