4
Fork 0

Implemented health bar fix with DLL, removed custom hudmenu.swf and .gfx

remove-levelsystem
Eddoursul 4 months ago
parent 31482f145d
commit 85c1cc1b0c
  1. BIN
      SKSE/Plugins/EnderalSE.dll
  2. BIN
      interface/exported/hudmenu.gfx
  3. BIN
      interface/hudmenu.swf
  4. 2
      source/Enderal DLL/src/Main.cpp
  5. 45
      source/Enderal DLL/src/Patches/HUDMenuPatch.h
  6. 8
      source/Enderal DLL/src/Patches/HeroMenuPatch.cpp

BIN
SKSE/Plugins/EnderalSE.dll (Stored with Git LFS)

Binary file not shown.

BIN
interface/exported/hudmenu.gfx (Stored with Git LFS)

Binary file not shown.

BIN
interface/hudmenu.swf (Stored with Git LFS)

Binary file not shown.

@ -9,6 +9,7 @@
#include "DialogueMenuPatch.h"
#include "Patches/TweenMenuPatch.h"
#include "Patches/HeroMenuPatch.h"
#include "Patches/HUDMenuPatch.h"
using namespace SKSE;
@ -173,6 +174,7 @@ SKSEPluginLoad(const LoadInterface* skse) {
DialogueMenuPatch::Install();
HeroMenuPatch::Install();
TweenMenuPatch::Install();
HUDMenuPatch::Install();
if (g_settings.at("VideoInterruptPatch")) {
logger::info("Making videos interruptible...");

@ -0,0 +1,45 @@
#pragma once
inline std::time_t lastUpdate;
class HUDMenuPatch final : public RE::ActorValueMeter
{
public:
static void Install()
{
REL::Relocation<uintptr_t> vtbl(RE::VTABLE_ActorValueMeter[0]);
_ProcessMessage = vtbl.write_vfunc(0x2, &ProcessMessageEx);
}
private:
bool ProcessMessageEx(RE::UIMessage* a_message)
{
if (this->actorValue == RE::ActorValue::kHealth && a_message->type == RE::UI_MESSAGE_TYPE::kScaleformEvent) {
std::time_t currentTime = std::time(nullptr);
if (currentTime > lastUpdate) {
// Ping the health bar every second
lastUpdate = currentTime;
auto playerAV = RE::PlayerCharacter::GetSingleton()->AsActorValueOwner();
auto currentHealth = playerAV->GetActorValue(RE::ActorValue::kHealth);
if (currentHealth < playerAV->GetBaseActorValue(RE::ActorValue::kHealth) && currentHealth > 0) {
auto uiMovie = RE::UI::GetSingleton()->GetMovieView(RE::HUDMenu::MENU_NAME);
if (uiMovie) {
RE::GFxValue va;
uiMovie->GetVariable(&va, "HUDMovieBaseInstance.HealthMeterAnim._currentframe");
RE::GFxValue args[1];
args[0].SetNumber(va.GetNumber());
uiMovie->Invoke("HUDMovieBaseInstance.HealthMeterAnim.PlayForward", nullptr, args, 1);
}
}
}
}
return _ProcessMessage(this, a_message);
}
inline static REL::Relocation<decltype(&ProcessMessageEx)> _ProcessMessage;
};

@ -57,8 +57,12 @@ void HeroMenuPatch::FillMenuValues()
public:
void operator()(RE::BSScript::Variable a_result)
{
auto uiMovie = RE::UI::GetSingleton()->GetMovieView("CustomMenu");
uiMovie->SetVariable("_root.heromenu_mc.stats.playerclass.stat_value.text", a_result.GetString());
if (a_result.IsString()) {
auto uiMovie = RE::UI::GetSingleton()->GetMovieView("CustomMenu");
if (uiMovie) {
uiMovie->SetVariable("_root.heromenu_mc.stats.playerclass.stat_value.text", a_result.GetString());
}
}
}
bool CanSave() { return false; }
void SetObject(const RE::BSTSmartPointer<RE::BSScript::Object>&) {}

Loading…
Cancel
Save