@@ -282,6 +282,8 @@ DWORD RETURN_CObject_ProcessCollision = 0x548DD1;
282
282
DWORD JMP_DynamicObject_Cond_Zero = 0x548E98 ;
283
283
#define HOOKPOS_CGlass_WindowRespondsToCollision 0x71BC40
284
284
DWORD RETURN_CGlass_WindowRespondsToCollision = 0x71BC48 ;
285
+ #define HOOKPOS_CGlass__BreakGlassPhysically 0x71D14B
286
+ DWORD RETURN_CGlass__BreakGlassPhysically = 0x71D150 ;
285
287
286
288
#define HOOKPOS_FxManager_c__DestroyFxSystem 0x4A989A
287
289
@@ -499,6 +501,7 @@ void HOOK_CObject_ProcessDamage ();
499
501
void HOOK_CObject_ProcessBreak ();
500
502
void HOOK_CObject_ProcessCollision ();
501
503
void HOOK_CGlass_WindowRespondsToCollision ();
504
+ void HOOK_CGlass__BreakGlassPhysically ();
502
505
503
506
void HOOK_FxManager_c__DestroyFxSystem ();
504
507
@@ -706,6 +709,7 @@ void CMultiplayerSA::InitHooks()
706
709
HookInstall ( HOOKPOS_CObject_ProcessBreak, (DWORD)HOOK_CObject_ProcessBreak, 5 );
707
710
HookInstall ( HOOKPOS_CObject_ProcessCollision, (DWORD)HOOK_CObject_ProcessCollision, 10 );
708
711
HookInstall ( HOOKPOS_CGlass_WindowRespondsToCollision, (DWORD)HOOK_CGlass_WindowRespondsToCollision, 8 );
712
+ HookInstall ( HOOKPOS_CGlass__BreakGlassPhysically, (DWORD)HOOK_CGlass__BreakGlassPhysically, 5 );
709
713
710
714
// Post-destruction hook for FxSystems
711
715
HookInstall ( HOOKPOS_FxManager_c__DestroyFxSystem, (DWORD)HOOK_FxManager_c__DestroyFxSystem, 5 );
@@ -6609,6 +6613,41 @@ void _declspec(naked) HOOK_CGlass_WindowRespondsToCollision ()
6609
6613
}
6610
6614
}
6611
6615
6616
+ // Called when glass object is being broken by ped melee attack
6617
+ DWORD dummy_404350 = 0x404350 ;
6618
+ void _declspec (naked) HOOK_CGlass__BreakGlassPhysically ()
6619
+ {
6620
+ _asm
6621
+ {
6622
+ mov pDamagedObject, esi
6623
+ }
6624
+ // we can't get attacker from here
6625
+ pObjectAttacker = NULL ;
6626
+
6627
+ if ( TriggerObjectBreakEvent () )
6628
+ {
6629
+ _asm
6630
+ {
6631
+ // restore replaced part
6632
+ push dummy_404350
6633
+ // jump outside of the hook
6634
+ jmp RETURN_CGlass__BreakGlassPhysically
6635
+ }
6636
+ }
6637
+ else
6638
+ {
6639
+ _asm
6640
+ {
6641
+ pop edi
6642
+ pop esi
6643
+ pop ebp
6644
+ pop ebx
6645
+ add esp, 0BCh
6646
+ retn
6647
+ }
6648
+ }
6649
+ }
6650
+
6612
6651
void * pFxSystemToBeDestroyed;
6613
6652
void FxManager_c__DestroyFxSystem ()
6614
6653
{
0 commit comments