Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 committed Oct 12, 2024
1 parent 4a69e76 commit 7873751
Show file tree
Hide file tree
Showing 15 changed files with 198 additions and 40 deletions.
1 change: 1 addition & 0 deletions cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set(SOURCES
include/RE/A/AutoMoveHandler.h
include/RE/A/AutoRegisterCreator.h
include/RE/A/AutoRegisterFactory.h
include/RE/A/AutoVanityState.h
include/RE/A/ahkpCharacterProxy.h
include/RE/A/ahkpWorld.h
include/RE/B/BGSAbilityPerkEntry.h
Expand Down
8 changes: 6 additions & 2 deletions include/RE/A/AIProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ namespace RE
};
static_assert(sizeof(Data0B8) == 0x38);

void AddToProcedureIndexRunning(Actor* a_actor, std::uint32_t a_num);
void ClearActionHeadtrackTarget(bool a_defaultHold);
void ClearMuzzleFlashes();
void ComputeLastTimeProcessed();
float GetCachedHeight() const;
bhkCharacterController* GetCharController();
ActorHandle GetCommandingActor() const;
Expand All @@ -182,11 +184,13 @@ namespace RE
bool IsInCommandState() const;
void KnockExplosion(Actor* a_actor, const NiPoint3& a_location, float a_magnitude);
bool PlayIdle(Actor* a_actor, TESIdleForm* a_idle, TESObjectREFR* a_target);
void RandomlyPlaySpecialIdles(Actor* a_actor);
void SetActorsDetectionEvent(Actor* a_actor, const NiPoint3& a_location, std::int32_t a_soundLevel, TESObjectREFR* a_ref);
void SetArrested(bool a_arrested);
void SetCachedHeight(float a_height);
void SetHeadtrackTarget(Actor* a_owner, NiPoint3& a_targetPosition);
void Set3DUpdateFlag(RESET_3D_FLAGS a_flags);
void SetRunOncePackage(TESPackage* a_package, Actor* a_actor);
bool SetupSpecialIdle(Actor* a_actor, DEFAULT_OBJECT a_action, TESIdleForm* a_idle, bool a_arg5, bool a_arg6, TESObjectREFR* a_target);
void StopCurrentIdle(Actor* a_actor, bool a_forceIdleStop);
void Update3DModel(Actor* a_actor);
Expand All @@ -197,8 +201,8 @@ namespace RE
MiddleHighProcessData* middleHigh; // 008
HighProcessData* high; // 010
ActorPackage currentPackage; // 018
float unk048; // 048
std::uint32_t unk04C; // 04C
float hourLastProcessed; // 048
float dateLastProcessed; // 04C
CachedValues* cachedValues; // 050
std::int32_t numberItemsActivate; // 058
std::uint32_t pad05C; // 05C
Expand Down
2 changes: 1 addition & 1 deletion include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ namespace RE
virtual void InitiateSpectator(Actor* a_target); // 0DC - { return; }
virtual void InitiateFlee(TESObjectREFR* a_fleeRef, bool a_runOnce, bool a_knows, bool a_combatMode, TESObjectCELL* a_cell, TESObjectREFR* a_ref, float a_fleeFromDist, float a_fleeToDist); // 0DD
virtual void InitiateGetUpPackage(); // 0DE
virtual void PutCreatedPackage(TESPackage* a_package, bool a_tempPackage, bool a_createdPackage, bool a_allowFromFurniture); // 0DF
virtual void PutCreatedPackage(TESPackage* a_package, bool a_tempPackage, bool a_createdPackage); // 0DF
virtual void UpdateAlpha(); // 0E0
virtual void SetAlpha(float a_alpha = 1.0); // 0E1
virtual float GetAlpha(); // 0E2
Expand Down
16 changes: 14 additions & 2 deletions include/RE/A/ActorState.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ namespace RE
void Unk_08(void) override; // 08 - { return 0; }

// add
virtual void Unk_14(void); // 14
virtual void Unk_15(void); // 15
virtual bool DoSetSitSleepState(SIT_SLEEP_STATE a_state); // 14
virtual void Unk_15(void); // 15

[[nodiscard]] ATTACK_STATE_ENUM GetAttackState() const noexcept { return actorState1.meleeAttackState; }
[[nodiscard]] FLY_STATE GetFlyState() const noexcept { return actorState1.flyState; }
Expand Down Expand Up @@ -183,6 +183,18 @@ namespace RE
}

[[nodiscard]] bool IsReanimated() const noexcept { return GetLifeState() == ACTOR_LIFE_STATE::kReanimate; }

[[nodiscard]] bool IsSitting() const noexcept
{
switch (GetSitSleepState()) {
case SIT_SLEEP_STATE::kIsSitting:
case SIT_SLEEP_STATE::kWantToStand:
return true;
default:
return false;
}
}

[[nodiscard]] bool IsSneaking() const noexcept { return static_cast<bool>(actorState1.sneaking); }
[[nodiscard]] bool IsSprinting() const noexcept { return static_cast<bool>(actorState1.sprinting); }
[[nodiscard]] bool IsSwimming() const noexcept { return static_cast<bool>(actorState1.swimming); }
Expand Down
27 changes: 27 additions & 0 deletions include/RE/A/AutoVanityState.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include "RE/T/TESCameraState.h"

namespace RE
{
class AutoVanityState : public TESCameraState
{
public:
inline static constexpr auto RTTI = RTTI_AutoVanityState;
inline static constexpr auto VTABLE = VTABLE_AutoVanityState;

~AutoVanityState() override; // 00

// override (TESCameraState)
void Begin() override; // 01
void End() override; // 02
void Update(BSTSmartPointer<TESCameraState>& a_nextState) override; // 03
void GetRotation(NiQuaternion& a_rotation) override; // 04
void GetTranslation(NiPoint3& a_translation) override; // 05

// members
float autoVanityRot; // 20
std::uint32_t pad24; // 24
};
static_assert(sizeof(AutoVanityState) == 0x28);
}
2 changes: 1 addition & 1 deletion include/RE/H/HighProcessData.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ namespace RE
float takeBackTimer; // 200
std::uint32_t pad204; // 204
Data208* unk208; // 208
std::uint32_t unk210; // 210
float avoidWaitTimer; // 210
PLAYER_ACTION playerActionReaction; // 214
BSFixedString voiceSubtitle; // 218
BSTArray<BSTTuple<FormID, NiPointer<ActorKnowledge>>> knowledgeArray; // 220
Expand Down
24 changes: 12 additions & 12 deletions include/RE/M/MovementControllerNPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ namespace RE
~MovementControllerNPC() override; // 00

// add
virtual void Unk_0A(void); // 0A
virtual void Unk_0B(void); // 0B
virtual void DisablePlayerControls(); // 0C
virtual void EnablePlayerControls(); // 0D
virtual bool IsPlayerControlsDisabled(); // 0E - { return unk1C5 == 0; }
virtual bool IsPlayerControlsEnabled(); // 0F - { return unk1C5; }
virtual void Unk_10(void); // 10
virtual void Unk_11(void); // 11
virtual void Unk_12(void); // 12
virtual void Unk_13(void); // 13
virtual void Unk_14(void); // 14
virtual void Unk_0A(void); // 0A
virtual void Unk_0B(void); // 0B
virtual void SetAIDriven(); // 0C
virtual void SetControlsDriven(); // 0D
virtual bool GetAIDriven(); // 0E - { return controlsDriven == 0; }
virtual bool GetControlsDriven(); // 0F - { return controlsDriven; }
virtual void Unk_10(void); // 10
virtual void Unk_11(void); // 11
virtual void Unk_12(void); // 12
virtual void Unk_13(void); // 13
virtual void Unk_14(void); // 14

// members
std::uint64_t unk150; // 150
Expand All @@ -55,7 +55,7 @@ namespace RE
std::uint64_t unk1B8; // 1B8
std::uint32_t unk1C0; // 1C0
std::uint8_t unk1C4; // 1C4
bool playerControls; // 1C5
bool controlsDriven; // 1C5
std::uint16_t unk1C6; // 1C6
std::uint64_t unk1C8; // 1C8
};
Expand Down
1 change: 1 addition & 0 deletions include/RE/P/PlayerCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace RE
bool IsInFirstPerson() const;
bool IsInFreeCameraMode() const;
bool IsInThirdPerson() const;
void PushCameraState(CameraState a_state);
void ToggleFreeCameraMode(bool a_freezeTime);
void UpdateThirdPerson(bool a_weaponDrawn);

Expand Down
1 change: 1 addition & 0 deletions include/RE/P/ProcessLists.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace RE

static ProcessLists* GetSingleton();

bool AreHostileActorsNear(BSScrapArray<ActorHandle>* a_arrayOut);
void ClearCachedFactionFightReactions() const;
void ForAllActors(std::function<BSContainer::ForEachResult(Actor*)> a_callback);
void ForEachHighActor(std::function<BSContainer::ForEachResult(Actor*)> a_callback);
Expand Down
1 change: 1 addition & 0 deletions include/RE/Skyrim.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "RE/A/AutoMoveHandler.h"
#include "RE/A/AutoRegisterCreator.h"
#include "RE/A/AutoRegisterFactory.h"
#include "RE/A/AutoVanityState.h"
#include "RE/A/ahkpCharacterProxy.h"
#include "RE/A/ahkpWorld.h"
#include "RE/B/BGSAbilityPerkEntry.h"
Expand Down
105 changes: 87 additions & 18 deletions include/RE/T/TESPackage.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace RE
kFOOD = 15
};

enum class PACKAGE_PROCEDURE_TYPE
enum class PACKAGE_TYPE
{
kNone = static_cast<std::underlying_type_t<PACKAGE_PROCEDURE_TYPE>>(-1),
kFind = 0,
kNone = static_cast<std::underlying_type_t<PACKAGE_TYPE>>(-1),
kExplore = 0,
kFollow = 1,
kEscort = 2,
kEat = 3,
Expand All @@ -51,7 +51,7 @@ namespace RE
kGuard = 14,
kDialogue = 15,
kUseWeapon = 16,
kFind2 = 17,
kFind = 17,
kPackage = 18,
kPackageTemplate = 19,
kActivate = 20,
Expand All @@ -73,13 +73,67 @@ namespace RE
kMovementBlocked = 36,
kVampireFeed = 37,
kCannibal = 38,
kUnk39 = 39,
kUnk40 = 40,
kUnk41 = 41,
kUnk42 = 42,
kUnk43 = 43,
kUnk44 = 44,
kUnk45 = 45,
kLanding = 39,
kUnused = 40,
kMountActor = 41,
kDismountActor = 42,
kClearMountPosition = 43,

kTotal = 44
};

enum class PACKAGE_PROCEDURE_TYPE
{
kNone = static_cast<std::underlying_type_t<PACKAGE_PROCEDURE_TYPE>>(-1),
kExploreTravel = 0,
kExploreWander = 1,
ExploreActivate = 2,
kExploreAcquire = 3,
kSleep = 4,
kEat = 5,
kFollowWithEscort = 6,
kAmbushFollow = 7,
kEscortActor = 8,
kEscortObject = 9,
kDialogue = 10,
kAlarm = 11,
kActivate = 12,
kGreet = 13,
kObserveCombat = 14,
kObserveDialogue = 15,
kTalkToDead = 16,
kFlee = 17,
kTrespass = 18,
kGetUpFromChairBed = 19,
kExploreNPC = 20,
kMountActor = 21,
kDismountActor = 22,
kDoNothing = 23,
kExploreAcquireGeneric = 24,
kAccompany = 25,
kUseItemAt = 26,
kVampireFeed = 27,
kAmbush = 28,
kSurface = 29,
kFleeNotCombat = 30,
kSearchForAttacker = 31,
kClearMountPosition = 32,
kWaitForDialogue = 33,
kAvoidPlayer = 34,
kSandbox = 35,
kPatrol = 36,
kReactToDestroyedObject = 37,
kReactToGrenadeOrMine = 38,
kGuard = 39,
kStealWarning = 40,
kPickPocketWarning = 41,
kUseWeapon = 42,
kFollowWithoutEscort = 43,
kMovementBlocked = 44,
kCannibal = 45,
kPackage = 46,
kLanding = 47,
kKeepAnEyeOn = 48
};

enum class PACK_EVENT_ACTION_TYPE
Expand Down Expand Up @@ -112,6 +166,7 @@ namespace RE
kUnlocksDoorsAtPackageEnd = 1 << 7,
kContinueIfPCNear = 1 << 9,
kOncePerDay = 1 << 10,
kCreated = 1 << 11,
kPreferredSpeed = 1 << 13,
kAlwaysSneak = 1 << 17,
kAllowSwimming = 1 << 18,
Expand Down Expand Up @@ -145,13 +200,13 @@ namespace RE
};

// members
stl::enumeration<GeneralFlag, std::uint32_t> packFlags; // 0
stl::enumeration<PACKAGE_PROCEDURE_TYPE, std::uint8_t> packType; // 4
stl::enumeration<PACK_INTERRUPT_TARGET, std::uint8_t> interruptOverrideType; // 5
stl::enumeration<PreferredSpeed, std::uint8_t> maxSpeed; // 6
std::uint8_t pad7; // 7
stl::enumeration<InterruptFlag, std::uint16_t> foBehaviorFlags; // 8
std::uint16_t packageSpecificFlags; // A
stl::enumeration<GeneralFlag, std::uint32_t> packFlags; // 0
stl::enumeration<PACKAGE_TYPE, std::uint8_t> packType; // 4
stl::enumeration<PACK_INTERRUPT_TARGET, std::uint8_t> interruptOverrideType; // 5
stl::enumeration<PreferredSpeed, std::uint8_t> maxSpeed; // 6
std::uint8_t pad7; // 7
stl::enumeration<InterruptFlag, std::uint16_t> foBehaviorFlags; // 8
std::uint16_t packageSpecificFlags; // A
};
static_assert(sizeof(PACKAGE_DATA) == 0xC);

Expand Down Expand Up @@ -296,6 +351,20 @@ namespace RE
virtual bool IsTargetAtLocation(Actor* a_actor, std::int32_t a_arg2); // 3E
virtual bool IsPackageOwner(Actor* a_actor); // 3F - { return true; }

static TESPackage* CreatePackage(PACKAGE_PROCEDURE_TYPE a_type)
{
using func_t = decltype(&TESPackage::CreatePackage);
static REL::Relocation<func_t> func{ RELOCATION_ID(28732, 29496) };
return func(a_type);
}

void SetPackType(PACKAGE_PROCEDURE_TYPE a_type)
{
using func_t = decltype(&TESPackage::SetPackType);
static REL::Relocation<func_t> func{ RELOCATION_ID(28751, 29525) };
return func(this, a_type);
}

// members
PACKAGE_DATA packData; // 20 - PKDT
std::uint32_t pad2C; // 2C
Expand Down
28 changes: 28 additions & 0 deletions src/RE/A/AIProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

namespace RE
{
void AIProcess::AddToProcedureIndexRunning(Actor* a_actor, std::uint32_t a_num)
{
using func_t = decltype(&AIProcess::AddToProcedureIndexRunning);
static REL::Relocation<func_t> func{ RELOCATION_ID(38198, 39158) };
return func(this, a_actor, a_num);
}

void AIProcess::ClearActionHeadtrackTarget(bool a_defaultHold)
{
if (high) {
Expand All @@ -24,6 +31,13 @@ namespace RE
return func(this);
}

void AIProcess::ComputeLastTimeProcessed()
{
using func_t = decltype(&AIProcess::ComputeLastTimeProcessed);
static REL::Relocation<func_t> func{ RELOCATION_ID(38158, 39116) };
return func(this);
}

float AIProcess::GetCachedHeight() const
{
return high ? high->cachedActorHeight : static_cast<float>(-1.0);
Expand Down Expand Up @@ -211,6 +225,13 @@ namespace RE
return SetupSpecialIdle(a_actor, DEFAULT_OBJECT::kActionIdle, a_idle, true, false, a_target);
}

void AIProcess::RandomlyPlaySpecialIdles(Actor* a_actor)
{
using func_t = decltype(&AIProcess::RandomlyPlaySpecialIdles);
static REL::Relocation<func_t> func{ RELOCATION_ID(38308, 39281) };
return func(this, a_actor);
}

void AIProcess::SetActorsDetectionEvent(Actor* a_actor, const NiPoint3& a_location, std::int32_t a_soundLevel, TESObjectREFR* a_ref)
{
using func_t = decltype(&AIProcess::SetActorsDetectionEvent);
Expand Down Expand Up @@ -246,6 +267,13 @@ namespace RE
}
}

void AIProcess::SetRunOncePackage(TESPackage* a_package, Actor* a_actor)
{
using func_t = decltype(&AIProcess::SetRunOncePackage);
static REL::Relocation<func_t> func{ RELOCATION_ID(38819, 39849) };
return func(this, a_package, a_actor);
}

bool AIProcess::SetupSpecialIdle(Actor* a_actor, DEFAULT_OBJECT a_action, TESIdleForm* a_idle, bool a_arg5, bool a_arg6, TESObjectREFR* a_target)
{
using func_t = decltype(&AIProcess::SetupSpecialIdle);
Expand Down
Loading

0 comments on commit 7873751

Please sign in to comment.