mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
VC: Make drive-by one shot sounds owned by the driver instead of the car
This commit is contained in:
parent
f3f9004322
commit
4679873c3a
@ -1130,6 +1130,19 @@ void Patch_VC_Common()
|
||||
static const float MULT_6 = 6.0f;
|
||||
Patch( extraMult6, &MULT_6 );
|
||||
}
|
||||
|
||||
|
||||
// Make drive-by one shot sounds owned by the driver instead of the car
|
||||
// Fixes incorrect weapon sound being used for drive-by
|
||||
{
|
||||
auto getDriverOneShot = pattern( "FF 35 ? ? ? ? 6A 37 50 E8 ? ? ? ? 83 7E 08 00" ).get_one();
|
||||
|
||||
// nop
|
||||
// mov ecx, ebx
|
||||
// call CVehicle::GetOneShotOwnerID
|
||||
Patch( getDriverOneShot.get<void>( -8 ), { 0x90, 0x89, 0xD9 } );
|
||||
InjectHook( getDriverOneShot.get<void>( -5 ), &CVehicle::GetOneShotOwnerID_SilentPatch, PATCH_CALL );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
@ -220,6 +220,7 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VehicleVC.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc" />
|
||||
|
@ -92,6 +92,9 @@
|
||||
<ClCompile Include="..\SilentPatch\SVF.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VehicleVC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||
|
15
SilentPatchVC/VehicleVC.cpp
Normal file
15
SilentPatchVC/VehicleVC.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "StdAfx.h"
|
||||
#include "VehicleVC.h"
|
||||
|
||||
int32_t CVehicle::GetOneShotOwnerID_SilentPatch() const
|
||||
{
|
||||
if ( m_pDriver != nullptr )
|
||||
{
|
||||
// TODO: Define this as a proper CPhysical
|
||||
uintptr_t ptr = reinterpret_cast<uintptr_t>(m_pDriver);
|
||||
return *reinterpret_cast<int32_t*>( ptr + 0x64 );
|
||||
}
|
||||
|
||||
// Fallback
|
||||
return m_audioEntityId;
|
||||
}
|
@ -21,8 +21,12 @@ protected:
|
||||
CMatrix m_matrix;
|
||||
uint8_t __pad4[16];
|
||||
uint16_t m_modelIndex; // TODO: THE FLA
|
||||
void* m_pFirstReference;
|
||||
int32_t m_audioEntityId; // TODO: This should really be CPhysical
|
||||
uint8_t __pad5[320];
|
||||
void* m_pDriver;
|
||||
|
||||
uint8_t __pad1[414];
|
||||
uint8_t __pad1[80];
|
||||
uint8_t m_BombOnBoard : 3;
|
||||
uint8_t __pad2[17];
|
||||
class CEntity* m_pBombOwner;
|
||||
@ -44,6 +48,8 @@ public:
|
||||
{ m_BombOnBoard = bombOnBoard; }
|
||||
void SetBombOwner( class CEntity* owner )
|
||||
{ m_pBombOwner = owner; }
|
||||
|
||||
int32_t GetOneShotOwnerID_SilentPatch() const;
|
||||
};
|
||||
|
||||
class CAutomobile : public CVehicle
|
||||
|
Loading…
Reference in New Issue
Block a user