Skip to content

Commit

Permalink
feat: werewolf and vampire lord sync
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Mar 16, 2022
1 parent 85eda1c commit d0a387d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 9 additions & 0 deletions Code/client/Games/Skyrim/Magic/MagicTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <Games/ActorExtension.h>
#include "EffectItem.h"

#include <Structs/Skyrim/AnimationGraphDescriptor_WerewolfBehavior.h>
#include <Structs/Skyrim/AnimationGraphDescriptor_VampireLordBehavior.h>

#include <Events/AddTargetEvent.h>

TP_THIS_FUNCTION(TAddTarget, bool, MagicTarget, MagicTarget::AddTargetData& arData);
Expand Down Expand Up @@ -36,6 +39,12 @@ bool TP_MAKE_THISCALL(HookAddTarget, MagicTarget, MagicTarget::AddTargetData& ar
if (!pTargetActorEx)
return ThisCall(RealAddTarget, apThis, arData);

if (arData.pEffectItem->IsWerewolfEffect())
pTargetActorEx->GraphDescriptorHash = AnimationGraphDescriptor_WerewolfBehavior::m_key;

if (arData.pEffectItem->IsVampireLordEffect())
pTargetActorEx->GraphDescriptorHash = AnimationGraphDescriptor_VampireLordBehavior::m_key;

AddTargetEvent addTargetEvent{};
addTargetEvent.TargetID = pTargetActor->formID;
addTargetEvent.SpellID = arData.pSpell->formID;
Expand Down
6 changes: 1 addition & 5 deletions Code/client/Games/Skyrim/PlayerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ void TP_MAKE_THISCALL(HookSetBeastForm, void, void* apUnk1, void* apUnk2, bool a
{
spdlog::warn("Setting beast form: {}", aEntering);

BSAnimationGraphManager* pManager = nullptr;
PlayerCharacter::Get()->animationGraphHolder.GetBSAnimationGraph(&pManager);
auto hash = pManager->GetDescriptorKey();
auto pDescriptor = AnimationGraphDescriptorManager::Get().GetDescriptor(hash);
spdlog::info("Key: {}", hash);
// TODO: send respawn event

ThisCall(RealSetBeastForm, apThis, apUnk1, apUnk2, aEntering);
}
Expand Down
3 changes: 3 additions & 0 deletions Code/client/Services/Debug/Views/AnimDebugView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <Games/Skyrim/Misc/InventoryEntry.h>
#include <Games/Skyrim/Misc/MiddleProcess.h>
#include <Games/Skyrim/Actor.h>
#include <Games/ActorExtension.h>
#endif

#if (TP_FALLOUT4)
Expand Down Expand Up @@ -69,6 +70,8 @@ void TestService::DrawAnimDebugView()
return;
}

spdlog::info("{}", pActor->GetExtension()->GraphDescriptorHash);

if (ImGui::Button("Clear all"))
{
s_varMap.clear();
Expand Down

0 comments on commit d0a387d

Please sign in to comment.