2015-12-23 21:26:46 -05:00
|
|
|
#define MAX_SOURCEFILES 64
|
2016-01-15 13:23:07 -05:00
|
|
|
#undef LoadMenu
|
2015-12-23 21:26:46 -05:00
|
|
|
|
2015-12-23 16:21:03 -05:00
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Menus : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Menus();
|
2015-12-23 21:26:46 -05:00
|
|
|
~Menus();
|
2015-12-23 16:21:03 -05:00
|
|
|
const char* GetName() { return "Menus"; };
|
2015-12-23 21:26:46 -05:00
|
|
|
|
2015-12-25 15:42:35 -05:00
|
|
|
static void FreeEverything();
|
|
|
|
|
2015-12-30 09:37:53 -05:00
|
|
|
static void Add(std::string menu);
|
|
|
|
|
2015-12-23 21:26:46 -05:00
|
|
|
private:
|
2016-01-14 08:26:29 -05:00
|
|
|
static std::map<std::string, Game::menuDef_t*> MenuList;
|
|
|
|
static std::map<std::string, Game::MenuList*> MenuListList;
|
2015-12-30 09:37:53 -05:00
|
|
|
static std::vector<std::string> CustomMenus;
|
2015-12-23 21:26:46 -05:00
|
|
|
|
2016-02-06 07:37:23 -05:00
|
|
|
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);
|
|
|
|
static Game::XAssetHeader MenuFileLoad(Game::XAssetType type, std::string filename);
|
2016-01-14 08:26:29 -05:00
|
|
|
|
2015-12-23 21:26:46 -05:00
|
|
|
static Game::MenuList* LoadMenuList(Game::MenuList* menuList);
|
2015-12-28 08:08:46 -05:00
|
|
|
static Game::MenuList* LoadScriptMenu(const char* menu);
|
2015-12-24 06:00:29 -05:00
|
|
|
static std::vector<Game::menuDef_t*> LoadMenu(Game::menuDef_t* menudef);
|
2015-12-28 08:08:46 -05:00
|
|
|
static std::vector<Game::menuDef_t*> LoadMenu(std::string file);
|
2015-12-24 06:00:29 -05:00
|
|
|
|
2015-12-28 08:08:46 -05:00
|
|
|
static Game::script_t* LoadMenuScript(std::string name, std::string buffer);
|
|
|
|
static int LoadMenuSource(std::string name, std::string buffer);
|
2015-12-23 21:26:46 -05:00
|
|
|
|
|
|
|
static int ReserveSourceHandle();
|
2015-12-24 06:00:29 -05:00
|
|
|
static bool IsValidSourceHandle(int handle);
|
|
|
|
|
2016-01-15 13:39:33 -05:00
|
|
|
static Game::menuDef_t* ParseMenu(int handle);
|
2015-12-23 21:26:46 -05:00
|
|
|
|
|
|
|
static void FreeMenuSource(int handle);
|
|
|
|
|
|
|
|
static void FreeMenuList(Game::MenuList* menuList);
|
|
|
|
static void FreeMenu(Game::menuDef_t* menudef);
|
|
|
|
|
2016-01-14 08:26:29 -05:00
|
|
|
static void RemoveMenu(std::string menu);
|
2015-12-24 08:28:08 -05:00
|
|
|
static void RemoveMenu(Game::menuDef_t* menudef);
|
2016-01-14 08:26:29 -05:00
|
|
|
static void RemoveMenuList(std::string menuList);
|
2015-12-24 08:28:08 -05:00
|
|
|
static void RemoveMenuList(Game::MenuList* menuList);
|
|
|
|
|
2016-01-16 07:11:00 -05:00
|
|
|
static void OverrideMenu(Game::menuDef_t *menu);
|
|
|
|
|
2016-01-14 09:29:39 -05:00
|
|
|
static bool IsMenuVisible(Game::UiContext *dc, Game::menuDef_t *menu);
|
2015-12-24 06:00:29 -05:00
|
|
|
|
2016-01-15 13:23:07 -05:00
|
|
|
static void RemoveMenuFromContext(Game::UiContext *dc, Game::menuDef_t *menu);
|
2016-01-14 17:23:14 -05:00
|
|
|
|
2015-12-24 06:00:29 -05:00
|
|
|
// Ugly!
|
|
|
|
static int KeywordHash(char* key);
|
2015-12-23 16:21:03 -05:00
|
|
|
};
|
|
|
|
}
|