[Vote]: Add menus (#613)
This commit is contained in:
parent
66d6cc3568
commit
874a8027af
@ -768,6 +768,11 @@ namespace Components
|
||||
|
||||
Menus::Menus()
|
||||
{
|
||||
if (ZoneBuilder::IsEnabled())
|
||||
{
|
||||
Game::Menu_Setup(Game::uiContext);
|
||||
}
|
||||
|
||||
if (Dedicated::IsEnabled()) return;
|
||||
|
||||
// Ensure everything is zero'ed
|
||||
@ -870,6 +875,7 @@ namespace Components
|
||||
|
||||
Menus::~Menus()
|
||||
{
|
||||
// In your dreams!
|
||||
Menus::FreeEverything();
|
||||
}
|
||||
}
|
||||
|
@ -316,11 +316,16 @@ namespace Components
|
||||
Vote::Vote()
|
||||
{
|
||||
// Replicate g_allowVote
|
||||
Utils::Hook::Set<DWORD>(0x5E3A4F, Game::DVAR_INTERNAL | Game::DVAR_CODINFO);
|
||||
Utils::Hook::Set<std::uint32_t>(0x5E3A4F, Game::DVAR_INTERNAL | Game::DVAR_CODINFO);
|
||||
|
||||
ClientCommand::Add("callvote", Cmd_CallVote_f);
|
||||
ClientCommand::Add("vote", Cmd_Vote_f);
|
||||
|
||||
Menus::Add("ui_mp/scriptmenus/callvote.menu");
|
||||
Menus::Add("ui_mp/scriptmenus/kickplayer.menu");
|
||||
Menus::Add("ui_mp/scriptmenus/changegametype.menu");
|
||||
Menus::Add("ui_mp/scriptmenus/changemap.menu");
|
||||
|
||||
UIScript::Add("voteKick", []([[maybe_unused]] const UIScript::Token& token, [[maybe_unused]] const Game::uiInfo_s* info)
|
||||
{
|
||||
if (info->playerIndex >= 0 && info->playerIndex < Game::sharedUiInfo->playerCount)
|
||||
|
@ -83,6 +83,7 @@ namespace Game
|
||||
Menus_MenuIsInStack_t Menus_MenuIsInStack = Menus_MenuIsInStack_t(0x47ACB0);
|
||||
Menu_HandleKey_t Menu_HandleKey = Menu_HandleKey_t(0x4C4A00);
|
||||
Menu_GetFocused_t Menu_GetFocused = Menu_GetFocused_t(0x4AFF10);
|
||||
Menu_Setup_t Menu_Setup = Menu_Setup_t(0x415AD0);
|
||||
|
||||
MSG_Init_t MSG_Init = MSG_Init_t(0x45FCA0);
|
||||
MSG_ReadBit_t MSG_ReadBit = MSG_ReadBit_t(0x476D20);
|
||||
|
@ -173,7 +173,7 @@ namespace Game
|
||||
typedef int(*Menus_OpenByName_t)(UiContext* dc, const char* p);
|
||||
extern Menus_OpenByName_t Menus_OpenByName;
|
||||
|
||||
typedef menuDef_t *(*Menus_FindByName_t)(UiContext* dc, const char* name);
|
||||
typedef menuDef_t*(*Menus_FindByName_t)(UiContext* dc, const char* name);
|
||||
extern Menus_FindByName_t Menus_FindByName;
|
||||
|
||||
typedef bool(*Menu_IsVisible_t)(UiContext* dc, menuDef_t* menu);
|
||||
@ -182,11 +182,14 @@ namespace Game
|
||||
typedef bool(*Menus_MenuIsInStack_t)(UiContext* dc, menuDef_t* menu);
|
||||
extern Menus_MenuIsInStack_t Menus_MenuIsInStack;
|
||||
|
||||
typedef void(*Menu_HandleKey_t)(UiContext* ctx, menuDef_t* menu, Game::keyNum_t key, int down);
|
||||
extern Menu_HandleKey_t Menu_HandleKey;
|
||||
|
||||
typedef menuDef_t*(*Menu_GetFocused_t)(UiContext* ctx);
|
||||
extern Menu_GetFocused_t Menu_GetFocused;
|
||||
|
||||
typedef void(*Menu_HandleKey_t)(UiContext* ctx, menuDef_t* menu, Game::keyNum_t key, int down);
|
||||
extern Menu_HandleKey_t Menu_HandleKey;
|
||||
typedef void(*Menu_Setup_t)(UiContext* dc);
|
||||
extern Menu_Setup_t Menu_Setup;
|
||||
|
||||
typedef bool(*UI_KeyEvent_t)(int clientNum, int key, int down);
|
||||
extern UI_KeyEvent_t UI_KeyEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user