mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- add 'playerrespawn' skill flag to allow gameplay mods to retroactively enable player respawns in single player on all maps
This commit is contained in:
parent
10465c1d27
commit
45531090a7
5 changed files with 15 additions and 2 deletions
|
@ -1743,7 +1743,8 @@ static void G_QueueBody (AActor *body)
|
|||
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
|
||||
void G_DoReborn (int playernum, bool freshbot)
|
||||
{
|
||||
if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn)
|
||||
if (!multiplayer && !(level.flags2 & LEVEL2_ALLOWRESPAWN) && !sv_singleplayerrespawn &&
|
||||
!G_SkillProperty(SKILLP_PlayerRespawn))
|
||||
{
|
||||
if (BackupSaveName.Len() > 0 && FileExists (BackupSaveName.GetChars()))
|
||||
{ // Load game from the last point it was saved
|
||||
|
|
|
@ -538,6 +538,7 @@ enum ESkillProperty
|
|||
SKILLP_EasyKey,
|
||||
SKILLP_SlowMonsters,
|
||||
SKILLP_Infight,
|
||||
SKILLP_PlayerRespawn,
|
||||
};
|
||||
enum EFSkillProperty // floating point properties
|
||||
{
|
||||
|
@ -595,6 +596,7 @@ struct FSkillInfo
|
|||
double FriendlyHealth;
|
||||
bool NoPain;
|
||||
int Infighting;
|
||||
bool PlayerRespawn;
|
||||
|
||||
FSkillInfo() {}
|
||||
FSkillInfo(const FSkillInfo &other)
|
||||
|
|
|
@ -89,6 +89,7 @@ void FMapInfoParser::ParseSkill ()
|
|||
skill.FriendlyHealth = 1.;
|
||||
skill.NoPain = false;
|
||||
skill.Infighting = 0;
|
||||
skill.PlayerRespawn = false;
|
||||
|
||||
sc.MustGetString();
|
||||
skill.Name = sc.String;
|
||||
|
@ -155,6 +156,10 @@ void FMapInfoParser::ParseSkill ()
|
|||
{
|
||||
skill.NoMenu = true;
|
||||
}
|
||||
else if (sc.Compare ("playerrespawn"))
|
||||
{
|
||||
skill.PlayerRespawn = true;
|
||||
}
|
||||
else if (sc.Compare("respawntime"))
|
||||
{
|
||||
ParseAssign();
|
||||
|
@ -397,6 +402,9 @@ int G_SkillProperty(ESkillProperty prop)
|
|||
if (AllSkills[gameskill].Infighting == LEVEL2_TOTALINFIGHTING) return 1;
|
||||
if (AllSkills[gameskill].Infighting == LEVEL2_NOINFIGHTING) return -1;
|
||||
return infighting;
|
||||
|
||||
case SKILLP_PlayerRespawn:
|
||||
return AllSkills[gameskill].PlayerRespawn;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -5648,7 +5648,8 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
|||
{ // Give all cards in death match mode.
|
||||
p->mo->GiveDeathmatchInventory ();
|
||||
}
|
||||
else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn) && state == PST_REBORN && oldactor != NULL)
|
||||
else if ((multiplayer || (level.flags2 & LEVEL2_ALLOWRESPAWN) || sv_singleplayerrespawn ||
|
||||
!!G_SkillProperty(SKILLP_PlayerRespawn)) && state == PST_REBORN && oldactor != NULL)
|
||||
{ // Special inventory handling for respawning in coop
|
||||
p->mo->FilterCoopRespawnInventory (oldactor);
|
||||
}
|
||||
|
|
|
@ -962,6 +962,7 @@ enum ESkillProperty
|
|||
SKILLP_EasyKey,
|
||||
SKILLP_SlowMonsters,
|
||||
SKILLP_Infight,
|
||||
SKILLP_PlayerRespawn,
|
||||
};
|
||||
enum EFSkillProperty // floating point properties
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue