mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-11 23:38:09 -05:00
Add AssetLoader basis
This commit is contained in:
@ -8,8 +8,7 @@
|
||||
|
||||
using namespace IW4;
|
||||
|
||||
const std::string GameAssetPoolIW4::ASSET_TYPE_INVALID = "invalid_asset";
|
||||
const std::string GameAssetPoolIW4::ASSET_TYPE_NAMES[]
|
||||
const char* GameAssetPoolIW4::ASSET_TYPE_NAMES[]
|
||||
{
|
||||
"physpreset",
|
||||
"physcollmap",
|
||||
@ -383,10 +382,15 @@ XAssetInfoGeneric* GameAssetPoolIW4::GetAsset(const asset_type_t type, std::stri
|
||||
#undef CASE_GET_ASSET
|
||||
}
|
||||
|
||||
const std::string& GameAssetPoolIW4::GetAssetTypeName(const asset_type_t assetType) const
|
||||
const char* GameAssetPoolIW4::AssetTypeNameByType(asset_type_t assetType)
|
||||
{
|
||||
if (assetType >= 0 && assetType < static_cast<int>(std::extent<decltype(ASSET_TYPE_NAMES)>::value))
|
||||
return ASSET_TYPE_NAMES[assetType];
|
||||
|
||||
return ASSET_TYPE_INVALID;
|
||||
}
|
||||
|
||||
const char* GameAssetPoolIW4::GetAssetTypeName(const asset_type_t assetType) const
|
||||
{
|
||||
return AssetTypeNameByType(assetType);
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ class GameAssetPoolIW4 final : public ZoneAssetPools
|
||||
{
|
||||
int m_priority;
|
||||
|
||||
static const std::string ASSET_TYPE_INVALID;
|
||||
static const std::string ASSET_TYPE_NAMES[];
|
||||
static constexpr const char* ASSET_TYPE_INVALID = "invalid_asset_type";
|
||||
static const char* ASSET_TYPE_NAMES[];
|
||||
|
||||
protected:
|
||||
XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*>& dependencies) override;
|
||||
@ -60,5 +60,6 @@ public:
|
||||
void InitPoolDynamic(asset_type_t type) override;
|
||||
|
||||
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
||||
const std::string& GetAssetTypeName(asset_type_t assetType) const override;
|
||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||
const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||
};
|
||||
|
@ -8,8 +8,7 @@
|
||||
|
||||
using namespace T6;
|
||||
|
||||
const std::string GameAssetPoolT6::ASSET_TYPE_INVALID = "invalid_asset";
|
||||
const std::string GameAssetPoolT6::ASSET_TYPE_NAMES[]
|
||||
const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]
|
||||
{
|
||||
"xmodelpieces",
|
||||
"physpreset",
|
||||
@ -478,10 +477,15 @@ XAssetInfoGeneric* GameAssetPoolT6::GetAsset(const asset_type_t type, std::strin
|
||||
#undef CASE_GET_ASSET
|
||||
}
|
||||
|
||||
const std::string& GameAssetPoolT6::GetAssetTypeName(const asset_type_t assetType) const
|
||||
const char* GameAssetPoolT6::AssetTypeNameByType(asset_type_t assetType)
|
||||
{
|
||||
if (assetType >= 0 && assetType < static_cast<int>(std::extent<decltype(ASSET_TYPE_NAMES)>::value))
|
||||
return ASSET_TYPE_NAMES[assetType];
|
||||
|
||||
return ASSET_TYPE_INVALID;
|
||||
}
|
||||
|
||||
const char* GameAssetPoolT6::GetAssetTypeName(const asset_type_t assetType) const
|
||||
{
|
||||
return AssetTypeNameByType(assetType);
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ class GameAssetPoolT6 final : public ZoneAssetPools
|
||||
{
|
||||
int m_priority;
|
||||
|
||||
static const std::string ASSET_TYPE_INVALID;
|
||||
static const std::string ASSET_TYPE_NAMES[];
|
||||
static constexpr const char* ASSET_TYPE_INVALID = "invalid_asset_type";
|
||||
static const char* ASSET_TYPE_NAMES[];
|
||||
|
||||
protected:
|
||||
XAssetInfoGeneric* AddAssetToPool(asset_type_t type, std::string name, void* asset, std::vector<XAssetInfoGeneric*>& dependencies) override;
|
||||
@ -71,5 +71,6 @@ public:
|
||||
void InitPoolDynamic(asset_type_t type) override;
|
||||
|
||||
XAssetInfoGeneric* GetAsset(asset_type_t type, std::string name) const override;
|
||||
const std::string& GetAssetTypeName(asset_type_t assetType) const override;
|
||||
static const char* AssetTypeNameByType(asset_type_t assetType);
|
||||
const char* GetAssetTypeName(asset_type_t assetType) const override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user