[Vote]: Add menus (#613)

This commit is contained in:
Edo 2022-12-01 00:00:18 +00:00 committed by GitHub
parent 66d6cc3568
commit 874a8027af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -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();
}
}

View File

@ -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)

View File

@ -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);

View File

@ -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;