1
0
mirror of synced 2025-01-31 03:43:48 +01:00

Add new rumble code inplace of old simple rumble

never used so no need to keep it
This commit is contained in:
Aaron M 2019-10-30 18:20:41 +13:00
parent b11f3507c1
commit 7714a7ccd9
2 changed files with 11 additions and 3 deletions

View File

@ -6,7 +6,7 @@ struct EffectTriggers {
void(*Spring)(double strength);
void(*Friction)(double strength);
void(*Sine)(UINT16 period, UINT16 fadePeriod, double strength);
void(*Rumble)(double strength, double length);
void(*Rumble)(double lowfrequency, double highfrequency, double length);
void(*LeftRight)(double smallstrength, double largestrength, double length);
void(*LeftRightDevice2)(double smallstrength, double largestrength, double length);
void(*Springi)(double strength);

View File

@ -1566,11 +1566,19 @@ void TriggerLeftRightDevice2Effect(double smallstrength, double largestrength, d
}
}
void TriggerRumbleEffect(double strength, double length)
void TriggerRumbleEffect(double lowfrequency, double highfrequency, double length)
{
if (EnableRumble == 1)
{
SDL_HapticRumblePlay(haptic, strength, length);
DWORD minForceLow = (DWORD)(lowfrequency > 0.001 ? (configMinForce / 100.0 * 65535.0) : 0);
DWORD minForceHigh = (DWORD)(highfrequency > 0.001 ? (configMinForce / 100.0 * 65535.0) : 0);
DWORD maxForce = (DWORD)(configMaxForce / 100.0 * 65535.0);
DWORD rangeLow = maxForce - minForceLow;
DWORD rangeHigh = maxForce - minForceHigh;
DWORD LowMotor = (DWORD)(lowfrequency * rangeLow + minForceLow);
DWORD HighMotor = (DWORD)(highfrequency * rangeHigh + minForceHigh);
SDL_JoystickRumble(GameController, LowMotor, HighMotor, length);
}
}