diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index eb65e69433..22981062bd 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -268,6 +268,7 @@ void level_info_t::Reset() Music = ""; LevelName = ""; AuthorName = ""; + MapLabel = ""; FadeTable = "COLORMAP"; CustomColorMap = "COLORMAP"; WallHorizLight = -8; @@ -1028,6 +1029,13 @@ DEFINE_MAP_OPTION(author, true) info->AuthorName = parse.sc.String; } +DEFINE_MAP_OPTION(label, true) +{ + parse.ParseAssign(); + parse.sc.MustGetString(); + info->MapLabel = parse.sc.String; +} + DEFINE_MAP_OPTION(secretnext, true) { parse.ParseAssign(); diff --git a/src/gamedata/g_mapinfo.h b/src/gamedata/g_mapinfo.h index 8b2706ed06..5d3309f4a9 100644 --- a/src/gamedata/g_mapinfo.h +++ b/src/gamedata/g_mapinfo.h @@ -350,6 +350,7 @@ struct level_info_t FString LightningSound = "world/thunder"; FString Music; FString LevelName; + FString MapLabel; FString AuthorName; int8_t WallVertLight, WallHorizLight; int musicorder; diff --git a/src/gamedata/umapinfo.cpp b/src/gamedata/umapinfo.cpp index e5de4fbecf..9ba72e61b4 100644 --- a/src/gamedata/umapinfo.cpp +++ b/src/gamedata/umapinfo.cpp @@ -41,6 +41,8 @@ struct UMapEntry FString LevelName; FString InterText; FString InterTextSecret; + FString author; + FString label; TArray BossActions; bool BossCleared = false; @@ -139,6 +141,16 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape, int *id24_l scanner.MustGetToken(TK_StringConst); mape->LevelName = scanner.String; } + else if (!pname.CompareNoCase("author")) + { + scanner.MustGetToken(TK_StringConst); + mape->author = scanner.String; + } + else if (!pname.CompareNoCase("label")) + { + scanner.MustGetToken(TK_StringConst); + mape->label = scanner.String; + } else if (!pname.CompareNoCase("next")) { ParseLumpName(scanner, mape->nextmap); @@ -417,6 +429,14 @@ void CommitUMapinfo(level_info_t *defaultinfo) levelinfo->LevelName = map.LevelName; levelinfo->PName = ""; // clear the map name patch to force the string version to be shown - unless explicitly overridden right next. } + if (map.author.IsNotEmpty()) + { + levelinfo->AuthorName = map.author; + } + if (map.label.IsNotEmpty()) + { + levelinfo->MapLabel = map.label; + } if (map.levelpic[0]) levelinfo->PName = map.levelpic; if (map.nextmap[0]) levelinfo->NextMap = map.nextmap; else if (map.endpic[0]) diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 4cc0488431..3153a4eabc 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -2263,7 +2263,12 @@ void FormatMapName(FLevelLocals *self, int cr, FString *result) bool ishub = (cluster != nullptr && (cluster->flags & CLUSTER_HUB)); *result = ""; - if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub)) + // If a label is specified, use it uncontitionally here. + if (self->info->MapLabel.IsNotEmpty()) + { + *result << self->info->MapLabel << ": "; + } + else if (am_showmaplabel == 1 || (am_showmaplabel == 2 && !ishub)) { *result << self->MapName << ": "; } @@ -2767,6 +2772,7 @@ DEFINE_FIELD_X(LevelInfo, level_info_t, Music) DEFINE_FIELD_X(LevelInfo, level_info_t, LightningSound) DEFINE_FIELD_X(LevelInfo, level_info_t, LevelName) DEFINE_FIELD_X(LevelInfo, level_info_t, AuthorName) +DEFINE_FIELD_X(LevelInfo, level_info_t, MapLabel) DEFINE_FIELD_X(LevelInfo, level_info_t, musicorder) DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed1) DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed2) diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index 54c44f8219..1ef97188c7 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -345,6 +345,7 @@ struct LevelInfo native native readonly String LightningSound; native readonly String Music; native readonly String LevelName; + native readonly String MapLabel; native readonly String AuthorName; native readonly int musicorder; native readonly float skyspeed1;