With Roll & Pitch binding to "Keyboard" and both degrees setting to "Free Swing", the "Pitch Left" and "Pitch Right" keys on keyboard now work like "Swing to left" and "Swing to right".

This enables you to use knife on a keyboard instead of an analog stick in games of "Resident Evil: Umbrella Chronicles" and "Resident Evil: Darkside Chronicles".

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4642 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
ayuanx 2009-12-04 21:13:27 +00:00
parent c71adffa80
commit 24a785af59

View File

@ -444,32 +444,20 @@ void SingleShake(u8 &_x, u8 &_y, u8 &_z, int wm)
switch(Shake[wm]) switch(Shake[wm])
{ {
case 1: case 1:
case 3:
_x = g_wm.cal_zero.x / 2; _x = g_wm.cal_zero.x / 2;
_y = g_wm.cal_zero.y / 2; _y = g_wm.cal_zero.y / 2;
_z = g_wm.cal_zero.z / 2; _z = g_wm.cal_zero.z / 2;
break; break;
case 5:
case 7:
_x = (0xFF - g_wm.cal_zero.x ) / 2;
_y = (0xFF - g_wm.cal_zero.y ) / 2;
_z = (0xFF - g_wm.cal_zero.z ) / 2;
break;
case 2: case 2:
_x = 0x00;
_y = 0x00;
_z = 0x00;
break;
case 6:
_x = 0xFF;
_y = 0xFF;
_z = 0xFF;
break;
case 4:
_x = 0x80; _x = 0x80;
_y = 0x80; _y = 0x80;
_z = 0x80; _z = 0x80;
break; break;
case 3:
_x = (0xFF - g_wm.cal_zero.x ) / 2;
_y = (0xFF - g_wm.cal_zero.y ) / 2;
_z = (0xFF - g_wm.cal_zero.z ) / 2;
break;
default: default:
Shake[wm] = -1; Shake[wm] = -1;
_x = g_wm.cal_zero.x; _x = g_wm.cal_zero.x;
@ -501,7 +489,7 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
adjustment. And instead for example upsize the XInput trigger from 0x80 adjustment. And instead for example upsize the XInput trigger from 0x80
to 0x8000. */ to 0x8000. */
int Lx, Ly, Rx, Ry, Tl, Tr; int Lx, Ly, Rx, Ry, Tl, Tr;
PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr);; PadStateAdjustments(Lx, Ly, Rx, Ry, Tl, Tr);
// Save the Range in degrees, 45 and 90 are good values in some games // Save the Range in degrees, 45 and 90 are good values in some games
int RollRange = g_Config.Trigger.Range.Roll; int RollRange = g_Config.Trigger.Range.Roll;
@ -555,16 +543,27 @@ void TiltWiimoteGamepad(int &Roll, int &Pitch)
void TiltWiimoteKeyboard(int &Roll, int &Pitch) void TiltWiimoteKeyboard(int &Roll, int &Pitch)
{ {
#ifdef _WIN32 #ifdef _WIN32
if(IsKey(g_Wiimote_kbd.PITCH_L)) // Direct map keyboard pitch to roll
if (g_Config.Trigger.Range.Roll == 0 && g_Config.Trigger.Range.Pitch == 0)
{
if (IsKey(g_Wiimote_kbd.PITCH_L))
Roll = -128 / 2;
else if (IsKey(g_Wiimote_kbd.PITCH_R))
Roll = 128 / 2;
return;
}
if (IsKey(g_Wiimote_kbd.PITCH_L))
{ {
// Stop at the upper end of the range // Stop at the upper end of the range
if(KbDegree < g_Config.Trigger.Range.Pitch) if (KbDegree < g_Config.Trigger.Range.Pitch)
KbDegree += 3; // aim left KbDegree += 3; // aim left
} }
else if(IsKey(g_Wiimote_kbd.PITCH_R)) else if (IsKey(g_Wiimote_kbd.PITCH_R))
{ {
// Stop at the lower end of the range // Stop at the lower end of the range
if(KbDegree > -g_Config.Trigger.Range.Pitch) if (KbDegree > -g_Config.Trigger.Range.Pitch)
KbDegree -= 3; // aim right KbDegree -= 3; // aim right
} }
@ -611,7 +610,8 @@ void Tilt(u8 &_x, u8 &_y, u8 &_z)
TiltWiimoteGamepad(Roll, Pitch); TiltWiimoteGamepad(Roll, Pitch);
// Adjust angles, it's only needed if both roll and pitch is used together // Adjust angles, it's only needed if both roll and pitch is used together
if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0) AdjustAngles(Roll, Pitch); if (g_Config.Trigger.Range.Roll != 0 && g_Config.Trigger.Range.Pitch != 0)
AdjustAngles(Roll, Pitch);
// Calculate the accelerometer value from this tilt angle // Calculate the accelerometer value from this tilt angle
//PitchDegreeToAccelerometer(Roll, Pitch, _x, _y, _z, g_Config.Trigger.Roll, g_Config.Trigger.Pitch); //PitchDegreeToAccelerometer(Roll, Pitch, _x, _y, _z, g_Config.Trigger.Roll, g_Config.Trigger.Pitch);