add missing 'author' and 'label' UMAPINFO fields.

This commit is contained in:
Professor Hastig 2024-10-01 14:35:27 +02:00 committed by Rachael Alexanderson
parent d455f57346
commit 2decf10863
5 changed files with 37 additions and 1 deletions

View file

@ -268,6 +268,7 @@ void level_info_t::Reset()
Music = ""; Music = "";
LevelName = ""; LevelName = "";
AuthorName = ""; AuthorName = "";
MapLabel = "";
FadeTable = "COLORMAP"; FadeTable = "COLORMAP";
CustomColorMap = "COLORMAP"; CustomColorMap = "COLORMAP";
WallHorizLight = -8; WallHorizLight = -8;
@ -1028,6 +1029,13 @@ DEFINE_MAP_OPTION(author, true)
info->AuthorName = parse.sc.String; 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) DEFINE_MAP_OPTION(secretnext, true)
{ {
parse.ParseAssign(); parse.ParseAssign();

View file

@ -350,6 +350,7 @@ struct level_info_t
FString LightningSound = "world/thunder"; FString LightningSound = "world/thunder";
FString Music; FString Music;
FString LevelName; FString LevelName;
FString MapLabel;
FString AuthorName; FString AuthorName;
int8_t WallVertLight, WallHorizLight; int8_t WallVertLight, WallHorizLight;
int musicorder; int musicorder;

View file

@ -41,6 +41,8 @@ struct UMapEntry
FString LevelName; FString LevelName;
FString InterText; FString InterText;
FString InterTextSecret; FString InterTextSecret;
FString author;
FString label;
TArray<FSpecialAction> BossActions; TArray<FSpecialAction> BossActions;
bool BossCleared = false; bool BossCleared = false;
@ -139,6 +141,16 @@ static int ParseStandardProperty(FScanner &scanner, UMapEntry *mape, int *id24_l
scanner.MustGetToken(TK_StringConst); scanner.MustGetToken(TK_StringConst);
mape->LevelName = scanner.String; 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")) else if (!pname.CompareNoCase("next"))
{ {
ParseLumpName(scanner, mape->nextmap); ParseLumpName(scanner, mape->nextmap);
@ -417,6 +429,14 @@ void CommitUMapinfo(level_info_t *defaultinfo)
levelinfo->LevelName = map.LevelName; levelinfo->LevelName = map.LevelName;
levelinfo->PName = ""; // clear the map name patch to force the string version to be shown - unless explicitly overridden right next. 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.levelpic[0]) levelinfo->PName = map.levelpic;
if (map.nextmap[0]) levelinfo->NextMap = map.nextmap; if (map.nextmap[0]) levelinfo->NextMap = map.nextmap;
else if (map.endpic[0]) else if (map.endpic[0])

View file

@ -2263,7 +2263,12 @@ void FormatMapName(FLevelLocals *self, int cr, FString *result)
bool ishub = (cluster != nullptr && (cluster->flags & CLUSTER_HUB)); bool ishub = (cluster != nullptr && (cluster->flags & CLUSTER_HUB));
*result = ""; *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 << ": "; *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, LightningSound)
DEFINE_FIELD_X(LevelInfo, level_info_t, LevelName) DEFINE_FIELD_X(LevelInfo, level_info_t, LevelName)
DEFINE_FIELD_X(LevelInfo, level_info_t, AuthorName) 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, musicorder)
DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed1) DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed1)
DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed2) DEFINE_FIELD_X(LevelInfo, level_info_t, skyspeed2)

View file

@ -345,6 +345,7 @@ struct LevelInfo native
native readonly String LightningSound; native readonly String LightningSound;
native readonly String Music; native readonly String Music;
native readonly String LevelName; native readonly String LevelName;
native readonly String MapLabel;
native readonly String AuthorName; native readonly String AuthorName;
native readonly int musicorder; native readonly int musicorder;
native readonly float skyspeed1; native readonly float skyspeed1;