Skip to content

Commit b4e9a6a

Browse files
committed
refactor: re-add Havok
1 parent c525e6c commit b4e9a6a

68 files changed

Lines changed: 2395 additions & 8 deletions

Some content is hidden

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

include/RE/B/BeamProjectile.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace RE
88
{
99
class BeamProjectileImpactEvent;
10+
class bhkCollisionQueryResultHandle;
1011
class BSProceduralGeomEvent;
1112

1213
class __declspec(novtable) BeamProjectile :
@@ -20,12 +21,12 @@ namespace RE
2021
static constexpr auto FORM_ID{ ENUM_FORM_ID::kPBEA };
2122

2223
// members
23-
ProjectileLaunchData launchData; // 2D0
24-
void* castResult; // 370 - bhkCollisionQueryResultHandle
25-
float baseModelLength; // 378
26-
bool transformSet; // 37C
27-
bool queueUncull; // 37D
28-
bool dealtDamage; // 37E
24+
ProjectileLaunchData launchData; // 2D0
25+
bhkCollisionQueryResultHandle* castResult; // 370
26+
float baseModelLength; // 378
27+
bool transformSet; // 37C
28+
bool queueUncull; // 37D
29+
bool dealtDamage; // 37E
2930
};
3031
static_assert(sizeof(BeamProjectile) == 0x380);
3132
}

include/RE/B/bhkCharProxyManager.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
#include "RE/B/bhkIWorldStepListener.h"
4+
#include "RE/B/BSTArray.h"
5+
#include "RE/B/BSTHashMap.h"
6+
7+
namespace RE
8+
{
9+
class bhkCharProxyController;
10+
11+
class __declspec(novtable) bhkCharProxyManager :
12+
public bhkIWorldStepListener
13+
{
14+
public:
15+
inline static constexpr auto RTTI{ RTTI::bhkCharProxyManager };
16+
inline static constexpr auto VTABLE{ VTABLE::bhkCharProxyManager };
17+
18+
class ThreadLocalCharRBDeferredCmds;
19+
20+
virtual ~bhkCharProxyManager();
21+
22+
// members
23+
BSTArray<bhkCharProxyController*> proxyControllersA;
24+
BSTHashMap<bhkCharProxyController*, std::uint32_t> proxyControllerIndex;
25+
BSTArray<ThreadLocalCharRBDeferredCmds> deferredCommandsA;
26+
};
27+
static_assert(sizeof(bhkCharProxyManager) == 0x70);
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#pragma once
2+
3+
#include "RE/B/bhkIWorldStepListener.h"
4+
#include "RE/B/BSTArray.h"
5+
#include "RE/B/BSTHashMap.h"
6+
7+
namespace RE
8+
{
9+
class bhkCharRigidBodyController;
10+
11+
class __declspec(novtable) bhkCharRigidBodyManager :
12+
public bhkIWorldStepListener
13+
{
14+
public:
15+
inline static constexpr auto RTTI{ RTTI::bhkCharRigidBodyManager };
16+
inline static constexpr auto VTABLE{ VTABLE::bhkCharRigidBodyManager };
17+
18+
class ThreadLocalCharRBDeferredCmds;
19+
20+
virtual ~bhkCharRigidBodyManager();
21+
22+
// members
23+
BSTArray<bhkCharRigidBodyController*> rigidBodyControllersA;
24+
BSTHashMap<bhkCharRigidBodyController*, std::uint32_t> rigidBodyControllerIndex;
25+
BSTArray<ThreadLocalCharRBDeferredCmds> deferredCommandsA;
26+
};
27+
static_assert(sizeof(bhkCharRigidBodyManager) == 0x70);
28+
}
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#pragma once
2+
3+
#include "RE/B/bhkNPCollisionObjectUnlinked.h"
4+
#include "RE/B/BSTEvent.h"
5+
#include "RE/H/hkVector4f.h"
6+
#include "RE/H/hkStepInfo.h"
7+
#include "RE/B/BSBound.h"
8+
#include "RE/N/NiPoint.h"
9+
#include "RE/H/hknpCharacterSurfaceInfo.h"
10+
#include "RE/H/hknpCharacterContext.h"
11+
#include "RE/H/hknpCharacterState.h"
12+
#include "RE/H/hkRefPtr.h"
13+
#include "RE/N/NiPointer.h"
14+
#include "RE/B/BSTHashMap.h"
15+
16+
namespace RE
17+
{
18+
enum class COL_LAYER;
19+
enum class SHAPE_TYPES;
20+
class bhkCharacterControllerCinfo;
21+
class bhkCharacterMoveFinishEvent;
22+
class bhkCharacterStateChangeEvent;
23+
class bhkICharOrientationController;
24+
class bhkNonSupportContactEvent;
25+
class bhkWorld;
26+
class DamageImpactData;
27+
class MoveData;
28+
29+
class __declspec(novtable) bhkCharacterController :
30+
public bhkNPCollisionObjectUnlinked, // 000
31+
public BSTEventSource<bhkCharacterMoveFinishEvent>, // 030
32+
public BSTEventSource<bhkNonSupportContactEvent>, // 088
33+
public BSTEventSource<bhkCharacterStateChangeEvent> // 0E0
34+
{
35+
public:
36+
inline static constexpr auto RTTI{ RTTI::bhkCharacterController };
37+
inline static constexpr auto VTABLE{ VTABLE::bhkCharacterController };
38+
39+
enum class CHARACTER_SIZE
40+
{
41+
kNormal = 0x0,
42+
kSized = 0x1,
43+
kSizing = 0x2
44+
};
45+
46+
// add
47+
virtual float GetKeepDistanceImpl() const = 0; // 31
48+
virtual void InitPhysicsSystemImpl(const bhkCharacterControllerCinfo& a_info) = 0; // 32
49+
virtual void GetPositionImpl(hkVector4f& a_pos, bool a_applyCenterOffset) const = 0; // 33
50+
virtual void SetPositionImpl(const hkVector4f& a_pos, bool a_applyCenterOffset, bool a_forceWarp) = 0; // 34
51+
virtual void GetPredictedPositionImpl(hkVector4f& a_pos, bool a_applyCenterOffset) const = 0; // 35
52+
virtual void ClearPreviousStepCachedDataImpl() = 0; // 36
53+
virtual void GetTransformImpl(hkTransformf& a_transform) const = 0; // 37
54+
virtual void SetTransformImpl(const hkTransformf& a_transform) = 0; // 38
55+
virtual void GetLinearVelocityImpl(hkVector4f& a_linVel) const = 0; // 39
56+
virtual void SetLinearVelocityImpl(const hkVector4f& a_linVel) = 0; // 3A
57+
virtual bool CheckPenetrationImpl() = 0; // 3B
58+
virtual bool IntegrateStepImpl(BSTArray<NiPointer<bhkNPCollisionObject>>* a_deferredReleaseColObjs) = 0; // 3C
59+
virtual void FinishMoveImpl(const MoveData& a_moveData) = 0; // 3D
60+
virtual void CheckSupportImpl() = 0; // 3E
61+
virtual void SetWorldImpl(bhkWorld* a_newWorld) = 0; // 3F
62+
virtual bhkWorld* GetWorldImpl() const = 0; // 40
63+
virtual hknpBodyId GetBodyIdImpl() const = 0; // 41
64+
virtual const hknpBody* GetBodyImpl() const = 0; // 42
65+
virtual bool SetShapeImpl(hknpShape* a_shape, const hkVector4f&) = 0; // 43
66+
virtual float GetVDBAlpha() const = 0; // 44
67+
virtual bool GetCurrentCollisionsImpl(BSScrapArray<const hknpBody*>& a_cols) = 0; // 45
68+
virtual bool HasPhysicsStepSubscriptionsImpl() const = 0; // 46
69+
virtual bool AddPhysicsStepSubscriptionsImpl() = 0; // 47
70+
virtual bool RemovePhysicsStepSubscriptionsImpl() = 0; // 48
71+
virtual void RotateImpl(const hkTransformf& a_transf, bool a_forceWarp) = 0; // 49
72+
virtual void SendEventOnNonSupportContactsImpl(BSTEventSink<bhkNonSupportContactEvent>& a_sink, bool a_receiveEvent) = 0; // 4A
73+
virtual void ApplyMoveImmediately() = 0; // 4B
74+
virtual void ClearCollectorDataImpl() = 0; // 4C
75+
76+
// members
77+
hkVector4f forwardVec; // 140
78+
hkStepInfo stepInfo; // 150
79+
hkVector4f outVelocity; // 160
80+
hkVector4f initialVelocity; // 170
81+
hkVector4f velocityMod; // 180
82+
hkVector4f direction; // 190
83+
hkVector4f rotCenter; // 1A0
84+
hkVector4f pushDelta; // 1B0
85+
hkVector4f fakeSupportStart; // 1C0
86+
hkVector4f up; // 1D0
87+
hkVector4f supportNorm; // 1E0
88+
BSBound collisionBound; // 1F0
89+
BSBound bumperCollisionBound; // 220
90+
NiPoint3 cachedLinearVelocity; // 250
91+
NiPoint3 remainderDeltaWS; // 24C
92+
bhkICharOrientationController* orientationCtrl; // 268
93+
hknpCharacterSurfaceInfo surfaceInfo; // 270
94+
hknpCharacterContext context; // 2A0
95+
std::uint32_t flags; // 300
96+
REX::EnumSet<hknpCharacterState::hknpCharacterStateType, std::int32_t> wantState; // 304
97+
float velocityTime; // 308
98+
float rotMod; // 30C
99+
float rotModTime; // 310
100+
float calculatePitchTimer; // 314
101+
float acrobatics; // 318
102+
float center; // 31C
103+
float waterHeight; // 320
104+
float jumpHeight; // 324
105+
float fallStartHeight; // 328
106+
float fallTime; // 32C
107+
float gravity; // 330
108+
float pitchAngle; // 334
109+
float rollAngle; // 338
110+
float pitchMult; // 33C
111+
float scale; // 340
112+
float swimFloatHeight; // 344
113+
float actorHeight; // 348
114+
float speedPct; // 34C
115+
std::uint32_t pushCount; // 350
116+
REX::EnumSet<SHAPE_TYPES, std::int32_t> shapeType; // 354
117+
REX::EnumSet<SHAPE_TYPES, std::int32_t> sizedShapeType; // 358
118+
hkRefPtr<hknpShape> shapes[2]; // 360
119+
float radius; // 370
120+
float height; // 374
121+
float destRadius; // 378
122+
float lodDistance; // 37C
123+
REX::EnumSet<CHARACTER_SIZE, std::int32_t> size; // 380
124+
std::uint32_t priority; // 384
125+
std::int32_t supportCount; // 388
126+
NiPointer<bhkNPCollisionObject> supportBody; // 390
127+
float bumpedForce; // 398
128+
NiPointer<bhkNPCollisionObject> bumpedBody; // 3A0
129+
NiPointer<bhkNPCollisionObject> bumpedCharCollisionObject; // 3A8
130+
BSTHashMap<std::uint32_t, float> bumpedBodyIdExpirationM; // 3B0
131+
void* userData; // 3E0
132+
BSTHashMap<bhkNPCollisionObject*, DamageImpactData*> damageImpacts; // 3E8
133+
float maxSlope; // 418
134+
std::uint32_t supportMaterial; // 41C
135+
REX::EnumSet<COL_LAYER, std::int32_t> supportLayer; // 420
136+
float stepHeight; // 424
137+
float stepHeightMod; // 428
138+
float stepHeightModTimer; // 42C
139+
const float castDepthC; // 430
140+
std::uint32_t numCollisions; // 434
141+
std::uint32_t stickyCollisionGroup; // 438
142+
bool allSurfacesStopped; // 43C
143+
bool stickyCollisions; // 43D
144+
bool fakeSupport; // 43E
145+
bool calculatePitch; // 43F
146+
bool useBumper; // 440
147+
bool hasBumper; // 441
148+
bool inAirPreMove; // 442
149+
};
150+
static_assert(sizeof(bhkCharacterController) == 0x450);
151+
}

include/RE/B/bhkCollisionQueryResultHandle.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace RE
66
{
77
public:
88
// members
9-
std::uint64_t data; // 0
9+
std::uint64_t data; // 00
1010
};
11-
static_assert(sizeof(bhkCollisionQueryResultHandle) == 0x8);
11+
static_assert(sizeof(bhkCollisionQueryResultHandle) == 0x08);
1212
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
#include "RE/B/BSTArray.h"
4+
#include "RE/N/NiPointer.h"
5+
6+
namespace RE
7+
{
8+
class bhkNPCollisionObject;
9+
10+
class __declspec(novtable) bhkIWorldStepListener
11+
{
12+
public:
13+
inline static constexpr auto RTTI{ RTTI::bhkIWorldStepListener };
14+
inline static constexpr auto VTABLE{ VTABLE::bhkIWorldStepListener };
15+
16+
virtual ~bhkIWorldStepListener();
17+
18+
// members
19+
BSTArray<BSTArray<NiPointer<bhkNPCollisionObject>>>* deferredReleaseColObjs;
20+
};
21+
static_assert(sizeof(bhkIWorldStepListener) == 0x10);
22+
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#pragma once
2+
3+
#include "RE/B/bhkNPCollisionObjectBase.h"
4+
#include "RE/H/hknpMotionPropertiesId.h"
5+
#include "RE/N/NiPointer.h"
6+
7+
namespace RE
8+
{
9+
class bhkPhysicsSystem;
10+
class bhkWorld;
11+
class CFilter;
12+
class hknpBody;
13+
class hknpBodyId;
14+
class hknpShape;
15+
class hkTransformf;
16+
17+
class __declspec(novtable) bhkNPCollisionObject :
18+
public bhkNPCollisionObjectBase // 00
19+
{
20+
public:
21+
inline static constexpr auto RTTI{ RTTI::bhkNPCollisionObject };
22+
inline static constexpr auto VTABLE{ VTABLE::bhkNPCollisionObject };
23+
inline static constexpr auto Ni_RTTI{ Ni_RTTI::bhkNPCollisionObject };
24+
25+
// add
26+
virtual void CreateInstance(bhkWorld& a_world); // 2D
27+
virtual void AddToWorld(bhkWorld& a_world); // 2E
28+
virtual void RemoveFromWorld(); // 2F
29+
virtual bool SetCollisionFilterInfo(CFilter a_filterInfo); // 30
30+
31+
void CopyMembers(bhkNPCollisionObject* a_dest, NiCloningProcess& a_cloningProcess)
32+
{
33+
using func_t = decltype(&bhkNPCollisionObject::CopyMembers);
34+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::CopyMembers };
35+
func(this, a_dest, a_cloningProcess);
36+
}
37+
38+
const hknpBody* GetBody()
39+
{
40+
using func_t = decltype(&bhkNPCollisionObject::GetBody);
41+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::GetBody };
42+
return func(this);
43+
}
44+
45+
hknpBodyId& GetBodyId(hknpBodyId& a_id)
46+
{
47+
using func_t = decltype(&bhkNPCollisionObject::GetBodyId);
48+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::GetBodyId };
49+
return func(this, a_id);
50+
}
51+
52+
bhkPhysicsSystem* GetPhysicsSystem()
53+
{
54+
return system.get();
55+
}
56+
57+
/*hknpShape* GetShape()
58+
{
59+
using func_t = decltype(&bhkNPCollisionObject::GetShape);
60+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::GetShape };
61+
return func(this);
62+
}
63+
64+
bool GetTransform(hkTransformf& a_transform)
65+
{
66+
using func_t = decltype(&bhkNPCollisionObject::GetTransform);
67+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::GetTransform };
68+
return func(this, a_transform);
69+
}*/
70+
71+
void SetMotionType(hknpMotionPropertiesId::Preset a_type)
72+
{
73+
using func_t = decltype(&bhkNPCollisionObject::SetMotionType);
74+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::SetMotionType };
75+
func(this, a_type);
76+
}
77+
78+
/* bool SetTransform(hkTransformf& a_transform)
79+
{
80+
using func_t = decltype(&bhkNPCollisionObject::SetTransform);
81+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::SetTransform };
82+
return func(this, a_transform);
83+
}*/
84+
85+
static bhkNPCollisionObject* Getbhk(bhkWorld* a_world, hknpBodyId& a_bodyId)
86+
{
87+
using func_t = decltype(&bhkNPCollisionObject::Getbhk);
88+
static REL::Relocation<func_t> func{ ID::bhkNPCollisionObject::Getbhk };
89+
return func(a_world, a_bodyId);
90+
}
91+
92+
// members
93+
NiPointer<bhkPhysicsSystem> system; // 20
94+
std::uint32_t systemBodyIdx; // 28
95+
};
96+
static_assert(sizeof(bhkNPCollisionObject) == 0x30);
97+
}

0 commit comments

Comments
 (0)