mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user