mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
Animated Phoenix hood scoop
This commit is contained in:
parent
ebd4732411
commit
9236463f88
@ -3423,6 +3423,16 @@ void Patch_SA_10()
|
||||
// Properly initialize all CVehicleModelInfo fields
|
||||
ReadCall( 0x4C75E4, orgVehicleModelInfoCtor );
|
||||
InjectHook( 0x4C75E4, VehicleModelInfoCtor );
|
||||
|
||||
|
||||
// Animated Phoenix hood scoop
|
||||
auto* automobilePreRender = &(*(decltype(CAutomobile::orgPreRender)**)(0x6B0AD2 + 2))[17];
|
||||
CAutomobile::orgPreRender = *automobilePreRender;
|
||||
Patch(automobilePreRender, &CAutomobile::PreRender_Stub);
|
||||
|
||||
InjectHook(0x6C7E7A, &CAutomobile::PreRender_Stub);
|
||||
InjectHook(0x6CEAEC, &CAutomobile::PreRender_Stub);
|
||||
InjectHook(0x6CFADC, &CAutomobile::PreRender_Stub);
|
||||
}
|
||||
|
||||
void Patch_SA_11()
|
||||
|
@ -2,3 +2,4 @@
|
||||
#include "TimerSA.h"
|
||||
|
||||
int& CTimer::m_snTimeInMilliseconds = **AddressByVersion<int**>(0x4242D1, 0x53F6A1, 0x406FA1);
|
||||
float& CTimer::m_fTimeStep = **AddressByVersion<float**>(0x41DE4F + 2, 0, 0);
|
@ -5,6 +5,7 @@ class CTimer
|
||||
{
|
||||
public:
|
||||
static int& m_snTimeInMilliseconds;
|
||||
static float& m_fTimeStep;
|
||||
};
|
||||
|
||||
#endif
|
@ -18,6 +18,10 @@ static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0x6D1680, 0x70
|
||||
WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
|
||||
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);
|
||||
WRAPPER bool CVehicle::IsLawEnforcementVehicle() { VARJMP(varIsLawEnforcementVehicle); }
|
||||
static void* varSetComponentRotation = AddressByVersion<void*>(0x6DBA30, 0, 0);
|
||||
WRAPPER void CVehicle::SetComponentRotation( RwFrame* component, int axis, float angle, bool absolute ) { VARJMP(varSetComponentRotation); }
|
||||
|
||||
void (CAutomobile::*CAutomobile::orgPreRender)();
|
||||
|
||||
static int32_t random(int32_t from, int32_t to)
|
||||
{
|
||||
@ -250,6 +254,16 @@ void CPlane::Fix_SilentPatch()
|
||||
}
|
||||
}
|
||||
|
||||
void CAutomobile::PreRender()
|
||||
{
|
||||
(this->*(orgPreRender))();
|
||||
|
||||
if ( FLAUtils::GetExtendedID( &m_nModelIndex ) == 603 )
|
||||
{
|
||||
ProcessPhoenixBlower();
|
||||
}
|
||||
}
|
||||
|
||||
void CAutomobile::Fix_SilentPatch()
|
||||
{
|
||||
ResetFrames();
|
||||
@ -285,3 +299,30 @@ void CAutomobile::ResetFrames()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CAutomobile::ProcessPhoenixBlower()
|
||||
{
|
||||
if ( m_pCarNode[20] == nullptr ) return;
|
||||
|
||||
float finalAngle = 0.0f;
|
||||
if ( m_fGasPedal > 0.0f )
|
||||
{
|
||||
if ( m_fSpecialComponentAngle < 1.3f )
|
||||
{
|
||||
finalAngle = m_fSpecialComponentAngle = std::min( m_fSpecialComponentAngle + 0.1f * CTimer::m_fTimeStep, 1.3f );
|
||||
}
|
||||
else
|
||||
{
|
||||
finalAngle = m_fSpecialComponentAngle + (std::sin( (CTimer::m_snTimeInMilliseconds % 10000) / 70.0f ) * 0.13f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_fSpecialComponentAngle > 0.0f )
|
||||
{
|
||||
finalAngle = m_fSpecialComponentAngle = std::max( m_fSpecialComponentAngle - 0.05f * CTimer::m_fTimeStep, 0.0f );
|
||||
}
|
||||
}
|
||||
|
||||
SetComponentRotation( m_pCarNode[20], 0, finalAngle, true );
|
||||
}
|
||||
|
@ -117,7 +117,10 @@ class NOVMT CVehicle : public CPhysical
|
||||
protected:
|
||||
BYTE __pad1[752];
|
||||
CVehicleFlags m_nVehicleFlags;
|
||||
BYTE __pad2[160];
|
||||
BYTE __pad2[108];
|
||||
float m_fGasPedal;
|
||||
float m_fBrakePedal;
|
||||
BYTE __pad6[44];
|
||||
signed int m_nTimeTillWeNeedThisCar;
|
||||
BYTE __pad4[56];
|
||||
CEntity* pDamagingEntity;
|
||||
@ -134,12 +137,14 @@ public:
|
||||
{ return pDamagingEntity; }
|
||||
|
||||
virtual void Render() override;
|
||||
virtual void PreRender() override;
|
||||
|
||||
bool CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo);
|
||||
void CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo);
|
||||
//void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
|
||||
|
||||
bool IsLawEnforcementVehicle();
|
||||
void SetComponentRotation( RwFrame* component, int axis, float angle, bool absolute );
|
||||
|
||||
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
|
||||
};
|
||||
@ -152,12 +157,22 @@ public:
|
||||
CBouncingPanel m_aBouncingPanel[3];
|
||||
BYTE padding[320];
|
||||
float m_fRotorSpeed;
|
||||
BYTE __moarpad[312];
|
||||
BYTE __moarpad[264];
|
||||
float m_fSpecialComponentAngle;
|
||||
BYTE __pad3[44];
|
||||
|
||||
public:
|
||||
inline void PreRender_Stub()
|
||||
{ CAutomobile::PreRender(); }
|
||||
|
||||
virtual void PreRender() override;
|
||||
|
||||
void Fix_SilentPatch();
|
||||
|
||||
void ResetFrames();
|
||||
void ProcessPhoenixBlower();
|
||||
|
||||
static void (CAutomobile::*orgPreRender)();
|
||||
};
|
||||
|
||||
class NOVMT CHeli : public CAutomobile
|
||||
|
Loading…
Reference in New Issue
Block a user