allow getting checksum for current map

This commit is contained in:
Ricardo Luís Vaz Silva 2024-10-17 16:25:47 -03:00 committed by Christoph Oelckers
parent 261881e0d7
commit 758c0dbc7e

View file

@ -141,30 +141,58 @@ CCMD (spray)
CCMD (mapchecksum)
{
MapData *map;
uint8_t cksum[16];
if (argv.argc() < 2)
if (argv.argc() == 1)
{ //current map
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum));
for (size_t i = 0; i < 16; ++i)
{
Printf("%02X", level.md5[i]);
}
Printf(" // %s %s\n", wadname, level.MapName.GetChars());
}
else if (argv.argc() < 2)
{
Printf("Usage: mapchecksum <map> ...\n");
}
for (int i = 1; i < argv.argc(); ++i)
else
{
map = P_OpenMapData(argv[i], true);
if (map == NULL)
MapData *map;
uint8_t cksum[16];
for (int i = 1; i < argv.argc(); ++i)
{
Printf("Cannot load %s as a map\n", argv[i]);
}
else
{
map->GetChecksum(cksum);
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum));
delete map;
for (size_t j = 0; j < sizeof(cksum); ++j)
if(argv[i] == "*")
{
Printf("%02X", cksum[j]);
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(level.lumpnum));
for (size_t i = 0; i < 16; ++i)
{
Printf("%02X", level.md5[i]);
}
Printf(" // %s %s\n", wadname, level.MapName.GetChars());
}
else
{
map = P_OpenMapData(argv[i], true);
if (map == NULL)
{
Printf("Cannot load %s as a map\n", argv[i]);
}
else
{
map->GetChecksum(cksum);
const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum));
delete map;
for (size_t j = 0; j < sizeof(cksum); ++j)
{
Printf("%02X", cksum[j]);
}
Printf(" // %s %s\n", wadname, argv[i]);
}
}
Printf(" // %s %s\n", wadname, argv[i]);
}
}
}