SA: Invert a CPed::IsAlive check in

CTaskComplexEnterCar::CreateNextSubTask
to avoid assigning CTaskComplexLeaveCarAndDie to alive drivers

Fixes a bug where stealing the car from the passenger side while holding
throttle and/or brake would kill the driver, or briefly resurrect them
if they were already dead.
This commit is contained in:
Silent 2024-05-26 15:04:24 +02:00
parent 432ca9fee8
commit fe53b68248
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1

View File

@ -5361,6 +5361,13 @@ void Patch_SA_10(HINSTANCE hInstance)
}
// Invert a CPed::IsAlive check in CTaskComplexEnterCar::CreateNextSubTask to avoid assigning
// CTaskComplexLeaveCarAndDie to alive drivers
// Fixes a bug where stealing the car from the passenger side while holding throttle and/or brake would kill the driver,
// or briefly resurrect them if they were already dead
Patch<uint8_t>(0x63F576, 0x75);
#if FULL_PRECISION_D3D
// Test - full precision D3D device
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
@ -7327,6 +7334,19 @@ void Patch_SA_NewBinaries_Common(HINSTANCE hInstance)
HookEach_Rand(rands, InterceptCall);
}
TXN_CATCH();
// Invert a CPed::IsAlive check in CTaskComplexEnterCar::CreateNextSubTask to avoid assigning
// CTaskComplexLeaveCarAndDie to alive drivers
// Fixes a bug where stealing the car from the passenger side while holding throttle and/or brake would kill the driver,
// or briefly resurrect them if they were already dead
try
{
auto isAlive = get_pattern("74 38 E8 ? ? ? ? 8B F8");
Patch<uint8_t>(isAlive, 0x75);
}
TXN_CATCH();
}