@@ -298,6 +298,8 @@ const DWORD RETURN_Idle_CWorld_ProcessPedsAfterPreRender = 0x53EA08;
298
298
299
299
#define HOOKPOS_CAutomobile__dmgDrawCarCollidingParticles 0x6A6FF0
300
300
301
+ #define HOOKPOS_CCollision__CheckCameraCollisionObjects 0x41AB8E
302
+
301
303
CPed* pContextSwitchedPed = 0 ;
302
304
CVector vecCenterOfWorld;
303
305
FLOAT fFalseHeading ;
@@ -541,6 +543,8 @@ void HOOK_CAEAmbienceTrackManager__UpdateAmbienceTrackAndVolume_StopRadio();
541
543
542
544
void HOOK_CAutomobile__dmgDrawCarCollidingParticles ();
543
545
546
+ void HOOK_CCollision__CheckCameraCollisionObjects ();
547
+
544
548
CMultiplayerSA::CMultiplayerSA ()
545
549
{
546
550
// Unprotect all of the GTASA code at once and leave it that way
@@ -774,6 +778,8 @@ void CMultiplayerSA::InitHooks()
774
778
775
779
HookInstall (HOOKPOS_CAutomobile__dmgDrawCarCollidingParticles, (DWORD)HOOK_CAutomobile__dmgDrawCarCollidingParticles, 0x91 );
776
780
781
+ HookInstall (HOOKPOS_CCollision__CheckCameraCollisionObjects, (DWORD)HOOK_CCollision__CheckCameraCollisionObjects, 6 + 4 );
782
+
777
783
// Disable GTA setting g_bGotFocus to false when we minimize
778
784
MemSet ((void *)ADDR_GotFocus, 0x90 , pGameInterface->GetGameVersion () == VERSION_EU_10 ? 6 : 10 );
779
785
@@ -7048,3 +7054,51 @@ void _declspec(naked) HOOK_CAutomobile__dmgDrawCarCollidingParticles()
7048
7054
jmp RETURN_CAutomobile__dmgDrawCarCollidingParticles
7049
7055
}
7050
7056
}
7057
+
7058
+ // Disable camera collisions for projectiles and detached vehicle parts
7059
+ const DWORD RETURN_CCollision__CheckCameraCollisionObjects = 0x41AB98 ;
7060
+ const DWORD RETURN_CCollision__CheckCameraCollisionObjects_2 = 0x41AC26 ;
7061
+
7062
+ bool CanEntityCollideWithCamera (CEntitySAInterface* pEntity)
7063
+ {
7064
+ switch (pEntity->m_nModelIndex )
7065
+ {
7066
+ // projectiles
7067
+ case 342 : // grenade
7068
+ case 343 : // teargas
7069
+ case 344 : // molotov
7070
+ case 363 : // satchel
7071
+
7072
+ // vehicle parts
7073
+ case 374 : // car_door
7074
+ case 375 : // car_bumper
7075
+ case 376 : // car_panel
7076
+ case 377 : // car_bonnet
7077
+ case 378 : // car_boot
7078
+ case 379 : // car_wheel
7079
+ return false ;
7080
+ }
7081
+
7082
+ return true ;
7083
+ }
7084
+
7085
+ void _declspec (naked) HOOK_CCollision__CheckCameraCollisionObjects()
7086
+ {
7087
+ _asm
7088
+ {
7089
+ // Restore instructions replaced by hook
7090
+ jz out2
7091
+ movsx edx, word ptr [esi+22h]
7092
+
7093
+ // Do our stuff
7094
+ push esi // pEntity
7095
+ call CanEntityCollideWithCamera
7096
+ add esp, 4
7097
+ test al, al
7098
+ jnz out1
7099
+ jmp RETURN_CCollision__CheckCameraCollisionObjects_2
7100
+
7101
+ out1: jmp RETURN_CCollision__CheckCameraCollisionObjects
7102
+ out2: jmp RETURN_CCollision__CheckCameraCollisionObjects_2
7103
+ }
7104
+ }
0 commit comments