Stop BF Injection/Bandito/Hotknife rotating engine components when engine is off

This commit is contained in:
Silent 2017-06-25 14:09:30 +02:00
parent 6006e253b1
commit 1da99647b5
3 changed files with 12 additions and 1 deletions

View file

@ -3438,6 +3438,11 @@ void Patch_SA_10()
InjectHook(0x6C7E7A, &CAutomobile::PreRender_Stub); InjectHook(0x6C7E7A, &CAutomobile::PreRender_Stub);
InjectHook(0x6CEAEC, &CAutomobile::PreRender_Stub); InjectHook(0x6CEAEC, &CAutomobile::PreRender_Stub);
InjectHook(0x6CFADC, &CAutomobile::PreRender_Stub); InjectHook(0x6CFADC, &CAutomobile::PreRender_Stub);
// Stop BF Injection/Bandito/Hotknife rotating engine components when engine is off
Patch<const void*>(0x6AC2BE + 2, &CAutomobile::ms_engineCompSpeed);
Patch<const void*>(0x6ACB91 + 2, &CAutomobile::ms_engineCompSpeed);
} }
void Patch_SA_11() void Patch_SA_11()

View file

@ -9,6 +9,8 @@
std::vector<int32_t> vecRotorExceptions; std::vector<int32_t> vecRotorExceptions;
float CAutomobile::ms_engineCompSpeed;
static bool ShouldIgnoreRotor( int32_t id ) static bool ShouldIgnoreRotor( int32_t id )
{ {
return std::find( vecRotorExceptions.begin(), vecRotorExceptions.end(), id ) != vecRotorExceptions.end(); return std::find( vecRotorExceptions.begin(), vecRotorExceptions.end(), id ) != vecRotorExceptions.end();
@ -278,6 +280,9 @@ void CPlane::Fix_SilentPatch()
void CAutomobile::PreRender() void CAutomobile::PreRender()
{ {
// For rotating engine components
ms_engineCompSpeed = m_nVehicleFlags.bEngineOn ? CTimer::m_fTimeStep : 0.0f;
(this->*(orgPreRender))(); (this->*(orgPreRender))();
if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 603 ) if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 603 )

View file

@ -173,7 +173,8 @@ public:
void ProcessPhoenixBlower( int32_t modelID ); void ProcessPhoenixBlower( int32_t modelID );
void ProcessSweeper(); void ProcessSweeper();
static void (CAutomobile::*orgPreRender)(); static void (CAutomobile::*orgPreRender)();
static float ms_engineCompSpeed;
}; };
class NOVMT CHeli : public CAutomobile class NOVMT CHeli : public CAutomobile