mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-01 00:21:35 +00:00
- undid part of the last commit and hopefully corrected it for good now.
We have to be extremely careful with the player data, because there's just too much code littered around that has certain expectations about what needs to be present and what not. Obviously, when travelling in a hub, the player_t should be retained from the previous level. But we still have to set player_t::mo to the PlayerPawn from the savegame so that G_UnsnapshotLevel doesn't prematurely delete it and all associated voodoo dolls, because it checks player_t::mo to decide whether a player is valid or not. The actual deletion of this redundant PlayerPawn should only be done in G_FinishTravel, after the actual player has been fully set up
This commit is contained in:
parent
6a6a0e8017
commit
92d0043a81
1 changed files with 19 additions and 4 deletions
|
@ -537,7 +537,7 @@ void P_SerializeSounds(FSerializer &arc)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void CopyPlayer(player_t *dst, player_t *src, const char *name);
|
void CopyPlayer(player_t *dst, player_t *src, const char *name);
|
||||||
static void ReadOnePlayer(FSerializer &arc);
|
static void ReadOnePlayer(FSerializer &arc, bool skipload);
|
||||||
static void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
|
static void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
|
||||||
static void SpawnExtraPlayers();
|
static void SpawnExtraPlayers();
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ void P_SerializePlayers(FSerializer &arc, bool skipload)
|
||||||
// first player present, no matter what their name.
|
// first player present, no matter what their name.
|
||||||
if (numPlayers == 1)
|
if (numPlayers == 1)
|
||||||
{
|
{
|
||||||
ReadOnePlayer(arc);
|
ReadOnePlayer(arc, skipload);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -617,7 +617,7 @@ void P_SerializePlayers(FSerializer &arc, bool skipload)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void ReadOnePlayer(FSerializer &arc)
|
static void ReadOnePlayer(FSerializer &arc, bool skipload)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
@ -636,9 +636,17 @@ static void ReadOnePlayer(FSerializer &arc)
|
||||||
didIt = true;
|
didIt = true;
|
||||||
player_t playerTemp;
|
player_t playerTemp;
|
||||||
playerTemp.Serialize(arc);
|
playerTemp.Serialize(arc);
|
||||||
|
if (!skipload)
|
||||||
|
{
|
||||||
CopyPlayer(&players[i], &playerTemp, name);
|
CopyPlayer(&players[i], &playerTemp, name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// we need the player actor, so that G_FinishTravel can destroy it later.
|
||||||
|
players[i].mo = playerTemp.mo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (players[i].mo != NULL)
|
if (players[i].mo != NULL)
|
||||||
{
|
{
|
||||||
|
@ -750,6 +758,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[] tempPlayerUsed;
|
||||||
delete[] playertemp;
|
delete[] playertemp;
|
||||||
|
|
Loading…
Reference in a new issue