From 5e9ffaad0462238db8b7dbbf6aebd13a5c2f6907 Mon Sep 17 00:00:00 2001 From: Eddoursul Date: Fri, 5 Aug 2022 14:51:25 +0200 Subject: [PATCH] Possible implementation with bFadedIn --- SKSE/Plugins/EnderalSE.dll | 2 +- interface/dialoguemenu.swf | 4 +- source/Enderal DLL/CMakeLists.txt | 1 + source/Enderal DLL/src/EventListener.cpp | 9 ++++ source/Enderal DLL/src/LockableDialogs.cpp | 48 ++++++++++++++++++++++ source/Enderal DLL/src/LockableDialogs.h | 18 ++++++++ source/Enderal DLL/src/Main.cpp | 3 ++ 7 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 source/Enderal DLL/src/LockableDialogs.cpp create mode 100644 source/Enderal DLL/src/LockableDialogs.h diff --git a/SKSE/Plugins/EnderalSE.dll b/SKSE/Plugins/EnderalSE.dll index c50ae351..c5424f17 100644 --- a/SKSE/Plugins/EnderalSE.dll +++ b/SKSE/Plugins/EnderalSE.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:339403c800358d36bdcf4e0f8d2bc4503135d6e16a64405994f026e328168c4f +oid sha256:0b88d4e515fd448e38f2128c1fc9a282716e10bc761e0f814840f2a430943eb7 size 632320 diff --git a/interface/dialoguemenu.swf b/interface/dialoguemenu.swf index e85d0f95..f62f98ec 100644 --- a/interface/dialoguemenu.swf +++ b/interface/dialoguemenu.swf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:301b8c7e99fc049a1b38c57ecd907583a977863be9ab5dcfee2d4cca2d9da3a2 -size 24628 +oid sha256:06abe963a694ba0cb2a85b837b3d04f18732b8becffeb3d67fd66af858fe4e33 +size 53022 diff --git a/source/Enderal DLL/CMakeLists.txt b/source/Enderal DLL/CMakeLists.txt index e74a3d46..876bcaeb 100644 --- a/source/Enderal DLL/CMakeLists.txt +++ b/source/Enderal DLL/CMakeLists.txt @@ -26,6 +26,7 @@ set(sources src/Main.cpp src/EventListener.cpp src/Papyrus.cpp + src/LockableDialogs.cpp ${CMAKE_CURRENT_BINARY_DIR}/version.rc) diff --git a/source/Enderal DLL/src/EventListener.cpp b/source/Enderal DLL/src/EventListener.cpp index ca90a8df..504c7211 100644 --- a/source/Enderal DLL/src/EventListener.cpp +++ b/source/Enderal DLL/src/EventListener.cpp @@ -57,6 +57,15 @@ auto EventListener::ProcessEvent( } } + if (a_event->opening && a_event->menuName == RE::DialogueMenu::MENU_NAME) { + if (auto ui = RE::UI::GetSingleton(); ui) { + if (auto menu = ui->GetMenu(RE::DialogueMenu::MENU_NAME); menu) { + const RE::GFxValue boolVal = false; + menu->uiMovie->SetVariable("_root.DialogueMenu_mc.bFadedIn", boolVal, RE::GFxMovie::SetVarType::kSticky); + } + } + } + return RE::BSEventNotifyControl::kContinue; } diff --git a/source/Enderal DLL/src/LockableDialogs.cpp b/source/Enderal DLL/src/LockableDialogs.cpp new file mode 100644 index 00000000..572bdf3e --- /dev/null +++ b/source/Enderal DLL/src/LockableDialogs.cpp @@ -0,0 +1,48 @@ +#include "LockableDialogs.h" + +namespace LockableDialogs +{ + RE::UI_MESSAGE_RESULTS LockableDialogsEx::ProcessMessageEx(RE::UIMessage& a_message) + { + using Message = RE::UI_MESSAGE_TYPE; // this gives easy access to the message types, like kShow etc. + + if (a_message.type == Message::kHide) { + + /* + if (auto ui = RE::UI::GetSingleton(); ui) { + if (auto menu = ui->GetMenu(RE::DialogueMenu::MENU_NAME); menu) { + RE::GFxValue bEnableTab; + const auto movie = RE::UI::GetSingleton()->GetMovieView(RE::DialogueMenu::MENU_NAME); + if (movie) { + if (movie->GetVariable(&bEnableTab, "_root.DialogueMenu_mc.bEnableTab") && !bEnableTab.GetBool()) { + RE::DebugNotification("LOCKED"); + } + } + } + } + */ + + return RE::UI_MESSAGE_RESULTS::kIgnore; + } + + return _ProcessMessageFn(this, a_message); + } + + /* + void DialogueMenuEx::doAllowProgressFix() + { + if (auto ui = RE::UI::GetSingleton(); ui) { + if (auto menu = ui->GetMenu(RE::DialogueMenu::MENU_NAME); menu) { + const RE::GFxValue forceTrue = true; + menu->uiMovie->SetVariable("_root.DialogueMenu_mc.bAllowProgress", true, RE::GFxMovie::SetVarType::kSticky); + } + } + } + */ + + void LockableDialogsEx::Install() + { + REL::Relocation vtbl(RE::VTABLE_DialogueMenu[0]); + _ProcessMessageFn = vtbl.write_vfunc(0x4, &ProcessMessageEx); + } +} \ No newline at end of file diff --git a/source/Enderal DLL/src/LockableDialogs.h b/source/Enderal DLL/src/LockableDialogs.h new file mode 100644 index 00000000..9b62d5af --- /dev/null +++ b/source/Enderal DLL/src/LockableDialogs.h @@ -0,0 +1,18 @@ +#pragma once + +namespace LockableDialogs +{ + class LockableDialogsEx : public RE::DialogueMenu + { + public: + static void Install(); + + public: + RE::UI_MESSAGE_RESULTS ProcessMessageEx(RE::UIMessage& a_message); + + private: + using ProcessMessageFn = decltype(&RE::DialogueMenu::ProcessMessage); + + inline static REL::Relocation _ProcessMessageFn; + }; +} diff --git a/source/Enderal DLL/src/Main.cpp b/source/Enderal DLL/src/Main.cpp index cd7af985..03c6184d 100644 --- a/source/Enderal DLL/src/Main.cpp +++ b/source/Enderal DLL/src/Main.cpp @@ -3,6 +3,7 @@ #include "Papyrus.h" #include "FlatMapMarkers.h" #include "StayAtSystemPage.h" +#include "LockableDialogs.h" using namespace SKSE; @@ -121,6 +122,8 @@ SKSEPluginLoad(const LoadInterface* skse) { JournalMenuEx::InstallHooks(); } + //LockableDialogs::LockableDialogsEx::Install(); + logger::info("{} has finished loading.", plugin->GetName()); return true; }