[ZoneBuilder] Add ComWorld interface
This commit is contained in:
parent
3e69704aed
commit
48557d02d1
@ -391,6 +391,7 @@ namespace Components
|
||||
AssetHandler::RegisterInterface(new Assets::IXModel());
|
||||
AssetHandler::RegisterInterface(new Assets::IMapEnts());
|
||||
AssetHandler::RegisterInterface(new Assets::IRawFile());
|
||||
AssetHandler::RegisterInterface(new Assets::IComWorld());
|
||||
AssetHandler::RegisterInterface(new Assets::IGfxImage());
|
||||
AssetHandler::RegisterInterface(new Assets::IGfxWorld());
|
||||
AssetHandler::RegisterInterface(new Assets::ISndCurve());
|
||||
|
@ -73,6 +73,7 @@ namespace Components
|
||||
#include "AssetInterfaces\IXModel.hpp"
|
||||
#include "AssetInterfaces\IMapEnts.hpp"
|
||||
#include "AssetInterfaces\IRawFile.hpp"
|
||||
#include "AssetInterfaces\IComWorld.hpp"
|
||||
#include "AssetInterfaces\IGfxImage.hpp"
|
||||
#include "AssetInterfaces\IGfxWorld.hpp"
|
||||
#include "AssetInterfaces\IMaterial.hpp"
|
||||
|
47
src/Components/Modules/AssetInterfaces/IComWorld.cpp
Normal file
47
src/Components/Modules/AssetInterfaces/IComWorld.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
void IComWorld::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::ComWorld, 16);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::ComWorld* asset = header.comWorld;
|
||||
Game::ComWorld* dest = buffer->dest<Game::ComWorld>();
|
||||
buffer->save(asset);
|
||||
|
||||
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
|
||||
|
||||
if (asset->name)
|
||||
{
|
||||
buffer->saveString(builder->getAssetName(this->getType(), asset->name));
|
||||
Utils::Stream::ClearPointer(&dest->name);
|
||||
}
|
||||
|
||||
if (asset->lights)
|
||||
{
|
||||
AssertSize(Game::ComPrimaryLight, 68);
|
||||
buffer->align(Utils::Stream::ALIGN_4);
|
||||
|
||||
Game::ComPrimaryLight* destLights = buffer->dest<Game::ComPrimaryLight>();
|
||||
buffer->saveArray(asset->lights, asset->lightCount);
|
||||
|
||||
for (int i = 0; i < asset->lightCount; ++i)
|
||||
{
|
||||
Game::ComPrimaryLight* destLight = &destLights[i];
|
||||
Game::ComPrimaryLight* light = &asset->lights[i];
|
||||
|
||||
if (light->name)
|
||||
{
|
||||
buffer->saveString(light->name);
|
||||
Utils::Stream::ClearPointer(&destLight->name);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::Stream::ClearPointer(&dest->lights);
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
}
|
||||
}
|
10
src/Components/Modules/AssetInterfaces/IComWorld.hpp
Normal file
10
src/Components/Modules/AssetInterfaces/IComWorld.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
namespace Assets
|
||||
{
|
||||
class IComWorld : public Components::AssetHandler::IAsset
|
||||
{
|
||||
public:
|
||||
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_COM_MAP; };
|
||||
|
||||
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user