mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Gecko codes: Added parenthesis where they were needed.(thanks to glennrics and soren) Fixed a copy paste error with write & fill 8bit codes. Also forgot to remove a return false;.(some more codes should work (fixed issue 2968)) New Wiimote Plugin: Added emulated swinging.(seems to work) Changed the emulated calibration data to some nice values. ControllerInterface: moved and constified some stuff.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5980 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -253,19 +253,35 @@ public:
|
||||
Force( const char* const _name );
|
||||
|
||||
template <typename C, typename R>
|
||||
void GetState( C* axis, const u8 base, const R range )
|
||||
void GetState(C* axis, const u8 base, const R range)
|
||||
{
|
||||
const float deadzone = settings[0]->value;
|
||||
for ( unsigned int i=0; i<6; i+=2 )
|
||||
for (unsigned int i=0; i<6; i+=2)
|
||||
{
|
||||
float tmpf = 0;
|
||||
const float state = controls[i+1]->control_ref->State() - controls[i]->control_ref->State();
|
||||
if (fabsf(state) > deadzone)
|
||||
*axis++ = (C)((state - (deadzone * sign(state))) / (1 - deadzone) * range + base);
|
||||
//*axis++ = state * range + base;
|
||||
tmpf = ((state - (deadzone * sign(state))) / (1 - deadzone));
|
||||
else
|
||||
*axis++ = (C)(base);
|
||||
tmpf = 0;
|
||||
|
||||
float &ax = m_swing[i >> 1];
|
||||
|
||||
if (fabs(tmpf) > fabsf(ax))
|
||||
{
|
||||
if (tmpf > ax)
|
||||
ax = std::min(ax + 0.15f, tmpf);
|
||||
else if (tmpf < ax)
|
||||
ax = std::max(ax - 0.15f, tmpf);
|
||||
}
|
||||
else
|
||||
ax = tmpf;
|
||||
|
||||
*axis++ = (C)(ax * range + base);
|
||||
}
|
||||
}
|
||||
private:
|
||||
float m_swing[3];
|
||||
};
|
||||
|
||||
class Tilt : public ControlGroup
|
||||
|
Reference in New Issue
Block a user