- add 'playerrespawn' skill flag to allow gameplay mods to retroactively enable player respawns in single player on all maps

This commit is contained in:
Rachael Alexanderson 2017-12-28 00:53:30 -05:00
parent 10465c1d27
commit 45531090a7
5 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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);
}

View File

@ -962,6 +962,7 @@ enum ESkillProperty
SKILLP_EasyKey,
SKILLP_SlowMonsters,
SKILLP_Infight,
SKILLP_PlayerRespawn,
};
enum EFSkillProperty // floating point properties
{