2023-11-19 21:07:21 +00:00

58 lines
2.4 KiB
C++

#pragma once
#include "AssetLoading/IAssetLoader.h"
#include "Game/T6/T6.h"
#include "IObjLoader.h"
#include "ObjContainer/SoundBank/SoundBank.h"
#include "SearchPath/ISearchPath.h"
#include <map>
#include <memory>
#include <set>
#include <stack>
#include <string>
namespace T6
{
class ObjLoader final : public IObjLoader
{
static const int IPAK_READ_HASH;
static const int GLOBAL_HASH;
std::map<asset_type_t, std::unique_ptr<IAssetLoader>> m_asset_loaders_by_type;
static bool VerifySoundBankChecksum(const SoundBank* soundBank, const SndRuntimeAssetBank& sndRuntimeAssetBank);
static SoundBank* LoadSoundBankForZone(ISearchPath* searchPath, const std::string& soundBankFileName, Zone* zone);
static void LoadSoundBankFromLinkedInfo(ISearchPath* searchPath,
const std::string& soundBankFileName,
const SndRuntimeAssetBank* sndBankLinkedInfo,
Zone* zone,
std::set<std::string>& loadedBanksForZone,
std::stack<std::string>& dependenciesToLoad);
static void LoadSoundBanksFromAsset(ISearchPath* searchPath, const SndBank* sndBank, Zone* zone, std::set<std::string>& loadedBanksForZone);
static void LoadIPakForZone(ISearchPath* searchPath, const std::string& ipakName, Zone* zone);
static void LoadImageFromIwi(GfxImage* image, ISearchPath* searchPath, Zone* zone);
static void LoadImageFromLoadDef(GfxImage* image, Zone* zone);
static void LoadImageData(ISearchPath* searchPath, Zone* zone);
static bool IsMpZone(Zone* zone);
static bool IsZmZone(Zone* zone);
static void LoadCommonIPaks(ISearchPath* searchPath, Zone* zone);
public:
ObjLoader();
bool SupportsZone(Zone* zone) const override;
void LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const override;
void UnloadContainersOfZone(Zone* zone) const override;
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;
};
} // namespace T6