2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
#define MAX_SOURCEFILES 64
|
2019-01-17 16:33:26 -05:00
|
|
|
#define MAX_MENUS_IN_CONTEXT 640
|
2017-01-19 16:23:59 -05:00
|
|
|
#undef LoadMenu
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Menus : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Menus();
|
|
|
|
~Menus();
|
|
|
|
|
|
|
|
static void FreeEverything();
|
2019-01-17 16:33:26 -05:00
|
|
|
static void RegisterMenuLists();
|
2017-01-19 16:23:59 -05:00
|
|
|
|
2019-01-17 16:33:26 -05:00
|
|
|
// used to load assets for zonebuilder
|
2019-01-22 12:06:07 -05:00
|
|
|
static std::vector<Game::menuDef_t*> LoadMenu(const std::string& file);
|
2019-01-16 23:52:42 -05:00
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
private:
|
2019-01-17 16:33:26 -05:00
|
|
|
static std::unordered_map<std::string, Game::menuDef_t*> DiskMenuList;
|
|
|
|
|
|
|
|
// Loading
|
|
|
|
static int ReserveSourceHandle();
|
|
|
|
static bool IsValidSourceHandle(int handle);
|
|
|
|
static Game::menuDef_t* ParseMenu(int handle);
|
|
|
|
static Game::script_t* LoadMenuScript(const std::string& name, const std::string& buffer);
|
|
|
|
static int LoadMenuSource(const std::string& name, const std::string& buffer);
|
|
|
|
|
|
|
|
// Freeing
|
2017-01-19 16:23:59 -05:00
|
|
|
static void FreeMenuSource(int handle);
|
2019-01-17 16:33:26 -05:00
|
|
|
static void FreeDiskMenu(Game::menuDef_t* menudef);
|
2017-01-19 16:23:59 -05:00
|
|
|
|
2019-01-17 16:33:26 -05:00
|
|
|
// Etc.
|
2017-01-19 16:23:59 -05:00
|
|
|
static bool IsMenuVisible(Game::UiContext *dc, Game::menuDef_t *menu);
|
|
|
|
|
2019-01-17 16:33:26 -05:00
|
|
|
// Manage menus in uiContext
|
|
|
|
static void AddMenuListToContext(Game::UiContext* ctx, Game::MenuList* list, int close);
|
|
|
|
static void ResetContextHook(int a1);
|
2019-01-16 23:52:42 -05:00
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
// Ugly!
|
|
|
|
static int KeywordHash(char* key);
|
|
|
|
};
|
|
|
|
}
|