CommonLibSSE NG
BookMenu.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/B/BSString.h"
5 #include "RE/B/BSTEvent.h"
6 #include "RE/G/GPtr.h"
7 #include "RE/I/IMenu.h"
8 #include "RE/N/NiMatrix3.h"
9 #include "RE/N/NiSmartPointer.h"
11 
12 namespace RE
13 {
14  struct BSAnimationGraphEvent;
15 
16  class ExtraDataList;
17  class NiAVObject;
18  class TESObjectBOOK;
19  class TESObjectREFR;
20 
21  // menuDepth = 1
22  // flags = kPausesGame | kUsesMenuContext | kDisablePauseMenu | kRequiresUpdate | kTopmostRenderedMenu | kRendersOffscreenTargets
23  // context = kBook
24  class BookMenu :
25 #ifndef SKYRIM_CROSS_VR
26  public IMenu, // 00
28  public BSTEventSink<BSAnimationGraphEvent> // 48
29 #else
30  public IMenu // 00
31 #endif
32  {
33  public:
34  inline static constexpr auto RTTI = RTTI_BookMenu;
35  inline static constexpr auto VTABLE = VTABLE_BookMenu;
36  constexpr static std::string_view MENU_NAME = "Book Menu";
37 
38  struct RUNTIME_DATA
39  {
40 #define RUNTIME_DATA_CONTENT \
41  BSTArray<BSScaleformExternalTexture> bookTextures; /* 00 */ \
42  GPtr<GFxMovieView> book; /* 18 */ \
43  NiPointer<NiAVObject> book3D; /* 20 */ \
44  std::uint32_t unk78; /* 28 */ \
45  std::uint32_t pad7C; /* 2C */ \
46  std::uint64_t unk80; /* 30 */ \
47  void* unk88; /* 38 - smart ptr */ \
48  std::uint16_t unk90; /* 40 */ \
49  std::uint16_t unk92; /* 42 */ \
50  bool closeMenu; /* 44 */ \
51  bool isNote; /* 45 */ \
52  std::uint8_t unk96; /* 46 */ \
53  std::uint8_t pad97; /* 47 */
54 
56  };
57  static_assert(sizeof(RUNTIME_DATA) == 0x48);
58 
59  ~BookMenu() override; // 00
60 
61  // override (IMenu)
62  UI_MESSAGE_RESULTS ProcessMessage(UIMessage& a_message) override; // 04
63  void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override; // 05
64  void PostDisplay() override; // 06
65  void PreDisplay() override; // 07
66 
67 #ifndef SKYRIM_CROSS_VR
68  // override (BSTEventSink<BSAnimationGraphEvent>)
70 #endif
71 
72  [[nodiscard]] static TESObjectBOOK* GetTargetForm();
73  [[nodiscard]] static TESObjectREFR* GetTargetReference(); // returns null if opened from inventory
74 
76  {
77  return &REL::RelocateMember<SimpleAnimationGraphManagerHolder>(this, 0x30, 0x40);
78  }
79 
81  {
82  return const_cast<BookMenu*>(this)->AsSimpleAnimationGraphManagerHolder();
83  }
84 
86  {
87  return &REL::RelocateMember<BSTEventSink<BSAnimationGraphEvent>>(this, 0x48, 0x58);
88  }
89 
91  {
92  return const_cast<BookMenu*>(this)->AsBSAnimationGraphEventSink();
93  }
94 
95  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
96  {
97  return REL::RelocateMember<RUNTIME_DATA>(this, 0x50, 0x60);
98  }
99 
100  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
101  {
102  return REL::RelocateMember<RUNTIME_DATA>(this, 0x50, 0x60);
103  }
104 
105  static void OpenBookMenu(const BSString& a_description, const ExtraDataList* a_extraList, TESObjectREFR* a_ref, TESObjectBOOK* a_book, const NiPoint3& a_pos, const NiMatrix3& a_rot, float a_scale, bool a_useDefaultPos);
106 
107  // members
108 #ifndef SKYRIM_CROSS_VR
109  RUNTIME_DATA_CONTENT // 50, 60
110 #endif
111  };
112 #ifndef ENABLE_SKYRIM_VR
113  static_assert(sizeof(BookMenu) == 0x98);
114 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
115  static_assert(sizeof(BookMenu) == 0xA8);
116 #endif
117 }
118 #undef RUNTIME_DATA_CONTENT
#define RUNTIME_DATA_CONTENT
Definition: BookMenu.h:40
Definition: BSTEvent.h:143
Definition: BookMenu.h:32
constexpr static std::string_view MENU_NAME
Definition: BookMenu.h:36
BSTEventSink< BSAnimationGraphEvent > * AsBSAnimationGraphEventSink() noexcept
Definition: BookMenu.h:85
static constexpr auto VTABLE
Definition: BookMenu.h:35
void PostDisplay() override
UI_MESSAGE_RESULTS ProcessMessage(UIMessage &a_message) override
void PreDisplay() override
const BSTEventSink< BSAnimationGraphEvent > * AsBSAnimationGraphEventSink() const noexcept
Definition: BookMenu.h:90
const SimpleAnimationGraphManagerHolder * AsSimpleAnimationGraphManagerHolder() const noexcept
Definition: BookMenu.h:80
static constexpr auto RTTI
Definition: BookMenu.h:34
SimpleAnimationGraphManagerHolder * AsSimpleAnimationGraphManagerHolder() noexcept
Definition: BookMenu.h:75
static TESObjectREFR * GetTargetReference()
BSEventNotifyControl ProcessEvent(const BSAnimationGraphEvent *a_event, BSTEventSource< BSAnimationGraphEvent > *a_eventSource) override
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: BookMenu.h:100
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: BookMenu.h:95
static TESObjectBOOK * GetTargetForm()
~BookMenu() override
void AdvanceMovie(float a_interval, std::uint32_t a_currentTime) override
static void OpenBookMenu(const BSString &a_description, const ExtraDataList *a_extraList, TESObjectREFR *a_ref, TESObjectBOOK *a_book, const NiPoint3 &a_pos, const NiMatrix3 &a_rot, float a_scale, bool a_useDefaultPos)
Definition: ExtraDataList.h:53
Definition: IMenu.h:55
Definition: NiMatrix3.h:8
Definition: NiPoint3.h:6
Definition: SimpleAnimationGraphManagerHolder.h:11
Definition: TESObjectBOOK.h:66
Definition: TESObjectREFR.h:113
Definition: UIMessage.h:28
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_BookMenu(688801, 396653, 0x1f45fa8)
UI_MESSAGE_RESULTS
Definition: IMenu.h:48
BSEventNotifyControl
Definition: BSTEvent.h:12
constexpr std::array< REL::VariantID, 3 > VTABLE_BookMenu
Definition: Offsets_VTABLE.h:4003
Definition: BSAnimationGraphEvent.h:10
Definition: BookMenu.h:39