Skip to content

Commit

Permalink
feat: add BGSFormFolderKeywordList, fix BGSKeywordForm defs (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 authored Oct 22, 2023
1 parent 39fa9b4 commit 5b5bda7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 7 deletions.
23 changes: 23 additions & 0 deletions CommonLibSF/include/RE/B/BGSFormFolderKeywordList.h
Original file line number Diff line number Diff line change
@@ -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<BGSKeyword*> keywords; // 38
BSFixedString formFolder; // 48
};
static_assert(sizeof(BGSFormFolderKeywordList) == 0x50);
}
6 changes: 4 additions & 2 deletions CommonLibSF/include/RE/B/BGSKeywordForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace RE
{
class BGSFormFolderKeywordList;

class BGSKeywordForm :
public BaseFormComponent, // 00
public IKeywordFormBase // 08
Expand All @@ -29,8 +31,8 @@ namespace RE
[[nodiscard]] bool HasKeywordString(std::string_view a_editorID);

// members
BSTArray<BGSKeyword*> keywords1; // 10 - empty?
BSTArray<BGSKeyword*> keywords2; // 20
BSTArray<BGSFormFolderKeywordList*> formFolderKeywordLists; // 10
BSTArray<BGSKeyword*> keywords; // 20
};
static_assert(sizeof(BGSKeywordForm) == 0x30);
}
27 changes: 27 additions & 0 deletions CommonLibSF/include/RE/B/BGSReflectedForm.h
Original file line number Diff line number Diff line change
@@ -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);
}
15 changes: 10 additions & 5 deletions CommonLibSF/src/RE/B/BGSKeywordForm.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "RE/B/BGSKeywordForm.h"
#include "RE/B/BGSFormFolderKeywordList.h"
#include "RE/B/BGSKeyword.h"

namespace RE
Expand All @@ -17,21 +18,25 @@ namespace RE

void BGSKeywordForm::ForEachKeyword(std::function<BSContainer::ForEachResult(BGSKeyword*)> 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)
Expand Down

0 comments on commit 5b5bda7

Please sign in to comment.