mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-23 13:17:53 -05:00
Rename AssetLoading from Linker to ZoneCreation
This commit is contained in:
@ -1,16 +1,16 @@
|
||||
#include "AssetLoaderIW4.h"
|
||||
#include "ZoneCreatorIW4.h"
|
||||
|
||||
#include "Game/IW4/GameIW4.h"
|
||||
#include "Game/IW4/GameAssetPoolIW4.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
bool AssetLoader::SupportsGame(const std::string& gameName) const
|
||||
bool ZoneCreator::SupportsGame(const std::string& gameName) const
|
||||
{
|
||||
return gameName == g_GameIW4.GetShortName();
|
||||
}
|
||||
|
||||
std::unique_ptr<Zone> AssetLoader::CreateZoneForDefinition(AssetLoadingContext& context) const
|
||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||
{
|
||||
auto zone = std::make_unique<Zone>(context.m_zone_name, 0, &g_GameIW4);
|
||||
zone->m_pools = std::make_unique<GameAssetPoolIW4>(zone.get(), zone->m_priority);
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include "AssetLoading/IAssetLoader.h"
|
||||
#include "ZoneCreation/IZoneCreator.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetLoader final : public IAssetLoader
|
||||
class ZoneCreator final : public IZoneCreator
|
||||
{
|
||||
public:
|
||||
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
|
||||
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(AssetLoadingContext& context) const override;
|
||||
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
|
||||
};
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
#include "AssetLoaderT6.h"
|
||||
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Game/T6/GameT6.h"
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
bool AssetLoader::SupportsGame(const std::string& gameName) const
|
||||
{
|
||||
return gameName == g_GameT6.GetShortName();
|
||||
}
|
||||
|
||||
std::unique_ptr<Zone> AssetLoader::CreateZoneForDefinition(AssetLoadingContext& context) const
|
||||
{
|
||||
auto zone = std::make_unique<Zone>(context.m_zone_name, 0, &g_GameT6);
|
||||
zone->m_pools = std::make_unique<GameAssetPoolT6>(zone.get(), zone->m_priority);
|
||||
|
||||
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
|
||||
zone->m_pools->InitPoolDynamic(assetType);
|
||||
|
||||
return zone;
|
||||
}
|
58
src/Linker/Game/T6/ZoneCreatorT6.cpp
Normal file
58
src/Linker/Game/T6/ZoneCreatorT6.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "ZoneCreatorT6.h"
|
||||
|
||||
#include "Game/T6/T6.h"
|
||||
#include "Game/T6/GameT6.h"
|
||||
#include "Game/T6/GameAssetPoolT6.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class SpecifiedAsset
|
||||
{
|
||||
public:
|
||||
XAssetType m_type;
|
||||
std::string m_name;
|
||||
bool m_reference;
|
||||
};
|
||||
|
||||
class AssetLoaderImpl
|
||||
{
|
||||
ZoneCreationContext& m_context;
|
||||
|
||||
void CreateZoneAssetPools(Zone* zone) const
|
||||
{
|
||||
zone->m_pools = std::make_unique<GameAssetPoolT6>(zone, zone->m_priority);
|
||||
|
||||
for (auto assetType = 0; assetType < ASSET_TYPE_COUNT; assetType++)
|
||||
zone->m_pools->InitPoolDynamic(assetType);
|
||||
}
|
||||
|
||||
public:
|
||||
explicit AssetLoaderImpl(ZoneCreationContext& context)
|
||||
: m_context(context)
|
||||
{
|
||||
}
|
||||
|
||||
std::unique_ptr<Zone> CreateZoneForDefinition()
|
||||
{
|
||||
auto zone = std::make_unique<Zone>(m_context.m_zone_name, 0, &g_GameT6);
|
||||
CreateZoneAssetPools(zone.get());
|
||||
|
||||
std::vector<SpecifiedAsset> specifiedAssets;
|
||||
|
||||
return zone;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
bool ZoneCreator::SupportsGame(const std::string& gameName) const
|
||||
{
|
||||
return gameName == g_GameT6.GetShortName();
|
||||
}
|
||||
|
||||
std::unique_ptr<Zone> ZoneCreator::CreateZoneForDefinition(ZoneCreationContext& context) const
|
||||
{
|
||||
AssetLoaderImpl impl(context);
|
||||
return impl.CreateZoneForDefinition();
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
#include "AssetLoading/IAssetLoader.h"
|
||||
#include "ZoneCreation/IZoneCreator.h"
|
||||
|
||||
namespace T6
|
||||
{
|
||||
class AssetLoader final : public IAssetLoader
|
||||
class ZoneCreator final : public IZoneCreator
|
||||
{
|
||||
public:
|
||||
_NODISCARD bool SupportsGame(const std::string& gameName) const override;
|
||||
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(AssetLoadingContext& context) const override;
|
||||
_NODISCARD std::unique_ptr<Zone> CreateZoneForDefinition(ZoneCreationContext& context) const override;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user