[IGfxImage] Fix non-streamed image loading

This commit is contained in:
momo5502 2016-12-29 02:21:45 +01:00
parent 9130a57465
commit e5e164e9b5
2 changed files with 13 additions and 3 deletions

View File

@ -7,7 +7,7 @@ namespace Assets
void IGfxImage::load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) void IGfxImage::load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder)
{ {
Game::GfxImage* image = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_IMAGE, name.data()).image; Game::GfxImage* image = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_IMAGE, name.data()).image;
if (image) return; if (image && name[0] != '*') return;
image = builder->getAllocator()->allocate<Game::GfxImage>(); image = builder->getAllocator()->allocate<Game::GfxImage>();
if (!image) if (!image)
@ -43,6 +43,12 @@ namespace Assets
image->dataLen2 = image->dataLen1; image->dataLen2 = image->dataLen1;
image->loadDef = reinterpret_cast<Game::GfxImageLoadDef*>(reader.readArray<char>(image->dataLen1 + 16)); image->loadDef = reinterpret_cast<Game::GfxImageLoadDef*>(reader.readArray<char>(image->dataLen1 + 16));
image->height = image->loadDef->dimensions[0];
image->width = image->loadDef->dimensions[1];
image->depth = image->loadDef->dimensions[2];
image->loaded = true;
} }
else else
{ {
@ -81,6 +87,10 @@ namespace Assets
image->loadDef->flags = 0; image->loadDef->flags = 0;
image->loadDef->levelCount = 0; image->loadDef->levelCount = 0;
image->height = image->loadDef->dimensions[0];
image->width = image->loadDef->dimensions[1];
image->depth = image->loadDef->dimensions[2];
switch (iwiHeader->format) switch (iwiHeader->format)
{ {
case Game::IWI_COMPRESSION::IWI_ARGB: case Game::IWI_COMPRESSION::IWI_ARGB:

View File

@ -3003,7 +3003,7 @@ namespace Game
struct GfxPackedPlacement struct GfxPackedPlacement
{ {
float origin[3]; float origin[3];
PackedUnitVec axis[3]; vec3_t/*PackedUnitVec*/ axis[3];
float scale; float scale;
}; };
@ -3011,7 +3011,7 @@ namespace Game
{ {
GfxPackedPlacement placement; GfxPackedPlacement placement;
char pad[24]; //char pad[24];
XModel *model; // 52 XModel *model; // 52
float cullDist; float cullDist;