2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Maps : public Component
|
|
|
|
{
|
|
|
|
public:
|
2017-04-06 16:22:30 -04:00
|
|
|
class UserMapContainer
|
|
|
|
{
|
|
|
|
public:
|
2017-04-08 09:32:51 -04:00
|
|
|
UserMapContainer() : wasFreed(false), hash(0) {}
|
2018-12-17 08:29:18 -05:00
|
|
|
UserMapContainer(const std::string& _mapname) : wasFreed(false), mapname(_mapname)
|
2017-04-06 16:22:30 -04:00
|
|
|
{
|
|
|
|
ZeroMemory(&this->searchPath, sizeof this->searchPath);
|
|
|
|
this->hash = Maps::GetUsermapHash(this->mapname);
|
2017-04-08 09:32:51 -04:00
|
|
|
Game::UI_UpdateArenas();
|
2017-04-06 16:22:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
~UserMapContainer()
|
|
|
|
{
|
|
|
|
this->freeIwd();
|
|
|
|
this->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int getHash() { return this->hash; }
|
|
|
|
std::string getName() { return this->mapname; }
|
|
|
|
bool isValid() { return !this->mapname.empty(); }
|
2017-04-08 09:32:51 -04:00
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
bool wasValid = this->isValid();
|
|
|
|
this->mapname.clear();
|
2017-06-14 06:06:04 -04:00
|
|
|
if (wasValid) Game::UI_UpdateArenas();
|
2017-04-08 09:32:51 -04:00
|
|
|
}
|
2017-04-06 16:22:30 -04:00
|
|
|
|
|
|
|
void loadIwd();
|
|
|
|
void freeIwd();
|
|
|
|
|
|
|
|
void reloadIwd();
|
|
|
|
|
|
|
|
void handlePackfile(void* packfile);
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool wasFreed;
|
|
|
|
unsigned int hash;
|
|
|
|
std::string mapname;
|
|
|
|
Game::searchpath_t searchPath;
|
|
|
|
};
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
Maps();
|
|
|
|
~Maps();
|
|
|
|
|
|
|
|
static void HandleAsSPMap();
|
|
|
|
|
|
|
|
static std::string CurrentMainZone;
|
2017-04-08 09:32:51 -04:00
|
|
|
static const char* UserMapFiles[4];
|
2017-01-19 16:23:59 -05:00
|
|
|
|
2022-12-31 09:03:33 -05:00
|
|
|
static bool CheckMapInstalled(const std::string& mapname, bool error = false, bool dlcIsTrue = false);
|
2017-01-29 12:27:11 -05:00
|
|
|
|
2017-04-06 16:22:30 -04:00
|
|
|
static UserMapContainer* GetUserMap();
|
2018-12-17 08:29:18 -05:00
|
|
|
static unsigned int GetUsermapHash(const std::string& map);
|
2017-04-06 16:22:30 -04:00
|
|
|
|
2017-05-01 07:08:34 -04:00
|
|
|
static Game::XAssetEntry* GetAssetEntryPool();
|
2017-05-01 08:57:17 -04:00
|
|
|
static bool IsCustomMap();
|
2018-12-17 08:29:18 -05:00
|
|
|
static bool IsUserMap(const std::string& mapname);
|
2017-05-01 07:08:34 -04:00
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
private:
|
|
|
|
class DLC
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int index;
|
2017-01-29 12:27:11 -05:00
|
|
|
std::string name;
|
2017-01-19 16:23:59 -05:00
|
|
|
std::vector<std::string> maps;
|
|
|
|
};
|
|
|
|
|
2022-07-20 15:47:54 -04:00
|
|
|
struct MapDependencies
|
|
|
|
{
|
|
|
|
std::vector<std::string> requiredMaps;
|
|
|
|
std::pair<std::string, std::string> requiredTeams;
|
|
|
|
bool requiresTeamZones;
|
|
|
|
};
|
|
|
|
|
2017-04-06 16:22:30 -04:00
|
|
|
static bool SPMap;
|
|
|
|
static UserMapContainer UserMap;
|
2017-01-19 16:23:59 -05:00
|
|
|
static std::vector<DLC> DlcPacks;
|
|
|
|
|
|
|
|
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
|
|
|
static std::vector<std::string> CurrentDependencies;
|
|
|
|
|
2022-06-16 10:15:26 -04:00
|
|
|
static Dvar::Var RListSModels;
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
static void GetBSPName(char* buffer, size_t size, const char* format, const char* mapname);
|
2018-12-17 08:29:18 -05:00
|
|
|
static void LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, const std::string& name, bool* restrict);
|
2017-01-19 16:23:59 -05:00
|
|
|
static void LoadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
2017-04-06 16:22:30 -04:00
|
|
|
static void UnloadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static void OverrideMapEnts(Game::MapEnts* ents);
|
2022-07-20 15:47:54 -04:00
|
|
|
static MapDependencies GetDependenciesForMap(const std::string& map);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
|
|
|
static int IgnoreEntityStub(const char* entity);
|
|
|
|
|
|
|
|
static Game::G_GlassData* GetWorldData();
|
|
|
|
static void GetWorldDataStub();
|
|
|
|
|
|
|
|
static void LoadRawSun();
|
|
|
|
|
|
|
|
static void AddDlc(DLC dlc);
|
|
|
|
static void UpdateDlcStatus();
|
|
|
|
|
2017-04-06 16:22:30 -04:00
|
|
|
static void PrepareUsermap(const char* mapname);
|
|
|
|
static void SpawnServerStub();
|
|
|
|
static void LoadMapLoadscreenStub();
|
|
|
|
|
2017-05-30 15:49:13 -04:00
|
|
|
static int TriggerReconnectForMap(Game::msg_t* msg, const char* mapname);
|
2017-04-07 15:37:01 -04:00
|
|
|
static void RotateCheckStub();
|
2017-05-30 15:49:13 -04:00
|
|
|
static void LoadNewMapCommand(char* buffer, size_t size, const char* format, const char* mapname, const char* gametype);
|
2017-04-06 16:22:30 -04:00
|
|
|
|
2017-04-08 09:32:51 -04:00
|
|
|
static const char* LoadArenaFileStub(const char* name, char* buffer, int size);
|
|
|
|
|
2017-04-24 15:13:54 -04:00
|
|
|
static void HideModel();
|
|
|
|
static void HideModelStub();
|
|
|
|
|
2019-10-02 02:08:11 -04:00
|
|
|
static void G_SpawnTurretHook(Game::gentity_s* ent, int unk, int unk2);
|
2021-04-02 10:13:51 -04:00
|
|
|
static bool SV_SetTriggerModelHook(Game::gentity_s* ent);
|
|
|
|
static int16 CM_TriggerModelBounds(int brushModelPointer, Game::Bounds* bounds);
|
2017-01-19 16:23:59 -05:00
|
|
|
};
|
|
|
|
}
|