mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 05:38:50 +00: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:
parent
e472b7f28d
commit
57c4620902
11 changed files with 154 additions and 53 deletions
|
@ -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° the Wiimote is upside down and these adjustments are needed. */
|
||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue