CCMD listmaps: Colorize maps loaded from pwads in blue text

Colorize maps added from pwads differently so they stand out better
This commit is contained in:
yqco 2022-12-30 21:02:23 -06:00 committed by Christoph Oelckers
parent 80d1c61714
commit e0275df931

View file

@ -361,6 +361,8 @@ CCMD(targetinv)
CCMD(listmaps) CCMD(listmaps)
{ {
int iwadNum = fileSystem.GetIwadNum();
for (unsigned i = 0; i < wadlevelinfos.Size(); i++) for (unsigned i = 0; i < wadlevelinfos.Size(); i++)
{ {
level_info_t *info = &wadlevelinfos[i]; level_info_t *info = &wadlevelinfos[i];
@ -368,13 +370,20 @@ CCMD(listmaps)
if (map != NULL) if (map != NULL)
{ {
int mapWadNum = fileSystem.GetFileContainer(map->lumpnum);
if (argv.argc() == 1 if (argv.argc() == 1
|| CheckWildcards(argv[1], info->MapName.GetChars()) || CheckWildcards(argv[1], info->MapName.GetChars())
|| CheckWildcards(argv[1], info->LookupLevelName().GetChars()) || CheckWildcards(argv[1], info->LookupLevelName().GetChars())
|| CheckWildcards(argv[1], fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)))) || CheckWildcards(argv[1], fileSystem.GetResourceFileName(mapWadNum)))
{ {
Printf("%s: '%s' (%s)\n", info->MapName.GetChars(), info->LookupLevelName().GetChars(), bool isFromPwad = mapWadNum != iwadNum;
fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)));
const char* lineColor = isFromPwad ? TEXTCOLOR_LIGHTBLUE : "";
Printf("%s%s: '%s' (%s)\n", lineColor, info->MapName.GetChars(),
info->LookupLevelName().GetChars(),
fileSystem.GetResourceFileName(mapWadNum));
} }
delete map; delete map;
} }