mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- force player respawn to call up the player's default class settings before determining where to respawn the player
This commit is contained in:
parent
192882f63a
commit
0f0768652a
3 changed files with 48 additions and 25 deletions
|
@ -1709,7 +1709,24 @@ void FLevelLocals::DoReborn (int playernum, bool freshbot)
|
|||
}
|
||||
else
|
||||
{
|
||||
bool isUnfriendly = players[playernum].mo && !(players[playernum].mo->flags & MF_FRIENDLY);
|
||||
bool isUnfriendly;
|
||||
|
||||
PlayerSpawnPickClass(playernum);
|
||||
|
||||
// this condition should never be false
|
||||
assert(players[playernum].cls != NULL);
|
||||
|
||||
if (players[playernum].cls != NULL)
|
||||
{
|
||||
isUnfriendly = !(GetDefaultByType(players[playernum].cls)->flags & MF_FRIENDLY);
|
||||
DPrintf(DMSG_NOTIFY, "Player class IS defined: unfriendly is %i\n", isUnfriendly);
|
||||
}
|
||||
else
|
||||
{
|
||||
// we shouldn't be here, but if we are, get the player's current status
|
||||
isUnfriendly = players[playernum].mo && !(players[playernum].mo->flags & MF_FRIENDLY);
|
||||
DPrintf(DMSG_NOTIFY, "Player class NOT defined: unfriendly is %i\n", isUnfriendly);
|
||||
}
|
||||
|
||||
// respawn at the start
|
||||
// first disassociate the corpse
|
||||
|
|
|
@ -165,6 +165,7 @@ private:
|
|||
void ReadOnePlayer(FSerializer &arc, bool skipload);
|
||||
void ReadMultiplePlayers(FSerializer &arc, int numPlayers, int numPlayersNow, bool skipload);
|
||||
void SerializeSounds(FSerializer &arc);
|
||||
void PlayerSpawnPickClass (int playernum);
|
||||
|
||||
public:
|
||||
void SnapshotLevel();
|
||||
|
|
|
@ -4996,31 +4996,9 @@ void StaticPointerSubstitution(AActor* old, AActor* notOld)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
||||
void FLevelLocals::PlayerSpawnPickClass (int playernum)
|
||||
{
|
||||
player_t *p;
|
||||
AActor *mobj, *oldactor;
|
||||
uint8_t state;
|
||||
DVector3 spawn;
|
||||
DAngle SpawnAngle;
|
||||
|
||||
if (mthing == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
// not playing?
|
||||
if ((unsigned)playernum >= (unsigned)MAXPLAYERS || !PlayerInGame(playernum) )
|
||||
return NULL;
|
||||
|
||||
// Old lerp data needs to go
|
||||
if (playernum == consoleplayer)
|
||||
{
|
||||
P_PredictionLerpReset();
|
||||
}
|
||||
|
||||
p = Players[playernum];
|
||||
auto p = Players[playernum];
|
||||
|
||||
if (p->cls == NULL)
|
||||
{
|
||||
|
@ -5049,6 +5027,33 @@ AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flag
|
|||
}
|
||||
p->cls = PlayerClasses[p->CurrentPlayerClass].Type;
|
||||
}
|
||||
}
|
||||
|
||||
AActor *FLevelLocals::SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
||||
{
|
||||
player_t *p;
|
||||
AActor *mobj, *oldactor;
|
||||
uint8_t state;
|
||||
DVector3 spawn;
|
||||
DAngle SpawnAngle;
|
||||
|
||||
if (mthing == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
// not playing?
|
||||
if ((unsigned)playernum >= (unsigned)MAXPLAYERS || !PlayerInGame(playernum) )
|
||||
return NULL;
|
||||
|
||||
// Old lerp data needs to go
|
||||
if (playernum == consoleplayer)
|
||||
{
|
||||
P_PredictionLerpReset();
|
||||
}
|
||||
|
||||
p = Players[playernum];
|
||||
|
||||
PlayerSpawnPickClass(playernum);
|
||||
|
||||
if (( dmflags2 & DF2_SAME_SPAWN_SPOT ) &&
|
||||
( p->playerstate == PST_REBORN ) &&
|
||||
|
|
Loading…
Reference in a new issue