enderalse/source/Enderal DLL/src/Patches/TweenMenuPatch.h

35 lines
823 B
C
Raw Normal View History

2023-12-15 20:39:41 +00:00
#pragma once
#include "HeroMenuPatch.h"
2023-12-15 20:39:41 +00:00
class TweenMenuPatch final : public RE::TweenMenu
{
public:
static void Install();
2023-12-15 20:39:41 +00:00
private:
static void OpenMenu(RE::IMenu* tweenMenu, std::int32_t index)
{
using func_t = decltype(&OpenMenu);
REL::Relocation<func_t> func{ REL::RelocationID(51845, 52718) };
return func(tweenMenu, index);
}
2023-12-15 20:39:41 +00:00
void AcceptEx(CallbackProcessor* a_cbReg)
{
_AcceptFn(this, a_cbReg);
fxDelegate->callbacks.Remove("OpenHighlightedMenu");
a_cbReg->Process("OpenHighlightedMenu", [](const RE::FxDelegateArgs& args) {
auto index = args[0].GetSInt();
if (index <= 1) {
HeroMenuPatch::OpenHeroMenu();
2023-12-15 20:39:41 +00:00
} else if (index <= 4) {
OpenMenu(RE::UI::GetSingleton()->GetMenu(MENU_NAME).get(), index);
}
});
}
inline static REL::Relocation<decltype(&Accept)> _AcceptFn;
2023-12-15 20:39:41 +00:00
};