From 5b5bda718431bebd7fd51422feaa676037a574f6 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:12:04 +0530 Subject: [PATCH] feat: add `BGSFormFolderKeywordList`, fix `BGSKeywordForm` defs (#185) --- .../include/RE/B/BGSFormFolderKeywordList.h | 23 ++++++++++++++++ CommonLibSF/include/RE/B/BGSKeywordForm.h | 6 +++-- CommonLibSF/include/RE/B/BGSReflectedForm.h | 27 +++++++++++++++++++ CommonLibSF/src/RE/B/BGSKeywordForm.cpp | 15 +++++++---- 4 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 CommonLibSF/include/RE/B/BGSFormFolderKeywordList.h create mode 100644 CommonLibSF/include/RE/B/BGSReflectedForm.h diff --git a/CommonLibSF/include/RE/B/BGSFormFolderKeywordList.h b/CommonLibSF/include/RE/B/BGSFormFolderKeywordList.h new file mode 100644 index 00000000..0292b727 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSFormFolderKeywordList.h @@ -0,0 +1,23 @@ +#pragma once + +#include "RE/B/BGSReflectedForm.h" +#include "RE/B/BSTArray.h" + +namespace RE +{ + class BGSKeyword; + + class BGSFormFolderKeywordList : public BGSReflectedForm + { + public: + SF_RTTI_VTABLE(BGSFormFolderKeywordList); + SF_FORMTYPE(FFKW); + + ~BGSFormFolderKeywordList() override; // 00 + + // members + BSTArray keywords; // 38 + BSFixedString formFolder; // 48 + }; + static_assert(sizeof(BGSFormFolderKeywordList) == 0x50); +} diff --git a/CommonLibSF/include/RE/B/BGSKeywordForm.h b/CommonLibSF/include/RE/B/BGSKeywordForm.h index abd2af46..35642933 100644 --- a/CommonLibSF/include/RE/B/BGSKeywordForm.h +++ b/CommonLibSF/include/RE/B/BGSKeywordForm.h @@ -7,6 +7,8 @@ namespace RE { + class BGSFormFolderKeywordList; + class BGSKeywordForm : public BaseFormComponent, // 00 public IKeywordFormBase // 08 @@ -29,8 +31,8 @@ namespace RE [[nodiscard]] bool HasKeywordString(std::string_view a_editorID); // members - BSTArray keywords1; // 10 - empty? - BSTArray keywords2; // 20 + BSTArray formFolderKeywordLists; // 10 + BSTArray keywords; // 20 }; static_assert(sizeof(BGSKeywordForm) == 0x30); } diff --git a/CommonLibSF/include/RE/B/BGSReflectedForm.h b/CommonLibSF/include/RE/B/BGSReflectedForm.h new file mode 100644 index 00000000..93763151 --- /dev/null +++ b/CommonLibSF/include/RE/B/BGSReflectedForm.h @@ -0,0 +1,27 @@ +#pragma once + +#include "RE/T/TESForm.h" + +namespace RE +{ + class BGSReflectedForm : public TESForm + { + public: + SF_RTTI_VTABLE(BGSReflectedForm); + + ~BGSReflectedForm() override; // 00 + + // add + virtual void Unk_62(); // 62 + virtual void Unk_63(); // 63 + virtual void Unk_64(); // 64 + virtual void Unk_65(); // 65 + virtual void Unk_66(); // 66 + virtual void Unk_67(); // 67 + virtual void Unk_68(); // 68 + virtual void Unk_69(); // 69 + virtual void Unk_6A(); // 6A + virtual void Unk_6B(); // 6B + }; + static_assert(sizeof(BGSReflectedForm) == 0x38); +} diff --git a/CommonLibSF/src/RE/B/BGSKeywordForm.cpp b/CommonLibSF/src/RE/B/BGSKeywordForm.cpp index 048b457c..c62ecc19 100644 --- a/CommonLibSF/src/RE/B/BGSKeywordForm.cpp +++ b/CommonLibSF/src/RE/B/BGSKeywordForm.cpp @@ -1,4 +1,5 @@ #include "RE/B/BGSKeywordForm.h" +#include "RE/B/BGSFormFolderKeywordList.h" #include "RE/B/BGSKeyword.h" namespace RE @@ -17,21 +18,25 @@ namespace RE void BGSKeywordForm::ForEachKeyword(std::function a_callback) { - for (const auto& keyword : keywords2) { + for (const auto& keyword : keywords) { if (keyword && a_callback(keyword) == BSContainer::ForEachResult::kStop) { return; } } - for (const auto& keyword : keywords1) { - if (keyword && a_callback(keyword) == BSContainer::ForEachResult::kStop) { - return; + for (const auto& formFolderKeywordList : formFolderKeywordLists) { + if (formFolderKeywordList) { + for (const auto& keyword : formFolderKeywordList->keywords) { + if (keyword && a_callback(keyword) == BSContainer::ForEachResult::kStop) { + return; + } + } } } } std::uint32_t BGSKeywordForm::GetNumKeywords() const { - return keywords1.size() + keywords2.size(); + return keywords.size(); } bool BGSKeywordForm::HasKeywordString(std::string_view a_editorID)