mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 07:18:11 -05:00
Reformat code with clang format
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
#include "AssetLoaderGfxImage.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "Image/DdsLoader.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
#include "Image/IwiTypes.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
@ -23,7 +23,8 @@ bool AssetLoaderGfxImage::CanLoadFromRaw() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetLoaderGfxImage::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||
bool AssetLoaderGfxImage::LoadFromRaw(
|
||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||
{
|
||||
// Do not load any GfxImages from raw for now that are not loaded
|
||||
// TODO: Load iwis and add streaming info to asset
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "AssetLoading/BasicAssetLoader.h"
|
||||
#include "AssetLoading/IAssetLoadingManager.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
namespace IW3
|
||||
@ -11,6 +11,7 @@ namespace IW3
|
||||
public:
|
||||
_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;
|
||||
bool
|
||||
LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "AssetLoaderRawFile.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "Pool/GlobalAssetPool.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
void* AssetLoaderRawFile::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
|
||||
@ -20,7 +20,8 @@ bool AssetLoaderRawFile::CanLoadFromRaw() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AssetLoaderRawFile::LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||
bool AssetLoaderRawFile::LoadFromRaw(
|
||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||
{
|
||||
const auto file = searchPath->Open(assetName);
|
||||
if (!file.IsOpen())
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "AssetLoading/BasicAssetLoader.h"
|
||||
#include "AssetLoading/IAssetLoadingManager.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
namespace IW3
|
||||
@ -11,6 +11,7 @@ namespace IW3
|
||||
public:
|
||||
_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;
|
||||
bool
|
||||
LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
@ -1,22 +1,26 @@
|
||||
#include "ObjLoaderIW3.h"
|
||||
|
||||
#include "Game/IW3/GameIW3.h"
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
#include "ObjContainer/IPak/IPak.h"
|
||||
#include "ObjLoading.h"
|
||||
#include "AssetLoaders/AssetLoaderGfxImage.h"
|
||||
#include "AssetLoaders/AssetLoaderRawFile.h"
|
||||
#include "AssetLoading/AssetLoadingManager.h"
|
||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||
#include "Game/IW3/GameIW3.h"
|
||||
#include "Image/Dx9TextureLoader.h"
|
||||
#include "Image/Texture.h"
|
||||
#include "Image/IwiLoader.h"
|
||||
#include "Image/IwiTypes.h"
|
||||
#include "Image/Texture.h"
|
||||
#include "ObjContainer/IPak/IPak.h"
|
||||
#include "ObjLoading.h"
|
||||
|
||||
using namespace IW3;
|
||||
|
||||
ObjLoader::ObjLoader()
|
||||
{
|
||||
#define REGISTER_ASSET_LOADER(t) {auto l = std::make_unique<t>(); m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l);}
|
||||
#define REGISTER_ASSET_LOADER(t) \
|
||||
{ \
|
||||
auto l = std::make_unique<t>(); \
|
||||
m_asset_loaders_by_type[l->GetHandlingAssetType()] = std::move(l); \
|
||||
}
|
||||
#define BASIC_LOADER(assetType, assetClass) BasicAssetLoader<assetType, assetClass>
|
||||
|
||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_PHYSPRESET, PhysPreset))
|
||||
@ -58,23 +62,17 @@ bool ObjLoader::SupportsZone(Zone* zone) const
|
||||
|
||||
bool ObjLoader::IsMpZone(Zone* zone)
|
||||
{
|
||||
return zone->m_name.compare(0, 3, "mp_") == 0
|
||||
|| zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0;
|
||||
return zone->m_name.compare(0, 3, "mp_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_mp") == 0;
|
||||
}
|
||||
|
||||
bool ObjLoader::IsZmZone(Zone* zone)
|
||||
{
|
||||
return zone->m_name.compare(0, 3, "zm_") == 0
|
||||
|| zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0;
|
||||
return zone->m_name.compare(0, 3, "zm_") == 0 || zone->m_name.compare(zone->m_name.length() - 3, 3, "_zm") == 0;
|
||||
}
|
||||
|
||||
void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const
|
||||
{
|
||||
}
|
||||
void ObjLoader::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone) const {}
|
||||
|
||||
void ObjLoader::UnloadContainersOfZone(Zone* zone) const
|
||||
{
|
||||
}
|
||||
void ObjLoader::UnloadContainersOfZone(Zone* zone) const {}
|
||||
|
||||
void ObjLoader::LoadImageFromLoadDef(GfxImage* image, Zone* zone)
|
||||
{
|
||||
@ -183,4 +181,4 @@ void ObjLoader::FinalizeAssetsForZone(AssetLoadingContext* context) const
|
||||
{
|
||||
for (const auto& [type, loader] : m_asset_loaders_by_type)
|
||||
loader->FinalizeAssetsForZone(context);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "AssetLoading/IAssetLoader.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
#include "IObjLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "IObjLoader.h"
|
||||
#include "AssetLoading/IAssetLoader.h"
|
||||
#include "SearchPath/ISearchPath.h"
|
||||
#include "Game/IW3/IW3.h"
|
||||
|
||||
namespace IW3
|
||||
{
|
||||
class ObjLoader final : public IObjLoader
|
||||
@ -34,4 +34,4 @@ namespace IW3
|
||||
bool LoadAssetForZone(AssetLoadingContext* context, asset_type_t assetType, const std::string& assetName) const override;
|
||||
void FinalizeAssetsForZone(AssetLoadingContext* context) const override;
|
||||
};
|
||||
}
|
||||
} // namespace IW3
|
||||
|
Reference in New Issue
Block a user