- add 'sv_alwaystally' defaults to 0 with the following states:

* 0: previous behavior (completely MAPINFO controlled)
* 1: always show level tally at the end of an episode
* 2: always show level tally even when changing levels within a hub
This commit is contained in:
Rachael Alexanderson 2020-07-21 13:53:27 -04:00
parent fcb6e1b18c
commit 810e240f89
2 changed files with 24 additions and 5 deletions

View file

@ -151,7 +151,7 @@ CUSTOM_CVAR(Int, gl_lightmode, 3, CVAR_ARCHIVE | CVAR_NOINITCALL)
} }
} }
CVAR(Int, sv_alwaystally, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)
static FRandom pr_classchoice ("RandomPlayerClassChoice"); static FRandom pr_classchoice ("RandomPlayerClassChoice");
@ -580,6 +580,26 @@ static bool unloading;
EXTERN_CVAR(Bool, sv_singleplayerrespawn) EXTERN_CVAR(Bool, sv_singleplayerrespawn)
bool FLevelLocals::ShouldDoIntermission(cluster_info_t* nextcluster, cluster_info_t* thiscluster)
{
// this is here to remove some code duplication
if ((sv_alwaystally == 2) || (deathmatch))
return true;
if ((sv_alwaystally == 0) && (flags & LEVEL_NOINTERMISSION))
return false;
bool withinSameCluster = (nextcluster == thiscluster);
bool clusterIsHub = (thiscluster->flags & CLUSTER_HUB);
bool hubNoIntermission = !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION);
if (withinSameCluster && clusterIsHub && hubNoIntermission)
return false;
return true;
}
void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags, int nextSkill) void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags, int nextSkill)
{ {
if (!isPrimaryLevel()) return; // only the primary level may exit. if (!isPrimaryLevel()) return; // only the primary level may exit.
@ -682,7 +702,7 @@ void FLevelLocals::ChangeLevel(const char *levelname, int position, int inflags,
if (thiscluster && (thiscluster->flags & CLUSTER_HUB)) if (thiscluster && (thiscluster->flags & CLUSTER_HUB))
{ {
if ((flags & LEVEL_NOINTERMISSION) || ((nextcluster == thiscluster) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION))) if (!ShouldDoIntermission(nextcluster, thiscluster))
NoWipe = 35; NoWipe = 35;
D_DrawIcon = "TELEICON"; D_DrawIcon = "TELEICON";
} }
@ -994,9 +1014,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
finishstate = mode; finishstate = mode;
if (!deathmatch && if (!ShouldDoIntermission(nextcluster, thiscluster))
((flags & LEVEL_NOINTERMISSION) ||
((nextcluster == thiscluster) && (thiscluster->flags & CLUSTER_HUB) && !(thiscluster->flags & CLUSTER_ALLOWINTERMISSION))))
{ {
WorldDone (); WorldDone ();
return false; return false;

View file

@ -150,6 +150,7 @@ struct FLevelLocals
void Init(); void Init();
private: private:
bool ShouldDoIntermission(cluster_info_t* nextcluster, cluster_info_t* thiscluster);
line_t *FindPortalDestination(line_t *src, int tag); line_t *FindPortalDestination(line_t *src, int tag);
void BuildPortalBlockmap(); void BuildPortalBlockmap();
void UpdatePortal(FLinePortal *port); void UpdatePortal(FLinePortal *port);