From 99b00f46610ed29814ad00cd0ee1937fcff11744 Mon Sep 17 00:00:00 2001 From: PermaNull Date: Sun, 12 Jan 2020 19:51:31 -0800 Subject: [PATCH] Damage fixes to repair traps and AI damage. --- T4MP/Engine.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/T4MP/Engine.cpp b/T4MP/Engine.cpp index 3c69d95..5cec184 100644 --- a/T4MP/Engine.cpp +++ b/T4MP/Engine.cpp @@ -634,9 +634,11 @@ __declspec(naked) void DamagePlayer() PUSHAD PUSHFD - + mov eax,[ecx] + cmp eax,0x656B98 + jnz normal_ret } - + /* If we're not the server we update the pointer of the damage to be 0 so that the client applies no damage. This is a problem, because the damage function is also used to determine if an client should trigger events. @@ -661,14 +663,15 @@ __declspec(naked) void DamagePlayer() __asm { - POPFD - POPAD + normal_ret: + POPFD + POPAD - or dword ptr[ecx+0x28],2 - mov eax, 0x0051E570 - jmp eax - push DamagePlayer_Ret - ret + or dword ptr[ecx + 0x28], 2 + mov eax, 0x0051E570 + jmp eax + push DamagePlayer_Ret + ret } } @@ -715,6 +718,7 @@ __declspec(naked) void KillPlayer() player->death_type = death_type; } } + } __asm @@ -758,6 +762,9 @@ tIsDead pIsDead; BOOL __stdcall IsDead(DMPlayer* pDMPlayer) { + if (*(DWORD*)pDMPlayer != 0x656B98) + return pIsDead(pDMPlayer); + if (t4net.server) return pIsDead(pDMPlayer); else