CommonLibSSE NG
TESObjectCELL.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSAtomic.h"
4 #include "RE/B/BSBitField.h"
5 #include "RE/B/BSContainer.h"
7 #include "RE/B/BSPointerHandle.h"
8 #include "RE/B/BSTArray.h"
9 #include "RE/B/BSTHashMap.h"
10 #include "RE/B/BSTList.h"
11 #include "RE/C/Color.h"
12 #include "RE/E/ExtraDataList.h"
13 #include "RE/F/FormTypes.h"
14 #include "RE/I/InteriorData.h"
15 #include "RE/N/NiSmartPointer.h"
16 #include "RE/N/NiTMap.h"
17 #include "RE/T/TESForm.h"
18 #include "RE/T/TESFullName.h"
19 #include "RE/T/TESObjectREFR.h"
20 #include "SKSE/Version.h"
21 
22 namespace RE
23 {
24  class TESRegionList;
25 
26  namespace BGSWaterCollisionManager
27  {
28  class BGSWaterUpdateI;
29  }
30 
32  class bhkWorld;
33  class BSPortalGraph;
34  class NavMesh;
35  class NiNode;
36 
38  {
39  public:
40  // members
42  };
43  static_assert(sizeof(BGSTerrainVisibilityData) == 0x8);
44 
45  struct EXTERIOR_DATA // XCLC
46  {
47  public:
48  enum class LandHideFlag
49  {
50  kNone = 0,
51  kQuad1 = 1 << 0,
52  kQuad2 = 1 << 1,
53  kQuad3 = 1 << 2,
54  kQuad4 = 1 << 3
55  };
56 
57  // members
58  std::int32_t cellX; // 00
59  std::int32_t cellY; // 04
60  char* maxHeightData; // 08
62  float worldX; // 18
63  float worldY; // 1C
65  std::uint8_t pad21; // 21
66  std::uint16_t pad22; // 22
67  std::uint32_t pad24; // 24
68  };
69  static_assert(sizeof(EXTERIOR_DATA) == 0x28);
70 
72  {
73  public:
74  // members
76  };
77  static_assert(sizeof(NavMeshArray) == 0x18);
78 
80  {
81  public:
82  // members
85  void* unk010; // 010 - smart ptr
86  void* unk018; // 018 - smart ptr
87  void* unk020; // 020 - smart ptr
88  std::uint64_t unk028; // 028
89  std::uint64_t unk030; // 030
90  std::uint64_t unk038; // 038
99  std::uint64_t unk110; // 110
104  std::uint32_t unk168; // 168
105  volatile mutable std::int32_t criticalQueuedRefCount; // 16C
106  volatile mutable std::int32_t queuedRefCount; // 170
107  volatile mutable std::int32_t queuedDistantRefCount; // 174
108  std::uint32_t unk178; // 178
109  std::uint32_t unk17C; // 17C
110  };
111  static_assert(sizeof(LOADED_CELL_DATA) == 0x180);
112 
114  public TESForm, // 000
115  public TESFullName // 020
116  {
117  public:
118  inline static constexpr auto RTTI = RTTI_TESObjectCELL;
119  inline static constexpr auto VTABLE = VTABLE_TESObjectCELL;
120  inline static constexpr auto FORMTYPE = FormType::Cell;
121 
122  enum class Flag // DATA
123  {
124  kNone = 0,
125  kIsInteriorCell = 1 << 0,
126  kHasWater = 1 << 1,
127  kCanTravelFromHere = 1 << 2,
128  kNoLODWater = 1 << 3,
129  kHasTempData = 1 << 4,
130  kPublicArea = 1 << 5,
131  kHandChanged = 1 << 6,
132  kShowSky = 1 << 7,
133  kUseSkyLighting = 1 << 8,
134  kWarnToLeave = 1 << 9
135  };
136 
137  enum class CellState
138  {
139  kAttached = 7
140  };
141 
142  struct ChangeFlags
143  {
144  enum ChangeFlag : std::uint32_t
145  {
146  kFlags = 1 << 1,
147  kFullName = 1 << 2,
148  kOwnership = 1 << 3,
149  kExteriorShort = 1 << 28,
150  kExteriorChar = 1 << 29,
151  kDetachTime = 1 << 30,
152  kSeendData = (std::uint32_t)1 << 31
153  };
154  };
155 
156  struct RecordFlags
157  {
158  enum RecordFlag : std::uint32_t
159  {
160  kDeleted = 1 << 5,
161  kPersistent = 1 << 10,
162  kIgnored = 1 << 12,
163  kOffLimits = 1 << 17,
164  kCompressed = 1 << 18,
165  kCantWait = 1 << 19
166  };
167  };
168 
169  union CellData
170  {
173  };
174  static_assert(sizeof(CellData) == 0x8);
175 
176  ~TESObjectCELL() override; // 00
177 
178  // override (TESForm)
179  void ClearData() override; // 05
180  bool Load(TESFile* a_mod) override; // 06
181  TESForm* CreateDuplicateForm(bool a_createEditorID, void* a_arg2) override; // 09 - { return 0; }
182  bool FindInFileFast(TESFile* a_mod) override; // 0C
183  void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
184  void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
185  void Revert(BGSLoadFormBuffer* a_buf) override; // 12
186  void InitItemImpl() override; // 13
187  void GetFormDetailedString(char* a_buf, std::uint32_t a_bufLen) override; // 16
188  void SetAltered(bool a_set) override; // 24
189  bool BelongsInGroup(FORM* a_form, bool a_allowParentGroups, bool a_currentOnly) override; // 30
190  void CreateGroupData(FORM* a_form, FORM_GROUP* a_group) override; // 31
191  const char* GetFormEditorID() const override; // 32
192  bool SetFormEditorID(const char* a_str) override; // 33
193  [[nodiscard]] bool IsParentForm() override; // 34 - { return true; }
194  [[nodiscard]] bool IsFormTypeChild(FormType a_type) override; // 36
195 
198  void ForEachReference(std::function<BSContainer::ForEachResult(TESObjectREFR*)> a_callback) const;
199  void ForEachReferenceInRange(const NiPoint3& a_origin, float a_radius, std::function<BSContainer::ForEachResult(TESObjectREFR*)> a_callback) const;
200  [[nodiscard]] EXTERIOR_DATA* GetCoordinates();
201  [[nodiscard]] TESFaction* GetFactionOwner();
202  [[nodiscard]] INTERIOR_DATA* GetLighting();
203  [[nodiscard]] BGSLocation* GetLocation() const;
204  [[nodiscard]] float GetNorthRotation();
205  [[nodiscard]] TESForm* GetOwner();
206  [[nodiscard]] float GetExteriorWaterHeight() const;
207  [[nodiscard]] TESRegionList* GetRegionList(bool a_createIfMissing);
208  bool GetWaterHeight(const NiPoint3& a_pos, float& a_waterHeight);
209  [[nodiscard]] bool IsAttached() const;
210  [[nodiscard]] bool IsExteriorCell() const;
211  [[nodiscard]] bool IsInteriorCell() const;
212  void SetActorOwner(TESNPC* a_owner);
213  void SetFactionOwner(TESFaction* a_owner);
214  void SetFogColor(Color a_near, Color a_far);
215  void SetFogPlanes(float a_near, float a_far);
216  void SetFogPower(float a_power);
217  void SetHandChanged(bool a_changed);
218  void SetOwner(TESForm* a_owner);
219  void SetPublic(bool a_public);
220  [[nodiscard]] bool UsesSkyLighting() const;
221 
223  {
224 #define RUNTIME_DATA_CONTENT \
225  CellData cellData; /* 060, 068 - XCLL if interior, XCLC if exterior */ \
226  TESObjectLAND* cellLand; /* 068, 070 */ \
227  float waterHeight; /* 070, 078 - XCLW */ \
228  NavMeshArray* navMeshes; /* 078, 080 */ \
229  BSTSet<NiPointer<TESObjectREFR>> references; /* 080, 088 */ \
230  TESForm* unk0B0; /* 0B0, 0B8 - REFR owner of cell? */ \
231  BSTArray<TESObjectREFR*> objectList; /* 0B8, 0C0 - persistent */ \
232  BSTArray<void*> unk0D0; /* 0D0, 0D8 */ \
233  BSTArray<BGSWaterCollisionManager::BGSWaterUpdateI*> waterObjects; /* 0E8, 0F0 */ \
234  BSTArray<void*> unk100; /* 100, 108 */ \
235  mutable BSSpinLock spinLock; /* 118, 120 */ \
236  TESWorldSpace* worldSpace; /* 120, 128 */ \
237  LOADED_CELL_DATA* loadedData; /* 128, 130 */ \
238  BGSLightingTemplate* lightingTemplate; /* 130, 138 - LTMP */ \
239  std::uint64_t unk138; /* 138, 140 */
240 
242  };
243 
244  [[nodiscard]] inline RUNTIME_DATA& GetRuntimeData() noexcept
245  {
246  return REL::RelocateMemberIfNewer<RUNTIME_DATA>(SKSE::RUNTIME_SSE_1_6_629, this, 0x60, 0x68);
247  }
248 
249  [[nodiscard]] inline const RUNTIME_DATA& GetRuntimeData() const noexcept
250  {
251  return REL::RelocateMemberIfNewer<RUNTIME_DATA>(SKSE::RUNTIME_SSE_1_6_629, this, 0x60, 0x68);
252  }
253 
254  // members
255  mutable BSSpinLock grassCreateLock; // 030
256  mutable BSSpinLock grassTaskLock; // 038
258  std::uint16_t cellGameFlags; // 042
260  bool autoWaterLoaded; // 045
261  bool cellDetached; // 046
262  std::uint8_t pad047; // 047
264 
265 #ifndef ENABLE_SKYRIM_AE
267 #endif
268  };
269 #ifndef ENABLE_SKYRIM_AE
270  static_assert(sizeof(TESObjectCELL) == 0x140);
271 #endif
272 }
273 #undef RUNTIME_DATA_CONTENT
#define RUNTIME_DATA_CONTENT
Definition: TESObjectCELL.h:224
Definition: BGSEncounterZone.h:43
Definition: BGSLoadFormBuffer.h:11
Definition: BGSLocation.h:68
Definition: BGSSaveFormBuffer.h:8
Definition: TESObjectCELL.h:38
BSBitField * visData
Definition: TESObjectCELL.h:41
Definition: BSBitField.h:15
Definition: BSPortalGraph.h:13
Definition: BSTList.h:10
Definition: BSAtomic.h:51
Definition: BSTArray.h:377
Definition: BSTempEffectParticle.h:19
Definition: ExtraDataList.h:53
Definition: TESObjectCELL.h:72
BSTArray< BSTSmartPointer< NavMesh > > navMeshes
Definition: TESObjectCELL.h:75
Definition: NavMesh.h:14
Definition: NiNode.h:12
Definition: NiPoint3.h:6
Definition: NiSmartPointer.h:9
Definition: NiTMap.h:10
Definition: TESFaction.h:120
Definition: TESFile.h:17
Definition: TESForm.h:36
Definition: TESFullName.h:9
Definition: TESNPC.h:36
Definition: TESObjectCELL.h:116
bool BelongsInGroup(FORM *a_form, bool a_allowParentGroups, bool a_currentOnly) override
bool IsExteriorCell() const
bool SetFormEditorID(const char *a_str) override
bool Load(TESFile *a_mod) override
void SetFogColor(Color a_near, Color a_far)
void SetOwner(TESForm *a_owner)
BSSpinLock grassCreateLock
Definition: TESObjectCELL.h:255
float GetNorthRotation()
bool cellDetached
Definition: TESObjectCELL.h:261
void LoadGame(BGSLoadFormBuffer *a_buf) override
const RUNTIME_DATA & GetRuntimeData() const noexcept
Definition: TESObjectCELL.h:249
void SetFogPower(float a_power)
void ForEachReferenceInRange(const NiPoint3 &a_origin, float a_radius, std::function< BSContainer::ForEachResult(TESObjectREFR *)> a_callback) const
void SetAltered(bool a_set) override
std::uint8_t pad047
Definition: TESObjectCELL.h:262
bool IsFormTypeChild(FormType a_type) override
TESForm * CreateDuplicateForm(bool a_createEditorID, void *a_arg2) override
TESForm * GetOwner()
void SetHandChanged(bool a_changed)
TESFaction * GetFactionOwner()
bool IsParentForm() override
stl::enumeration< Flag, std::uint16_t > cellFlags
Definition: TESObjectCELL.h:257
bool IsInteriorCell() const
CellState
Definition: TESObjectCELL.h:138
void InitItemImpl() override
BSSpinLock grassTaskLock
Definition: TESObjectCELL.h:256
void ClearData() override
float GetExteriorWaterHeight() const
bhkWorld * GetbhkWorld() const
void SetActorOwner(TESNPC *a_owner)
INTERIOR_DATA * GetLighting()
bool GetWaterHeight(const NiPoint3 &a_pos, float &a_waterHeight)
Flag
Definition: TESObjectCELL.h:123
stl::enumeration< CellState, std::uint8_t > cellState
Definition: TESObjectCELL.h:259
static constexpr auto RTTI
Definition: TESObjectCELL.h:118
RUNTIME_DATA & GetRuntimeData() noexcept
Definition: TESObjectCELL.h:244
static constexpr auto FORMTYPE
Definition: TESObjectCELL.h:120
TESNPC * GetActorOwner()
void ForEachReference(std::function< BSContainer::ForEachResult(TESObjectREFR *)> a_callback) const
std::uint16_t cellGameFlags
Definition: TESObjectCELL.h:258
bool IsAttached() const
void GetFormDetailedString(char *a_buf, std::uint32_t a_bufLen) override
void CreateGroupData(FORM *a_form, FORM_GROUP *a_group) override
~TESObjectCELL() override
void Revert(BGSLoadFormBuffer *a_buf) override
EXTERIOR_DATA * GetCoordinates()
void SaveGame(BGSSaveFormBuffer *a_buf) override
void SetFactionOwner(TESFaction *a_owner)
bool autoWaterLoaded
Definition: TESObjectCELL.h:260
void SetPublic(bool a_public)
bool FindInFileFast(TESFile *a_mod) override
void SetFogPlanes(float a_near, float a_far)
static constexpr auto VTABLE
Definition: TESObjectCELL.h:119
BGSLocation * GetLocation() const
bool UsesSkyLighting() const
const char * GetFormEditorID() const override
ExtraDataList extraList
Definition: TESObjectCELL.h:263
TESRegionList * GetRegionList(bool a_createIfMissing)
Definition: TESObjectREFR.h:113
Definition: TESRegionList.h:10
Definition: bhkWorld.h:14
ForEachResult
Definition: BSContainer.h:6
Definition: AbsorbEffect.h:6
FormType
Definition: FormTypes.h:139
constexpr REL::VariantID RTTI_TESObjectCELL(513892, 392430, 0x1ed95a0)
constexpr std::array< REL::VariantID, 2 > VTABLE_TESObjectCELL
Definition: Offsets_VTABLE.h:619
constexpr REL::Version RUNTIME_SSE_1_6_629(1, 6, 629, 0)
Definition: Color.h:8
Definition: TESObjectCELL.h:46
std::int32_t cellY
Definition: TESObjectCELL.h:59
BGSTerrainVisibilityData * lodVisData
Definition: TESObjectCELL.h:61
std::uint32_t pad24
Definition: TESObjectCELL.h:67
std::int32_t cellX
Definition: TESObjectCELL.h:58
LandHideFlag
Definition: TESObjectCELL.h:49
char * maxHeightData
Definition: TESObjectCELL.h:60
float worldY
Definition: TESObjectCELL.h:63
std::uint16_t pad22
Definition: TESObjectCELL.h:66
std::uint8_t pad21
Definition: TESObjectCELL.h:65
stl::enumeration< LandHideFlag, std::uint8_t > landHideFlags
Definition: TESObjectCELL.h:64
float worldX
Definition: TESObjectCELL.h:62
Definition: FORM.h:20
Definition: FORM.h:6
Definition: InteriorData.h:9
Definition: TESObjectCELL.h:80
BSTArray< void * > unk058
Definition: TESObjectCELL.h:92
std::uint32_t unk17C
Definition: TESObjectCELL.h:109
BSTArray< void * > unk040
Definition: TESObjectCELL.h:91
NiTMap< ObjectRefHandle, NiNode * > emittanceLightRefMap
Definition: TESObjectCELL.h:94
volatile std::int32_t queuedDistantRefCount
Definition: TESObjectCELL.h:107
BSTArray< void * > unk130
Definition: TESObjectCELL.h:101
std::uint64_t unk028
Definition: TESObjectCELL.h:88
BSSimpleList< ObjectRefHandle > unk100
Definition: TESObjectCELL.h:98
volatile std::int32_t queuedRefCount
Definition: TESObjectCELL.h:106
NiTMap< ObjectRefHandle, NiPointer< BSMultiBoundNode > > multiboundRefMap
Definition: TESObjectCELL.h:95
volatile std::int32_t criticalQueuedRefCount
Definition: TESObjectCELL.h:105
std::uint64_t unk038
Definition: TESObjectCELL.h:90
std::uint64_t unk030
Definition: TESObjectCELL.h:89
BSTArray< void * > unk118
Definition: TESObjectCELL.h:100
NiTMap< BSMultiBoundNode *, ObjectRefHandle > refMultiboundMap
Definition: TESObjectCELL.h:96
NiPointer< BSPortalGraph > portalGraph
Definition: TESObjectCELL.h:83
NiPointer< NiNode > cell3D
Definition: TESObjectCELL.h:84
BGSEncounterZone * encounterZone
Definition: TESObjectCELL.h:103
void * unk020
Definition: TESObjectCELL.h:87
void * unk018
Definition: TESObjectCELL.h:86
std::uint32_t unk178
Definition: TESObjectCELL.h:108
BSSimpleList< ObjectRefHandle > activatingRefs
Definition: TESObjectCELL.h:97
void * unk010
Definition: TESObjectCELL.h:85
BSTArray< void * > unk148
Definition: TESObjectCELL.h:102
NiTMap< TESForm *, ObjectRefHandle > unk070
Definition: TESObjectCELL.h:93
std::uint64_t unk110
Definition: TESObjectCELL.h:99
std::uint32_t unk168
Definition: TESObjectCELL.h:104
Definition: TESObjectCELL.h:143
ChangeFlag
Definition: TESObjectCELL.h:145
@ kFullName
Definition: TESObjectCELL.h:147
@ kExteriorShort
Definition: TESObjectCELL.h:149
@ kSeendData
Definition: TESObjectCELL.h:152
@ kFlags
Definition: TESObjectCELL.h:146
@ kDetachTime
Definition: TESObjectCELL.h:151
@ kExteriorChar
Definition: TESObjectCELL.h:150
@ kOwnership
Definition: TESObjectCELL.h:148
Definition: TESObjectCELL.h:223
Definition: TESObjectCELL.h:157
RecordFlag
Definition: TESObjectCELL.h:159
@ kIgnored
Definition: TESObjectCELL.h:162
@ kOffLimits
Definition: TESObjectCELL.h:163
@ kPersistent
Definition: TESObjectCELL.h:161
@ kCompressed
Definition: TESObjectCELL.h:164
@ kDeleted
Definition: TESObjectCELL.h:160
@ kCantWait
Definition: TESObjectCELL.h:165
Definition: TESObjectCELL.h:170
EXTERIOR_DATA * exterior
Definition: TESObjectCELL.h:171
INTERIOR_DATA * interior
Definition: TESObjectCELL.h:172