From 8fa438dc0b5611ee9ea89f3388543c6f68bc01dd Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 15 Jan 2018 17:46:21 +0000 Subject: [PATCH] Fix friendly fire damage conditions in multiplayer. Patch from Striker. git-svn-id: https://svn.eduke32.com/eduke32@6578 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 8766cdab9..b3f254fcc 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -1029,10 +1029,21 @@ int A_IncurDamage(int const spriteNum) int const playerNum = P_GetP(pSprite); - if (pActor->owner >= 0 && ud.ffire == 0 && sprite[pActor->owner].picnum == APLAYER && - (g_gametypeFlags[ud.coop] & GAMETYPE_PLAYERSFRIENDLY || - (g_gametypeFlags[ud.coop] & GAMETYPE_TDM && g_player[playerNum].ps->team == g_player[P_Get(pActor->owner)].ps->team))) - return -1; + if (pActor->owner >= 0 && (sprite[pActor->owner].picnum == APLAYER)) + { + if ( + (ud.ffire == 0) && + (spriteNum != pActor->owner) && // Not damaging self. + ((g_gametypeFlags[ud.coop] & GAMETYPE_PLAYERSFRIENDLY) || + ((g_gametypeFlags[ud.coop] & GAMETYPE_TDM) && g_player[playerNum].ps->team == g_player[P_Get(pActor->owner)].ps->team)) + ) + { + // Nullify damage and cancel. + pActor->owner = -1; + pActor->extra = -1; + return -1; + } + } pSprite->extra -= pActor->extra;