From d2277d10346a59c99325280fac9929353b31d945 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 1 Jul 2024 19:43:15 +0200 Subject: [PATCH] Setup/Icons * do not consider the setup step failed if icons are missing. There are a couple void references in dbc --- setup/tools/filegen/img-maps.ss.php | 6 ++++-- setup/tools/filegen/simpleimg.ss.php | 12 ++++++++---- setup/tools/setupScript.class.php | 11 ++++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/setup/tools/filegen/img-maps.ss.php b/setup/tools/filegen/img-maps.ss.php index 97713edb..0185780d 100644 --- a/setup/tools/filegen/img-maps.ss.php +++ b/setup/tools/filegen/img-maps.ss.php @@ -838,10 +838,12 @@ CLISetup::registerSetup("build", new class extends SetupScript $x = 0; while ($x < $row['w']) { - $img = $this->loadImageFile($basePath . $row['textureString'] . $i); + $img = $this->loadImageFile($basePath . $row['textureString'] . $i, $noSrcFile); if (!$img) { - CLI::write('[img-maps] - overlay tile ' . $basePath . $row['textureString'] . $i . '.blp missing.', CLI::LOG_ERROR); + if ($noSrcFile) + CLI::write('[img-maps] - overlay tile ' . $basePath . $row['textureString'] . $i . '.blp missing.', CLI::LOG_ERROR); + break 2; } diff --git a/setup/tools/filegen/simpleimg.ss.php b/setup/tools/filegen/simpleimg.ss.php index 5dafd155..a8743b50 100644 --- a/setup/tools/filegen/simpleimg.ss.php +++ b/setup/tools/filegen/simpleimg.ss.php @@ -225,11 +225,13 @@ CLISetup::registerSetup("build", new class extends SetupScript } if (!$src) - $src = $this->loadImageFile($f); + $src = $this->loadImageFile($f, $noSrcFile); if (!$src) // error should be created by imagecreatefromblp { - $this->success = false; + if (!$noSrcFile) // there are a couple of void file references in dbc, so this can't be a hard error. + $this->success = false; + continue; } @@ -293,10 +295,12 @@ CLISetup::registerSetup("build", new class extends SetupScript continue; } - $src = $this->loadImageFile($f); + $src = $this->loadImageFile($f, $noSrcFile); if (!$src) // error should be created by imagecreatefromblp { - $this->success = false; + if (!$noSrcFile) // there are a couple of void file references in dbc, so this can't be a hard error. + $this->success = false; + continue; } diff --git a/setup/tools/setupScript.class.php b/setup/tools/setupScript.class.php index 98d61f2f..57d43e54 100644 --- a/setup/tools/setupScript.class.php +++ b/setup/tools/setupScript.class.php @@ -236,9 +236,10 @@ trait TrImageProcessor // prefer manually converted PNG files (as the imagecreatefromblp-script has issues with some formats) // alpha channel issues observed with locale deDE Hilsbrad and Elwynn - maps // see: https://github.com/Kanma/BLPConverter - private function loadImageFile(string $path) // : ?GdImage + private function loadImageFile(string $path, ?bool &$noSrc = false) // : ?GdImage { $result = null; + $noSrc = false; $path = preg_replace('/\.(png|blp)$/i', '', $path); $file = $path.'.png'; @@ -253,6 +254,8 @@ trait TrImageProcessor $file = $path.'.blp'; if (CLISetup::fileExists($file)) $result = imagecreatefromblp($file); + else + $noSrc = true; } return $result; @@ -360,10 +363,12 @@ trait TrComplexImage $tileW = $destW; foreach ($row as $x => $suffix) { - $src = $this->loadImageFile($baseName.$suffix); + $src = $this->loadImageFile($baseName.$suffix, $noSrcFile); if (!$src) { - CLI::write('[img-proc-c] tile '.$baseName.$suffix.'.blp missing.', CLI::LOG_ERROR); + if ($noSrcFile) + CLI::write('[img-proc-c] tile '.$baseName.$suffix.'.blp missing.', CLI::LOG_ERROR); + unset($dest); return null; }