Add wind animations when driving a Quadbike

Contributed by Wesser
This commit is contained in:
Silent 2021-07-27 22:17:10 +02:00
parent 2af4ec8e06
commit 2c8961c0d1
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
3 changed files with 25 additions and 1 deletions

View file

@ -4295,6 +4295,12 @@ void Patch_SA_10()
Patch<const char*>( 0x5593E4 + 1, "%.0fkgs" ); Patch<const char*>( 0x5593E4 + 1, "%.0fkgs" );
// Add wind animations when driving a Quadbike
// By Wesser
InjectHook(0x5E69BC, &CVehicle::IsOpenTopCarOrQuadbike, PATCH_CALL);
Nop(0x5E69BC + 5, 3);
#if FULL_PRECISION_D3D #if FULL_PRECISION_D3D
// Test - full precision D3D device // Test - full precision D3D device
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE ); Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
@ -5797,6 +5803,17 @@ void Patch_SA_NewBinaries_Common()
ReadCall( getPad, orgGetPad ); ReadCall( getPad, orgGetPad );
InjectHook( getPad, getPadAndSetFlag ); InjectHook( getPad, getPadAndSetFlag );
} }
// Add wind animations when driving a Quadbike
// By Wesser
{
auto isOpenTopCar = pattern("8B 11 8B 82 9C 00 00 00 FF D0").get_one();
InjectHook(isOpenTopCar.get<void>(), &CVehicle::IsOpenTopCarOrQuadbike, PATCH_CALL);
Nop(isOpenTopCar.get<void>(5), 5);
}
} }

View file

@ -101,6 +101,11 @@ bool CVehicle::IgnoresRotorFix() const
return SVF::ModelHasFeature( m_nModelIndex.Get(), SVF::Feature::_INTERNAL_NO_ROTOR_FADE ); return SVF::ModelHasFeature( m_nModelIndex.Get(), SVF::Feature::_INTERNAL_NO_ROTOR_FADE );
} }
bool CVehicle::IsOpenTopCarOrQuadbike() const
{
return IsOpenTopCar() || m_dwVehicleSubClass == VEHICLE_QUAD;
}
static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0x6D1680, 0x70C0B0); static void* varVehicleRender = AddressByVersion<void*>(0x6D0E60, 0x6D1680, 0x70C0B0);
WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); } WRAPPER void CVehicle::Render() { VARJMP(varVehicleRender); }
static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0); static void* varIsLawEnforcementVehicle = AddressByVersion<void*>(0x6D2370, 0x6D2BA0, 0x70D8C0);

View file

@ -221,7 +221,7 @@ public:
virtual bool IsDoorMissing(unsigned int door); virtual bool IsDoorMissing(unsigned int door);
virtual bool IsDoorMissing(eDoors door); virtual bool IsDoorMissing(eDoors door);
// check if car has roof as extra // check if car has roof as extra
virtual bool IsOpenTopCar(); virtual bool IsOpenTopCar() const;
// remove ref to this entity // remove ref to this entity
virtual void RemoveRefsToVehicle(CEntity* entity); virtual void RemoveRefsToVehicle(CEntity* entity);
virtual void BlowUpCar(CEntity* damager, unsigned char bHideExplosion); virtual void BlowUpCar(CEntity* damager, unsigned char bHideExplosion);
@ -279,6 +279,8 @@ public:
bool IgnoresLightbeamFix() const; bool IgnoresLightbeamFix() const;
bool IgnoresRotorFix() const; bool IgnoresRotorFix() const;
bool IsOpenTopCarOrQuadbike() const;
void DoHeadLightBeam( int type, CMatrix& m, bool right ) void DoHeadLightBeam( int type, CMatrix& m, bool right )
{ {
std::invoke( orgDoHeadLightBeam, this, type, m, right ); std::invoke( orgDoHeadLightBeam, this, type, m, right );