mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
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.
This commit is contained in:
parent
058bfdea26
commit
87dee5c611
3 changed files with 12 additions and 7 deletions
|
@ -1557,7 +1557,7 @@ void G_DeathMatchSpawnPlayer (int playernum)
|
||||||
if (spot == NULL)
|
if (spot == NULL)
|
||||||
{ // We have a player 1 start, right?
|
{ // We have a player 1 start, right?
|
||||||
spot = &playerstarts[0];
|
spot = &playerstarts[0];
|
||||||
if (spot == NULL)
|
if (spot->type == 0)
|
||||||
{ // Fine, whatever.
|
{ // Fine, whatever.
|
||||||
spot = &deathmatchstarts[0];
|
spot = &deathmatchstarts[0];
|
||||||
}
|
}
|
||||||
|
@ -1573,7 +1573,8 @@ void G_DeathMatchSpawnPlayer (int playernum)
|
||||||
//
|
//
|
||||||
FPlayerStart *G_PickPlayerStart(int playernum, int flags)
|
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))
|
if (!(flags & PPS_NOBLOCKINGCHECK))
|
||||||
{
|
{
|
||||||
|
@ -1592,7 +1593,7 @@ FPlayerStart *G_PickPlayerStart(int playernum, int flags)
|
||||||
{ // Pick an open spot at random.
|
{ // Pick an open spot at random.
|
||||||
return good_starts[pr_pspawn(good_starts.Size())];
|
return good_starts[pr_pspawn(good_starts.Size())];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Pick a spot at random, whether it's open or not.
|
// Pick a spot at random, whether it's open or not.
|
||||||
return &AllPlayerStarts[pr_pspawn(AllPlayerStarts.Size())];
|
return &AllPlayerStarts[pr_pspawn(AllPlayerStarts.Size())];
|
||||||
}
|
}
|
||||||
|
@ -1665,16 +1666,17 @@ void G_DoReborn (int playernum, bool freshbot)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) &&
|
if (!(level.flags2 & LEVEL2_RANDOMPLAYERSTARTS) &&
|
||||||
|
playerstarts[playernum].type != 0 &&
|
||||||
G_CheckSpot (playernum, &playerstarts[playernum]))
|
G_CheckSpot (playernum, &playerstarts[playernum]))
|
||||||
{
|
{
|
||||||
AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum);
|
AActor *mo = P_SpawnPlayer(&playerstarts[playernum], playernum);
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // try to spawn at any random player's spot
|
{ // try to spawn at any random player's spot
|
||||||
FPlayerStart *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM);
|
FPlayerStart *start = G_PickPlayerStart(playernum, PPS_FORCERANDOM);
|
||||||
AActor *mo = P_SpawnPlayer(start, playernum);
|
AActor *mo = P_SpawnPlayer(start, playernum);
|
||||||
if (mo != NULL) P_PlayerStartStomp(mo);
|
if (mo != NULL) P_PlayerStartStomp(mo, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
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);
|
void P_SlideMove (AActor* mo, fixed_t tryx, fixed_t tryy, int numsteps);
|
||||||
bool P_BounceWall (AActor *mo);
|
bool P_BounceWall (AActor *mo);
|
||||||
bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop);
|
bool P_BounceActor (AActor *mo, AActor *BlockingMobj, bool ontop);
|
||||||
|
|
|
@ -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;
|
AActor *th;
|
||||||
FBlockThingsIterator it(FBoundingBox(actor->X(), actor->Y(), actor->radius));
|
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))
|
if (th->player == NULL && !(th->flags3 & MF3_ISMONSTER))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (th->player != NULL && mononly)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (actor->Z() > th->Top())
|
if (actor->Z() > th->Top())
|
||||||
continue; // overhead
|
continue; // overhead
|
||||||
if (actor->Top() < th->Z())
|
if (actor->Top() < th->Z())
|
||||||
|
|
Loading…
Reference in a new issue