diff --git a/InstructionalButton.cpp b/InstructionalButton.cpp deleted file mode 100644 index 7531ddd..0000000 --- a/InstructionalButton.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "InstructionalButton.h" - - - -InstructionalButton::InstructionalButton() -{ -} - - -InstructionalButton::~InstructionalButton() -{ -} diff --git a/InstructionalButton.h b/InstructionalButton.h index 92d95f2..72a04b5 100644 --- a/InstructionalButton.h +++ b/InstructionalButton.h @@ -2,7 +2,8 @@ class InstructionalButton { public: - InstructionalButton(); - ~InstructionalButton(); + InstructionalButton() { } + + ~InstructionalButton() { } }; diff --git a/Scaleform.cpp b/Scaleform.cpp deleted file mode 100644 index c11e07f..0000000 --- a/Scaleform.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Scaleform.h" diff --git a/Scaleform.h b/Scaleform.h index de5de65..88c7c1b 100644 --- a/Scaleform.h +++ b/Scaleform.h @@ -3,7 +3,7 @@ #include #include "inc/natives.h" #include -#include +#include class ScaleformArgumentTXD { public: @@ -19,6 +19,7 @@ class ScaleformArgumentTXD { class Scaleform { + using ScaleArg = std::variant; public: Scaleform(std::string scaleformID) { m_handle = GRAPHICS::REQUEST_SCALEFORM_MOVIE((char *)scaleformID.c_str()); @@ -41,32 +42,31 @@ class Scaleform return GRAPHICS::HAS_SCALEFORM_MOVIE_LOADED(m_handle); } - void CallFunction(std::string function, std::vector args = std::vector{}) { + void CallFunction(std::string function, std::vector args = {}) { GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION(m_handle, (char *)function.c_str()); for (auto arg : args) { - if (!arg.has_value()) continue; - if (arg.type() == typeid(std::string)) { + if (std::holds_alternative(arg)) { GRAPHICS::BEGIN_TEXT_COMMAND_SCALEFORM_STRING("STRING"); - UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)std::any_cast(arg).c_str()); + UI::ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME((char *)std::get(arg).c_str()); GRAPHICS::END_TEXT_COMMAND_SCALEFORM_STRING(); } - else if (arg.type() == typeid(int)) { - GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(std::any_cast(arg)); + else if (std::holds_alternative(arg)) { + GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_INT(std::get(arg)); } - else if (arg.type() == typeid(float)) { - GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT(std::any_cast(arg)); + else if (std::holds_alternative(arg)) { + GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT(std::get(arg)); } - else if (arg.type() == typeid(double)) { - GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)std::any_cast(arg)); + else if (std::holds_alternative(arg)) { + GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_FLOAT((float)std::get(arg)); } - else if (arg.type() == typeid(bool)) { - GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL(std::any_cast(arg)); + else if (std::holds_alternative(arg)) { + GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_BOOL(std::get(arg)); } - else if (arg.type() == typeid(ScaleformArgumentTXD)) { - GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING((char *)std::any_cast(arg).Txd().c_str()); + else if (std::holds_alternative(arg)) { + GRAPHICS::_PUSH_SCALEFORM_MOVIE_FUNCTION_PARAMETER_STRING((char *)std::get(arg).Txd().c_str()); } else { diff --git a/menu.cpp b/menu.cpp index e1e22b2..0e872c3 100644 --- a/menu.cpp +++ b/menu.cpp @@ -598,7 +598,9 @@ void Menu::EndMenu() { instructionalButtonsScaleform.CallFunction("CREATE_CONTAINER"); instructionalButtonsScaleform.CallFunction("SET_DATA_SLOT", { 0, std::string(CONTROLS::GET_CONTROL_INSTRUCTIONAL_BUTTON(2, ControlPhoneSelect, 0)), std::string(UI::_GET_LABEL_TEXT("HUD_INPUT2")) }); instructionalButtonsScaleform.CallFunction("SET_DATA_SLOT", { 1, std::string(CONTROLS::GET_CONTROL_INSTRUCTIONAL_BUTTON(2, ControlPhoneCancel, 0)), std::string(UI::_GET_LABEL_TEXT("HUD_INPUT3")) }); - + instructionalButtonsScaleform.CallFunction("SET_DATA_SLOT", { 2, std::string(CONTROLS::GET_CONTROL_INSTRUCTIONAL_BUTTON(2, ControlPhoneUp, 0)), std::string("Up") }); + instructionalButtonsScaleform.CallFunction("SET_DATA_SLOT", { 3, std::string(CONTROLS::GET_CONTROL_INSTRUCTIONAL_BUTTON(2, ControlPhoneDown, 0)), std::string("Down") }); + //int count = 2; //for (auto button : instructionalButtons) { // if (button.ItemBind == null || MenuItems[CurrentSelection] == button.ItemBind) { @@ -607,7 +609,7 @@ void Menu::EndMenu() { // } //} - instructionalButtonsScaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", std::vector{ -1 }); + instructionalButtonsScaleform.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", { -1 }); instructionalButtonsScaleform.Render2D(); disableKeys();