[ZoneBuilder] Add GfxLightDef interface
This commit is contained in:
parent
fb8f618ddc
commit
fd3af1a965
@ -397,6 +397,7 @@ namespace Components
|
||||
AssetHandler::RegisterInterface(new Assets::IXAnimParts());
|
||||
AssetHandler::RegisterInterface(new Assets::IFxEffectDef());
|
||||
AssetHandler::RegisterInterface(new Assets::IGameWorldMp());
|
||||
AssetHandler::RegisterInterface(new Assets::IGfxLightDef());
|
||||
AssetHandler::RegisterInterface(new Assets::ILoadedSound());
|
||||
AssetHandler::RegisterInterface(new Assets::IPhysCollmap());
|
||||
AssetHandler::RegisterInterface(new Assets::IStringTable());
|
||||
|
@ -84,6 +84,7 @@ namespace Components
|
||||
#include "AssetInterfaces\IXAnimParts.hpp"
|
||||
#include "AssetInterfaces\IFxEffectDef.hpp"
|
||||
#include "AssetInterfaces\IGameWorldMp.hpp"
|
||||
#include "AssetInterfaces\IGfxLightDef.hpp"
|
||||
#include "AssetInterfaces\ILoadedSound.hpp"
|
||||
#include "AssetInterfaces\IPhysCollmap.hpp"
|
||||
#include "AssetInterfaces\IStringTable.hpp"
|
||||
|
40
src/Components/Modules/AssetInterfaces/IGfxLightDef.cpp
Normal file
40
src/Components/Modules/AssetInterfaces/IGfxLightDef.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
void IGfxLightDef::mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
Game::GfxLightDef* asset = header.lightDef;
|
||||
|
||||
if (asset->attenuation.image)
|
||||
{
|
||||
builder->loadAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->attenuation.image);
|
||||
}
|
||||
}
|
||||
|
||||
void IGfxLightDef::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
AssertSize(Game::GfxLightDef, 16);
|
||||
AssertSize(Game::GfxLightImage, 8);
|
||||
|
||||
Utils::Stream* buffer = builder->getBuffer();
|
||||
Game::GfxLightDef* asset = header.lightDef;
|
||||
Game::GfxLightDef* dest = buffer->dest<Game::GfxLightDef>();
|
||||
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->attenuation.image)
|
||||
{
|
||||
dest->attenuation.image = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_IMAGE, asset->attenuation.image).image;
|
||||
}
|
||||
|
||||
buffer->popBlock();
|
||||
}
|
||||
}
|
11
src/Components/Modules/AssetInterfaces/IGfxLightDef.hpp
Normal file
11
src/Components/Modules/AssetInterfaces/IGfxLightDef.hpp
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Assets
|
||||
{
|
||||
class IGfxLightDef : public Components::AssetHandler::IAsset
|
||||
{
|
||||
public:
|
||||
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_LIGHTDEF; };
|
||||
|
||||
virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user