Tidy some code
This commit is contained in:
parent
bbff96b82f
commit
aa584e5f56
@ -43,6 +43,7 @@ void AfterburnerClimax::FFBLoop(EffectConstants *constants, Helpers *helpers, Ef
|
||||
|
||||
if (NewVersion)
|
||||
Vibration = helpers->ReadByte(0x834A51E, false);
|
||||
|
||||
if (OldVersion)
|
||||
Vibration = helpers->ReadByte(0x8347A5E, false);
|
||||
|
||||
|
@ -77,7 +77,6 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
@ -141,60 +140,56 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (Ammo1pBool)
|
||||
{
|
||||
if ((Ammo1pB >= 0) && (Ammo1pA > 0))
|
||||
if (Ammo1pB >= 0 && Ammo1pA > 0)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Ammo1pA == 0) && (Ammo1pB == 0))
|
||||
{
|
||||
if (Ammo1pA == 0 && Ammo1pB == 0)
|
||||
Ammo1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ammo1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldShoot != newShoot)
|
||||
{
|
||||
if (((Ammo1pA == 0) && (Ammo1pB == 0)) || ((Ammo1pA == 10) && (Ammo1pB == 10)))
|
||||
if ((Ammo1pA == 0 && Ammo1pB == 0) || (Ammo1pA == 10 && Ammo1pB == 10))
|
||||
{
|
||||
if (Shoot1p & 0x10)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun1pStrength) / 100.0);
|
||||
double percentForce = (Gun1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -206,60 +201,56 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (Ammo2pBool)
|
||||
{
|
||||
if ((Ammo2pB >= 0) && (Ammo2pA > 0))
|
||||
if (Ammo2pB >= 0 && Ammo2pA > 0)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Ammo2pA == 0) && (Ammo2pB == 0))
|
||||
{
|
||||
if (Ammo2pA == 0 && Ammo2pB == 0)
|
||||
Ammo2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ammo2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldShoot2 != newShoot2)
|
||||
{
|
||||
if (((Ammo2pA == 0) && (Ammo2pB == 0)) || ((Ammo2pA == 10) && (Ammo2pB == 10)))
|
||||
if ((Ammo2pA == 0 && Ammo2pB == 0) || (Ammo2pA == 10 && Ammo2pB == 10))
|
||||
{
|
||||
if (Shoot2p & 0x10)
|
||||
{
|
||||
if (HowtoRumbleGunEffect == 0)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 1)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleGunEffect == 2)
|
||||
{
|
||||
double percentForce = ((Gun2pStrength) / 100.0);
|
||||
double percentForce = (Gun2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -275,19 +266,19 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (HowtoRumbleFlameEffect == 0)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentForce = (Flame1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 1)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentForce = (Flame1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 2)
|
||||
{
|
||||
double percentForce = ((Flame1pStrength) / 100.0);
|
||||
double percentForce = (Flame1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -295,13 +286,9 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
}
|
||||
|
||||
if ((Flame1p <= 0) )
|
||||
{
|
||||
Flame1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Flame1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldFlame2 != newFlame2)
|
||||
@ -312,19 +299,19 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (HowtoRumbleFlameEffect == 0)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentForce = (Flame2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 1)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentForce = (Flame2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleFlameEffect == 2)
|
||||
{
|
||||
double percentForce = ((Flame2pStrength) / 100.0);
|
||||
double percentForce = (Flame2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -332,13 +319,9 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
}
|
||||
|
||||
if ((Flame2p <= 0))
|
||||
{
|
||||
Flame2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Flame2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth != newHealth)
|
||||
@ -349,19 +332,19 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentForce = (Health1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentForce = (Health1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health1pStrength) / 100.0);
|
||||
double percentForce = (Health1pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -369,13 +352,9 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
}
|
||||
|
||||
if ((Health1p == 0))
|
||||
{
|
||||
Health1pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Health1pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldHealth2 != newHealth2)
|
||||
@ -386,19 +365,19 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
{
|
||||
if (HowtoRumbleHealthEffect == 0)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentForce = (Health2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 1)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentForce = (Health2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
else if (HowtoRumbleHealthEffect == 2)
|
||||
{
|
||||
double percentForce = ((Health2pStrength) / 100.0);
|
||||
double percentForce = (Health2pStrength / 100.0);
|
||||
double percentLength = configFeedbackLength;
|
||||
triggers->RumbleDevice2(percentForce, 0, percentLength);
|
||||
}
|
||||
@ -406,13 +385,9 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
|
||||
}
|
||||
|
||||
if ((Health2p == 0))
|
||||
{
|
||||
Health2pBool = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Health2pBool = true;
|
||||
}
|
||||
}
|
||||
|
||||
oldAmmo = newAmmo;
|
||||
|
@ -45,10 +45,8 @@ void BG4JP::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers
|
||||
std::string ffs = std::to_string(WallContact);
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
double percentForce = ffspeed / 180.00;
|
||||
double percentLength = 100.0;
|
||||
|
@ -24,10 +24,8 @@ void Batman::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigger
|
||||
std::string ffs = std::to_string(ff);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
if (ff > 0)
|
||||
{
|
||||
|
@ -64,7 +64,6 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
@ -131,6 +130,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!BothRumbleMotor && LeftRumbleMotor && !RightRumbleMotor)
|
||||
{
|
||||
if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble)
|
||||
@ -140,6 +140,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!BothRumbleMotor && !LeftRumbleMotor && RightRumbleMotor)
|
||||
{
|
||||
if (e.jbutton.button == Button1Rumble || e.jbutton.button == Button2Rumble || e.jbutton.button == Button3Rumble || e.jbutton.button == Button4Rumble || e.jbutton.button == Button5Rumble || e.jbutton.button == Button6Rumble || e.jbutton.button == Button7Rumble || e.jbutton.button == Button8Rumble || e.jbutton.button == Button9Rumble || e.jbutton.button == Button10Rumble)
|
||||
@ -150,6 +151,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.jaxis.which == joystick_index2)
|
||||
{
|
||||
if (BothRumbleMotor && !LeftRumbleMotor && !RightRumbleMotor)
|
||||
@ -161,6 +163,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
triggers->RumbleDevice2(percentForce, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!BothRumbleMotor && LeftRumbleMotor && !RightRumbleMotor)
|
||||
{
|
||||
if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble)
|
||||
@ -170,6 +173,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
triggers->RumbleDevice2(0, percentForce, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!BothRumbleMotor && !LeftRumbleMotor && RightRumbleMotor)
|
||||
{
|
||||
if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble)
|
||||
@ -181,6 +185,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e.type == SDL_JOYBUTTONUP)
|
||||
{
|
||||
if (e.jaxis.which == joystick_index1)
|
||||
@ -192,6 +197,7 @@ void ButtonRumble::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectT
|
||||
triggers->Rumble(0, 0, percentLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (e.jaxis.which == joystick_index2)
|
||||
{
|
||||
if (e.jbutton.button == Button1Device2Rumble || e.jbutton.button == Button2Device2Rumble || e.jbutton.button == Button3Device2Rumble || e.jbutton.button == Button4Device2Rumble || e.jbutton.button == Button5Device2Rumble || e.jbutton.button == Button6Device2Rumble || e.jbutton.button == Button7Device2Rumble || e.jbutton.button == Button8Device2Rumble || e.jbutton.button == Button9Device2Rumble || e.jbutton.button == Button10Device2Rumble)
|
||||
|
@ -21,7 +21,6 @@ static int RemoveCelShadedFilter = GetPrivateProfileInt(TEXT("Settings"), TEXT("
|
||||
|
||||
int ttx2chasehq2(int ffRaw) {
|
||||
switch (ffRaw) {
|
||||
// moving right, from weakest to strongest (30 => 16).
|
||||
case 28672:
|
||||
return 30;
|
||||
case 24640:
|
||||
@ -53,7 +52,6 @@ int ttx2chasehq2(int ffRaw) {
|
||||
case 30816:
|
||||
return 16;
|
||||
|
||||
// moving left, from weakest to strongest (15 => 1)
|
||||
case 20480:
|
||||
return 15;
|
||||
case 16448:
|
||||
@ -86,7 +84,6 @@ int ttx2chasehq2(int ffRaw) {
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,9 +91,9 @@ void ChaseHQ2::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg
|
||||
|
||||
int ff = 0;
|
||||
{
|
||||
long ffAddress = helpers->ReadInt32(0x130B558, /* isRelativeOffset*/ true);
|
||||
int ffRaw = helpers->ReadInt32(ffAddress + 0x45, /* isRelativeOffset */ false);
|
||||
int lampArray[8] = { (16384) + 1, 16 ,1024 ,512, 128, 8, 256 };//The 1 isn't needed but I wasn't sure how to get the 16384 to see the first digit any other way lol
|
||||
long ffAddress = helpers->ReadInt32(0x130B558, true);
|
||||
int ffRaw = helpers->ReadInt32(ffAddress + 0x45, false);
|
||||
int lampArray[8] = { (16384) + 1, 16 ,1024 ,512, 128, 8, 256 }; //The 1 isn't needed but I wasn't sure how to get the 16384 to see the first digit any other way lol
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if ((ffRaw & lampArray[i]) == lampArray[i]) {
|
||||
ffRaw -= lampArray[i];
|
||||
@ -106,7 +103,7 @@ void ChaseHQ2::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg
|
||||
ff = ttx2chasehq2(ffRaw);
|
||||
}
|
||||
|
||||
if (RemoveCelShadedFilter == 1)
|
||||
if (RemoveCelShadedFilter)
|
||||
{
|
||||
if (!removecel)
|
||||
{
|
||||
@ -116,10 +113,8 @@ void ChaseHQ2::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg
|
||||
helpers->WriteByte(0x130CB30, 0x00, true); // Remove Cel Shaded Filter
|
||||
}
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(ff);
|
||||
@ -128,21 +123,17 @@ void ChaseHQ2::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigg
|
||||
if (ff > 15)
|
||||
{
|
||||
helpers->log("moving wheel right");
|
||||
// assume that 30 is the weakest and 16 is the strongest
|
||||
double percentForce = (31 - ff) / 15.0;
|
||||
double percentLength = 100;
|
||||
// direction from left => makes wheel turn right
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce); // old logic: 31 - ff
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
else if (ff > 0)
|
||||
{
|
||||
helpers->log("moving wheel left");
|
||||
// assume that 1 is the strongest and 15 is the weakest
|
||||
double percentForce = (16 - ff) / 15.0;
|
||||
double percentLength = 100;
|
||||
// direction from right => makes wheel turn left
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce); // old logic: 15 - ff
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
|
||||
extern int EnableDamper;
|
||||
extern int DamperStrength;
|
||||
static int ShakeCount;
|
||||
static bool LetsShake;
|
||||
static UINT8 oldEffect;
|
||||
|
||||
@ -27,23 +28,14 @@ static int FFBGrassFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT(
|
||||
static int FFBRumbleStripSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBRumbleStripSinePeriod"), 0, settingsFilename);
|
||||
static int FFBRumbleStripFadeSinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBRumbleStripFadeSinePeriod"), 0, settingsFilename);
|
||||
|
||||
static int ShakeThread(void* ptr)
|
||||
{
|
||||
Sleep(500);
|
||||
LetsShake = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void D1GP::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers)
|
||||
{
|
||||
float FFBConstant = GetTeknoParrotFFB() / 1000.0;
|
||||
int Effect = GetTeknoParrotFFB2();
|
||||
float Speedo = helpers->ReadFloat32(0x2150F4, true);
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
if (FFBConstant > 0)
|
||||
{
|
||||
@ -86,7 +78,6 @@ void D1GP::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
break;
|
||||
case 0x04:
|
||||
LetsShake = true;
|
||||
SDL_CreateThread(ShakeThread, "ShakeThread", (void*)NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -114,6 +105,14 @@ void D1GP::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
|
||||
if (LetsShake)
|
||||
{
|
||||
++ShakeCount;
|
||||
|
||||
if (ShakeCount >= 32)
|
||||
{
|
||||
ShakeCount = 0;
|
||||
LetsShake = false;
|
||||
}
|
||||
|
||||
triggers->Rumble(0.6, 0.6, 100);
|
||||
triggers->Sine(70, 60, 0.4);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ static int ThreadLoop()
|
||||
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
if (ChangeGearsViaPlugin == 1)
|
||||
if (ChangeGearsViaPlugin)
|
||||
{
|
||||
if (e.jbutton.button == Gear1)
|
||||
{
|
||||
@ -77,11 +77,11 @@ static int ThreadLoop()
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, 0x03, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearDown) && (gear > 0x00))
|
||||
else if (e.jbutton.button == GearDown && gear > 0x00)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, --gear, false);
|
||||
}
|
||||
else if ((e.jbutton.button == GearUp) && (gear < 0x03))
|
||||
else if (e.jbutton.button == GearUp && gear < 0x03)
|
||||
{
|
||||
myHelpers->WriteByte(0x019B468C, ++gear, false);
|
||||
}
|
||||
@ -116,12 +116,10 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
||||
UINT8 ff = helpers->ReadByte(0x15AFC46, false);
|
||||
HWND hWnd = FindWindowA(0, ("Daytona Championship USA"));
|
||||
|
||||
if (HideCursor == 1)
|
||||
{
|
||||
if (HideCursor)
|
||||
SetCursorPos(2000, 2000);
|
||||
}
|
||||
|
||||
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
|
||||
if (GetAsyncKeyState(VK_ESCAPE) && EscapeKeyExitViaPlugin)
|
||||
{
|
||||
if (hWnd > NULL)
|
||||
{
|
||||
@ -136,7 +134,7 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
||||
//Menu Movement & Game Initial Screen
|
||||
if (gamestate == 18 || gamestate == 30)
|
||||
{
|
||||
if ((steering <= 0x75) && (steering > 0x50))
|
||||
if (steering <= 0x75 && steering > 0x50)
|
||||
{
|
||||
//Menu Left
|
||||
if (!keybdleft)
|
||||
@ -192,10 +190,8 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
||||
}
|
||||
}
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
if (ff > 15)
|
||||
{
|
||||
@ -211,6 +207,7 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(myConstants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
myHelpers = helpers;
|
||||
|
@ -49,7 +49,7 @@ void DirtyDrivin::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTr
|
||||
break;
|
||||
}
|
||||
|
||||
if (EnableDamper == 1)
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
if (ff > 0)
|
||||
|
@ -22,10 +22,8 @@ void FordRacing::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTri
|
||||
std::string ffs = std::to_string(ff);
|
||||
helpers->log((char *)ffs.c_str());
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
if (ff < -65505 && ff > -65515)
|
||||
{
|
||||
|
@ -84,10 +84,8 @@ void FordRacingOther::FFBLoop(EffectConstants *constants, Helpers *helpers, Effe
|
||||
}
|
||||
}
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
myTriggers = triggers;
|
||||
myConstants = constants;
|
||||
|
@ -51,19 +51,13 @@ void GRID::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
UINT8 static oldgear = 0;
|
||||
UINT8 newgear = gear;
|
||||
|
||||
{
|
||||
triggers->Springi(SpringStrength / 100.0);
|
||||
}
|
||||
triggers->Springi(SpringStrength / 100.0);
|
||||
|
||||
if (EnableDamper == 1)
|
||||
{
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
}
|
||||
|
||||
if ((oldgear != newgear) && (speedo > 0))
|
||||
{
|
||||
if (oldgear != newgear && speedo > 0)
|
||||
gearshift = true;
|
||||
}
|
||||
|
||||
if (gearshift)
|
||||
{
|
||||
@ -82,30 +76,30 @@ void GRID::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers*
|
||||
triggers->Sine(80, 80, percentForce);
|
||||
}
|
||||
|
||||
if ((Skids > 12) && (speedo > 0))
|
||||
if (Skids > 12 && speedo > 0)
|
||||
{
|
||||
double percentForce = ((Skids - 12) / 8.0);
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
}
|
||||
|
||||
if ((AI > 0) && (PanelBase4 > 0))
|
||||
if (AI > 0 && PanelBase4 > 0)
|
||||
{
|
||||
double percentForce = (PanelBase4) / 8.0;
|
||||
double percentForce = PanelBase4 / 8.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, percentForce, percentLength);
|
||||
}
|
||||
|
||||
if ((WallBase4 > 0) && (PanelBase4 > 0))
|
||||
if (WallBase4 > 0 && PanelBase4 > 0)
|
||||
{
|
||||
double percentForce = (PanelBase4) / 8.0;
|
||||
double percentForce = PanelBase4 / 8.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(percentForce, 0, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
else if ((WallBase4 < 0) && (PanelBase4 > 0))
|
||||
else if (WallBase4 < 0 && PanelBase4 > 0)
|
||||
{
|
||||
double percentForce = (PanelBase4) / 8.0;
|
||||
double percentForce = PanelBase4 / 8.0;
|
||||
double percentLength = 100;
|
||||
triggers->Rumble(0, percentForce, percentLength);
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
|
@ -85,7 +85,7 @@ void GaelcoTuningRace::FFBLoop(EffectConstants* constants, Helpers* helpers, Eff
|
||||
}
|
||||
}
|
||||
|
||||
if (EnableDamper == 1)
|
||||
if (EnableDamper)
|
||||
triggers->Damper(DamperStrength / 100.0);
|
||||
|
||||
myTriggers = triggers;
|
||||
|
@ -74,7 +74,6 @@ void GoldenGun::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrig
|
||||
SDL_JoystickGUID guid, dev_guid;
|
||||
int numJoysticks = SDL_NumJoysticks();
|
||||
std::string njs = std::to_string(numJoysticks);
|
||||
((char)njs.c_str());
|
||||
for (int i = 0; i < SDL_NumJoysticks(); i++)
|
||||
{
|
||||
extern int joystick1Index;
|
||||
|
Loading…
Reference in New Issue
Block a user