Some changes
This commit is contained in:
parent
d8d20ed919
commit
baa6ef236e
@ -26,11 +26,6 @@ namespace patches
|
|||||||
off_11C52460 = game::base_address + 0xAD0C58;
|
off_11C52460 = game::base_address + 0xAD0C58;
|
||||||
return &off_11C52460;
|
return &off_11C52460;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _true()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
@ -39,8 +34,8 @@ namespace patches
|
|||||||
void post_unpack() override
|
void post_unpack() override
|
||||||
{
|
{
|
||||||
// Not sure but it works
|
// Not sure but it works
|
||||||
utils::hook::jump(game::base_address + 0x633080, _true, true);
|
utils::hook::set(game::base_address + 0x633080, 0xC301B0);
|
||||||
utils::hook::jump(game::base_address + 0x272F70, _true, true);
|
utils::hook::set(game::base_address + 0x272F70, 0xC301B0);
|
||||||
utils::hook::jump(game::base_address + 0x46148, sub_46148, true);
|
utils::hook::jump(game::base_address + 0x46148, sub_46148, true);
|
||||||
|
|
||||||
// Unlock fps in main menu
|
// Unlock fps in main menu
|
||||||
|
@ -43,6 +43,8 @@ namespace ui_scripting
|
|||||||
|
|
||||||
void render() const;
|
void render() const;
|
||||||
|
|
||||||
|
bool hidden = false;
|
||||||
|
|
||||||
float x = 0.f;
|
float x = 0.f;
|
||||||
float y = 0.f;
|
float y = 0.f;
|
||||||
float w = 0.f;
|
float w = 0.f;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../../scripting/execution.hpp"
|
#include "../../scripting/execution.hpp"
|
||||||
|
|
||||||
#include "../../../component/ui_scripting.hpp"
|
#include "../../../component/ui_scripting.hpp"
|
||||||
|
#include "../../../component/command.hpp"
|
||||||
|
|
||||||
#include "component/game_console.hpp"
|
#include "component/game_console.hpp"
|
||||||
#include "component/scheduler.hpp"
|
#include "component/scheduler.hpp"
|
||||||
@ -437,6 +438,17 @@ namespace ui_scripting::lua
|
|||||||
handler.dispatch(event);
|
handler.dispatch(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
element_type["hidden"] = sol::property(
|
||||||
|
[](element& element)
|
||||||
|
{
|
||||||
|
return element.hidden;
|
||||||
|
},
|
||||||
|
[](element& element, bool hidden)
|
||||||
|
{
|
||||||
|
element.hidden = hidden;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
element_type[sol::meta_function::new_index] = [](element& element, const std::string& attribute, const std::string& value)
|
element_type[sol::meta_function::new_index] = [](element& element, const std::string& attribute, const std::string& value)
|
||||||
{
|
{
|
||||||
element.attributes[attribute] = value;
|
element.attributes[attribute] = value;
|
||||||
@ -517,6 +529,17 @@ namespace ui_scripting::lua
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
menu_type["hidden"] = sol::property(
|
||||||
|
[](menu& menu)
|
||||||
|
{
|
||||||
|
return menu.hidden;
|
||||||
|
},
|
||||||
|
[](menu& menu, bool hidden)
|
||||||
|
{
|
||||||
|
menu.hidden = hidden;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
menu_type["isopen"] = [](menu& menu)
|
menu_type["isopen"] = [](menu& menu)
|
||||||
{
|
{
|
||||||
return menu.visible || (menu.type == menu_type::overlay && game::Menu_IsMenuOpenAndVisible(0, menu.overlay_menu.data()));
|
return menu.visible || (menu.type == menu_type::overlay && game::Menu_IsMenuOpenAndVisible(0, menu.overlay_menu.data()));
|
||||||
@ -646,7 +669,7 @@ namespace ui_scripting::lua
|
|||||||
|
|
||||||
game_type["executecommand"] = [](const game&, const std::string& command)
|
game_type["executecommand"] = [](const game&, const std::string& command)
|
||||||
{
|
{
|
||||||
::game::Cbuf_AddText(0, command.data());
|
command::execute(command, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
game_type["luiopen"] = [](const game&, const std::string& menu)
|
game_type["luiopen"] = [](const game&, const std::string& menu)
|
||||||
|
@ -43,7 +43,7 @@ namespace ui_scripting::lua::engine
|
|||||||
|
|
||||||
bool is_menu_visible(const menu& menu)
|
bool is_menu_visible(const menu& menu)
|
||||||
{
|
{
|
||||||
return menu.visible || (menu.type == menu_type::overlay && game::Menu_IsMenuOpenAndVisible(0, menu.overlay_menu.data()));
|
return menu.visible && !menu.hidden || (!menu.hidden && menu.type == menu_type::overlay && game::Menu_IsMenuOpenAndVisible(0, menu.overlay_menu.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<element*> elements_in_point(int x, int y)
|
std::vector<element*> elements_in_point(int x, int y)
|
||||||
@ -59,6 +59,11 @@ namespace ui_scripting::lua::engine
|
|||||||
|
|
||||||
for (const auto& child : menu.second.children)
|
for (const auto& child : menu.second.children)
|
||||||
{
|
{
|
||||||
|
if (child->hidden)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto in_rect = point_in_rect(
|
const auto in_rect = point_in_rect(
|
||||||
x, y,
|
x, y,
|
||||||
(int)child->x,
|
(int)child->x,
|
||||||
|
@ -55,6 +55,11 @@ namespace ui_scripting
|
|||||||
|
|
||||||
for (auto& element : this->children)
|
for (auto& element : this->children)
|
||||||
{
|
{
|
||||||
|
if (element->hidden)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
element->render();
|
element->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ namespace ui_scripting
|
|||||||
menu();
|
menu();
|
||||||
|
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
|
bool hidden = false;
|
||||||
bool cursor = false;
|
bool cursor = false;
|
||||||
bool cursor_was_enabled = false;
|
bool cursor_was_enabled = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user