2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-23 05:12:05 +00:00
Files
OpenAssetTools/src/ObjLoading/Game/T6/CustomMap/LoaderCustomMapT6.cpp
LJW-Dev e19a3a142a WIP: Updating code to follow laupentin's code review.
Done:
- Moved custom map structures to their own objcommon header file
- Updated GfxLightGridRow struct
- Reverted shader_bin file path
- Renamed Project Creator to BSP Creator
- Removed model loading from BSP creator
- Cleaned up BSP Creator and updated the names of structs
WIP:
- Update BSP calculation code to be more readable and use unique/shared ptrs
2025-10-20 18:04:03 +08:00

63 lines
1.9 KiB
C++

#include "Game/T6/Maps/CustomMaps.h"
#include "LoaderCustomMapT6.h"
#include "BSPCreator.h"
#include "CustomMapLinker.h"
#include "Game/T6/T6.h"
#include <cstring>
using namespace T6;
namespace
{
class CustomMapLoader final : public AssetCreator<AssetGfxWorld>
{
public:
CustomMapLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
: m_memory(memory),
m_search_path(searchPath),
m_zone(zone)
{
}
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
// custom maps must have a map_gfx file
auto mapGfxFile = m_search_path.Open("custom_map/map_gfx.fbx");
if (!mapGfxFile.IsOpen())
return AssetCreationResult::NoAction();
CustomMapBSP* mapBSP = BSPCreator::createCustomMapBSP(m_zone.m_name, m_search_path);
if (mapBSP == NULL)
return AssetCreationResult::Failure();
CustomMapLinker* linker = new CustomMapLinker(m_memory, m_search_path, m_zone, context);
bool result = linker->linkCustomMap(mapBSP);
if (result)
{
auto gfxWorldAsset = context.LoadDependency<AssetGfxWorld>(mapBSP->bspName);
_ASSERT(gfxWorldAsset != NULL);
return AssetCreationResult::Success(gfxWorldAsset);
}
else
return AssetCreationResult::Failure();
}
private:
MemoryManager& m_memory;
ISearchPath& m_search_path;
Zone& m_zone;
};
} // namespace
namespace custom_map
{
std::unique_ptr<AssetCreator<AssetGfxWorld>> CreateLoaderT6(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<CustomMapLoader>(memory, searchPath, zone);
}
} // namespace custom_map