[IMenuList] Initial commit

This commit is contained in:
RektInator 2017-02-25 19:41:54 +01:00
parent c0dcc4afbf
commit bd8a746811
4 changed files with 54 additions and 0 deletions

View File

@ -436,6 +436,7 @@ namespace Components
#endif
AssetHandler::RegisterInterface(new Assets::ISndCurve());
AssetHandler::RegisterInterface(new Assets::IMaterial());
AssetHandler::RegisterInterface(new Assets::IMenuList());
#ifdef ENABLE_EXPERIMENTAL_MAP_CODE
AssetHandler::RegisterInterface(new Assets::IclipMap_t());
#endif

View File

@ -83,6 +83,7 @@ namespace Components
#include "AssetInterfaces/IGfxWorld.hpp"
#include "AssetInterfaces/IMaterial.hpp"
#include "AssetInterfaces/ISndCurve.hpp"
#include "AssetInterfaces/IMenuList.hpp"
#include "AssetInterfaces/IclipMap_t.hpp"
#include "AssetInterfaces/IPhysPreset.hpp"
#include "AssetInterfaces/IXAnimParts.hpp"

View File

@ -0,0 +1,38 @@
#include "STDInclude.hpp"
namespace Assets
{
void IMenuList::save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder)
{
AssertSize(Game::MenuList, 12);
Utils::Stream* buffer = builder->getBuffer();
Game::MenuList* asset = header.menuList;
Game::MenuList* dest = buffer->dest<Game::MenuList>();
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->menus)
{
buffer->align(Utils::Stream::ALIGN_4);
Game::menuDef_t **destMenus = buffer->dest<Game::menuDef_t*>();
buffer->saveArray(asset->menus, asset->menuCount);
for (int i = 0; i < asset->menuCount; i++)
{
destMenus[i] = builder->saveSubAsset(Game::XAssetType::ASSET_TYPE_MENU, asset->menus[i]).menu;
}
}
buffer->popBlock();
}
}

View File

@ -0,0 +1,14 @@
#pragma once
namespace Assets
{
class IMenuList : public Components::AssetHandler::IAsset
{
public:
virtual Game::XAssetType getType() override { return Game::XAssetType::ASSET_TYPE_MENULIST; };
virtual void save(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
// virtual void mark(Game::XAssetHeader header, Components::ZoneBuilder::Zone* builder) override;
// virtual void load(Game::XAssetHeader* header, std::string name, Components::ZoneBuilder::Zone* builder) override;
};
}