2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-06-06 08:42:35 +00:00

chore: use templating on XAnimLoader

This commit is contained in:
Jan Laupetin
2026-06-05 15:31:28 +02:00
parent 6bb2688f95
commit 440216b517
4 changed files with 53 additions and 17 deletions
+1 -1
View File
@@ -8,6 +8,7 @@
#include "Game/IW3/Image/ImageLoaderExternalIW3.h"
#include "Game/IW3/Techset/PixelShaderLoaderIW3.h"
#include "Game/IW3/Techset/VertexShaderLoaderIW3.h"
#include "Game/IW3/XAnim/XAnimLoaderIW3.h"
#include "Game/IW3/XModel/LoaderXModelIW3.h"
#include "LightDef/LightDefLoaderIW3.h"
#include "Localize/AssetLoaderLocalizeIW3.h"
@@ -18,7 +19,6 @@
#include "RawFile/AssetLoaderRawFileIW3.h"
#include "Sound/LoaderSoundCurveIW3.h"
#include "StringTable/AssetLoaderStringTableIW3.h"
#include "XAnim/XAnimLoaderIW3.h"
#include <memory>
@@ -1,13 +0,0 @@
#pragma once
#include "Asset/IAssetCreator.h"
#include "Game/IW3/IW3.h"
#include "SearchPath/ISearchPath.h"
#include "Utils/MemoryManager.h"
#include <memory>
namespace xanim
{
std::unique_ptr<AssetCreator<IW3::AssetXAnim>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace xanim
@@ -1,4 +1,26 @@
#include "XAnimLoaderIW3.h"
#options GAME(IW3)
#filename "Game/" + GAME + "/XAnim/XAnimLoader" + GAME + ".cpp"
#set LOADER_HEADER "\"XAnimLoader" + GAME + ".h\""
#if GAME == "IW3"
#define FEATURE_IW3
#elif GAME == "IW4"
#define FEATURE_IW4
#elif GAME == "IW5"
#define FEATURE_IW5
#elif GAME == "T5"
#define FEATURE_T5
#elif GAME == "T6"
#define FEATURE_T6
#endif
// This file was templated.
// See XAnimLoader.cpp.template.
// Do not modify, changes will be lost.
#include LOADER_HEADER
#include "Utils/Logging/Log.h"
#include "XAnim/CompiledXAnimLoader.h"
@@ -16,7 +38,7 @@
#include <utility>
#include <vector>
using namespace IW3;
using namespace GAME;
namespace
{
@@ -325,9 +347,11 @@ namespace
};
} // namespace
#set METHOD_NAME "CreateLoader" + GAME
namespace xanim
{
std::unique_ptr<AssetCreator<AssetXAnim>> CreateLoaderIW3(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
std::unique_ptr<AssetCreator<AssetXAnim>> METHOD_NAME(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
{
return std::make_unique<XAnimLoader>(memory, searchPath, zone.m_script_strings);
}
@@ -0,0 +1,25 @@
#options GAME(IW3)
#filename "Game/" + GAME + "/XAnim/XAnimLoader" + GAME + ".h"
#set GAME_HEADER "\"Game/" + GAME + "/" + GAME + ".h\""
// This file was templated.
// See XAnimLoader.h.template.
// Do not modify, changes will be lost.
#pragma once
#include "Asset/IAssetCreator.h"
#include GAME_HEADER
#include "SearchPath/ISearchPath.h"
#include "Utils/MemoryManager.h"
#include <memory>
#set METHOD_NAME "CreateLoader" + GAME
namespace xanim
{
std::unique_ptr<AssetCreator<GAME::AssetXAnim>> METHOD_NAME(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
} // namespace xanim