From 5050c6510e6500907804106468839e579db1f583 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 9 Sep 2017 20:29:01 +0200 Subject: [PATCH] Rotate Newsvan dish when player is using the car --- SilentPatchSA/VehicleSA.cpp | 20 +++++++++++++++++++- SilentPatchSA/VehicleSA.h | 6 +++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/SilentPatchSA/VehicleSA.cpp b/SilentPatchSA/VehicleSA.cpp index 61231d5..50762cd 100644 --- a/SilentPatchSA/VehicleSA.cpp +++ b/SilentPatchSA/VehicleSA.cpp @@ -9,7 +9,9 @@ static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f; static constexpr float PHOENIX_FLUTTER_AMP = 0.13f; -static constexpr float SWEEPER_BRUSH_SPEED = 0.3f; +static constexpr float SWEEPER_BRUSH_SPEED = 0.3f; + +static constexpr float PI = 3.14159265358979323846f; std::vector vecRotorExceptions; @@ -298,6 +300,11 @@ void CAutomobile::PreRender() { ProcessSweeper(); } + + if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 582 ) + { + ProcessNewsvan(); + } } void CAutomobile::Fix_SilentPatch() @@ -394,3 +401,14 @@ void CAutomobile::ProcessSweeper() SetComponentRotation( m_pCarNode[21], ROT_AXIS_Z, -angle, false ); } } + +void CAutomobile::ProcessNewsvan() +{ + if ( GetStatus() == STATUS_PLAYER ) + { + // TODO: Point at something? Like nearest collectable or safehouse + m_fGunOrientation += CTimer::m_fTimeStep * 0.05f; + if ( m_fGunOrientation > 2.0f * PI ) m_fGunOrientation -= 2.0f * PI; + SetComponentRotation( m_pCarNode[20], ROT_AXIS_Z, m_fGunOrientation ); + } +} \ No newline at end of file diff --git a/SilentPatchSA/VehicleSA.h b/SilentPatchSA/VehicleSA.h index a36412b..2cccf4d 100644 --- a/SilentPatchSA/VehicleSA.h +++ b/SilentPatchSA/VehicleSA.h @@ -164,7 +164,10 @@ public: CBouncingPanel m_aBouncingPanel[3]; BYTE padding[320]; float m_fRotorSpeed; - BYTE __moarpad[264]; + BYTE __moarpad[252]; + float m_fGunOrientation; + float m_fGunElevation; + float m_fUnknown; float m_fSpecialComponentAngle; BYTE __pad3[44]; @@ -179,6 +182,7 @@ public: void ResetFrames(); void ProcessPhoenixBlower( int32_t modelID ); void ProcessSweeper(); + void ProcessNewsvan(); static void (CAutomobile::*orgPreRender)(); static float ms_engineCompSpeed;