mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
Finalize menu assets after loading all assets
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
#include "ObjLoading.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
#include "Game/IW4/Menu/MenuConversionZoneStateIW4.h"
|
||||
#include "Game/IW4/Menu/MenuConverterIW4.h"
|
||||
#include "Parsing/Menu/MenuFileReader.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
@ -158,3 +159,8 @@ bool AssetLoaderMenuList::LoadFromRaw(const std::string& assetName, ISearchPath*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetLoaderMenuList::FinalizeAssetsForZone(AssetLoadingContext* context) const
|
||||
{
|
||||
context->GetZoneAssetLoaderState<MenuConversionZoneState>()->FinalizeSupportingData();
|
||||
}
|
||||
|
@ -23,5 +23,6 @@ namespace IW4
|
||||
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
|
||||
_NODISCARD bool CanLoadFromRaw() const override;
|
||||
bool LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override;
|
||||
void FinalizeAssetsForZone(AssetLoadingContext* context) const override;
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "MenuConversionZoneStateIW4.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
MenuConversionZoneState::MenuConversionZoneState()
|
||||
|
@ -189,4 +189,10 @@ bool ObjLoader::LoadAssetForZone(AssetLoadingContext* context, asset_type_t asse
|
||||
{
|
||||
AssetLoadingManager assetLoadingManager(m_asset_loaders_by_type, *context);
|
||||
return assetLoadingManager.LoadAssetFromLoader(assetType, assetName);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjLoader::FinalizeAssetsForZone(AssetLoadingContext* context) const
|
||||
{
|
||||
for (const auto& [type, loader] : m_asset_loaders_by_type)
|
||||
loader->FinalizeAssetsForZone(context);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "IObjLoader.h"
|
||||
@ -12,7 +12,7 @@ namespace IW4
|
||||
{
|
||||
class ObjLoader final : public IObjLoader
|
||||
{
|
||||
std::unordered_map<asset_type_t, std::unique_ptr<IAssetLoader>> m_asset_loaders_by_type;
|
||||
std::map<asset_type_t, std::unique_ptr<IAssetLoader>> m_asset_loaders_by_type;
|
||||
|
||||
static void LoadImageFromIwi(GfxImage* image, ISearchPath* searchPath, Zone* zone);
|
||||
static void LoadImageFromLoadDef(GfxImage* image, Zone* zone);
|
||||
@ -32,5 +32,6 @@ namespace IW4
|
||||
void LoadObjDataForZone(ISearchPath* searchPath, Zone* zone) const override;
|
||||
|
||||
bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
void FinalizeAssetsForZone(AssetLoadingContext* context) const override;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user