[IclipMap_t] Use existing clipmap as base

This commit is contained in:
momo5502 2017-03-16 20:40:32 +01:00
parent 0e21794380
commit 3b702b9d9a
3 changed files with 18 additions and 3 deletions

View File

@ -586,6 +586,17 @@ namespace Assets
return;
}
Game::clipMap_t* orgClipMap = nullptr;
Game::DB_EnumXAssets(Game::XAssetType::ASSET_TYPE_MAP_ENTS, [](Game::XAssetHeader header, void* clipMap)
{
if (!*reinterpret_cast<void**>(clipMap))
{
*reinterpret_cast<Game::clipMap_t**>(clipMap) = header.clipMap;
}
}, &orgClipMap, false);
if (orgClipMap) std::memcpy(clipMap, orgClipMap, sizeof Game::clipMap_t);
Utils::Stream::Reader reader(builder->getAllocator(), clipFile.getBuffer());
__int64 magic = reader.read<__int64>();
@ -880,6 +891,11 @@ namespace Assets
Utils::Stream::ClearPointer(&clipMap->dynEntCollList[i]);
}
if(!reader.end())
{
Components::Logger::Error("Clipmap data left!");
}
header->clipMap = clipMap;
}
}

View File

@ -2476,7 +2476,6 @@ namespace Game
char edgeCount[2][3];
};
struct cLeaf_t
{
unsigned __int16 firstCollAabbIndex;

View File

@ -26,7 +26,7 @@ namespace Utils
return this->buffer[this->position++];
}
return 0;
throw std::runtime_error("Reading past the buffer");
}
void* Stream::Reader::read(size_t size, size_t count)
@ -43,7 +43,7 @@ namespace Utils
return _buffer;
}
return nullptr;
throw std::runtime_error("Reading past the buffer");
}
bool Stream::Reader::end()