mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Icons
* do not consider the setup step failed if icons are missing. There are a couple void references in dbc
This commit is contained in:
@@ -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)
|
||||
{
|
||||
if ($noSrcFile)
|
||||
CLI::write('[img-maps] - overlay tile ' . $basePath . $row['textureString'] . $i . '.blp missing.', CLI::LOG_ERROR);
|
||||
|
||||
break 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
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
|
||||
{
|
||||
if (!$noSrcFile) // there are a couple of void file references in dbc, so this can't be a hard error.
|
||||
$this->success = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
if ($noSrcFile)
|
||||
CLI::write('[img-proc-c] tile '.$baseName.$suffix.'.blp missing.', CLI::LOG_ERROR);
|
||||
|
||||
unset($dest);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user