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