<?php/* * dmmotor: what is in a WAD, and what this engine can play of it. * php tools/wad-info.php wads/*.wad assets/wads/freedoom1.wad * Written for dmmotor (GPL v2, see LICENSE). */spl_autoload_register(function (string $class): void { $file = __DIR__ . '/../src/' . str_replace(['App\\', '\\'], ['', '/'], $class) . '.php'; if (is_file($file)) { require $file; }});$paths = array_slice($argv, 1) ?: glob(__DIR__ . '/../wads/*.wad') ?: [];if ($paths === []) { fwrite(STDERR, "usage: php tools/wad-info.php <file.wad>... (default: wads/*.wad)\n"); exit(1);}foreach ($paths as $path) { $base = preg_replace('~\.0$~', '', $path); $wad = new App\Dm\WadFile($base); echo str_repeat('=', 72), "\n", basename($base), "\n"; if (!$wad->isWad()) { echo " not a WAD file\n"; continue; } $a = $wad->analyse(); printf(" %s, %.1f MB, %d lumps\n", $wad->type === 'IWAD' ? 'IWAD (a whole game)' : 'PWAD (a mod)', $wad->size() / 1048576, count($wad->lumps)); printf(" maps (%d, %s): %s\n", count($a['maps']), $a['commercial'] ? 'MAPxx format' : 'ExMy format', implode(' ', $a['maps']) ?: '-'); printf(" things: %d sprites: %d flats: %d own textures: %s songs: %d sounds: %d DEHACKED: %s\n", $a['things'], $a['sprites'], $a['flats'], $a['textures'] ? 'yes' : 'no', $a['music'], $a['sounds'], $a['dehacked'] ? 'yes' : 'no'); if ($wad->type === 'PWAD') { echo ' played over: ', $a['commercial'] ? 'Freedoom Phase 2 (MAPxx maps)' : 'Freedoom Phase 1 (ExMy maps)', "\n"; } if ($a['problems'] === []) { echo " support: everything this WAD uses is in the engine\n"; } else { echo " not supported:\n"; foreach ($a['problems'] as $p) { echo " - $p\n"; } }}