[IGfxImage] Fix image loading
This commit is contained in:
parent
e08365e8c3
commit
a56e28db74
@ -60,13 +60,20 @@ namespace Assets
|
|||||||
|
|
||||||
const Game::GfxImageFileHeader* iwiHeader = reinterpret_cast<const Game::GfxImageFileHeader*>(iwiBuffer.data());
|
const Game::GfxImageFileHeader* iwiHeader = reinterpret_cast<const Game::GfxImageFileHeader*>(iwiBuffer.data());
|
||||||
|
|
||||||
|
if (std::memcmp(iwiHeader->tag, "IWi", 3) && iwiHeader->version == 8)
|
||||||
|
{
|
||||||
|
Components::Logger::Error("Image is not a valid IWi!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
image->mapType = Game::MAPTYPE_2D;
|
image->mapType = Game::MAPTYPE_2D;
|
||||||
image->dataLen1 = iwiHeader->fileSizeForPicmip[0] - 32;
|
image->dataLen1 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||||
image->dataLen2 = iwiHeader->fileSizeForPicmip[0] - 32;
|
image->dataLen2 = iwiHeader->fileSizeForPicmip[0] - 32;
|
||||||
|
|
||||||
if (std::memcmp(iwiHeader->tag, "IWi", 3) && iwiHeader->version == 8)
|
image->loadDef = builder->getAllocator()->allocate<Game::GfxImageLoadDef>();
|
||||||
|
if (!image->loadDef)
|
||||||
{
|
{
|
||||||
Components::Logger::Error("Image is not a valid IWi!");
|
Components::Logger::Error("Failed to allocate GfxImageLoadDef structure!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user