CommonLibSSE (powerof3)
NiObjectNET.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/N/NiObject.h"
5 #include "RE/N/NiSmartPointer.h"
6 
7 namespace RE
8 {
9  class NiExtraData;
10  class NiTimeController;
11 
12  class NiObjectNET : public NiObject
13  {
14  public:
15  inline static constexpr auto RTTI = RTTI_NiObjectNET;
16  inline static constexpr auto Ni_RTTI = NiRTTI_NiObjectNET;
17  inline static constexpr auto VTABLE = VTABLE_NiObjectNET;
18 
19  ~NiObjectNET() override; // 00
20 
21  // override (NiObject)
22  const NiRTTI* GetRTTI() const override; // 02
23  void LoadBinary(NiStream& a_stream) override; // 18
24  void LinkObject(NiStream& a_stream) override; // 19
25  bool RegisterStreamables(NiStream& a_stream) override; // 1A
26  void SaveBinary(NiStream& a_stream) override; // 1B
27  bool IsEqual(NiObject* a_object) override; // 1C
28  void ProcessClone(NiCloningProcess& a_cloning) override; // 1D
29  void PostLinkObject(NiStream& a_stream) override; // 1E
30 
31  bool AddExtraData(const BSFixedString& a_key, NiExtraData* a_extra);
32  bool AddExtraData(NiExtraData* a_extra);
33  void DeleteExtraData(std::uint16_t a_extraDataIndex);
34  [[nodiscard]] NiTimeController* GetControllers() const;
35  NiTimeController* GetController(const NiRTTI* a_rtti) const;
36 
37  template <class T>
38  [[nodiscard]] T* GetController() const;
39 
40  [[nodiscard]] NiExtraData* GetExtraData(const BSFixedString& a_key) const;
41  template <class T>
42  [[nodiscard]] T* GetExtraData(const BSFixedString& a_key) const;
43 
44  [[nodiscard]] NiExtraData* GetExtraDataAt(std::uint16_t a_extraDataIndex) const;
45  [[nodiscard]] std::uint16_t GetExtraDataSize() const;
46  [[nodiscard]] bool HasExtraData(const BSFixedString& a_key) const;
47  bool InsertExtraData(NiExtraData* a_extra);
49  bool RemoveExtraData(const BSFixedString& a_key);
50  bool RemoveExtraDataAt(std::uint16_t a_extraDataIndex);
51  bool SetExtraDataSize(std::uint16_t a_size);
52 
53  // members
56  NiExtraData** extra; // 20
57  std::uint16_t extraDataSize; // 28
58  std::uint16_t maxSize; // 2A
59  std::uint32_t pad2C; // 2C
60  };
61  static_assert(sizeof(NiObjectNET) == 0x30);
62 
63  template <class T>
65  {
66  const REL::Relocation<const NiRTTI*> rtti{ T::Ni_RTTI };
67  return static_cast<T*>(GetController(rtti.get()));
68  }
69 
70  template <class T>
72  {
73  return static_cast<T*>(GetExtraData(a_key));
74  }
75 }
Definition: Relocation.h:210
Definition: NiCloningProcess.h:10
Definition: NiExtraData.h:9
Definition: NiObjectNET.h:13
bool AddExtraData(NiExtraData *a_extra)
void LoadBinary(NiStream &a_stream) override
void LinkObject(NiStream &a_stream) override
BSFixedString name
Definition: NiObjectNET.h:54
bool InsertExtraData(NiExtraData *a_extra)
~NiObjectNET() override
NiTimeController * GetController(const NiRTTI *a_rtti) const
NiPointer< NiTimeController > controllers
Definition: NiObjectNET.h:55
bool SetExtraDataSize(std::uint16_t a_size)
NiExtraData * GetExtraData(const BSFixedString &a_key) const
bool RegisterStreamables(NiStream &a_stream) override
static constexpr auto Ni_RTTI
Definition: NiObjectNET.h:16
NiExtraData ** extra
Definition: NiObjectNET.h:56
bool AddExtraData(const BSFixedString &a_key, NiExtraData *a_extra)
std::uint32_t pad2C
Definition: NiObjectNET.h:59
std::uint16_t GetExtraDataSize() const
static constexpr auto VTABLE
Definition: NiObjectNET.h:17
bool HasExtraData(const BSFixedString &a_key) const
void DeleteExtraData(std::uint16_t a_extraDataIndex)
std::uint16_t maxSize
Definition: NiObjectNET.h:58
NiExtraData * GetExtraDataAt(std::uint16_t a_extraDataIndex) const
bool IsEqual(NiObject *a_object) override
static constexpr auto RTTI
Definition: NiObjectNET.h:15
void ProcessClone(NiCloningProcess &a_cloning) override
void SaveBinary(NiStream &a_stream) override
bool RemoveExtraDataAt(std::uint16_t a_extraDataIndex)
const NiRTTI * GetRTTI() const override
std::uint16_t extraDataSize
Definition: NiObjectNET.h:57
NiTimeController * GetControllers() const
void PostLinkObject(NiStream &a_stream) override
T * GetController() const
Definition: NiObjectNET.h:64
bool RemoveExtraData(const BSFixedString &a_key)
void RemoveAllExtraData()
Definition: NiObject.h:37
Definition: NiSmartPointer.h:9
Definition: NiRTTI.h:6
Definition: NiStream.h:29
Definition: NiTimeController.h:13
Definition: AbsorbEffect.h:6
constexpr REL::ID NiRTTI_NiObjectNET(static_cast< std::uint64_t >(523910))
constexpr REL::ID RTTI_NiObjectNET(static_cast< std::uint64_t >(684826))
constexpr std::array< REL::ID, 1 > VTABLE_NiObjectNET
Definition: Offsets_VTABLE.h:12240