mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-11-23 21:22:07 +00:00
WIP: Converted custom map linker into different asset files
This commit is contained in:
38
src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp
Normal file
38
src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include "GameWorldMpLinker.h"
|
||||
|
||||
namespace BSP
|
||||
{
|
||||
GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context)
|
||||
: m_memory(memory),
|
||||
m_search_path(searchPath),
|
||||
m_context(context)
|
||||
{
|
||||
}
|
||||
|
||||
AssetCreationResult GameWorldMpLinker::linkGameWorldMp(BSPData* bsp)
|
||||
{
|
||||
GameWorldMp* gameWorldMp = m_memory.Alloc<GameWorldMp>();
|
||||
|
||||
gameWorldMp->name = m_memory.Dup(bsp->bspName.c_str());
|
||||
|
||||
gameWorldMp->path.nodeCount = 0;
|
||||
gameWorldMp->path.originalNodeCount = 0;
|
||||
gameWorldMp->path.visBytes = 0;
|
||||
gameWorldMp->path.smoothBytes = 0;
|
||||
gameWorldMp->path.nodeTreeCount = 0;
|
||||
|
||||
int nodeCount = gameWorldMp->path.nodeCount + 128;
|
||||
gameWorldMp->path.nodes = m_memory.Alloc<pathnode_t>(nodeCount);
|
||||
gameWorldMp->path.basenodes = m_memory.Alloc<pathbasenode_t>(nodeCount);
|
||||
memset(gameWorldMp->path.nodes, 0, nodeCount * sizeof(pathnode_t));
|
||||
memset(gameWorldMp->path.basenodes, 0, nodeCount * sizeof(pathbasenode_t));
|
||||
|
||||
gameWorldMp->path.pathVis = nullptr;
|
||||
gameWorldMp->path.smoothCache = nullptr;
|
||||
gameWorldMp->path.nodeTree = nullptr;
|
||||
|
||||
auto gameWorldMpAsset = m_context.AddAsset<AssetGameWorldMp>(gameWorldMp->name, gameWorldMp);
|
||||
return AssetCreationResult::Success(gameWorldMpAsset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user