[ZoneBuilder] Add sndcurve interface

This commit is contained in:
momo5502 2016-11-29 19:03:56 +01:00
parent 3d159d3112
commit 1b12886229
5 changed files with 46 additions and 0 deletions

View File

@ -388,6 +388,7 @@ namespace Components
AssetHandler::RegisterInterface(new Assets::IMapEnts());
AssetHandler::RegisterInterface(new Assets::IRawFile());
AssetHandler::RegisterInterface(new Assets::IGfxImage());
AssetHandler::RegisterInterface(new Assets::ISndCurve());
AssetHandler::RegisterInterface(new Assets::IMaterial());
AssetHandler::RegisterInterface(new Assets::IPhysPreset());
AssetHandler::RegisterInterface(new Assets::IXAnimParts());

View File

@ -73,6 +73,7 @@ namespace Components
#include "AssetInterfaces\IRawFile.hpp"
#include "AssetInterfaces\IGfxImage.hpp"
#include "AssetInterfaces\IMaterial.hpp"
#include "AssetInterfaces\ISndCurve.hpp"
#include "AssetInterfaces\IPhysPreset.hpp"
#include "AssetInterfaces\IXAnimParts.hpp"
#include "AssetInterfaces\IFxEffectDef.hpp"

View File

@ -0,0 +1,24 @@
#include <STDInclude.hpp>
namespace Assets
{
void ISndCurve::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::SndCurve, 136);
Utils::Stream* buffer = builder->getBuffer();
Game::SndCurve* asset = header.sndCurve;
Game::SndCurve* dest = buffer->dest<Game::SndCurve>();
buffer->save(asset);
buffer->pushBlock(Game::XFILE_BLOCK_VIRTUAL);
if (asset->filename)
{
buffer->saveString(builder->getAssetName(this->getType(), asset->filename));
Utils::Stream::ClearPointer(&dest->filename);
}
buffer->popBlock();
}
}

View File

@ -0,0 +1,10 @@
namespace Assets
{
class ISndCurve : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_SNDCURVE; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
};
}

View File

@ -1215,6 +1215,15 @@ namespace Game
char * compressedData;
};
#pragma pack(push, 4)
struct SndCurve
{
const char *filename;
unsigned __int16 knotCount;
vec2_t knots[16];
};
#pragma pack(pop)
struct FontEntry
{
unsigned short character;
@ -2888,6 +2897,7 @@ namespace Game
TracerDef* tracer;
VehicleDef* vehicle;
GfxWorld* gfxMap;
SndCurve* sndCurve;
};
struct XAsset