Skip to content

Commit

Permalink
CCMD listmaps: Colorize maps loaded from pwads in blue text
Browse files Browse the repository at this point in the history
Colorize maps added from pwads differently so they stand out better
  • Loading branch information
yqco authored and coelckers committed Jan 14, 2023
1 parent 80d1c61 commit e0275df
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/g_dumpinfo.cpp
Expand Up @@ -361,20 +361,29 @@ CCMD(targetinv)

CCMD(listmaps)
{
int iwadNum = fileSystem.GetIwadNum();

for (unsigned i = 0; i < wadlevelinfos.Size(); i++)
{
level_info_t *info = &wadlevelinfos[i];
MapData *map = P_OpenMapData(info->MapName, true);

if (map != NULL)
{
int mapWadNum = fileSystem.GetFileContainer(map->lumpnum);

if (argv.argc() == 1
|| CheckWildcards(argv[1], info->MapName.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(),
fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)));
bool isFromPwad = mapWadNum != iwadNum;

const char* lineColor = isFromPwad ? TEXTCOLOR_LIGHTBLUE : "";

Printf("%s%s: '%s' (%s)\n", lineColor, info->MapName.GetChars(),
info->LookupLevelName().GetChars(),
fileSystem.GetResourceFileName(mapWadNum));
}
delete map;
}
Expand Down

0 comments on commit e0275df

Please sign in to comment.