CommonLibSSE NG
HUDMenu.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSTArray.h"
4 #include "RE/B/BSTEvent.h"
5 #include "RE/G/GFxValue.h"
6 #include "RE/I/IMenu.h"
7 #include "RE/W/WorldSpaceMenu.h"
8 
9 namespace RE
10 {
11  class ActorValueMeter;
12  class HudModeChangeEvent;
13  class HUDObject;
14  class ShoutMeter;
15  class UserEventEnabledEvent;
16  struct BSRemoteGamepadEvent;
17 
18  // menuDepth = 2
19  // flags = kAlwaysOpen | kRequiresUpdate | kAllowSaving | kCustomRendering | kAssignCursorToRenderer
20  // context = kNone
21  class HUDMenu :
22 #if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
23  public WorldSpaceMenu, // 00
24  public BSTEventSink<UserEventEnabledEvent>, // 58
25  public BSTEventSink<BSRemoteGamepadEvent> // 60
26 #elif !defined(ENABLE_SKYRIM_VR)
27  public IMenu, // 00
28  public BSTEventSink<UserEventEnabledEvent>, // 30
29  public BSTEventSink<BSRemoteGamepadEvent> // 38
30 #else
31  public IMenu // 00
32 #endif
33  {
34  public:
35  inline static constexpr auto RTTI = RTTI_HUDMenu;
36  inline static constexpr auto VTABLE = VTABLE_HUDMenu;
37  constexpr static std::string_view MENU_NAME = "HUD Menu";
38 
39  struct RUNTIME_DATA
40  {
41 #define RUNTIME_DATA_CONTENT \
42  BSTArray<HUDObject*> objects; /* 00 */ \
43  ActorValueMeter* health; /* 18 */ \
44  ActorValueMeter* stamina; /* 20 */ \
45  ActorValueMeter* magicka; /* 28 */ \
46  ShoutMeter* shout; /* 30 */ \
47  GFxValue root; /* 38 - kDisplayObject - "_level0.HUDMovieBaseInstance" */ \
48  std::uint64_t unk90; /* 50 */
49 
51  };
52 
53  ~HUDMenu() override; // 00
54 
55  // override (IMenu)
56  void Accept(CallbackProcessor* a_processor) override; // 01
57  UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04
58  void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05
59  void RefreshPlatform() override; // 08
60 
61 #ifndef SKYRIM_CROSS_VR
62  // override (BSTEventSink<UserEventEnabledEvent>)
63  BSEventNotifyControl ProcessEvent(const UserEventEnabledEvent* a_event, BSTEventSource<UserEventEnabledEvent>* a_eventSource) override; // 01
64 
65  // override (BSTEventSink<BSRemoteGamepadEvent>)
66  BSEventNotifyControl ProcessEvent(const BSRemoteGamepadEvent* a_event, BSTEventSource<BSRemoteGamepadEvent>* a_eventSource) override; // 01
67 #endif
68 
69  [[nodiscard]] WorldSpaceMenu* AsWorldSpaceMenu() noexcept
70  {
72  return nullptr;
73  }
74  return &REL::RelocateMember<WorldSpaceMenu>(this, 0, 0);
75  }
76 
77  [[nodiscard]] const WorldSpaceMenu* AsWorldSpaceMenu() const noexcept
78  {
79  return const_cast<HUDMenu*>(this)->AsWorldSpaceMenu();
80  }
81 
83  {
84  return &REL::RelocateMember<BSTEventSink<UserEventEnabledEvent>>(this, 0x30, 0x58);
85  }
86 
88  {
89  return const_cast<HUDMenu*>(this)->AsUserEventEnabledEventSink();
90  }
91 
93  {
94  return &REL::RelocateMember<BSTEventSink<BSRemoteGamepadEvent>>(this, 0x38, 0x60);
95  }
96 
97  [[nodiscard]] const BSTEventSink<BSRemoteGamepadEvent>* AsBSRemoteGamepadEventSink() const noexcept
98  {
99  return const_cast<HUDMenu*>(this)->AsBSRemoteGamepadEventSink();
100  }
101 
102  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
103  {
104  return REL::RelocateMember<RUNTIME_DATA>(this, 0x40, 0x70);
105  }
106 
107  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
108  {
109  return REL::RelocateMember<RUNTIME_DATA>(this, 0x40, 0x70);
110  }
111 
112  static void FlashMeter(ActorValue a_actorValue)
113  {
114  using func_t = decltype(&HUDMenu::FlashMeter);
115  REL::Relocation<func_t> func{ RELOCATION_ID(51907, 52845) };
116  return func(a_actorValue);
117  }
118 
119  static void UpdateCrosshairMagicTarget(bool a_valid)
120  {
121  using func_t = decltype(&HUDMenu::UpdateCrosshairMagicTarget);
122  REL::Relocation<func_t> func{ RELOCATION_ID(50738, 51633) };
123  return func(a_valid);
124  }
125 
126  // members
127 #ifndef SKYRIM_CROSS_VR
128 # if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
129  std::uint64_t pad68; // 68
130 # endif
131  RUNTIME_DATA_CONTENT // 40, 70
132 #endif
133  };
134 #ifndef ENABLE_SKYRIM_VR
135  static_assert(sizeof(HUDMenu) == 0x98);
136 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
137  static_assert(sizeof(HUDMenu) == 0xC8);
138 #endif
139 }
140 #undef RUNTIME_DATA_CONTENT
#define SKYRIM_REL_CONSTEXPR
Definition: Common.h:47
#define RUNTIME_DATA_CONTENT
Definition: HUDMenu.h:41
#define RELOCATION_ID(a_se, a_ae)
Definition: PCH.h:724
static SKYRIM_REL_VR bool IsVR() noexcept
Definition: Module.h:254
Definition: Relocation.h:204
Definition: BSTEvent.h:143
Definition: BSTEvent.h:19
Definition: FxDelegateHandler.h:19
Definition: HUDMenu.h:33
~HUDMenu() override
const BSTEventSink< BSRemoteGamepadEvent > * AsBSRemoteGamepadEventSink() const noexcept
Definition: HUDMenu.h:97
constexpr static std::string_view MENU_NAME
Definition: HUDMenu.h:37
BSEventNotifyControl ProcessEvent(const UserEventEnabledEvent *a_event, BSTEventSource< UserEventEnabledEvent > *a_eventSource) override
UI_MESSAGE_RESULTS ProcessMessage(UIMessage &a_message) override
static void UpdateCrosshairMagicTarget(bool a_valid)
Definition: HUDMenu.h:119
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: HUDMenu.h:107
BSTEventSink< BSRemoteGamepadEvent > * AsBSRemoteGamepadEventSink() noexcept
Definition: HUDMenu.h:92
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: HUDMenu.h:102
std::uint64_t pad68
Definition: HUDMenu.h:129
static constexpr auto VTABLE
Definition: HUDMenu.h:36
const BSTEventSink< UserEventEnabledEvent > * AsUserEventEnabledEventSink() const noexcept
Definition: HUDMenu.h:87
void RefreshPlatform() override
void Accept(CallbackProcessor *a_processor) override
const WorldSpaceMenu * AsWorldSpaceMenu() const noexcept
Definition: HUDMenu.h:77
WorldSpaceMenu * AsWorldSpaceMenu() noexcept
Definition: HUDMenu.h:69
void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override
static void FlashMeter(ActorValue a_actorValue)
Definition: HUDMenu.h:112
static constexpr auto RTTI
Definition: HUDMenu.h:35
BSEventNotifyControl ProcessEvent(const BSRemoteGamepadEvent *a_event, BSTEventSource< BSRemoteGamepadEvent > *a_eventSource) override
BSTEventSink< UserEventEnabledEvent > * AsUserEventEnabledEventSink() noexcept
Definition: HUDMenu.h:82
Definition: IMenu.h:55
Definition: UIMessage.h:28
Definition: WorldSpaceMenu.h:19
Definition: AbsorbEffect.h:6
ActorValue
Definition: ActorValues.h:6
UI_MESSAGE_RESULTS
Definition: IMenu.h:48
constexpr REL::VariantID RTTI_HUDMenu(688836, 396688, 0x1f46818)
BSEventNotifyControl
Definition: BSTEvent.h:12
constexpr std::array< REL::VariantID, 4 > VTABLE_HUDMenu
Definition: Offsets_VTABLE.h:4038
Definition: HUDMenu.h:40