From 21ea68d552a8d4d1292587339f6e4dac513a94f4 Mon Sep 17 00:00:00 2001 From: Nash Muhandes Date: Wed, 24 Feb 2021 01:35:06 +0800 Subject: [PATCH] Fix player not being able to talk to a Strife NPC during netplay, if another player talked to that NPC first. (#1312) The ConversationNPC and ConversationPC fields were not cleared if the conversation was closed by selecting the goodbye option, or if the conversation was closed from the item checks. https://forum.zdoom.org/viewtopic.php?f=2&t=53655 --- src/p_conversation.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 9b662a46e..69ed835a8 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -151,6 +151,22 @@ int FLevelLocals::FindNode (const FStrifeDialogueNode *node) return rootnode; } +//============================================================================ +// +// ClearConversationStuff +// +// Clear the conversation pointers on the player +// +//============================================================================ + +static void ClearConversationStuff(player_t* player) +{ + player->ConversationFaceTalker = false; + player->ConversationNPC = nullptr; + player->ConversationPC = nullptr; + player->ConversationNPCAngle = 0.; +} + //============================================================================ // // CheckStrifeItem @@ -471,6 +487,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply if (!(npc->flags8 & MF8_DONTFACETALKER)) npc->Angles.Yaw = player->ConversationNPCAngle; npc->flags5 &= ~MF5_INCONVERSATION; + if (gameaction != ga_slideshow) ClearConversationStuff(player); return; } @@ -488,6 +505,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply if (!(npc->flags8 & MF8_DONTFACETALKER)) npc->Angles.Yaw = player->ConversationNPCAngle; npc->flags5 &= ~MF5_INCONVERSATION; + if (gameaction != ga_slideshow) ClearConversationStuff(player); return; } } @@ -626,10 +644,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply if (gameaction != ga_slideshow) { npc->flags5 &= ~MF5_INCONVERSATION; - player->ConversationFaceTalker = false; - player->ConversationNPC = nullptr; - player->ConversationPC = nullptr; - player->ConversationNPCAngle = 0.; + ClearConversationStuff(player); } if (isconsole) @@ -673,10 +688,7 @@ void P_ConversationCommand (int netcode, int pnum, uint8_t **stream) } if (netcode == DEM_CONVNULL) { - player->ConversationFaceTalker = false; - player->ConversationNPC = nullptr; - player->ConversationPC = nullptr; - player->ConversationNPCAngle = 0.; + ClearConversationStuff(player); } } }