CommonLibSSE NG
Loading...
Searching...
No Matches
TESWorldSpace.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSString.h"
4#include "RE/B/BSTArray.h"
5#include "RE/B/BSTHashMap.h"
6#include "RE/B/BSTList.h"
7#include "RE/F/FormTypes.h"
8#include "RE/N/NiPoint2.h"
10#include "RE/N/NiTPointerMap.h"
11#include "RE/T/TESForm.h"
12#include "RE/T/TESFullName.h"
13#include "RE/T/TESModel.h"
14#include "RE/T/TESTexture.h"
15
16namespace RE
17{
18 class BGSTerrainManager;
19 class BSPortalGraph;
20 class NiNode;
21
22 struct WORLD_MAP_DATA // MNAM
23 {
24 public:
26 {
27 float minHeight; // 0
28 float maxHeight; // 4
29 float initialPitch; // 8
30 };
31 static_assert(sizeof(CameraData) == 0xC);
32
33 // members
34 std::uint32_t usableWidth; // 00
35 std::uint32_t usableHeight; // 04
36 std::int16_t nwCellX; // 08
37 std::int16_t nwCellY; // 0A
38 std::int16_t seCellX; // 0C
39 std::int16_t seCellY; // 0E
41 };
42 static_assert(sizeof(WORLD_MAP_DATA) == 0x1C);
43
44 struct WORLD_MAP_OFFSET_DATA // ONAM
45 {
46 public:
47 // members
48 float mapScale; // 00
49 float mapOffsetX; // 04
50 float mapOffsetY; // 08
51 float mapOffsetZ; // 0C
52 };
53 static_assert(sizeof(WORLD_MAP_OFFSET_DATA) == 0x10);
54
55 struct CellID
56 {
57 public:
58 constexpr CellID() noexcept :
59 CellID(0, 0)
60 {}
61
62 constexpr CellID(std::int16_t a_y, std::int16_t a_x) noexcept :
63 y(a_y),
64 x(a_x)
65 {}
66
67 [[nodiscard]] friend constexpr bool operator==(const CellID& a_lhs, const CellID& a_rhs) noexcept
68 {
69 return a_lhs[0] == a_rhs[0] && a_lhs[1] == a_rhs[1];
70 }
71
72 [[nodiscard]] constexpr std::int16_t& operator[](std::size_t a_idx) noexcept
73 {
74 assert(a_idx < 2);
75 return std::addressof(y)[a_idx];
76 }
77
78 [[nodiscard]] constexpr const std::int16_t& operator[](std::size_t a_idx) const noexcept
79 {
80 assert(a_idx < 2);
81 return std::addressof(y)[a_idx];
82 }
83
84 // members
85 std::int16_t y;
86 std::int16_t x;
87 };
88 static_assert(sizeof(CellID) == 0x4);
89
90 template <>
92 {
93 public:
94 [[nodiscard]] inline std::uint32_t operator()(CellID a_key) const noexcept
95 {
96 return BSCRC32_<std::uint32_t>()(reinterpret_cast<const std::uint32_t&>(a_key));
97 }
98 };
99
100 class BGSLargeRefData // RNAM
101 {
102 public:
103 // RNAM format in plugins is cell x,y -> formID + cell that contains refr x,y
104 // a lot of RNAM data is for refrs that are actually in adjacent cells, it is currently unknown what behavior this has in game
105 BSTHashMap<CellID, FormID*> cellFormIDMap; // 00 - full data merged at runtime, value is an array of FormIDs with array size as the first entry
106 BSTHashMap<FormID, CellID> formIDCellMap; // 30 - maps FormID to cell so opposite of above map
107
108 // this filtered version of the full data removes all duplicate RNAM entries and also all entries where cell x,y doesn't match cell that contains refr x,y
109 // this is the one actually used for loading large references on cell attach
111 };
112 static_assert(sizeof(BGSLargeRefData) == 0x90);
113
115 public TESForm, // 000
116 public TESFullName, // 020
117 public TESModel // 030
118 {
119 public:
120 inline static constexpr auto RTTI = RTTI_TESWorldSpace;
121 inline static constexpr auto VTABLE = VTABLE_TESWorldSpace;
122 inline static constexpr auto FORMTYPE = FormType::WorldSpace;
123
124 enum class Flag
125 {
126 kNone = 0,
127 kSmallWorld = 1 << 0,
128 kCantFastTravel = 1 << 1,
129 kNoLODWater = 1 << 3,
130 kNoLandscape = 1 << 4,
131 kNoSky = 1 << 5,
132 kFixedDimensions = 1 << 6,
133 kNoGrass = 1 << 7,
134 };
135
136 enum class ParentUseFlag
137 {
138 kNone = 0,
139 kUseLandData = 1 << 0,
140 kUseLODData = 1 << 1,
141 kUseMapData = 1 << 2,
142 kUseWaterData = 1 << 3,
143 kUseClimateData = 1 << 4,
144 kUseImageSpaceData = 1 << 5, // unused
145 kUseSkyCell = 1 << 6,
146 };
147
149 {
150 enum RecordFlag : std::uint32_t
151 {
152 kDeleted = 1 << 5,
153 kIgnored = 1 << 12,
154 kCantWait = 1 << 19
155 };
156 };
157
159 {
160 public:
161 // members
162 std::int16_t x;
163 std::int16_t y;
164 };
165 static_assert(sizeof(ShortPoint) == 0x4);
166
167 ~TESWorldSpace() override; // 00
168
169 // override (TESForm)
170 void InitializeData() override; // 04
171 void ClearData() override; // 05
172 bool Load(TESFile* a_mod) override; // 06
173 bool LoadPartial(TESFile* a_mod) override; // 07
174 TESForm* CreateDuplicateForm(bool a_createEditorID, void* a_arg2) override; // 09
175 bool FindInFileFast(TESFile* a_mod) override; // 0C
176 void InitItemImpl() override; // 13
177 const char* GetFormEditorID() const override; // 32 - { return editorID.c_str(); }
178 bool SetFormEditorID(const char* a_str) override; // 33 - { editorID = a_str; }
179 bool IsParentForm() override; // 34 - { return true; }
180 bool IsFormTypeChild(FormType a_type) override; // 36
181
182 [[nodiscard]] bool HasMaxHeightData() const;
183 [[nodiscard]] TESObjectCELL* GetSkyCell();
184 [[nodiscard]] float GetDefaultWaterHeight() const;
185
186 // members
189 BGSTerrainManager* terrainManager; // 090
190 TESClimate* climate; // 098 - CNAM
192 std::uint8_t unk0A1; // 0A1 - more flags
194 ShortPoint fixedCenter; // 0A4 - WCTR
201 void* unk138; // 138
202 void* unk140; // 140
207 TESWaterForm* worldWater; // 168 - NAM2
208 TESWaterForm* lodWater; // 170 - NAM3
209 float lodWaterHeight; // 178 - NAM4
210 std::uint32_t pad17C; // 17C
211 std::uint64_t unk180; // 180
214 std::uint32_t pad1B4; // 1B4
215 BGSMusicType* musicType; // 1B8 - ZNAM
218 BSTHashMap<UnkKey, UnkValue> unk1D0; // 1D0 - BSTHashMap<TESFile*, OFFSET_DATA*> offsetDataMap?
219 BSString editorID; // 200 - EDID
220 float defaultLandHeight; // 210 - DNAM~
221 float defaultWaterHeight; // 214 - ~DNAM
222 float distantLODMult; // 218 - NAMA
223 std::uint32_t pad21C; // 21C
225 BGSLocation* location; // 228 - XLCN
227 TESTexture waterEnvMap; // 240 - UNAM
229 std::uint64_t unk2E0; // 2E0
232 float northRotation; // 348
233 std::uint32_t pad34C; // 34C
234 std::int8_t* maxHeightData; // 350 - MHDT
235 };
236 static_assert(sizeof(TESWorldSpace) == 0x358);
237}
Definition BGSEncounterZone.h:43
Definition TESWorldSpace.h:101
BSTHashMap< FormID, CellID > formIDCellMap
Definition TESWorldSpace.h:106
BSTHashMap< CellID, FormID * > cellFormIDMap
Definition TESWorldSpace.h:105
BSTHashMap< CellID, FormID * > cellFormIDMapFiltered
Definition TESWorldSpace.h:110
Definition BGSLightingTemplate.h:11
Definition BGSLocation.h:68
Definition BGSMusicType.h:13
Definition BSTArray.h:377
Definition BSTHashMap.h:21
Definition NiPoint2.h:6
Definition NiSmartPointer.h:9
Definition NiTPointerMap.h:10
Definition TESClimate.h:13
Definition TESFile.h:15
Definition TESForm.h:35
Definition TESFullName.h:9
Definition TESModel.h:16
Definition TESObjectCELL.h:116
Definition TESTexture.h:10
Definition TESWaterForm.h:83
Definition TESWorldSpace.h:118
std::uint8_t unk0A1
Definition TESWorldSpace.h:192
TESForm * CreateDuplicateForm(bool a_createEditorID, void *a_arg2) override
bool FindInFileFast(TESFile *a_mod) override
void * unk138
Definition TESWorldSpace.h:201
TESObjectCELL * persistentCell
Definition TESWorldSpace.h:188
BGSLargeRefData largeRefData
Definition TESWorldSpace.h:228
BSTHashMap< UnkKey, UnkValue > unk1D0
Definition TESWorldSpace.h:218
ShortPoint fixedCenter
Definition TESWorldSpace.h:194
TESObjectCELL * GetSkyCell()
std::uint32_t pad21C
Definition TESWorldSpace.h:223
TESTexture canopyShadowTexture
Definition TESWorldSpace.h:226
NiTPointerMap< std::uint32_t, BSSimpleList< TESObjectREFR * > * > * overlappedMultiboundMap
Definition TESWorldSpace.h:197
TESTexture waterEnvMap
Definition TESWorldSpace.h:227
TESWorldSpace * parentWorld
Definition TESWorldSpace.h:205
void * unk140
Definition TESWorldSpace.h:202
BGSLightingTemplate * lightingTemplate
Definition TESWorldSpace.h:206
WORLD_MAP_OFFSET_DATA worldMapOffsetData
Definition TESWorldSpace.h:213
NiPoint2 maximumCoords
Definition TESWorldSpace.h:217
BSTHashMap< CellID, TESObjectCELL * > cellMap
Definition TESWorldSpace.h:187
static constexpr auto FORMTYPE
Definition TESWorldSpace.h:122
BSTHashMap< FormID, BGSLocation * > locationMap
Definition TESWorldSpace.h:199
std::uint32_t pad1B4
Definition TESWorldSpace.h:214
float defaultWaterHeight
Definition TESWorldSpace.h:221
NiPointer< NiNode > portalSharedNode
Definition TESWorldSpace.h:204
TESWaterForm * worldWater
Definition TESWorldSpace.h:207
TESObjectCELL * skyCell
Definition TESWorldSpace.h:198
Flag
Definition TESWorldSpace.h:125
const char * GetFormEditorID() const override
static constexpr auto VTABLE
Definition TESWorldSpace.h:121
BGSMusicType * musicType
Definition TESWorldSpace.h:215
NiPoint2 minimumCoords
Definition TESWorldSpace.h:216
BSTHashMap< UnkKey, UnkValue > unk318
Definition TESWorldSpace.h:231
BSString editorID
Definition TESWorldSpace.h:219
ParentUseFlag
Definition TESWorldSpace.h:137
bool HasMaxHeightData() const
BGSTerrainManager * terrainManager
Definition TESWorldSpace.h:189
WORLD_MAP_DATA worldMapData
Definition TESWorldSpace.h:212
bool IsFormTypeChild(FormType a_type) override
BSTArray< NiPointer< TESObjectREFR > > mobilePersistentRefs
Definition TESWorldSpace.h:196
bool SetFormEditorID(const char *a_str) override
stl::enumeration< Flag, std::uint8_t > flags
Definition TESWorldSpace.h:191
bool IsParentForm() override
float defaultLandHeight
Definition TESWorldSpace.h:220
std::uint64_t unk180
Definition TESWorldSpace.h:211
float distantLODMult
Definition TESWorldSpace.h:222
BSTHashMap< UnkKey, UnkValue > unk2E8
Definition TESWorldSpace.h:230
std::int8_t * maxHeightData
Definition TESWorldSpace.h:234
float lodWaterHeight
Definition TESWorldSpace.h:209
NiPointer< BSPortalGraph > portalGraph
Definition TESWorldSpace.h:200
bool LoadPartial(TESFile *a_mod) override
BGSEncounterZone * encounterZone
Definition TESWorldSpace.h:224
~TESWorldSpace() override
BSTHashMap< std::uint32_t, BSTArray< NiPointer< TESObjectREFR > > > fixedPersistentRefMap
Definition TESWorldSpace.h:195
TESWaterForm * lodWater
Definition TESWorldSpace.h:208
BGSLocation * location
Definition TESWorldSpace.h:225
float northRotation
Definition TESWorldSpace.h:232
stl::enumeration< ParentUseFlag, std::uint16_t > parentUseFlags
Definition TESWorldSpace.h:193
std::uint32_t pad17C
Definition TESWorldSpace.h:210
float GetDefaultWaterHeight() const
static constexpr auto RTTI
Definition TESWorldSpace.h:120
NiPointer< NiNode > multiBoundNode
Definition TESWorldSpace.h:203
std::uint32_t pad34C
Definition TESWorldSpace.h:233
void ClearData() override
bool Load(TESFile *a_mod) override
void InitializeData() override
void InitItemImpl() override
std::uint64_t unk2E0
Definition TESWorldSpace.h:229
TESClimate * climate
Definition TESWorldSpace.h:190
Definition PCH.h:223
Definition AbsorbEffect.h:6
FormType
Definition FormTypes.h:139
constexpr REL::VariantID RTTI_TESWorldSpace(513891, 392429, 0x1ed9578)
constexpr std::array< REL::VariantID, 3 > VTABLE_TESWorldSpace
Definition Offsets_VTABLE.h:689
std::uint32_t operator()(CellID a_key) const noexcept
Definition TESWorldSpace.h:94
Definition CRC.h:72
Definition TESWorldSpace.h:56
friend constexpr bool operator==(const CellID &a_lhs, const CellID &a_rhs) noexcept
Definition TESWorldSpace.h:67
constexpr std::int16_t & operator[](std::size_t a_idx) noexcept
Definition TESWorldSpace.h:72
std::int16_t x
Definition TESWorldSpace.h:86
constexpr const std::int16_t & operator[](std::size_t a_idx) const noexcept
Definition TESWorldSpace.h:78
constexpr CellID() noexcept
Definition TESWorldSpace.h:58
std::int16_t y
Definition TESWorldSpace.h:85
constexpr CellID(std::int16_t a_y, std::int16_t a_x) noexcept
Definition TESWorldSpace.h:62
Definition TESWorldSpace.h:149
RecordFlag
Definition TESWorldSpace.h:151
@ kDeleted
Definition TESWorldSpace.h:152
@ kIgnored
Definition TESWorldSpace.h:153
@ kCantWait
Definition TESWorldSpace.h:154
Definition TESWorldSpace.h:159
std::int16_t x
Definition TESWorldSpace.h:162
std::int16_t y
Definition TESWorldSpace.h:163
Definition TESWorldSpace.h:26
float minHeight
Definition TESWorldSpace.h:27
float maxHeight
Definition TESWorldSpace.h:28
float initialPitch
Definition TESWorldSpace.h:29
Definition TESWorldSpace.h:23
std::int16_t nwCellX
Definition TESWorldSpace.h:36
std::uint32_t usableWidth
Definition TESWorldSpace.h:34
std::int16_t seCellX
Definition TESWorldSpace.h:38
CameraData cameraData
Definition TESWorldSpace.h:40
std::uint32_t usableHeight
Definition TESWorldSpace.h:35
std::int16_t seCellY
Definition TESWorldSpace.h:39
std::int16_t nwCellY
Definition TESWorldSpace.h:37
Definition TESWorldSpace.h:45
float mapOffsetZ
Definition TESWorldSpace.h:51
float mapOffsetX
Definition TESWorldSpace.h:49
float mapOffsetY
Definition TESWorldSpace.h:50
float mapScale
Definition TESWorldSpace.h:48