From f82c2170476edf121c14ef16f995ac9ee60b19b6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 7 Mar 2016 10:53:51 -0600 Subject: [PATCH] Fixed: In multiplayer, players could spawn at voodoo doll starts - This could happen in co-op games that did not have enough player starts for all the players spawning. Voodoo doll starts were not excluded from the set of possible starts as they should have been. --- src/p_mobj.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index aa3691afa..cfbce5a73 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5020,7 +5020,29 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) // save spots for respawning in network games FPlayerStart start(mthing, pnum+1); playerstarts[pnum] = start; - AllPlayerStarts.Push(start); + if (level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) + { // When using random player starts, all starts count + AllPlayerStarts.Push(start); + } + else + { // When not using random player starts, later single player + // starts should override earlier ones, since the earlier + // ones are for voodoo dolls and not likely to be ideal for + // spawning regular players. + unsigned i; + for (i = 0; i < AllPlayerStarts.Size(); ++i) + { + if (AllPlayerStarts[i].type == pnum+1) + { + AllPlayerStarts[i] = start; + break; + } + } + if (i == AllPlayerStarts.Size()) + { + AllPlayerStarts.Push(start); + } + } if (!deathmatch && !(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS)) { return P_SpawnPlayer(&start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);