Added level transition spawning for missing starts

- Additional player bodies are spawned for any absent starts in co-op.
- Removed now-redundant bot start limitation
This commit is contained in:
Edward Richardson 2016-01-30 22:02:27 +13:00
parent 409525cde6
commit c1e362ee83
3 changed files with 66 additions and 63 deletions

View file

@ -369,14 +369,6 @@ bool FCajunMaster::DoAddBot (BYTE *info, botskill_t skill)
D_ReadUserInfoStrings (bnum, &info, false);
if (!deathmatch && playerstarts[bnum].type == 0)
{
Printf ("%s tried to join, but there was no player %d start\n",
players[bnum].userinfo.GetName(), bnum+1);
ClearPlayer (bnum, false); // Make the bot inactive again
return false;
}
multiplayer = true; //Prevents cheating and so on; emulates real netgame (almost).
players[bnum].Bot = new DBot;
players[bnum].Bot->player = &players[bnum];

View file

@ -1422,6 +1422,8 @@ bool G_CheckSpot (int playernum, FPlayerStart *mthing)
fixed_t z, oldz;
int i;
if (mthing->type == 0) return false;
x = mthing->x;
y = mthing->y;
z = mthing->z;

View file

@ -1195,26 +1195,36 @@ void G_FinishTravel ()
TThinkerIterator<APlayerPawn> it (STAT_TRAVELLING);
APlayerPawn *pawn, *pawndup, *oldpawn, *next;
AInventory *inv;
FPlayerStart *start;
int pnum;
next = it.Next ();
while ( (pawn = next) != NULL)
{
next = it.Next ();
pnum = (pawn->player - players);
pawn->ChangeStatNum (STAT_PLAYER);
pawndup = pawn->player->mo;
start = NULL;
assert (pawn != pawndup);
if (pawndup == NULL)
{ // Oh no! there was no start for this player!
pawn->flags |= MF_NOSECTOR|MF_NOBLOCKMAP;
pawn->Destroy ();
}
else
start = G_PickPlayerStart(pnum, PPS_FORCERANDOM);
pawndup = P_SpawnPlayer(start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
if (pawndup == NULL)
{
pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP;
pawn->Destroy();
continue;
}
}
if (start == NULL) start = G_PickPlayerStart(pnum, 0);
oldpawn = pawndup;
// The player being spawned here is a short lived dummy and
// must not start any ENTER script or big problems will happen.
pawndup = P_SpawnPlayer (&playerstarts[pawn->player - players], int(pawn->player - players), SPF_TEMPPLAYER);
pawndup = P_SpawnPlayer(start, pnum, SPF_TEMPPLAYER);
if (!(changeflags & CHANGELEVEL_KEEPFACING))
{
pawn->angle = pawndup->angle;
@ -1264,7 +1274,6 @@ void G_FinishTravel ()
FBehavior::StaticStartTypedScripts (SCRIPT_Return, pawn, true);
}
}
}
bglobal.FinishTravel ();
}