mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 14:52:30 +01:00
Play passenger's voice lines when killing peds with car, not only when hitting them damages player's vehicle
This commit is contained in:
parent
2dfc9d30be
commit
914d482d0d
@ -23,6 +23,8 @@ static RwTexture*& ms_pRemapTexture = **AddressByVersion<RwTexture***>(0x59F1BD,
|
||||
|
||||
auto SetEditableMaterialsCB = AddressByVersion<RpAtomic*(*)(RpAtomic*,void*)>(0x4C83E0, 0x4C8460, 0x4D2CE0);
|
||||
|
||||
void* (CEntity::*CEntity::orgGetColModel)();
|
||||
|
||||
static void ResetEditableMaterials(std::pair<void*,int>* pData)
|
||||
{
|
||||
for ( auto* i = pData; i->first != nullptr; i++ )
|
||||
|
@ -196,9 +196,14 @@ public:
|
||||
uint8_t nStatus : 5; // control status // 0x36
|
||||
//********* END CEntityInfo ************//
|
||||
|
||||
public:
|
||||
static void* (CEntity::*orgGetColModel)();
|
||||
|
||||
public:
|
||||
uint8_t GetStatus() const { return nStatus; }
|
||||
|
||||
void* GetColModel() { return std::invoke(orgGetColModel, this); }
|
||||
|
||||
bool IsVisible();
|
||||
|
||||
void SetPositionAndAreaCode( CVector position );
|
||||
|
@ -7,6 +7,9 @@ WRAPPER unsigned char CPed::GetWeaponSkill() { VARJMP(varGetWeaponSkill); }
|
||||
static void* varSetGunFlashAlpha = AddressByVersion<void*>(0x5DF400, 0x5DFC20, 0x5FC120);
|
||||
WRAPPER void CPed::SetGunFlashAlpha(bool bSecondWeapon) { WRAPARG(bSecondWeapon); VARJMP(varSetGunFlashAlpha); }
|
||||
|
||||
static void* varSay = AddressByVersion<void*>(0x5EFFE0, 0, 0); // TODO: Do
|
||||
WRAPPER void CPed::Say(uint16_t phrase, uint32_t param2, float volume, bool param4, bool param5, bool param6) { VARJMP(varSay); }
|
||||
|
||||
static void* varGetTaskJetPack = AddressByVersion<void*>(0x601110, 0x601930, 0x620E70);
|
||||
WRAPPER CTaskSimpleJetPack* CPedIntelligence::GetTaskJetPack() const { VARJMP(varGetTaskJetPack); }
|
||||
|
||||
|
@ -312,6 +312,7 @@ public:
|
||||
unsigned char GetWeaponSkill();
|
||||
void ResetGunFlashAlpha();
|
||||
void SetGunFlashAlpha(bool bSecondWeapon);
|
||||
void Say(uint16_t phrase, uint32_t param2 = 0, float volume = 1.0f, bool param4 = false, bool param5 = false, bool param6 = false);
|
||||
|
||||
void RenderWeapon(bool bMuzzleFlash, bool bForShadow);
|
||||
void RenderForShadow();
|
||||
|
@ -3701,6 +3701,11 @@ void Patch_SA_10()
|
||||
// Tug tow bar (misc_b instead of misc_a
|
||||
Nop( 0x6AF2CC, 1 );
|
||||
InjectHook( 0x6AF2CC + 1, &CAutomobile::GetTowBarFrame, PATCH_CALL );
|
||||
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
void Patch_SA_11()
|
||||
|
@ -345,6 +345,21 @@ bool CVehicle::HasFirelaLadder() const
|
||||
return SVF::ModelHasFeature( m_nModelIndex.Get(), SVF::Feature::FIRELA_LADDER );
|
||||
}
|
||||
|
||||
void* CVehicle::PlayPedHitSample_GetColModel()
|
||||
{
|
||||
if ( this == FindPlayerVehicle() )
|
||||
{
|
||||
CPed *pPassenger = PickRandomPassenger();
|
||||
if ( pPassenger != nullptr )
|
||||
{
|
||||
constexpr uint16_t CONTEXT_GLOBAL_CAR_HIT_PED = 36;
|
||||
pPassenger->Say( CONTEXT_GLOBAL_CAR_HIT_PED );
|
||||
}
|
||||
}
|
||||
|
||||
return GetColModel();
|
||||
}
|
||||
|
||||
void CVehicle::SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha)
|
||||
{
|
||||
RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic);
|
||||
@ -421,6 +436,18 @@ void CVehicle::SetComponentRotation( RwFrame* component, eRotAxis axis, float an
|
||||
matrix.UpdateRW();
|
||||
}
|
||||
|
||||
CPed* CVehicle::PickRandomPassenger()
|
||||
{
|
||||
const unsigned int randomNum = static_cast<unsigned int>((static_cast<double>(rand()) / RAND_MAX) * 8.0);
|
||||
for ( size_t i = 0; i < 8; i++ )
|
||||
{
|
||||
const size_t index = (i + randomNum) % 8;
|
||||
if ( m_apPassengers[index] != nullptr ) return m_apPassengers[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CHeli::Render()
|
||||
{
|
||||
double dRotorsSpeed, dMovingRotorSpeed;
|
||||
|
@ -261,8 +261,10 @@ public:
|
||||
//void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo);
|
||||
|
||||
bool HasFirelaLadder() const;
|
||||
void* PlayPedHitSample_GetColModel();
|
||||
|
||||
bool IsLawEnforcementVehicle();
|
||||
CPed* PickRandomPassenger();
|
||||
|
||||
static void SetComponentRotation( RwFrame* component, eRotAxis axis, float angle, bool absolute = true );
|
||||
static void SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha);
|
||||
|
Loading…
Reference in New Issue
Block a user