ZoneLoading: Add implementation for LoadImageData action:

Duplicate any ImageLoadDef that contains data, otherwise discard temporary empty loaddef
This commit is contained in:
Jan 2020-02-04 19:45:45 +01:00
parent b8c2557482
commit d01f5c49a8
2 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,17 @@ Actions_GfxImage::Actions_GfxImage(Zone* zone)
{
}
void Actions_GfxImage::LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image)
void Actions_GfxImage::LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image) const
{
if(loadDef->resourceSize > 0)
{
const size_t loadDefSize = offsetof(T6::GfxImageLoadDef, data) + loadDef->resourceSize;
image->texture.loadDef = static_cast<T6::GfxImageLoadDef*>(m_zone->GetMemory()->Alloc(loadDefSize));
memcpy(image->texture.loadDef, loadDef, loadDefSize);
}
else
{
image->texture.loadDef = nullptr;
}
}

View File

@ -8,5 +8,5 @@ class Actions_GfxImage final : public AssetLoadingActions
public:
explicit Actions_GfxImage(Zone* zone);
void LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image);
void LoadImageData(T6::GfxImageLoadDef* loadDef, T6::GfxImage* image) const;
};