Emulated Wiimote: Fixed the upside down mode for roll and pitch, 360° roll and pitch is now emulated by an analog gamepad

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2224 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-12 16:43:35 +00:00
parent e472b7f28d
commit 57c4620902
11 changed files with 154 additions and 53 deletions

View File

@ -66,6 +66,32 @@ void TiltTest(u8 x, u8 y, u8 z)
////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
/* Angles adjustment for the upside down state when both roll and pitch is used. When the absolute values
of the angles go over 90<39> the Wiimote is upside down and these adjustments are needed. */
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void AdjustAngles(float &Roll, float &Pitch)
{
float OldPitch = Pitch;
if (abs(Roll) > 90)
{
if (Pitch >= 0)
Pitch = 180 - Pitch; // 15 to 165
else if (Pitch < 0)
Pitch = -180 - Pitch; // -15 to -165
}
if (abs(OldPitch) > 90)
{
if (Roll >= 0)
Roll = 180 - Roll; // 15 to 165
else if (Roll < 0)
Roll = -180 - Roll; // -15 to -165
}
}
////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Angles to accelerometer values