From 959fb2577bdd8187c26bae8213ccf4d80f5f07e1 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 14 Mar 2017 04:02:40 -0400 Subject: [PATCH] - Unfriendly players now spawn at deathmatch starts. --- src/g_game.cpp | 4 +++- src/p_setup.cpp | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 92ccc65556..447fb82dbe 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1766,6 +1766,8 @@ void G_DoReborn (int playernum, bool freshbot) } else { + bool isUnfriendly = players[playernum].mo && !(players[playernum].mo->flags & MF_FRIENDLY); + // respawn at the start // first disassociate the corpse if (players[playernum].mo) @@ -1775,7 +1777,7 @@ void G_DoReborn (int playernum, bool freshbot) } // spawn at random spot if in deathmatch - if (deathmatch) + if (deathmatch || isUnfriendly) { G_DeathMatchSpawnPlayer (playernum); return; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index eccad199e0..064a92a1f6 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -4080,6 +4080,22 @@ void P_SetupLevel (const char *lumpname, int position) } } + // [SP] move unfriendly players around + // horribly hacky - yes, this needs rewritten. + for (i = 0; i < MAXPLAYERS; ++i) + { + if (playeringame[i] && players[i].mo != NULL) + { + if (!(players[i].mo->flags & MF_FRIENDLY)) + { + AActor * oldSpawn = players[i].mo; + G_DeathMatchSpawnPlayer (i); + oldSpawn->Destroy(); + } + } + } + + // Don't count monsters in end-of-level sectors if option is on if (dmflags2 & DF2_NOCOUNTENDMONST) {