This commit is contained in:
Christoph Oelckers 2016-09-25 10:28:51 +02:00
commit d65589281f
3 changed files with 26 additions and 16 deletions

View File

@ -60,6 +60,7 @@ void DSectorEffect::Destroy()
}
DSectorEffect::DSectorEffect (sector_t *sector)
: DThinker(STAT_SECTOREFFECT)
{
m_Sector = sector;
}

View File

@ -1207,29 +1207,23 @@ void G_FinishTravel ()
pnum = int(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!
start = G_PickPlayerStart(pnum, PPS_FORCERANDOM);
if (start != NULL) pawndup = P_SpawnPlayer(start, pnum, (level.flags2 & LEVEL2_PRERAISEWEAPON) ? SPF_WEAPONFULLYUP : 0);
if (pawndup == NULL)
{
pawn->flags |= MF_NOSECTOR | MF_NOBLOCKMAP;
pawn->Destroy();
continue;
}
}
start = G_PickPlayerStart(pnum, 0);
if (start == NULL)
{
start = G_PickPlayerStart(pnum, 0);
if (start == NULL)
if (pawndup != nullptr)
{
Printf(TEXTCOLOR_RED "No player %d start to travel to!\n", pnum + 1);
// Move to the coordinates this player had when they left the level.
pawn->SetXYZ(pawndup->Pos());
}
else
{
// Could not find a start for this player at all. This really should never happen but if it does, let's better abort.
DThinker::DestroyThinkersInList(STAT_TRAVELLING);
I_Error ("No player %d start to travel to!\n", pnum + 1);
}
}
oldpawn = pawndup;
@ -1266,8 +1260,11 @@ void G_FinishTravel ()
pawn->player->camera = pawn;
pawn->player->viewheight = pawn->ViewHeight;
pawn->flags2 &= ~MF2_BLASTED;
DObject::StaticPointerSubstitution (oldpawn, pawn);
oldpawn->Destroy();
if (oldpawn != nullptr)
{
DObject::StaticPointerSubstitution (oldpawn, pawn);
oldpawn->Destroy();
}
if (pawndup != NULL)
{
pawndup->Destroy();

View File

@ -642,6 +642,11 @@ static void ReadOnePlayer(FSerializer &arc, bool skipload)
{
CopyPlayer(&players[i], &playerTemp, name);
}
else
{
// we need the player actor, so that G_FinishTravel can destroy it later.
players[i].mo = playerTemp.mo;
}
}
else
{
@ -755,6 +760,13 @@ static void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayers
}
}
}
else
{
for (i = 0; i < MAXPLAYERS; ++i)
{
players[i].mo = playertemp[i].mo;
}
}
delete[] tempPlayerUsed;
delete[] playertemp;