mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-15 09:17:57 -05:00
chore: implement obj loading skeleton with localize asset
This commit is contained in:
23
src/ObjLoading/Game/IW4/Localize/AssetLoaderLocalizeIW4.cpp
Normal file
23
src/ObjLoading/Game/IW4/Localize/AssetLoaderLocalizeIW4.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "AssetLoaderLocalizeIW4.h"
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
AssetLoaderLocalize::AssetLoaderLocalize(MemoryManager& memory, ISearchPath& searchPath, Zone& zone)
|
||||
: CommonLocalizeLoader(searchPath, zone),
|
||||
m_memory(memory)
|
||||
{
|
||||
}
|
||||
|
||||
AssetCreationResult AssetLoaderLocalize::CreateAsset(const std::string& assetName, AssetCreationContext& context)
|
||||
{
|
||||
return CreateLocalizeAsset(assetName, context);
|
||||
}
|
||||
|
||||
AssetCreationResult AssetLoaderLocalize::CreateAssetFromCommonAsset(const CommonLocalizeEntry& localizeEntry, AssetCreationContext& context)
|
||||
{
|
||||
auto* asset = m_memory.Alloc<LocalizeEntry>();
|
||||
asset->name = m_memory.Dup(localizeEntry.m_key.c_str());
|
||||
asset->value = m_memory.Dup(localizeEntry.m_value.c_str());
|
||||
|
||||
return AssetCreationResult::Success(context.AddAsset<AssetLocalize>(localizeEntry.m_key, asset));
|
||||
}
|
25
src/ObjLoading/Game/IW4/Localize/AssetLoaderLocalizeIW4.h
Normal file
25
src/ObjLoading/Game/IW4/Localize/AssetLoaderLocalizeIW4.h
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "Asset/AssetCreationContext.h"
|
||||
#include "Asset/IAssetCreator.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Localize/CommonLocalizeLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Utils/MemoryManager.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
namespace IW4
|
||||
{
|
||||
class AssetLoaderLocalize final : public AssetCreator<AssetLocalize>, public CommonLocalizeLoader
|
||||
{
|
||||
public:
|
||||
AssetLoaderLocalize(MemoryManager& memory, ISearchPath& searchPath, Zone& zone);
|
||||
AssetCreationResult CreateAsset(const std::string& assetName, AssetCreationContext& context) override;
|
||||
|
||||
protected:
|
||||
AssetCreationResult CreateAssetFromCommonAsset(const CommonLocalizeEntry& localizeEntry, AssetCreationContext& context) override;
|
||||
|
||||
private:
|
||||
MemoryManager& m_memory;
|
||||
};
|
||||
} // namespace IW4
|
Reference in New Issue
Block a user