iw4x-client/iw4/Components/AssetHandler.hpp
2015-12-26 14:27:34 +01:00

31 lines
900 B
C++

namespace Components
{
class AssetHandler : public Component
{
public:
typedef Game::XAssetHeader(*Callback)(Game::XAssetType, const char*);
typedef bool(*RestrictCallback)(Game::XAssetType type, Game::XAssetHeader asset, const char* name);
AssetHandler();
~AssetHandler();
const char* GetName() { return "AssetHandler"; };
static void OnFind(Game::XAssetType type, Callback callback);
static void OnLoad(RestrictCallback callback);
static const bool Restrict;
static const bool Load;
private:
static bool BypassState;
static Game::XAssetHeader FindAsset(Game::XAssetType type, const char* filename);
static bool IsAssetEligible(Game::XAssetType type, Game::XAssetHeader* asset);
static void FindAssetStub();
static void AddAssetStub();
static std::map<Game::XAssetType, Callback> TypeCallbacks;
static std::vector<RestrictCallback> RestrictCallbacks;
};
}