From bb8f282f2b76f9c697c44489b9b7c2d933b07ad0 Mon Sep 17 00:00:00 2001 From: pinkimo Date: Mon, 28 Oct 2019 00:31:44 +0100 Subject: [PATCH] Fix on gear change effect for WMMT5 --- Game Files/WMMT5.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Game Files/WMMT5.cpp b/Game Files/WMMT5.cpp index bca6c7a..048f7ef 100644 --- a/Game Files/WMMT5.cpp +++ b/Game Files/WMMT5.cpp @@ -125,6 +125,19 @@ static int SpamThread(void* ptr) return 0; } +static int GearChangeThread(void* ptr) +{ + if (GearChangeDelay > 0) + { + Sleep(GearChangeDelay); + } + myHelpers->log("gear change"); + double percentForce = GearChangeStrength / 100.0; + myTriggers->Sine(GearChangeLength, 0, percentForce); + myTriggers->LeftRight(0, percentForce, 150); + return 0; +} + void WMMT5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) { if (!init) @@ -293,14 +306,7 @@ void WMMT5::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers if (oldgear != gear && 0 < gear && 0.5 < time && 0.1 <= speed) { - if (GearChangeDelay > 0) - { - Sleep(GearChangeDelay); - } - helpers->log("gear change"); - percentForce = GearChangeStrength / 100.0; - triggers->Sine(GearChangeLength, 0, percentForce); - triggers->LeftRight(0, percentForce, 150); + SDL_Thread* gearChangeThread = SDL_CreateThread(GearChangeThread, "GearChangeThread", (void*)NULL); } oldgear = gear; }