Skip to content

Commit

Permalink
add SpawnMultiCoopOnly mapinfo flag to spawn **only** coop spawns in …
Browse files Browse the repository at this point in the history
…single-player
  • Loading branch information
RicardoLuis0 committed Sep 8, 2024
1 parent 5895f9b commit 0ab12a4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gamedata/g_mapinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ enum ESkillProperty
SKILLP_PlayerRespawn,
SKILLP_SpawnMulti,
SKILLP_InstantReaction,
SKILLP_SpawnMultiCoopOnly,
};
enum EFSkillProperty // floating point properties
{
Expand Down Expand Up @@ -555,6 +556,7 @@ struct FSkillInfo
int SpawnFilter;
bool SpawnMulti;
bool InstantReaction;
bool SpawnMultiCoopOnly;
int ACSReturn;
FString MenuName;
FString PicName;
Expand Down
12 changes: 11 additions & 1 deletion src/gamedata/g_skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void FMapInfoParser::ParseSkill ()
skill.Aggressiveness = 1.;
skill.SpawnFilter = 0;
skill.SpawnMulti = false;
skill.SpawnMultiCoopOnly = false;
skill.InstantReaction = false;
skill.ACSReturn = 0;
skill.MustConfirm = false;
Expand Down Expand Up @@ -198,6 +199,10 @@ void FMapInfoParser::ParseSkill ()
{
skill.SpawnMulti = true;
}
else if (sc.Compare ("spawnmulticooponly"))
{
skill.SpawnMultiCoopOnly = true;
}
else if (sc.Compare ("InstantReaction"))
{
skill.InstantReaction = true;
Expand Down Expand Up @@ -408,9 +413,13 @@ int G_SkillProperty(ESkillProperty prop)

case SKILLP_SpawnMulti:
return AllSkills[gameskill].SpawnMulti;

case SKILLP_InstantReaction:
return AllSkills[gameskill].InstantReaction;

case SKILLP_SpawnMultiCoopOnly:
return AllSkills[gameskill].SpawnMultiCoopOnly;

}
}
return 0;
Expand Down Expand Up @@ -550,6 +559,7 @@ FSkillInfo &FSkillInfo::operator=(const FSkillInfo &other)
SpawnFilter = other.SpawnFilter;
SpawnMulti = other.SpawnMulti;
InstantReaction = other.InstantReaction;
SpawnMultiCoopOnly = other.SpawnMultiCoopOnly;
ACSReturn = other.ACSReturn;
MenuName = other.MenuName;
PicName = other.PicName;
Expand Down
5 changes: 3 additions & 2 deletions src/playsim/p_mobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5757,6 +5757,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
AActor *mobj;

bool spawnmulti = G_SkillProperty(SKILLP_SpawnMulti) || !!(dmflags2 & DF2_ALWAYS_SPAWN_MULTI);
bool spawnmulti_cooponly = G_SkillProperty(SKILLP_SpawnMultiCoopOnly);

if (mthing->EdNum == 0 || mthing->EdNum == -1)
return NULL;
Expand Down Expand Up @@ -5837,9 +5838,9 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
{
mask = MTF_COOPERATIVE;
}
else if (spawnmulti)
else if (spawnmulti || spawnmulti_cooponly)
{
mask = MTF_COOPERATIVE|MTF_SINGLE;
mask = spawnmulti_cooponly ? MTF_COOPERATIVE : (MTF_COOPERATIVE|MTF_SINGLE);
}
else
{
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/constants.zs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ enum ESkillProperty
SKILLP_PlayerRespawn,
SKILLP_SpawnMulti,
SKILLP_InstantReaction,
SKILLP_SpawnMultiCoopOnly,
};
enum EFSkillProperty // floating point properties
{
Expand Down

0 comments on commit 0ab12a4

Please sign in to comment.