diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 227b98f501e..6d9250290f1 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -141,30 +141,44 @@ CCMD (spray) CCMD (mapchecksum) { - MapData *map; - uint8_t cksum[16]; - - if (argv.argc() < 2) + if (argv.argc() == 1 || (argv.argc() == 2 && argv[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 ...\n"); } - for (int i = 1; i < argv.argc(); ++i) + else { - map = P_OpenMapData(argv[i], true); - if (map == NULL) - { - Printf("Cannot load %s as a map\n", argv[i]); - } - else + MapData *map; + uint8_t cksum[16]; + + for (int i = 1; i < argv.argc(); ++i) { - map->GetChecksum(cksum); - const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum)); - delete map; - for (size_t j = 0; j < sizeof(cksum); ++j) + map = P_OpenMapData(argv[i], true); + if (map == NULL) { - Printf("%02X", cksum[j]); + 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]); } } }