Skip to content

Commit 71b13df

Browse files
Merge pull request #684 from tiltedphoques/dev
V1.6.7
2 parents 4635ef2 + 9b620f1 commit 71b13df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+549
-194
lines changed

Code/client/Events/AddTargetEvent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct AddTargetEvent
88
AddTargetEvent() = default;
99

1010
uint32_t TargetID{};
11+
uint32_t CasterID{};
1112
uint32_t SpellID{};
1213
uint32_t EffectID{};
1314
float Magnitude{};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
3+
/**
4+
* @brief Dispatched when the local player enters or leaves beast form (vampire lord, werewolf).
5+
*/
6+
struct BeastFormChangeEvent
7+
{
8+
};

Code/client/Events/LeaveBeastFormEvent.h

Lines changed: 0 additions & 8 deletions
This file was deleted.

Code/client/Games/Animation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
TP_THIS_FUNCTION(TPerformAction, uint8_t, ActorMediator, TESActionData* apAction);
1818
static TPerformAction* RealPerformAction;
1919

20+
// TODO: make scoped override
2021
thread_local bool g_forceAnimation = false;
2122

2223
uint8_t TP_MAKE_THISCALL(HookPerformAction, ActorMediator, TESActionData* apAction)

Code/client/Games/Skyrim/Actor.cpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <Services/PapyrusService.h>
2222

2323
#include <Forms/ActorValueInfo.h>
24+
#include <Forms/TESRace.h>
2425

2526
#include <Effects/ValueModifierEffect.h>
2627

@@ -579,12 +580,58 @@ void Actor::Reset() noexcept
579580
s_pReset(this, 0, nullptr);
580581
}
581582

583+
bool Actor::PlayIdle(TESIdleForm* apIdle) noexcept
584+
{
585+
PAPYRUS_FUNCTION(bool, Actor, PlayIdle, TESIdleForm*);
586+
return s_pPlayIdle(this, apIdle);
587+
}
588+
582589
void Actor::Respawn() noexcept
583590
{
584591
Resurrect(false);
585592
Reset();
586593
}
587594

595+
bool Actor::IsVampireLord() const noexcept
596+
{
597+
return race && race->formID == 0x200283A;
598+
}
599+
600+
extern thread_local bool g_forceAnimation;
601+
602+
void Actor::FixVampireLordModel() noexcept
603+
{
604+
TESBoundObject* pObject = Cast<TESBoundObject>(TESForm::GetById(0x2011a84));
605+
if (!pObject)
606+
return;
607+
608+
{
609+
ScopedInventoryOverride _;
610+
AddObjectToContainer(pObject, nullptr, 1, nullptr);
611+
}
612+
613+
EquipManager::Get()->Equip(this, pObject, nullptr, 1, nullptr, false, true, false, false);
614+
615+
g_forceAnimation = true;
616+
617+
BSFixedString str("isLevitating");
618+
uint32_t isLevitating = GetAnimationVariableInt(&str);
619+
spdlog::critical("isLevitating {}", isLevitating);
620+
621+
// By default, a loaded vampire lord is not levitating.
622+
if (isLevitating)
623+
{
624+
BSFixedString levitation("LevitationToggle");
625+
SendAnimationEvent(&levitation);
626+
}
627+
628+
// TODO: weapon draw code does not seem to take care of this
629+
//BSFixedString weapEquip("WeapEquip");
630+
//SendAnimationEvent(&weapEquip);
631+
632+
g_forceAnimation = false;
633+
}
634+
588635
TP_THIS_FUNCTION(TForceState, void, Actor, const NiPoint3&, float, float, TESObjectCELL*, TESWorldSpace*, bool);
589636
static TForceState* RealForceState = nullptr;
590637

Code/client/Games/Skyrim/Actor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct ExPlayerCharacter;
2121
struct ActorExtension;
2222
struct AIProcess;
2323
struct CombatController;
24+
struct TESIdleForm;
2425

2526
struct Actor : TESObjectREFR
2627
{
@@ -208,6 +209,7 @@ struct Actor : TESObjectREFR
208209
[[nodiscard]] uint8_t GetPerkRank(uint32_t aPerkFormId) const noexcept;
209210
[[nodiscard]] bool IsWearingBodyPiece() const noexcept;
210211
[[nodiscard]] bool ShouldWearBodyPiece() const noexcept;
212+
[[nodiscard]] bool IsVampireLord() const noexcept;
211213

212214
// Setters
213215
void SetSpeed(float aSpeed) noexcept;
@@ -246,6 +248,8 @@ struct Actor : TESObjectREFR
246248
void SetCombatTargetEx(Actor* apTarget) noexcept;
247249
void StartCombat(Actor* apTarget) noexcept;
248250
void StopCombat() noexcept;
251+
bool PlayIdle(TESIdleForm* apIdle) noexcept;
252+
void FixVampireLordModel() noexcept;
249253

250254
enum ActorFlags
251255
{

Code/client/Games/Skyrim/Effects/ActiveEffect.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ struct ActiveEffect
4040

4141
static ActiveEffect* Instantiate(Actor* apCaster, MagicItem* apSpell, EffectItem* apEffect);
4242

43-
uint8_t pad8[0x38];
43+
uint8_t pad8[0x34 - 0x8];
44+
uint32_t hCaster;
45+
NiNode* pSourceNode;
4446
MagicItem* pSpell;
4547
void* pEffect;
4648
MagicTarget* pTarget;

Code/client/Games/Skyrim/Magic/MagicTarget.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ bool TP_MAKE_THISCALL(HookAddTarget, MagicTarget, MagicTarget::AddTargetData& ar
9191

9292
AddTargetEvent addTargetEvent{};
9393
addTargetEvent.TargetID = pTargetActor->formID;
94+
addTargetEvent.CasterID = arData.pCaster ? arData.pCaster->formID : 0;
9495
addTargetEvent.SpellID = arData.pSpell->formID;
9596
addTargetEvent.EffectID = arData.pEffectItem->pEffectSetting->formID;
9697
addTargetEvent.Magnitude = arData.fMagnitude;

Code/client/Games/Skyrim/PlayerCharacter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
#include <Games/ActorExtension.h>
33

44
#include <Structs/Skyrim/AnimationGraphDescriptor_Master_Behavior.h>
5+
#include <Structs/Skyrim/AnimationGraphDescriptor_VampireLordBehavior.h>
56

67
#include <Games/Overrides.h>
78

89
#include <Events/InventoryChangeEvent.h>
9-
#include <Events/LeaveBeastFormEvent.h>
10+
#include <Events/BeastFormChangeEvent.h>
1011
#include <Events/AddExperienceEvent.h>
1112
#include <Events/SetWaypointEvent.h>
1213
#include <Events/RemoveWaypointEvent.h>
@@ -162,7 +163,7 @@ void TP_MAKE_THISCALL(HookSetBeastForm, void, void* apUnk1, void* apUnk2, bool a
162163
if (!aEntering)
163164
{
164165
PlayerCharacter::Get()->GetExtension()->GraphDescriptorHash = AnimationGraphDescriptor_Master_Behavior::m_key;
165-
World::Get().GetRunner().Trigger(LeaveBeastFormEvent());
166+
World::Get().GetRunner().Trigger(BeastFormChangeEvent());
166167
}
167168

168169
TiltedPhoques::ThisCall(RealSetBeastForm, apThis, apUnk1, apUnk2, aEntering);

Code/client/Games/Skyrim/Projectiles/Projectile.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ struct Projectile : TESObjectREFR
4949
bool bForceConeOfFire; // unsure // usually false
5050
};
5151

52-
uint8_t unk98[0xF0];
52+
uint8_t unkA0[0x120 - sizeof(TESObjectREFR)];
53+
void* pActorCause;
54+
uint32_t hShooter;
55+
uint8_t unk[0x190 - 0x12C];
5356
float fPower;
5457
float fSpeedMult;
5558
float fRange;
@@ -60,3 +63,4 @@ struct Projectile : TESObjectREFR
6063
};
6164

6265
static_assert(sizeof(Projectile::LaunchData) == 0xA8);
66+
static_assert(offsetof(Projectile, fPower) == 0x190);

0 commit comments

Comments
 (0)