2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-06 16:57:25 +00:00

refactor: do not nest asset namespaces in game namespaces

* Duplicated namespace names are kind of annoying
This commit is contained in:
Jan Laupetin
2025-08-06 00:50:35 +02:00
parent 33c09dfe61
commit 46fb919a52
336 changed files with 1430 additions and 1480 deletions

View File

@@ -11,7 +11,6 @@
using namespace nlohmann;
using namespace IW4;
using namespace ::leaderboard;
namespace
{
@@ -116,7 +115,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto file = m_search_path.Open(GetJsonFileNameForAsset(assetName));
const auto file = m_search_path.Open(leaderboard::GetJsonFileNameForAsset(assetName));
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -139,10 +138,10 @@ namespace
};
} // namespace
namespace IW4::leaderboard
namespace leaderboard
{
std::unique_ptr<AssetCreator<AssetLeaderboard>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetLeaderboard>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<LeaderboardLoader>(memory, searchPath);
}
} // namespace IW4::leaderboard
} // namespace leaderboard

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::leaderboard
namespace leaderboard
{
std::unique_ptr<AssetCreator<AssetLeaderboard>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::leaderboard
std::unique_ptr<AssetCreator<IW4::AssetLeaderboard>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace leaderboard

View File

@@ -8,7 +8,6 @@
#include <iostream>
using namespace IW4;
using namespace ::light_def;
namespace
{
@@ -25,7 +24,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto filename = GetFileNameForAsset(assetName);
const auto filename = light_def::GetFileNameForAsset(assetName);
const auto file = m_search_path.Open(filename);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -68,10 +67,10 @@ namespace
};
} // namespace
namespace IW4::light_def
namespace light_def
{
std::unique_ptr<AssetCreator<AssetLightDef>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetLightDef>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<LoaderLightDef>(memory, searchPath);
}
} // namespace IW4::light_def
} // namespace light_def

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::light_def
namespace light_def
{
std::unique_ptr<AssetCreator<AssetLightDef>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::light_def
std::unique_ptr<AssetCreator<IW4::AssetLightDef>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace light_def

View File

@@ -35,10 +35,10 @@ namespace
};
} // namespace
namespace IW4::localize
namespace localize
{
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<LocalizeLoader>(memory, searchPath, zone);
}
} // namespace IW4::localize
} // namespace localize

View File

@@ -8,7 +8,7 @@
#include <memory>
namespace IW4::localize
namespace localize
{
std::unique_ptr<AssetCreator<AssetLocalize>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace IW4::localize
std::unique_ptr<AssetCreator<IW4::AssetLocalize>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace localize

View File

@@ -8,7 +8,6 @@
#include <iostream>
using namespace IW4;
using namespace ::material;
namespace
{
@@ -23,7 +22,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto file = m_search_path.Open(GetFileNameForAssetName(assetName));
const auto file = m_search_path.Open(material::GetFileNameForAssetName(assetName));
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -46,10 +45,10 @@ namespace
};
} // namespace
namespace IW4::material
namespace material
{
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<MaterialLoader>(memory, searchPath);
}
} // namespace IW4::material
} // namespace material

View File

@@ -6,7 +6,7 @@
#include "SearchPath/ISearchPath.h"
#include "Utils/MemoryManager.h"
namespace IW4::material
namespace material
{
std::unique_ptr<AssetCreator<AssetMaterial>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::material
std::unique_ptr<AssetCreator<IW4::AssetMaterial>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace material

View File

@@ -11,7 +11,6 @@
#include <iostream>
using namespace IW4;
using namespace ::menu;
namespace
{
@@ -29,7 +28,7 @@ namespace
std::vector<menuDef_t*> menus;
AssetRegistration<AssetMenuList> registration(assetName);
auto& zoneState = context.GetZoneAssetCreationState<MenuAssetZoneState>();
auto& zoneState = context.GetZoneAssetCreationState<menu::MenuAssetZoneState>();
auto& conversionState = context.GetZoneAssetCreationState<MenuConversionZoneState>();
std::deque<std::string> menuLoadQueue;
@@ -81,7 +80,7 @@ namespace
private:
bool LoadMenuFileFromQueue(const std::string& menuFilePath,
AssetCreationContext& context,
MenuAssetZoneState& zoneState,
menu::MenuAssetZoneState& zoneState,
MenuConversionZoneState& conversionState,
std::vector<menuDef_t*>& menus,
AssetRegistration<AssetMenuList>& registration) const
@@ -122,8 +121,8 @@ namespace
bool ProcessParsedResults(const std::string& fileName,
AssetCreationContext& context,
ParsingResult& parsingResult,
MenuAssetZoneState& zoneState,
menu::ParsingResult& parsingResult,
menu::MenuAssetZoneState& zoneState,
MenuConversionZoneState& conversionState,
std::vector<menuDef_t*>& menus,
AssetRegistration<AssetMenuList>& registration) const
@@ -197,9 +196,10 @@ namespace
menuList.menus = nullptr;
}
std::unique_ptr<ParsingResult> ParseMenuFile(std::istream& stream, const std::string& menuFileName, const MenuAssetZoneState& zoneState) const
std::unique_ptr<menu::ParsingResult>
ParseMenuFile(std::istream& stream, const std::string& menuFileName, const menu::MenuAssetZoneState& zoneState) const
{
MenuFileReader reader(stream, menuFileName, FeatureLevel::IW4, m_search_path);
menu::MenuFileReader reader(stream, menuFileName, menu::FeatureLevel::IW4, m_search_path);
reader.IncludeZoneState(zoneState);
reader.SetPermissiveMode(ObjLoading::Configuration.MenuPermissiveParsing);
@@ -212,10 +212,10 @@ namespace
};
} // namespace
namespace IW4::menu
namespace menu
{
std::unique_ptr<AssetCreator<AssetMenuList>> CreateMenuListLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetMenuList>> CreateMenuListLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<MenuListLoader>(memory, searchPath);
}
} // namespace IW4::menu
} // namespace menu

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::menu
namespace menu
{
std::unique_ptr<AssetCreator<AssetMenuList>> CreateMenuListLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::menu
std::unique_ptr<AssetCreator<IW4::AssetMenuList>> CreateMenuListLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace menu

View File

@@ -14,7 +14,7 @@ namespace IW4
IMenuConverter() = default;
virtual ~IMenuConverter() = default;
virtual void ConvertMenu(const ::menu::CommonMenuDef& commonMenu, menuDef_t& menu, AssetRegistration<AssetMenu>& registration) = 0;
virtual void ConvertMenu(const menu::CommonMenuDef& commonMenu, menuDef_t& menu, AssetRegistration<AssetMenu>& registration) = 0;
static std::unique_ptr<IMenuConverter> Create(bool disableOptimizations, ISearchPath& searchPath, MemoryManager& memory, AssetCreationContext& context);
};

View File

@@ -119,19 +119,19 @@ namespace
{
auto& memory = zone.Memory();
collection.AddAssetCreator(phys_preset::CreateRawLoader(memory, searchPath, zone));
collection.AddAssetCreator(phys_preset::CreateGdtLoader(memory, gdt, zone));
collection.AddAssetCreator(phys_preset::CreateRawLoaderIW4(memory, searchPath, zone));
collection.AddAssetCreator(phys_preset::CreateGdtLoaderIW4(memory, gdt, zone));
// collection.AddAssetCreator(std::make_unique<AssetLoaderPhysCollMap>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderXAnim>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderXModelSurfs>(memory));
collection.AddAssetCreator(xmodel::CreateXModelLoader(memory, searchPath, zone));
collection.AddAssetCreator(material::CreateLoader(memory, searchPath));
collection.AddAssetCreator(shader::CreatePixelShaderLoader(memory, searchPath));
collection.AddAssetCreator(shader::CreateVertexShaderLoader(memory, searchPath));
collection.AddAssetCreator(xmodel::CreateLoaderIW4(memory, searchPath, zone));
collection.AddAssetCreator(material::CreateLoaderIW4(memory, searchPath));
collection.AddAssetCreator(shader::CreatePixelShaderLoaderIW4(memory, searchPath));
collection.AddAssetCreator(shader::CreateVertexShaderLoaderIW4(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderTechset>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderImage>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderSound>(memory));
collection.AddAssetCreator(sound_curve::CreateLoader(memory, searchPath));
collection.AddAssetCreator(sound_curve::CreateLoaderIW4(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderLoadedSound>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderClipMap>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderComWorld>(memory));
@@ -140,19 +140,19 @@ namespace
// collection.AddAssetCreator(std::make_unique<AssetLoaderMapEnts>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderFxWorld>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderGfxWorld>(memory));
collection.AddAssetCreator(light_def::CreateLoader(memory, searchPath));
collection.AddAssetCreator(light_def::CreateLoaderIW4(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderFont>(memory));
collection.AddAssetCreator(menu::CreateMenuListLoader(memory, searchPath));
collection.AddAssetCreator(menu::CreateMenuListLoaderIW4(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderMenu>(memory));
collection.AddAssetCreator(localize::CreateLoader(memory, searchPath, zone));
collection.AddAssetCreator(weapon::CreateRawLoader(memory, searchPath, zone));
collection.AddAssetCreator(weapon::CreateGdtLoader(memory, searchPath, gdt, zone));
collection.AddAssetCreator(localize::CreateLoaderIW4(memory, searchPath, zone));
collection.AddAssetCreator(weapon::CreateRawLoaderIW4(memory, searchPath, zone));
collection.AddAssetCreator(weapon::CreateGdtLoaderIW4(memory, searchPath, gdt, zone));
// collection.AddAssetCreator(std::make_unique<AssetLoaderFx>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderImpactFx>(memory));
collection.AddAssetCreator(raw_file::CreateLoader(memory, searchPath));
collection.AddAssetCreator(string_table::CreateLoader(memory, searchPath));
collection.AddAssetCreator(leaderboard::CreateLoader(memory, searchPath));
collection.AddAssetCreator(structured_data_def::CreateLoader(memory, searchPath));
collection.AddAssetCreator(raw_file::CreateLoaderIW4(memory, searchPath));
collection.AddAssetCreator(string_table::CreateLoaderIW4(memory, searchPath));
collection.AddAssetCreator(leaderboard::CreateLoaderIW4(memory, searchPath));
collection.AddAssetCreator(structured_data_def::CreateLoaderIW4(memory, searchPath));
// collection.AddAssetCreator(std::make_unique<AssetLoaderTracer>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderVehicle>(memory));
// collection.AddAssetCreator(std::make_unique<AssetLoaderAddonMapEnts>(memory));

View File

@@ -39,14 +39,14 @@ namespace
private:
IGdtQueryable& m_gdt;
IW4::phys_preset::InfoStringLoader m_info_string_loader;
phys_preset::InfoStringLoaderIW4 m_info_string_loader;
};
} // namespace
namespace IW4::phys_preset
namespace phys_preset
{
std::unique_ptr<AssetCreator<AssetPhysPreset>> CreateGdtLoader(MemoryManager& memory, IGdtQueryable& gdt, Zone& zone)
std::unique_ptr<AssetCreator<IW4::AssetPhysPreset>> CreateGdtLoaderIW4(MemoryManager& memory, IGdtQueryable& gdt, Zone& zone)
{
return std::make_unique<GdtLoaderPhysPreset>(memory, gdt, zone);
}
} // namespace IW4::phys_preset
} // namespace phys_preset

View File

@@ -8,7 +8,7 @@
#include <memory>
namespace IW4::phys_preset
namespace phys_preset
{
std::unique_ptr<AssetCreator<AssetPhysPreset>> CreateGdtLoader(MemoryManager& memory, IGdtQueryable& gdt, Zone& zone);
} // namespace IW4::phys_preset
std::unique_ptr<AssetCreator<IW4::AssetPhysPreset>> CreateGdtLoaderIW4(MemoryManager& memory, IGdtQueryable& gdt, Zone& zone);
} // namespace phys_preset

View File

@@ -58,15 +58,15 @@ namespace
}
} // namespace
namespace IW4::phys_preset
namespace phys_preset
{
InfoStringLoader::InfoStringLoader(MemoryManager& memory, Zone& zone)
InfoStringLoaderIW4::InfoStringLoaderIW4(MemoryManager& memory, Zone& zone)
: m_memory(memory),
m_zone(zone)
{
}
AssetCreationResult InfoStringLoader::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
AssetCreationResult InfoStringLoaderIW4::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
{
PhysPresetInfo presetInfo;
std::memset(&presetInfo, 0, sizeof(presetInfo));
@@ -87,4 +87,4 @@ namespace IW4::phys_preset
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}
} // namespace IW4::phys_preset
} // namespace phys_preset

View File

@@ -4,12 +4,12 @@
#include "Asset/AssetCreationResult.h"
#include "InfoString/InfoString.h"
namespace IW4::phys_preset
namespace phys_preset
{
class InfoStringLoader
class InfoStringLoaderIW4
{
public:
InfoStringLoader(MemoryManager& memory, Zone& zone);
InfoStringLoaderIW4(MemoryManager& memory, Zone& zone);
AssetCreationResult CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context);
@@ -17,4 +17,4 @@ namespace IW4::phys_preset
MemoryManager& m_memory;
Zone& m_zone;
};
} // namespace IW4::phys_preset
} // namespace phys_preset

View File

@@ -10,7 +10,6 @@
#include <iostream>
using namespace IW4;
using namespace ::phys_preset;
namespace
{
@@ -25,7 +24,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForAssetName(assetName);
const auto fileName = phys_preset::GetFileNameForAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -42,14 +41,14 @@ namespace
private:
ISearchPath& m_search_path;
IW4::phys_preset::InfoStringLoader m_info_string_loader;
phys_preset::InfoStringLoaderIW4 m_info_string_loader;
};
} // namespace
namespace IW4::phys_preset
namespace phys_preset
{
std::unique_ptr<AssetCreator<AssetPhysPreset>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetPhysPreset>> CreateRawLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<RawLoaderPhysPreset>(memory, searchPath, zone);
}
} // namespace IW4::phys_preset
} // namespace phys_preset

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::phys_preset
namespace phys_preset
{
std::unique_ptr<AssetCreator<AssetPhysPreset>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace IW4::phys_preset
std::unique_ptr<AssetCreator<IW4::AssetPhysPreset>> CreateRawLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace phys_preset

View File

@@ -82,10 +82,10 @@ namespace
};
} // namespace
namespace IW4::raw_file
namespace raw_file
{
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<RawFileLoader>(memory, searchPath);
}
} // namespace IW4::raw_file
} // namespace raw_file

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::raw_file
namespace raw_file
{
std::unique_ptr<AssetCreator<AssetRawFile>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::raw_file
std::unique_ptr<AssetCreator<IW4::AssetRawFile>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace raw_file

View File

@@ -8,7 +8,6 @@
#include <iostream>
using namespace IW4;
using namespace ::shader;
namespace
{
@@ -23,7 +22,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForPixelShaderAssetName(assetName);
const auto fileName = shader::GetFileNameForPixelShaderAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -55,10 +54,10 @@ namespace
};
} // namespace
namespace IW4::shader
namespace shader
{
std::unique_ptr<AssetCreator<AssetPixelShader>> CreatePixelShaderLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetPixelShader>> CreatePixelShaderLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<PixelShaderLoader>(memory, searchPath);
}
} // namespace IW4::shader
} // namespace shader

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::shader
namespace shader
{
std::unique_ptr<AssetCreator<AssetPixelShader>> CreatePixelShaderLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::shader
std::unique_ptr<AssetCreator<IW4::AssetPixelShader>> CreatePixelShaderLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace shader

View File

@@ -8,7 +8,6 @@
#include <iostream>
using namespace IW4;
using namespace ::shader;
namespace
{
@@ -23,7 +22,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForVertexShaderAssetName(assetName);
const auto fileName = shader::GetFileNameForVertexShaderAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -55,10 +54,10 @@ namespace
};
} // namespace
namespace IW4::shader
namespace shader
{
std::unique_ptr<AssetCreator<AssetVertexShader>> CreateVertexShaderLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetVertexShader>> CreateVertexShaderLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<VertexShaderLoader>(memory, searchPath);
}
} // namespace IW4::shader
} // namespace shader

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::shader
namespace shader
{
std::unique_ptr<AssetCreator<AssetVertexShader>> CreateVertexShaderLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::shader
std::unique_ptr<AssetCreator<IW4::AssetVertexShader>> CreateVertexShaderLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace shader

View File

@@ -12,7 +12,6 @@
#include <sstream>
using namespace IW4;
using namespace ::sound_curve;
namespace
{
@@ -27,7 +26,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForAssetName(assetName);
const auto fileName = sound_curve::GetFileNameForAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -71,10 +70,10 @@ namespace
};
} // namespace
namespace IW4::sound_curve
namespace sound_curve
{
std::unique_ptr<AssetCreator<AssetSoundCurve>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetSoundCurve>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<LoaderSoundCurve>(memory, searchPath);
}
} // namespace IW4::sound_curve
} // namespace sound_curve

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::sound_curve
namespace sound_curve
{
std::unique_ptr<AssetCreator<AssetSoundCurve>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::sound_curve
std::unique_ptr<AssetCreator<IW4::AssetSoundCurve>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace sound_curve

View File

@@ -6,7 +6,6 @@
#include "StringTable/StringTableLoader.h"
using namespace IW4;
using namespace ::string_table;
namespace
{
@@ -25,7 +24,7 @@ namespace
if (!file.IsOpen())
return AssetCreationResult::NoAction();
StringTableLoaderV2<StringTable, Common::StringTable_HashString> loader;
string_table::StringTableLoaderV2<StringTable, Common::StringTable_HashString> loader;
auto* stringTable = loader.LoadFromStream(assetName, m_memory, *file.m_stream);
if (!stringTable)
return AssetCreationResult::Failure();
@@ -39,10 +38,10 @@ namespace
};
} // namespace
namespace IW4::string_table
namespace string_table
{
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<LoaderStringTable>(memory, searchPath);
}
} // namespace IW4::string_table
} // namespace string_table

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::string_table
namespace string_table
{
std::unique_ptr<AssetCreator<AssetStringTable>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::string_table
std::unique_ptr<AssetCreator<IW4::AssetStringTable>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace string_table

View File

@@ -207,10 +207,10 @@ namespace
};
} // namespace
namespace IW4::structured_data_def
namespace structured_data_def
{
std::unique_ptr<AssetCreator<AssetStructuredDataDef>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath)
std::unique_ptr<AssetCreator<AssetStructuredDataDef>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath)
{
return std::make_unique<StructuredDataDefLoader>(memory, searchPath);
}
} // namespace IW4::structured_data_def
} // namespace structured_data_def

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::structured_data_def
namespace structured_data_def
{
std::unique_ptr<AssetCreator<AssetStructuredDataDef>> CreateLoader(MemoryManager& memory, ISearchPath& searchPath);
} // namespace IW4::structured_data_def
std::unique_ptr<AssetCreator<IW4::AssetStructuredDataDef>> CreateLoaderIW4(MemoryManager& memory, ISearchPath& searchPath);
} // namespace structured_data_def

View File

@@ -40,14 +40,14 @@ namespace
private:
IGdtQueryable& m_gdt;
IW4::weapon::InfoStringLoader m_info_string_loader;
weapon::InfoStringLoaderIW4 m_info_string_loader;
};
} // namespace
namespace IW4::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
std::unique_ptr<AssetCreator<IW4::AssetWeapon>> CreateGdtLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone)
{
return std::make_unique<GdtLoaderWeapon>(memory, searchPath, gdt, zone);
}
} // namespace IW4::weapon
} // namespace weapon

View File

@@ -8,7 +8,7 @@
#include <memory>
namespace IW4::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateGdtLoader(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace IW4::weapon
std::unique_ptr<AssetCreator<IW4::AssetWeapon>> CreateGdtLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, IGdtQueryable& gdt, Zone& zone);
} // namespace weapon

View File

@@ -426,16 +426,16 @@ namespace
}
} // namespace
namespace IW4::weapon
namespace weapon
{
InfoStringLoader::InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
InfoStringLoaderIW4::InfoStringLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
: m_memory(memory),
m_search_path(searchPath),
m_zone(zone)
{
}
AssetCreationResult InfoStringLoader::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
AssetCreationResult InfoStringLoaderIW4::CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context)
{
auto* weaponFullDef = m_memory.Alloc<WeaponFullDef>();
@@ -458,4 +458,4 @@ namespace IW4::weapon
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}
} // namespace IW4::weapon
} // namespace weapon

View File

@@ -4,12 +4,12 @@
#include "Asset/AssetCreationResult.h"
#include "InfoString/InfoString.h"
namespace IW4::weapon
namespace weapon
{
class InfoStringLoader
class InfoStringLoaderIW4
{
public:
InfoStringLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
InfoStringLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
AssetCreationResult CreateAsset(const std::string& assetName, const InfoString& infoString, AssetCreationContext& context);
@@ -18,4 +18,4 @@ namespace IW4::weapon
ISearchPath& m_search_path;
Zone& m_zone;
};
} // namespace IW4::weapon
} // namespace weapon

View File

@@ -11,7 +11,6 @@
#include <iostream>
using namespace IW4;
using namespace ::weapon;
namespace
{
@@ -26,7 +25,7 @@ namespace
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override
{
const auto fileName = GetFileNameForAssetName(assetName);
const auto fileName = weapon::GetFileNameForAssetName(assetName);
const auto file = m_search_path.Open(fileName);
if (!file.IsOpen())
return AssetCreationResult::NoAction();
@@ -43,14 +42,14 @@ namespace
private:
ISearchPath& m_search_path;
IW4::weapon::InfoStringLoader m_info_string_loader;
weapon::InfoStringLoaderIW4 m_info_string_loader;
};
} // namespace
namespace IW4::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<RawLoaderWeapon>(memory, searchPath, zone);
}
} // namespace IW4::weapon
} // namespace weapon

View File

@@ -7,7 +7,7 @@
#include <memory>
namespace IW4::weapon
namespace weapon
{
std::unique_ptr<AssetCreator<AssetWeapon>> CreateRawLoader(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace IW4::weapon
std::unique_ptr<AssetCreator<IW4::AssetWeapon>> CreateRawLoaderIW4(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace weapon