CommonLibSSE NG
Hazard.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSPointerHandle.h"
4 #include "RE/B/BSSoundHandle.h"
5 #include "RE/F/FormTypes.h"
6 #include "RE/N/NiSmartPointer.h"
7 #include "RE/T/TESObjectREFR.h"
8 
9 namespace RE
10 {
11  class BGSHazard;
12  class NiLight;
13 
14  class Hazard : public TESObjectREFR
15  {
16  public:
17  inline static constexpr auto RTTI = RTTI_Hazard;
18  inline static constexpr auto VTABLE = VTABLE_Hazard;
19  inline static constexpr auto FORMTYPE = FormType::PlacedHazard;
20 
21  enum class Flags
22  {
23  };
24 
25  struct RecordFlags
26  {
27  enum RecordFlag : std::uint32_t
28  {
29  };
30  };
31 
32  ~Hazard() override; // 00
33 
34  // override (TESObjectREFR)
35  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
36  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
37  void FinishLoadGame(BGSLoadFormBuffer* a_buf) override; // 11
38  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
39  void InitItemImpl() override; // 13
40  void SetActorCause(ActorCause* a_cause) override; // 50
41  void Release3DRelatedData() override; // 6B
42 #ifndef SKYRIM_CROSS_VR
43  // Override functions past where Skyrim VR breaks compatibility.
44  bool OnAddCellPerformQueueReference(TESObjectCELL& a_cell) const override; // 90 - { return false; }
45 #endif
46 
47  // add
49  SKYRIM_REL_VR_VIRTUAL void Unk_A3(void); // A3 - { return; }
50  SKYRIM_REL_VR_VIRTUAL bool IsPermanent() const; // A4 - { return TESDataHandler::GetSingleton()->IsGeneratedFormID(formID) == 0; }
51 
53  {
54 #define HAZARD_RUNTIME_DATA_CONTENT \
55  void* hazardDBHandle; /* 98, A0 */ \
56  ActorHandle ownerActor; /* A0 */ \
57  float age; /* A4 */ \
58  float lifetime; /* A8 */ \
59  float targetTimer; /* AC */ \
60  float radius; /* B0 */ \
61  float magnitude; /* B4 */ \
62  BGSHazard* hazard; /* B8 */ \
63  NiPointer<NiLight> light; /* C0 */ \
64  BSSoundHandle sound; /* C8 */ \
65  stl::enumeration<Flags, std::uint32_t> flags; /* D4 */
66 
68  };
69 
70  [[nodiscard]] inline HAZARD_RUNTIME_DATA& GetHazardRuntimeData() noexcept
71  {
72  return REL::RelocateMemberIfNewer<HAZARD_RUNTIME_DATA>(SKSE::RUNTIME_SSE_1_6_629, this, 0x98, 0xA0);
73  }
74 
75  [[nodiscard]] inline const HAZARD_RUNTIME_DATA& GetHazardRuntimeData() const noexcept
76  {
77  return REL::RelocateMemberIfNewer<HAZARD_RUNTIME_DATA>(SKSE::RUNTIME_SSE_1_6_629, this, 0x98, 0xA0);
78  }
79 
80  // members
81 #ifndef ENABLE_SKYRIM_AE
83 #endif
84  };
85 #ifndef ENABLE_SKYRIM_AE
86  static_assert(sizeof(Hazard) == 0xD8);
87 #endif
88 }
89 #undef HAZARD_RUNTIME_DATA_CONTENT
#define SKYRIM_REL_VR_VIRTUAL
Definition: Common.h:94
#define HAZARD_RUNTIME_DATA_CONTENT
Definition: Hazard.h:54
Definition: ActorCause.h:9
Definition: BGSLoadFormBuffer.h:11
Definition: BGSSaveFormBuffer.h:8
Definition: Hazard.h:15
SKYRIM_REL_VR_VIRTUAL bool IsPermanent() const
SKYRIM_REL_VR_VIRTUAL void Initialize()
static constexpr auto FORMTYPE
Definition: Hazard.h:19
bool OnAddCellPerformQueueReference(TESObjectCELL &a_cell) const override
Flags
Definition: Hazard.h:22
void FinishLoadGame(BGSLoadFormBuffer *a_buf) override
void LoadGame(BGSLoadFormBuffer *a_buf) override
static constexpr auto VTABLE
Definition: Hazard.h:18
SKYRIM_REL_VR_VIRTUAL void Unk_A3(void)
void Revert(BGSLoadFormBuffer *a_buf) override
static constexpr auto RTTI
Definition: Hazard.h:17
HAZARD_RUNTIME_DATA & GetHazardRuntimeData() noexcept
Definition: Hazard.h:70
const HAZARD_RUNTIME_DATA & GetHazardRuntimeData() const noexcept
Definition: Hazard.h:75
~Hazard() override
void Release3DRelatedData() override
void SetActorCause(ActorCause *a_cause) override
void InitItemImpl() override
void SaveGame(BGSSaveFormBuffer *a_buf) override
Definition: TESObjectCELL.h:116
Definition: TESObjectREFR.h:113
Definition: AbsorbEffect.h:6
constexpr std::array< REL::VariantID, 4 > VTABLE_Hazard
Definition: Offsets_VTABLE.h:2783
constexpr REL::VariantID RTTI_Hazard(687507, 395357, 0x1f1b3c8)
constexpr REL::Version RUNTIME_SSE_1_6_629(1, 6, 629, 0)
Definition: Hazard.h:53
Definition: Hazard.h:26
RecordFlag
Definition: Hazard.h:28