From a3f39c37898d6fea7d961d95243db2de3d144795 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 28 Sep 2006 07:37:19 +0000 Subject: [PATCH] - Fixed: Monsters should never target friends, even if the friendliness state has changed since the target has been acquired. - Fixed: Multiplayer telefrag obituaries must be handled before weapon dependent obituary messages. SVN r341 (trunk) --- docs/rh-log.txt | 6 +++++ src/g_doom/a_archvile.cpp | 8 +++++++ src/p_enemy.cpp | 47 ++++++++++++++++++++++++++++----------- src/p_interaction.cpp | 33 ++++++++++++++------------- 4 files changed, 66 insertions(+), 28 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 916120df4c..9231b43277 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +September 27, 2006 (Changes by Graf Zahl) +- Fixed: Monsters should never target friends, even if the friendliness + state has changed since the target has been acquired. +- Fixed: Multiplayer telefrag obituaries must be handled before weapon + dependent obituary messages. + September 26, 2006 - PClass::StaticInit() now sorts the class metadata so that operations that iterate over it (such as the "give all" cheat) are compiler-independant. diff --git a/src/g_doom/a_archvile.cpp b/src/g_doom/a_archvile.cpp index b41e54a869..b607182915 100644 --- a/src/g_doom/a_archvile.cpp +++ b/src/g_doom/a_archvile.cpp @@ -241,6 +241,14 @@ void A_VileChase (AActor *self) temp = self->target; self->target = corpsehit; A_FaceTarget (self); + if (self->flags & MF_FRIENDLY) + { + // If this is a friendly Arch-Vile (which is turning the resurrected monster into its friend) + // and the Arch-Vile is currently targetting the resurrected monster the target must be cleared. + if (self->lastenemy == temp) self->lastenemy = NULL; + if (temp == self->target) temp = NULL; + + } self->target = temp; // Make the state the monster enters customizable - but leave the diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index f62016ce40..53e67cc1fb 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1210,9 +1210,16 @@ bool P_LookForTID (AActor *actor, INTBOOL allaround) // Use last known enemy if no hatee sighted -- killough 2/15/98: if (actor->lastenemy != NULL && actor->lastenemy->health > 0) { - actor->target = actor->lastenemy; - actor->lastenemy = NULL; - return true; + if (!actor->IsFriend(actor->lastenemy)) + { + actor->target = actor->lastenemy; + actor->lastenemy = NULL; + return true; + } + else + { + actor->lastenemy = NULL; + } } } return false; @@ -1351,12 +1358,19 @@ bool P_LookForEnemies (AActor *actor, INTBOOL allaround) actor->target = actor->goal; return true; } - // Use last known enemy if no enemies sighted -- killough 2/15/98: + // Use last known enemy if no hatee sighted -- killough 2/15/98: if (actor->lastenemy != NULL && actor->lastenemy->health > 0) { - actor->target = actor->lastenemy; - actor->lastenemy = NULL; - return true; + if (!actor->IsFriend(actor->lastenemy)) + { + actor->target = actor->lastenemy; + actor->lastenemy = NULL; + return true; + } + else + { + actor->lastenemy = NULL; + } } } return false; @@ -1437,12 +1451,19 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround) actor->target = actor->goal; return true; } - // Use last known enemy if no players sighted -- killough 2/15/98: + // Use last known enemy if no hatee sighted -- killough 2/15/98: if (actor->lastenemy != NULL && actor->lastenemy->health > 0) { - actor->target = actor->lastenemy; - actor->lastenemy = NULL; - return true; + if (!actor->IsFriend(actor->lastenemy)) + { + actor->target = actor->lastenemy; + actor->lastenemy = NULL; + return true; + } + else + { + actor->lastenemy = NULL; + } } } return actor->target == actor->goal && actor->goal != NULL; @@ -1799,8 +1820,8 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi } } - // [RH] If the target is dead (and not a goal), stop chasing it. - if (actor->target && actor->target != actor->goal && actor->target->health <= 0) + // [RH] If the target is dead or a friend (and not a goal), stop chasing it. + if (actor->target && actor->target != actor->goal && (actor->target->health <= 0 || actor->IsFriend(actor->target))) actor->target = NULL; // [RH] Friendly monsters will consider chasing whoever hurts a player if they diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 51014ac182..4dc71376aa 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -273,25 +273,28 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker) } else { - if (inflictor != NULL) - { - message = inflictor->GetClass()->Meta.GetMetaString (AMETA_Obituary); - } - if (message == NULL && attacker->player->ReadyWeapon != NULL) - { - message = attacker->player->ReadyWeapon->GetClass()->Meta.GetMetaString (AMETA_Obituary); - } + if (mod == MOD_TELEFRAG) message = GStrings("OB_MPTELEFRAG"); if (message == NULL) { - switch (mod) + if (inflictor != NULL) { - case MOD_R_SPLASH: messagename = "OB_MPR_SPLASH"; break; - case MOD_BFG_SPLASH: messagename = "OB_MPBFG_SPLASH"; break; - case MOD_TELEFRAG: messagename = "OB_MPTELEFRAG"; break; - case MOD_RAILGUN: messagename = "OB_RAILGUN"; break; + message = inflictor->GetClass()->Meta.GetMetaString (AMETA_Obituary); + } + if (message == NULL && attacker->player->ReadyWeapon != NULL) + { + message = attacker->player->ReadyWeapon->GetClass()->Meta.GetMetaString (AMETA_Obituary); + } + if (message == NULL) + { + switch (mod) + { + case MOD_R_SPLASH: messagename = "OB_MPR_SPLASH"; break; + case MOD_BFG_SPLASH: messagename = "OB_MPBFG_SPLASH"; break; + case MOD_RAILGUN: messagename = "OB_RAILGUN"; break; + } + if (messagename != NULL) + message = GStrings(messagename); } - if (messagename != NULL) - message = GStrings(messagename); } } }