From 87dee5c611ee87bbdc84c761587d3324fd9ab9c3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 28 Jan 2016 20:08:09 -0600 Subject: [PATCH] Fixed: Co-op players could spawn at (0,0) if no start spots for them - Check if a co-op start exists. If not, pick one at random. - Don't telefrag other players when spawning in co-op games, since you're allowed to move out of other players now. --- src/g_game.cpp | 12 +++++++----- src/p_local.h | 2 +- src/p_map.cpp | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 799a4e7aa..c97ea2198 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1557,7 +1557,7 @@ void G_DeathMatchSpawnPlayer (int playernum) if (spot == NULL) { // We have a player 1 start, right? spot = &playerstarts[0]; - if (spot == NULL) + if (spot->type == 0) { // Fine, whatever. spot = &deathmatchstarts[0]; } @@ -1573,7 +1573,8 @@ void G_DeathMatchSpawnPlayer (int playernum) // FPlayerStart *G_PickPlayerStart(int playernum, int flags) { - if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM)) + if ((level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) || (flags & PPS_FORCERANDOM) || + playerstarts[playernum].type == 0) { if (!(flags & PPS_NOBLOCKINGCHECK)) { @@ -1592,7 +1593,7 @@ FPlayerStart *G_PickPlayerStart(int playernum, int flags) { // Pick an open spot at random. return good_starts[pr_pspawn(good_starts.Size())]; } - } + } // Pick a spot at random, whether it's open or not. return &AllPlayerStarts[pr_pspawn(AllPlayerStarts.Size())]; } @@ -1665,16 +1666,17 @@ void G_DoReborn (int playernum, bool freshbot) } if (!(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) && + playerstarts[playernum].type != 0 && G_CheckSpot (playernum, &playerstarts[playernum])) { AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum); - if (mo != NULL) P_PlayerStartStomp(mo); + if (mo != NULL) P_PlayerStartStomp(mo, true); } else { // try to spawn at any random player's spot FPlayerStart *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM); AActor *mo = P_SpawnPlayer(start, playernum); - if (mo != NULL) P_PlayerStartStomp(mo); + if (mo != NULL) P_PlayerStartStomp(mo, true); } } } diff --git a/src/p_local.h b/src/p_local.h index 420fff565..c39bcef78 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -485,7 +485,7 @@ inline bool P_TeleportMove(AActor* thing, const fixedvec3 &pos, bool telefrag, b { return P_TeleportMove(thing, pos.x, pos.y, pos.z, telefrag, modifyactor); } -void P_PlayerStartStomp (AActor *actor); // [RH] Stomp on things for a newly spawned player +void P_PlayerStartStomp (AActor *actor, bool mononly=false); // [RH] Stomp on things for a newly spawned player void P_SlideMove (AActor* mo, fixed_t tryx, fixed_t tryy, int numsteps); bool P_BounceWall (AActor *mo); bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop); diff --git a/src/p_map.cpp b/src/p_map.cpp index d096beb0d..7fd0ece38 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -504,7 +504,7 @@ bool P_TeleportMove(AActor *thing, fixed_t x, fixed_t y, fixed_t z, bool telefra // //========================================================================== -void P_PlayerStartStomp(AActor *actor) +void P_PlayerStartStomp(AActor *actor, bool mononly) { AActor *th; FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius)); @@ -525,6 +525,9 @@ void P_PlayerStartStomp(AActor *actor) if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER)) continue; + if (th->player != NULL && mononly) + continue; + if (actor->Z() > th->Top()) continue; // overhead if (actor->Top() < th->Z())