CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
TESNPC.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BGSHeadPart.h"
6#include "RE/B/BSTArray.h"
7#include "RE/B/BSTEvent.h"
8#include "RE/C/Color.h"
9#include "RE/F/FormTypes.h"
10#include "RE/M/MemoryManager.h"
11#include "RE/S/Sexes.h"
12#include "RE/S/SoundLevels.h"
13#include "RE/T/TESActorBase.h"
14#include "RE/T/TESRaceForm.h"
15
16namespace RE
17{
18 class BSFaceGenNiNode;
19 class MenuOpenCloseEvent;
20 class NiColorA;
21 class TintMask;
22
24 {
25 public:
26 // members
28 };
29 static_assert(sizeof(CreatureSounds) == 0x40);
30
31 class TESNPC :
32 public TESActorBase, // 000
33 public TESRaceForm, // 150
34 public BGSOverridePackCollection, // 160
35 public BSTEventSink<MenuOpenCloseEvent> // 188
36 {
37 public:
38 inline static constexpr auto RTTI = RTTI_TESNPC;
39
41 inline static constexpr auto FORMTYPE = FormType::NPC;
42
44 {
45 enum ChangeFlag : std::uint32_t
46 {
47 kBaseData = 1 << 1,
48 kAttributes = 1 << 2,
49 kAIData = 1 << 3,
50 kSpellList = 1 << 4,
51 kFullName = 1 << 5,
52 kFactions = 1 << 6,
53 kNPCSkills = 1 << 9,
54 kClass = 1 << 10,
55 kFace = 1 << 11,
56 kDefaultOutfit = 1 << 12,
57 kSleepOutfit = 1 << 13,
58 kGender = 1 << 24,
59 kRace = 1 << 25
60 };
61 };
62
64 {
65 enum RecordFlag : std::uint32_t
66 {
67 kDeleted = 1 << 5,
68 kIgnored = 1 << 12,
69 kCompressed = 1 << 18,
70 kBleedoutOverride = 1 << 29
71 };
72 };
73
74 struct Skills
75 {
76 public:
77 enum
78 {
82 kBlock = 3,
88 kSneak = 9,
97
98 kTotal
99 };
100
101 // members
102 std::uint8_t values[kTotal]; // 00
103 std::uint8_t offsets[kTotal]; // 12
104 std::uint16_t health; // 24
105 std::uint16_t magicka; // 26
106 std::uint16_t stamina; // 28
107 std::uint16_t pad2A; // 2A
109 };
110 static_assert(sizeof(Skills) == 0x30);
111
113 {
114 public:
116 ~HeadRelatedData() = default;
117
119
120 // members
121 BGSColorForm* hairColor; // 00 - HCLF
123 };
124 static_assert(sizeof(HeadRelatedData) == 0x10);
125
126 union Sounds
127 {
130 };
131 static_assert(sizeof(Sounds) == 0x8);
132
133 struct FaceData
134 {
135 public:
136 struct Morphs
137 {
138 enum
139 {
158 kUnk = 18,
159
160 kTotal = 19
161 };
162 };
163
164 struct Parts
165 {
166 enum
167 {
168 kNose = 0,
170 kEyes = 2,
172
173 kTotal = 4
174 };
175 };
176
177 enum
178 {
179 kDefault = 0x7F7FFFFF,
180 kTotalPresets = 4
181 };
182
183 // members
184 float morphs[Morphs::kTotal]; // 00 - NAM9
185 std::int32_t parts[Parts::kTotal]; // 4C - NAMA
186 };
187 static_assert(sizeof(FaceData) == 0x5C);
188
189 struct Layer
190 {
191 public:
192 [[nodiscard]] float GetInterpolationValue() const;
193
194 // members
195 Color tintColor; // 00 - TINC
196 std::uint16_t tintIndex; // 04 - TINI
197 std::uint16_t preset; // 06 - TIAS
198 std::uint16_t interpolationValue; // 08 - TINV - CK value * 100 as an int
199 std::uint16_t pad0A; // 0A
200 std::uint32_t pad0C; // 0C
201 };
202 static_assert(sizeof(Layer) == 0x10);
203
204 ~TESNPC() override; // 00
205
206 // override (TESActorBase)
207 void InitializeData() override; // 04
208 void ClearData() override; // 05
209 bool Load(TESFile* a_mod) override; // 06
210 bool FindInFileFast(TESFile* a_mod) override; // 0C
211 void SaveGame(BGSSaveFormBuffer* a_buf) override; // 0E
212 void LoadGame(BGSLoadFormBuffer* a_buf) override; // 0F
213 void Revert(BGSLoadFormBuffer* a_buf) override; // 12
214 void InitItemImpl() override; // 13
215 const char* GetTextForParsedSubTag(const BSFixedString& a_tag) const override; // 2E
216 void Copy(TESForm* a_srcForm) override; // 2F
217 bool Activate(TESObjectREFR* a_targetRef, TESObjectREFR* a_activatorRef, std::uint8_t a_arg3, TESBoundObject* a_object, std::int32_t a_targetCount) override; // 37
218 void UnClone3D(TESObjectREFR* a_ref) override; // 41
219 void SetObjectVoiceType(BGSVoiceType* a_voiceType) override; // 48 - { TESActorBaseData::voice = a_voiceType; }
220 BGSVoiceType* GetObjectVoiceType() const override; // 49
221 NiAVObject* Clone3D(TESObjectREFR* a_ref) override; // 4A
222 bool GetActivateText(TESObjectREFR* a_activator, BSString& a_dst) override; // 4C
223 bool CalculateDoFavor(Actor* a_activator, bool a_arg2, TESObjectREFR* a_toActivate, float a_arg3) override; // 4D
224 TESCombatStyle* GetCombatStyle() override; // 54 - { return combatStyle; }
225 void SetCombatStyle(TESCombatStyle* a_combatStyle) override; // 55 - { combatStyle = a_combatStyle; }
226
227 // override (TESActorBaseData)
228 void CopyFromTemplateForms(TESActorBase** a_templateForms) override; // 04
229
230 // override (ActorValueOwner)
231 float GetActorValue(ActorValue a_akValue) override; // 01
232 void SetActorValue(ActorValue a_akValue, float a_value) override; // 07
233
234 // override (BSTEventSink<MenuOpenCloseEvent>)
236
238 [[nodiscard]] BGSHeadPart** GetBaseOverlays() const;
242 [[nodiscard]] float GetHeight() const;
243 [[nodiscard]] std::uint32_t GetNumBaseOverlays() const;
246 [[nodiscard]] const TESNPC* GetRootFaceNPC() const;
247 [[nodiscard]] SEX GetSex() const;
249 void SetFaceTexture(BGSTextureSet* a_textureSet);
250 void SetHairColor(BGSColorForm* a_hairColor);
251 void SetSkinFromTint(NiColorA* a_result, TintMask* a_tintMask, bool a_fromTint);
252 void UpdateNeck(BSFaceGenNiNode* a_faceNode);
253
254 // members
255 Skills playerSkills; // 190 - DNAM
256 TESClass* npcClass; // 1C0 - CNAM
258 BGSListForm* giftFilter; // 1D0 - GNAM
260 std::uint32_t fileOffset; // 1E0
261 std::uint32_t pad1E4; // 1E4
264 float height; // 1F8 - NAM6
265 float weight; // 1FC - NAM7
266 Sounds sounds; // 200 - CSCR
268 TESObjectARMO* farSkin; // 210 - ANAM
269 BGSOutfit* defaultOutfit; // 218 - DOFT
270 BGSOutfit* sleepOutfit; // 220 - SOFT
272 TESFaction* crimeFaction; // 230 - CRIF
273 BGSHeadPart** headParts; // 238 - PNAM
274 std::int8_t numHeadParts; // 240
275 std::uint8_t unk241; // 241
276 std::uint8_t unk242; // 242
277 std::uint8_t unk243; // 243
278 std::uint8_t unk244; // 244
280 Color bodyTintColor; // 246 - QNAM
281 std::uint16_t pad24A; // 24A
282 std::uint32_t pad24C; // 24C
286 };
287 static_assert(sizeof(TESNPC) == 0x268);
288}
Definition: Actor.h:125
Definition: BGSColorForm.h:13
Definition: BGSHeadPart.h:17
HeadPartType
Definition: BGSHeadPart.h:33
Definition: BGSListForm.h:10
Definition: BGSOutfit.h:10
Definition: BGSOverridePackCollection.h:10
Definition: BGSTextureSet.h:16
Definition: BGSVoiceType.h:25
Definition: BSFaceGenNiNode.h:14
Definition: BSTArray.h:377
Definition: BSTEvent.h:146
Definition: BSTEvent.h:28
Definition: TESNPC.h:24
BSTArray< void * > * unk00[8]
Definition: TESNPC.h:27
Definition: MenuOpenCloseEvent.h:8
Definition: NiAVObject.h:45
Definition: NiColor.h:137
Definition: TESActorBase.h:32
Definition: TESBoundObject.h:24
Definition: TESClass.h:88
Definition: TESCombatStyle.h:65
Definition: TESFaction.h:120
Definition: TESFile.h:14
Definition: TESForm.h:34
Definition: TESNPC.h:36
std::uint8_t unk244
Definition: TESNPC.h:278
~TESNPC() override
Skills playerSkills
Definition: TESNPC.h:255
HeadRelatedData * headRelatedData
Definition: TESNPC.h:257
void InitializeData() override
std::uint8_t unk241
Definition: TESNPC.h:275
bool HasOverlays()
BSTArray< Layer * > * tintLayers
Definition: TESNPC.h:285
const TESNPC * GetRootFaceNPC() const
BGSVoiceType * GetObjectVoiceType() const override
TESClass * npcClass
Definition: TESNPC.h:256
std::uint32_t pad24C
Definition: TESNPC.h:282
void SaveGame(BGSSaveFormBuffer *a_buf) override
SEX GetSex() const
void SetObjectVoiceType(BGSVoiceType *a_voiceType) override
float GetHeight() const
BSTArray< BGSRelationship * > * relationships
Definition: TESNPC.h:283
bool CalculateDoFavor(Actor *a_activator, bool a_arg2, TESObjectREFR *a_toActivate, float a_arg3) override
TESCombatStyle * combatStyle
Definition: TESNPC.h:259
bool Activate(TESObjectREFR *a_targetRef, TESObjectREFR *a_activatorRef, std::uint8_t a_arg3, TESBoundObject *a_object, std::int32_t a_targetCount) override
Color bodyTintColor
Definition: TESNPC.h:280
BGSListForm * giftFilter
Definition: TESNPC.h:258
void SetFaceTexture(BGSTextureSet *a_textureSet)
BGSHeadPart * GetHeadPartOverlayByType(HeadPartType a_type)
BSEventNotifyControl ProcessEvent(const MenuOpenCloseEvent *a_event, BSTEventSource< MenuOpenCloseEvent > *a_eventSource) override
TESObjectARMO * farSkin
Definition: TESNPC.h:268
std::uint32_t pad1E4
Definition: TESNPC.h:261
float GetActorValue(ActorValue a_akValue) override
void Revert(BGSLoadFormBuffer *a_buf) override
std::uint16_t pad24A
Definition: TESNPC.h:281
std::uint8_t unk243
Definition: TESNPC.h:277
void CopyFromTemplateForms(TESActorBase **a_templateForms) override
static constexpr auto FORMTYPE
Definition: TESNPC.h:41
void SetHairColor(BGSColorForm *a_hairColor)
float weight
Definition: TESNPC.h:265
BGSHeadPart ** GetBaseOverlays() const
BGSHeadPart ** headParts
Definition: TESNPC.h:273
BGSHeadPart * GetCurrentHeadPartByType(HeadPartType a_type)
static constexpr auto RTTI
Definition: TESNPC.h:38
stl::enumeration< SOUND_LEVEL, std::uint8_t > soundLevel
Definition: TESNPC.h:279
bool Load(TESFile *a_mod) override
void ChangeHeadPart(BGSHeadPart *a_target)
std::uint32_t GetNumBaseOverlays() const
BGSListForm * defaultPackList
Definition: TESNPC.h:271
void UnClone3D(TESObjectREFR *a_ref) override
void SetCombatStyle(TESCombatStyle *a_combatStyle) override
BGSOutfit * sleepOutfit
Definition: TESNPC.h:270
const char * GetTextForParsedSubTag(const BSFixedString &a_tag) const override
BGSHeadPart * GetHeadPartByType(HeadPartType a_type)
TESNPC * GetRootFaceNPC()
void ClearData() override
void SetSkinFromTint(NiColorA *a_result, TintMask *a_tintMask, bool a_fromTint)
std::int8_t numHeadParts
Definition: TESNPC.h:274
TESFaction * crimeFaction
Definition: TESNPC.h:272
std::uint32_t fileOffset
Definition: TESNPC.h:260
FaceData * faceData
Definition: TESNPC.h:284
NiAVObject * Clone3D(TESObjectREFR *a_ref) override
float height
Definition: TESNPC.h:264
Sounds sounds
Definition: TESNPC.h:266
TESRace * GetRace()
TESRace * originalRace
Definition: TESNPC.h:262
BSFixedString shortName
Definition: TESNPC.h:267
void Copy(TESForm *a_srcForm) override
TESNPC * faceNPC
Definition: TESNPC.h:263
std::uint8_t unk242
Definition: TESNPC.h:276
void InitItemImpl() override
bool GetActivateText(TESObjectREFR *a_activator, BSString &a_dst) override
BGSOutfit * defaultOutfit
Definition: TESNPC.h:269
void LoadGame(BGSLoadFormBuffer *a_buf) override
bool FindInFileFast(TESFile *a_mod) override
void UpdateNeck(BSFaceGenNiNode *a_faceNode)
void SetActorValue(ActorValue a_akValue, float a_value) override
TESCombatStyle * GetCombatStyle() override
Definition: TESObjectARMO.h:37
Definition: TESObjectREFR.h:105
Definition: TESRaceForm.h:10
Definition: TESRace.h:146
Definition: PCH.h:216
Definition: AbsorbEffect.h:6
ActorValue
Definition: ActorValues.h:6
constexpr REL::ID RTTI_TESNPC
Definition: Offsets_RTTI.h:6025
BSEventNotifyControl
Definition: BSTEvent.h:12
Definition: Color.h:6
SEX
Definition: Sexes.h:8
Definition: TESNPC.h:44
ChangeFlag
Definition: TESNPC.h:46
@ kDefaultOutfit
Definition: TESNPC.h:56
@ kClass
Definition: TESNPC.h:54
@ kBaseData
Definition: TESNPC.h:47
@ kFace
Definition: TESNPC.h:55
@ kAIData
Definition: TESNPC.h:49
@ kSleepOutfit
Definition: TESNPC.h:57
@ kNPCSkills
Definition: TESNPC.h:53
@ kSpellList
Definition: TESNPC.h:50
@ kFullName
Definition: TESNPC.h:51
@ kAttributes
Definition: TESNPC.h:48
@ kRace
Definition: TESNPC.h:59
@ kGender
Definition: TESNPC.h:58
@ kFactions
Definition: TESNPC.h:52
Definition: TESNPC.h:137
@ kBrows_InOut
Definition: TESNPC.h:150
@ kCheeks_ForwardBack
Definition: TESNPC.h:146
@ kEyes_InOut
Definition: TESNPC.h:148
@ kNose_LongShort
Definition: TESNPC.h:140
@ kChin_NarrowWide
Definition: TESNPC.h:154
@ kLips_UpDown
Definition: TESNPC.h:152
@ kCheeks_UpDown
Definition: TESNPC.h:145
@ kEyes_UpDown
Definition: TESNPC.h:147
@ kEyes_ForwardBack
Definition: TESNPC.h:157
@ kNose_UpDown
Definition: TESNPC.h:141
@ kBrows_ForwardBack
Definition: TESNPC.h:151
@ kJaw_NarrowWide
Definition: TESNPC.h:143
@ kUnk
Definition: TESNPC.h:158
@ kBrows_UpDown
Definition: TESNPC.h:149
@ kJaw_ForwardBack
Definition: TESNPC.h:144
@ kTotal
Definition: TESNPC.h:160
@ kChin_UnderbiteOverbite
Definition: TESNPC.h:156
@ kChin_UpDown
Definition: TESNPC.h:155
@ kLips_InOut
Definition: TESNPC.h:153
@ kJaw_UpDown
Definition: TESNPC.h:142
Definition: TESNPC.h:165
@ kEyes
Definition: TESNPC.h:170
@ kMouth
Definition: TESNPC.h:171
@ kUnknown
Definition: TESNPC.h:169
@ kTotal
Definition: TESNPC.h:173
@ kNose
Definition: TESNPC.h:168
Definition: TESNPC.h:134
std::int32_t parts[Parts::kTotal]
Definition: TESNPC.h:185
float morphs[Morphs::kTotal]
Definition: TESNPC.h:184
@ kTotalPresets
Definition: TESNPC.h:180
@ kDefault
Definition: TESNPC.h:179
Definition: TESNPC.h:190
std::uint16_t interpolationValue
Definition: TESNPC.h:198
float GetInterpolationValue() const
std::uint16_t pad0A
Definition: TESNPC.h:199
Color tintColor
Definition: TESNPC.h:195
std::uint16_t preset
Definition: TESNPC.h:197
std::uint32_t pad0C
Definition: TESNPC.h:200
std::uint16_t tintIndex
Definition: TESNPC.h:196
Definition: TESNPC.h:64
RecordFlag
Definition: TESNPC.h:66
@ kIgnored
Definition: TESNPC.h:68
@ kDeleted
Definition: TESNPC.h:67
@ kBleedoutOverride
Definition: TESNPC.h:70
@ kCompressed
Definition: TESNPC.h:69
Definition: TESNPC.h:75
std::uint16_t health
Definition: TESNPC.h:104
@ kIllusion
Definition: TESNPC.h:94
@ kHeavyArmor
Definition: TESNPC.h:84
@ kLockpicking
Definition: TESNPC.h:87
@ kSneak
Definition: TESNPC.h:88
@ kRestoration
Definition: TESNPC.h:95
@ kDestruction
Definition: TESNPC.h:93
@ kSmithing
Definition: TESNPC.h:83
@ kOneHanded
Definition: TESNPC.h:79
@ kEnchanting
Definition: TESNPC.h:96
@ kConjuration
Definition: TESNPC.h:92
@ kMarksman
Definition: TESNPC.h:81
@ kPickpocket
Definition: TESNPC.h:86
@ kBlock
Definition: TESNPC.h:82
@ kAlteration
Definition: TESNPC.h:91
@ kSpecchcraft
Definition: TESNPC.h:90
@ kTotal
Definition: TESNPC.h:98
@ kAlchemy
Definition: TESNPC.h:89
@ kLightArmor
Definition: TESNPC.h:85
@ kTwoHanded
Definition: TESNPC.h:80
std::uint16_t stamina
Definition: TESNPC.h:106
std::uint16_t magicka
Definition: TESNPC.h:105
std::uint8_t values[kTotal]
Definition: TESNPC.h:102
std::uint16_t pad2A
Definition: TESNPC.h:107
float farawayModelDistance
Definition: TESNPC.h:108
std::uint8_t offsets[kTotal]
Definition: TESNPC.h:103
Definition: TESNPC.h:127
TESNPC * soundCreature
Definition: TESNPC.h:128
CreatureSounds * creatureSounds
Definition: TESNPC.h:129