Skip to content

Commit

Permalink
- add 'mapinfo' ccmd
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle authored and coelckers committed Oct 1, 2023
1 parent d33f269 commit a53d3d6
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions src/console/c_cmds.cpp
Expand Up @@ -1270,3 +1270,85 @@ CCMD(dumpactors)
}
}
}

const char* testlocalised(const char* in)
{
const char *out = GStrings.GetLanguageString(in, FStringTable::default_table);
if (in[0] == '$')
out = GStrings.GetLanguageString(in + 1, FStringTable::default_table);
if (out)
return out;
return in;
}

CCMD (mapinfo)
{
level_info_t *myLevel = nullptr;
if (players[consoleplayer].mo && players[consoleplayer].mo->Level)
myLevel = players[consoleplayer].mo->Level->info;

if (argv.argc() > 1)
{
if (P_CheckMapData(argv[1]))
myLevel = FindLevelInfo(argv[1]);
else
{
Printf("Mapname '%s' not found\n", argv[1]);
return;
}
}

if (!myLevel)
{
Printf("Not in a level\n");
return;
}

Printf("[ Map Info For: '%s' ]\n\n", myLevel->MapName);

if (myLevel->LevelName.IsNotEmpty())
Printf(" LevelName: %s\n", testlocalised(myLevel->LevelName));

if (myLevel->AuthorName.IsNotEmpty())
Printf(" AuthorName: %s\n", testlocalised(myLevel->AuthorName));

if (myLevel->levelnum)
Printf(" LevelNum: %i\n", myLevel->levelnum);

if (myLevel->NextMap.IsNotEmpty())
Printf(" Next: %s\n", myLevel->NextMap);

if (myLevel->NextSecretMap.IsNotEmpty())
Printf(" SecretNext: %s\n", myLevel->NextSecretMap);

if (myLevel->Music.IsNotEmpty())
Printf(" Music: %s\n", testlocalised(myLevel->Music));

Printf(" PixelStretch: %f\n", myLevel->pixelstretch);

if (myLevel->RedirectType.GetChars())
Printf(" Redirect (Item): %s\n", myLevel->RedirectType.GetChars());

if (myLevel->RedirectMapName.IsNotEmpty())
Printf(" Redirect (Map): %s\n", myLevel->RedirectMapName);

if (myLevel->RedirectCVAR.GetChars())
Printf("CVAR_Redirect (CVAR): %s\n", myLevel->RedirectCVAR.GetChars());

if (myLevel->RedirectCVARMapName.IsNotEmpty())
Printf(" CVAR_Redirect (Map): %s\n", myLevel->RedirectCVARMapName);

Printf(" LightMode: %i\n", (int8_t)myLevel->lightmode);

if (players[consoleplayer].mo && players[consoleplayer].mo->Level)
{
level_info_t *check = myLevel->CheckLevelRedirect();
if (check)
Printf("Level IS currently being redirected to '%s'!\n", check->MapName);
else
Printf("Level is currently NOT being redirected!\n");
}
else
Printf("Level redirection is currently not being tested - not in game!\n");
}

0 comments on commit a53d3d6

Please sign in to comment.