iw4x-client/src/Components/Modules/ZoneBuilder.hpp

79 lines
1.9 KiB
C++
Raw Normal View History

2016-01-04 18:49:34 -05:00
#define XFILE_MAGIC_UNSIGNED 0x3030317566665749
#define XFILE_VERSION 276
namespace Components
{
class ZoneBuilder : public Component
{
public:
class Zone
{
public:
Zone(std::string zoneName);
~Zone();
2016-01-05 19:23:43 -05:00
void Build();
Utils::Stream* GetBuffer();
Utils::Memory::Allocator* GetAllocator();
2016-01-05 19:23:43 -05:00
bool HasPointer(const void* pointer);
void StorePointer(const void* pointer);
template<typename T>
T* GetPointer(const T* pointer) { return reinterpret_cast<T*>(SafeGetPointer(pointer)); }
int FindAsset(Game::XAssetType type, std::string name);
2016-01-05 19:23:43 -05:00
Game::XAsset* GetAsset(int index);
uint32_t GetAssetOffset(int index);
Game::XAssetHeader RequireAsset(Game::XAssetType type, const char* name);
bool LoadAsset(Game::XAssetType type, std::string name);
int AddScriptString(unsigned short gameIndex);
2016-01-22 07:18:26 -05:00
int AddScriptString(std::string str);
2016-01-05 19:23:43 -05:00
int FindScriptString(std::string str);
void MapScriptString(unsigned short* gameIndex);
void RenameAsset(Game::XAssetType type, std::string asset, std::string newName);
std::string GetAssetName(Game::XAssetType type, std::string asset);
2016-01-04 18:49:34 -05:00
2016-01-26 10:12:41 -05:00
void Store(Game::XAssetHeader header);
2016-01-04 18:49:34 -05:00
private:
2016-01-05 19:23:43 -05:00
void LoadFastFiles();
bool LoadAssets();
bool LoadAsset(std::string type, std::string name);
void SaveData();
void WriteZone();
void AddBranding();
uint32_t SafeGetPointer(const void* pointer);
int IndexStart;
Utils::Stream Buffer;
2016-01-04 18:49:34 -05:00
std::string ZoneName;
2016-01-05 19:23:43 -05:00
Utils::CSV DataMap;
Utils::Memory::Allocator MemAllocator;
2016-01-22 05:59:43 -05:00
std::vector<Game::XAsset> LoadedAssets;
2016-01-05 19:23:43 -05:00
std::vector<std::string> ScriptStrings;
std::map<unsigned short, unsigned int> ScriptStringMap;
std::map<std::string, std::string> RenameMap[Game::XAssetType::ASSET_TYPE_COUNT];
std::map<const void*, uint32_t> PointerMap;
2016-01-24 15:08:14 -05:00
Game::RawFile Branding;
2016-01-04 18:49:34 -05:00
};
ZoneBuilder();
const char* GetName() { return "ZoneBuilder"; };
static bool IsEnabled();
};
}