From 6fe6fb57e1c483d273a82b03a61c4df4046083f4 Mon Sep 17 00:00:00 2001 From: FlenarnTemp <68670981+FlenarnTemp@users.noreply.github.com> Date: Mon, 6 May 2024 20:59:55 +0200 Subject: [PATCH] feat: Update (#1) * feat: Dialogue-system centered declarations. * feat: Update 3 IDs. * feat: Declare `TESResponse`. --- CommonLibF4/cmake/sourcelist.cmake | 1 + CommonLibF4/include/RE/Bethesda/Actor.h | 2 +- .../include/RE/Bethesda/BGSSceneAction.h | 228 ++++++++++++++++++ .../RE/Bethesda/BGSStoryManagerTreeForm.h | 2 +- CommonLibF4/include/RE/Bethesda/BSExtraData.h | 2 +- CommonLibF4/include/RE/Bethesda/TESForms.h | 80 +++++- CommonLibF4/include/RE/Fallout.h | 1 + 7 files changed, 311 insertions(+), 5 deletions(-) create mode 100644 CommonLibF4/include/RE/Bethesda/BGSSceneAction.h diff --git a/CommonLibF4/cmake/sourcelist.cmake b/CommonLibF4/cmake/sourcelist.cmake index d9187a76..ec2d0666 100644 --- a/CommonLibF4/cmake/sourcelist.cmake +++ b/CommonLibF4/cmake/sourcelist.cmake @@ -27,6 +27,7 @@ set(SOURCES include/RE/Bethesda/BGSMod.h include/RE/Bethesda/BGSPrimitive.h include/RE/Bethesda/BGSSaveLoad.h + include/RE/Bethesda/BGSSceneAction.h include/RE/Bethesda/BGSStoryEventManager.h include/RE/Bethesda/BGSStoryManagerTreeForm.h include/RE/Bethesda/BGSSynchronizedAnimationManager.h diff --git a/CommonLibF4/include/RE/Bethesda/Actor.h b/CommonLibF4/include/RE/Bethesda/Actor.h index 9c376c2f..27cdf864 100644 --- a/CommonLibF4/include/RE/Bethesda/Actor.h +++ b/CommonLibF4/include/RE/Bethesda/Actor.h @@ -259,7 +259,7 @@ namespace RE void SetupFireSounds(Actor& a_actor, BGSObjectInstanceT& a_weapon) { using func_t = decltype(&EquippedWeaponData::SetupFireSounds); - REL::Relocation func{ REL::ID(1468462) }; + REL::Relocation func{ REL::ID(2232275) }; return func(this, a_actor, a_weapon); } diff --git a/CommonLibF4/include/RE/Bethesda/BGSSceneAction.h b/CommonLibF4/include/RE/Bethesda/BGSSceneAction.h new file mode 100644 index 00000000..14a968d2 --- /dev/null +++ b/CommonLibF4/include/RE/Bethesda/BGSSceneAction.h @@ -0,0 +1,228 @@ +#pragma once + +#include "RE/Bethesda/BSTArray.h" +#include "RE/Bethesda/BSTSmartPointer.h" +#include "RE/Bethesda/TESCondition.h" +#include "RE/Bethesda/TESForms.h" + +namespace RE +{ + class Actor; + class BGSScene; + class BGSKeyword; + class BGSSoundDescriptorForm; + class BGSSoundOutput; + class BSInputEnableLayer; + class TESCondition; + class TESPackage; + class TESQuest; + class TESTopic; + + class __declspec(novtable) BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneAction }; + static constexpr auto VTABLE{ VTABLE::BGSSceneAction }; + + struct STARTSCENEACTIONDATA + { + BGSScene* pScene; + std::uint16_t sceneStartPhase; + TESQuest* parentQuest; + TESCondition sceneConditions; + }; + + enum SCENE_ACTION_PLAYER_RESPONSE_TYPE : std::uint32_t + { + kPositive = 0, + kNegative = 1, + kNeutral = 2, + kQuestion = 3, + kTotal = 4, + kNone + }; + + enum SCENE_ACTION_TYPE : std::uint32_t + { + kDialogue = 0, + kPackage = 1, + kTimer = 2, + kPlayerDialogue = 3, + kStartScene = 4, + kNPCResponse = 5, + kRadio = 6, + }; + + enum class Flag + { + kPlayerUseDialogueSubtypePositive = 1 << 7, + kPlayerUseDialogueSubtypeNegative = 1 << 8, + kPlayerUseDialogueSubtypeNeutral = 1 << 9, + kUseDialogueSubtype = 1 << 10, + kPlayerUseDialogueSubtypeQuestion = 1 << 11, + kFaceTaget = 1 << 15, + kHeadTrackPlayer = 1 << 17, + kIngoreForCompletion = 1 << 19, + kCameraSpeakerTarget = 1 << 21 + }; + + enum class Status + { + kStopped, + kRunning, + kComplete + }; + + virtual ~BGSSceneAction(); // 00 + + // add + virtual void Unk_01(void); // 01 + virtual void Unk_02(void); // 02 + virtual void Unk_03(void); // 03 + virtual void Unk_04(void); // 04 + virtual void Unk_05(void); // 05 + virtual bool QIsLooping(void); // 06 + virtual bool QFaceHeadTrackTarget(const BGSScene* scene); // 07 + virtual SCENE_ACTION_TYPE GetActionType() const = 0; // 08 + virtual bool QActionCanEnd(); // 09 + virtual bool IsPackageActive(BGSScene* scene, TESPackage* package, Actor* actor); // 0A + virtual void Unk_0B(void); // 0B + virtual void Unk_0C(void); // 0C + virtual void Unk_0D(void); // 0D + virtual void Unk_0E(void); // 0E + virtual void Unk_0F(void); // 0F + virtual void Unk_10(void); // 10 + virtual void Unk_11(void); // 11 + virtual void StartAction(BGSScene* scene); // 12 + virtual void EndAction(BGSScene* scene); // 13 + virtual void CleanUpActionActor(void); // 14 + virtual void UpdateAction(BGSScene* scene); // 14 + + // members + std::uint32_t actorID; // 08 + std::uint16_t startPhase; // 0C + std::uint16_t endPhase; // 0E + stl::enumeration flags; // 10 + stl::enumeration status; // 14 + std::uint32_t uniqueID; // 18 + }; + static_assert(sizeof(BGSSceneAction) == 0x20); + + class __declspec(novtable) BGSSceneActionDialogue : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionDialogue }; + static constexpr auto VTABLE{ VTABLE::BGSSceneActionDialogue }; + + // members + TESTopic* topic; // 20 + float fMaxLoopTime; // 28 + float fMinLoopTime; // 2C + BSTArray iHeadTrackTargetA; // 30 + float fCurrentLoopTimer; // 48 + BGSKeyword* pAnimFaceArchType; // 50 + BGSKeyword* pSubtypeKeyword; // 58 + BGSSoundOutput* outputModel; // 60 + BSTSmartPointer pInputLayer; // 68 + std::uint32_t iHeadTargetValue; // 74 + float fHeadTrackChangeTimer; // 78 + }; + static_assert(sizeof(BGSSceneActionDialogue) == 0x78); + + class __declspec(novtable) BGSSceneActionConversationBase : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionConversationBase }; + static constexpr auto VTABLE{ VTABLE::BGSSceneActionConversationBase }; + + TESTopic* responseTopics[4]; // 20 + BGSKeyword* pResponseSubtypeKeywords[4]; // 40 + BGSSoundOutput* pOutputModel; // 60 + BSTArray iHeadTrackTargetA; // 68 + std::uint32_t iHeadTargetValue; // 80 + float fHeadTrackChangeTimer; // 84 + TESTopic* currentTopic; // 88 + }; + static_assert(sizeof(BGSSceneActionConversationBase) == 0x90); + + class __declspec(novtable) BGSSceneActionPlayerDialogue : + public BGSSceneActionConversationBase + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionPlayerDialogue }; + static constexpr auto VTABlE{ VTABLE::BGSSceneActionPlayerDialogue }; + + std::uint64_t dialogueTarget; // 90 + TESTopic* pNPCResponseTopics[4]; // 98 + BGSKeyword* pNPCResponseSubtypeKeywords[4]; // B8 + TESTopic* pTopic; // D8 + SCENE_ACTION_PLAYER_RESPONSE_TYPE playerInput; // E0 + }; + static_assert(sizeof(BGSSceneActionPlayerDialogue) == 0xE8); + + class __declspec(novtable) BGSSceneActionNPCResponseDialogue : public BGSSceneActionConversationBase { }; + + class __declspec(novtable) BGSSceneActionStartScene : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionStartScene }; + static constexpr auto VTABlE{ VTABLE::BGSSceneActionStartScene }; + + BSTArray scenesA; // 20 + BGSScene* scene; // 38 + std::uint16_t sceneStartPhase; // 40 + bool endSceneSayGreeting; // 42 + }; + static_assert(sizeof(BGSSceneActionStartScene) == 0x48); + + class __declspec(novtable) BGSSceneActionTimer : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionTimer }; + static constexpr auto VTABlE{ VTABLE::BGSSceneActionTimer }; + + float fSeconds; // 20 + float fMinSeconds; // 24 + float fTimer; // 28 + bool scriptEndRun; // 2C + bool runEnd; // 2D + float fCurrentSeconds; // 30 + }; + static_assert(sizeof(BGSSceneActionTimer) == 0x38); + + class __declspec(novtable) BGSSceneActionRadio : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionRadio }; + static constexpr auto VTABlE{ VTABLE::BGSSceneActionRadio }; + + TESTopic* topic; // 20 + BGSSoundDescriptorForm* sound; // 28 + BGSSoundOutput* outputModel; // 30 + BGSKeyword* subtypeKeyword; // 38 + BGSSoundDescriptorForm* topicSound; // 40 + float fSoundDuration; // 48 + std::uint32_t soundID; // 4C + bool soundDone; // 50 + TESTopic* currentTopic; // 58 + float fFailTimer; // 60 + }; + static_assert(sizeof(BGSSceneActionRadio) == 0x68); + + class __declspec(novtable) BGSSceneActionPackage : + public BGSSceneAction + { + public: + static constexpr auto RTTI{ RTTI::BGSSceneActionPackage }; + static constexpr auto VTABlE{ VTABLE::BGSSceneActionPackage }; + + std::uint32_t currentPackIndex; // 20 + BSTArray packages; // 28 + }; + static_assert(sizeof(BGSSceneActionPackage) == 0x40); +} diff --git a/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h b/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h index a87e5077..a6115be9 100644 --- a/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h +++ b/CommonLibF4/include/RE/Bethesda/BGSStoryManagerTreeForm.h @@ -96,7 +96,7 @@ namespace RE bool SetStage(std::uint16_t stage) { using func_t = decltype(&TESQuest::SetStage); - REL::Relocation func{ REL::ID(952799) }; + REL::Relocation func{ REL::ID(2207743) }; return func(this, stage); } diff --git a/CommonLibF4/include/RE/Bethesda/BSExtraData.h b/CommonLibF4/include/RE/Bethesda/BSExtraData.h index 876bcb72..1091ec2a 100644 --- a/CommonLibF4/include/RE/Bethesda/BSExtraData.h +++ b/CommonLibF4/include/RE/Bethesda/BSExtraData.h @@ -888,7 +888,7 @@ namespace RE void SetStartingWorldOrCell(TESForm* a_form) { using func_t = decltype(&ExtraDataList::SetStartingWorldOrCell); - REL::Relocation func{ REL::ID(603621) }; + REL::Relocation func{ REL::ID(2191213) }; return func(this, a_form); } diff --git a/CommonLibF4/include/RE/Bethesda/TESForms.h b/CommonLibF4/include/RE/Bethesda/TESForms.h index 3142cc6b..7a700f46 100644 --- a/CommonLibF4/include/RE/Bethesda/TESForms.h +++ b/CommonLibF4/include/RE/Bethesda/TESForms.h @@ -479,7 +479,6 @@ namespace RE class TESPackageData; class TESRegionDataList; class TESRegionPointList; - class TESResponse; struct BGSDebrisData; struct FORM; @@ -1663,12 +1662,63 @@ namespace RE struct TOPIC_INFO_DATA { public: + enum class TOPIC_INFO_FLAGS : std::uint32_t { + kNone = 0, + kStartSceneOnEnd = 0x1, + kRandom = 0x2, + kSayOnce = 0x4, + kRequirePlayerActivation = 0x8, + kInfoRefusal = 0x10, + kRandomEnd = 0x20, + kEndRunningScene = 0x40, + kIsForceGreet = 0x80, + kPlaredAddress = 0x100, + kGroupTracksData = 0x100, + kForceSubtitle = 0x200, + kGroupForceRandom = 0x200, + kCanMoveWhileGreeitng = 0x400, + kNoLIPFile = 0x800, + kGroupDontDoAll = 0x800, + kPostProcess = 0x1000, + kCustomSoundOutpt = 0x2000, + kDialogueInfoSaid = 0x4000, + kHasCapsData = 0x4000, + kAlreadySaidDoAllBeforeRepeating = 0x8000, + kEditorOnly = 0x4000, + }; + // members - std::uint16_t flags; // 0 + stl::enumeration flags; // 0 std::uint16_t timeUntilReset; // 2 }; static_assert(sizeof(TOPIC_INFO_DATA) == 0x4); + struct TESResponse + { + public: + struct RespData + { + std::uint16_t uiPercent; + std::uint8_t ucResponseID; + bool bUseEmotion; + }; + static_assert(sizeof(RespData) == 0x4); + + const char* GetResponseText() + { + using func_t = decltype(&TESResponse::GetResponseText); + REL::Relocation func{ REL::ID(2208288) }; + return func(this); + } + + // Members + BGSLocalizedString responseText; + TESResponse* pNext; + TESResponse::RespData data; + BGSTypedKeywordValue faceArcheType; + }; + static_assert(sizeof(TESRespone) == 0x18); + class ResponseListWrapper { public: @@ -1685,6 +1735,32 @@ namespace RE static constexpr auto VTABLE{ VTABLE::TESTopicInfo }; static constexpr auto FORM_ID{ ENUM_FORM_ID::kINFO }; + enum Flags + { + kInfoGroup = (1 << 6), + }; + + enum CHARISMA_CHALLENGE_DIFFICULTY : std::uint32_t + { + CC_CHALLENGE_NONE = 0x0, + CC_CHALLENGE_EASY = 0x1, + CC_CHALLENGE_MEDIUM = 0x2, + CC_CHALLENGE_HARD = 0x3, + CC_CHALLENGE_ALWAYS_SUCCEEDS = 0x4, + CC_CHALLENGE_EASY_REPEATABLE = 0x5, + CC_CHALLENGE_MEDIUM_REPEATABLE = 0x6, + CC_CHALLENGE_HARD_REPEATABLE = 0x7, + CC_CHALLENGE_COUNT = 0x8, + }; + + enum CHARISMA_CHALLENGE_SUCCESS : std::uint32_t + { + CC_SUCCESS_NONE = 0xFFFFFFFF, + CC_SUCCESS_FAIL = 0x0, + CC_SUCCESS_SUCCEED = 0x1, + CC_SUCCESS_COUNT = 0x2, + }; + // members TESTopic* parentTopic; // 20 TESGlobal* resetGlobal; // 28 diff --git a/CommonLibF4/include/RE/Fallout.h b/CommonLibF4/include/RE/Fallout.h index 33b33f89..140610b0 100644 --- a/CommonLibF4/include/RE/Fallout.h +++ b/CommonLibF4/include/RE/Fallout.h @@ -22,6 +22,7 @@ #include "RE/Bethesda/BGSMod.h" #include "RE/Bethesda/BGSPrimitive.h" #include "RE/Bethesda/BGSSaveLoad.h" +#include "RE/Bethesda/BGSSceneAction.h" #include "RE/Bethesda/BGSStoryEventManager.h" #include "RE/Bethesda/BGSStoryManagerTreeForm.h" #include "RE/Bethesda/BGSSynchronizedAnimationManager.h"