Prevent "ped hit" samples from playing where they used to, so passengers don't comment on gently pushing peds

This commit is contained in:
Silent 2018-09-22 23:54:25 +02:00
parent 914d482d0d
commit 1a92ebb95d
No known key found for this signature in database
GPG key ID: AE53149BB0C45AF1
3 changed files with 13 additions and 1 deletions

View file

@ -319,8 +319,19 @@ public:
static void (CPed::*orgGiveWeapon)(uint32_t weapon, uint32_t ammo, bool flag);
void GiveWeapon_SP( uint32_t weapon, uint32_t ammo, bool flag );
template<uint16_t blackSample>
void Say_SampleBlackList(uint16_t phrase, uint32_t param2 = 0, float volume = 1.0f, bool param4 = false, bool param5 = false, bool param6 = false)
{
if ( !(phrase == blackSample) )
{
Say( phrase, param2, volume, param4, param5, param6 );
}
}
};
constexpr uint16_t CONTEXT_GLOBAL_CAR_HIT_PED = 36; // CPed::Say enum
class NOVMT CPlayerPed : public CPed
{
private:

View file

@ -3706,6 +3706,8 @@ void Patch_SA_10()
// Play passenger's voice lines when killing peds with car, not only when hitting them damages player's vehicle
ReadCall( 0x5F05CA, CEntity::orgGetColModel );
InjectHook( 0x5F05CA, &CVehicle::PlayPedHitSample_GetColModel );
// Prevent samples from playing where they used to, so passengers don't comment on gently pushing peds
InjectHook( 0x6A8298, &CPed::Say_SampleBlackList<CONTEXT_GLOBAL_CAR_HIT_PED> );
}
void Patch_SA_11()

View file

@ -352,7 +352,6 @@ void* CVehicle::PlayPedHitSample_GetColModel()
CPed *pPassenger = PickRandomPassenger();
if ( pPassenger != nullptr )
{
constexpr uint16_t CONTEXT_GLOBAL_CAR_HIT_PED = 36;
pPassenger->Say( CONTEXT_GLOBAL_CAR_HIT_PED );
}
}