From 50d0dcae9e96fa40bc004d86474df1087f7ead3c Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Sun, 16 Jun 2024 16:35:41 +0530 Subject: [PATCH] Add `TESTopicInfoEvent` --- cmake/sourcelist.cmake | 2 ++ include/RE/D/DialogueItem.h | 4 ++-- include/RE/R/REFREventCallbacks.h | 27 ++++++++++++++++++++++++++ include/RE/Skyrim.h | 2 ++ include/RE/T/TESTopicInfo.h | 2 +- include/RE/T/TESTopicInfoEvent.h | 32 +++++++++++++++++++++++++++++++ src/RE/T/TESTopicInfo.cpp | 3 +-- 7 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 include/RE/R/REFREventCallbacks.h create mode 100644 include/RE/T/TESTopicInfoEvent.h diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index bce92e448..72783b4f5 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1352,6 +1352,7 @@ set(SOURCES include/RE/Q/QuestEvents.h include/RE/Q/QuestObjectiveStates.h include/RE/Q/QuestStatus.h + include/RE/R/REFREventCallbacks.h include/RE/R/RaceSexCamera.h include/RE/R/RaceSexMenu.h include/RE/R/RaceSexMenuEvent.h @@ -1575,6 +1576,7 @@ set(SOURCES include/RE/T/TESTexture1024.h include/RE/T/TESTopic.h include/RE/T/TESTopicInfo.h + include/RE/T/TESTopicInfoEvent.h include/RE/T/TESTrackedStatsEvent.h include/RE/T/TESUniqueIDChangeEvent.h include/RE/T/TESValueForm.h diff --git a/include/RE/D/DialogueItem.h b/include/RE/D/DialogueItem.h index 74fb5aec0..de9a6414b 100644 --- a/include/RE/D/DialogueItem.h +++ b/include/RE/D/DialogueItem.h @@ -40,7 +40,7 @@ namespace RE class DialogueItem : public BSIntrusiveRefCounted { public: - DialogueItem(TESQuest* a_quest, TESTopic* a_topic, TESTopicInfo* a_topicInfo, Actor* a_speaker) + DialogueItem(TESQuest* a_quest, TESTopic* a_topic, TESTopicInfo* a_topicInfo, TESObjectREFR* a_speaker) { Ctor(a_quest, a_topic, a_topicInfo, a_speaker); } @@ -60,7 +60,7 @@ namespace RE ExtraSayToTopicInfo* extraData{ nullptr }; // 40 private: - DialogueItem* Ctor(TESQuest* a_quest, TESTopic* a_topic, TESTopicInfo* a_topicInfo, Actor* a_speaker) + DialogueItem* Ctor(TESQuest* a_quest, TESTopic* a_topic, TESTopicInfo* a_topicInfo, TESObjectREFR* a_speaker) { using func_t = decltype(&DialogueItem::Ctor); REL::Relocation func{ RELOCATION_ID(34413, 35220) }; diff --git a/include/RE/R/REFREventCallbacks.h b/include/RE/R/REFREventCallbacks.h new file mode 100644 index 000000000..b735d430e --- /dev/null +++ b/include/RE/R/REFREventCallbacks.h @@ -0,0 +1,27 @@ +#pragma once + +#include "RE/B/BSIntrusiveRefCounted.h" + +namespace RE +{ + class BSStorage; + + namespace REFREventCallbacks + { + class IEventCallback : public BSIntrusiveRefCounted + { + public: + inline static constexpr auto RTTI = RTTI_REFREventCallbacks__IEventCallback; + inline static constexpr auto VTABLE = VTABLE_REFREventCallbacks__IEventCallback; + + virtual ~IEventCallback(); // 00 + + // add + virtual void operator()() = 0; // 01 + virtual bool Save(BSStorage& a_storage); // 02 + virtual const BSFixedString* GetType() = 0; // 03 + virtual bool Load(const BSStorage& a_storage); // 04 + }; + static_assert(sizeof(IEventCallback) == 0x10); + } +} diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 97e598f82..9026371fe 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -1351,6 +1351,7 @@ #include "RE/Q/QuestEvents.h" #include "RE/Q/QuestObjectiveStates.h" #include "RE/Q/QuestStatus.h" +#include "RE/R/REFREventCallbacks.h" #include "RE/R/RaceSexCamera.h" #include "RE/R/RaceSexMenu.h" #include "RE/R/RaceSexMenuEvent.h" @@ -1572,6 +1573,7 @@ #include "RE/T/TESTexture1024.h" #include "RE/T/TESTopic.h" #include "RE/T/TESTopicInfo.h" +#include "RE/T/TESTopicInfoEvent.h" #include "RE/T/TESTrackedStatsEvent.h" #include "RE/T/TESUniqueIDChangeEvent.h" #include "RE/T/TESValueForm.h" diff --git a/include/RE/T/TESTopicInfo.h b/include/RE/T/TESTopicInfo.h index e6f98265f..a4d82f439 100644 --- a/include/RE/T/TESTopicInfo.h +++ b/include/RE/T/TESTopicInfo.h @@ -129,7 +129,7 @@ namespace RE bool BelongsInGroup(FORM* a_form, bool a_allowParentGroups, bool a_currentOnly) override; // 30 void CreateGroupData(FORM* a_form, FORM_GROUP* a_group) override; // 31 - DialogueItem GetDialogueData(Actor* a_speaker); + DialogueItem GetDialogueData(TESObjectREFR* a_speaker); // members TESTopic* parentTopic; // 20 diff --git a/include/RE/T/TESTopicInfoEvent.h b/include/RE/T/TESTopicInfoEvent.h new file mode 100644 index 000000000..dc9366023 --- /dev/null +++ b/include/RE/T/TESTopicInfoEvent.h @@ -0,0 +1,32 @@ +#pragma once + +#include "RE/B/BSTSmartPointer.h" +#include "RE/N/NiSmartPointer.h" + +namespace RE +{ + class TESObjectREFR; + + namespace REFREventCallbacks + { + class IEventCallback; + } + + struct TESTopicInfoEvent + { + public: + enum class TopicInfoEventType + { + kTopicBegin = 0, + kTopicEnd + }; + + // members + BSTSmartPointer callback; // 00 + NiPointer speakerRef; // 08 + FormID topicInfoFormID; // 10 + stl::enumeration type; // 14 + std::uint16_t stage; // 18 + }; + static_assert(sizeof(TESTopicInfoEvent) == 0x20); +} diff --git a/src/RE/T/TESTopicInfo.cpp b/src/RE/T/TESTopicInfo.cpp index d2b132067..81a1d575a 100644 --- a/src/RE/T/TESTopicInfo.cpp +++ b/src/RE/T/TESTopicInfo.cpp @@ -21,9 +21,8 @@ namespace RE return static_cast(timeUntilReset); } - DialogueItem TESTopicInfo::GetDialogueData(Actor* a_speaker) + DialogueItem TESTopicInfo::GetDialogueData(TESObjectREFR* a_speaker) { return { parentTopic->ownerQuest, parentTopic, this, a_speaker }; } - }