Skip to content

Commit

Permalink
feat: misc2 (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix authored Oct 4, 2024
1 parent c93de6b commit 12acf2a
Show file tree
Hide file tree
Showing 46 changed files with 805 additions and 729 deletions.
97 changes: 93 additions & 4 deletions include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
#include "RE/I/IStoreAnimationActions.h"
#include "RE/M/MagicTarget.h"
#include "RE/P/PerkRankData.h"
#include "RE/T/TESNPC.h"
#include "RE/T/TESObjectREFR.h"

namespace RE
{
class TESNPC;
class AIProcess;
class BGSKeyword;
class BGSPerk;
class CombatController;
class CombatGroup;
Expand Down Expand Up @@ -50,7 +51,6 @@ namespace RE

struct Perks
{
public:
// members
BSTArray<PerkRankData>* perkRanks; // 00
BSTArray<void*> unk10; // 08
Expand Down Expand Up @@ -277,8 +277,88 @@ namespace RE
virtual void Unk_1A0(); // 1A0
virtual void Unk_1A1(); // 1A1

void EvaluatePackage(bool a_immediate = false, bool a_resetAI = false);
[[nodiscard]] bool IsHostileToActor(Actor* a_actor);
void EvaluatePackage(bool a_immediate = false, bool a_resetAI = false)
{
using func_t = decltype(&Actor::EvaluatePackage);
static REL::Relocation<func_t> func{ ID::Actor::EvaluatePackage };
func(this, a_immediate, a_resetAI);
}

[[nodiscard]] TESNPC* GetNPC()
{
return GetBaseObject()->As<TESNPC>();
}

[[nodiscard]] const TESNPC* GetNPC() const
{
return GetBaseObject()->As<TESNPC>();
}

[[nodiscard]] bool IsHostileToActor(Actor* a_actor)
{
using func_t = decltype(&Actor::IsHostileToActor);
static REL::Relocation<func_t> func{ ID::Actor::IsHostileToActor };
return func(this, a_actor);
}

[[nodiscard]] bool IsInWater() const
{
return boolBits.all(RE::Actor::BOOL_BITS::kInWater);
}

[[nodiscard]] bool IsInCombatSearch() const
{
return boolBits.all(RE::Actor::BOOL_BITS::kSearchingInCombat);
}

[[nodiscard]] bool IsJumping()
{
using func_t = decltype(&Actor::IsJumping);
static REL::Relocation<func_t> func{ ID::Actor::IsJumping };
return func(this);
}

[[nodiscard]] bool IsOverEncumbered()
{
using func_t = decltype(&Actor::IsOverEncumbered);
static REL::Relocation<func_t> func{ ID::Actor::IsOverEncumbered };
return func(this);
}

[[nodiscard]] bool IsSneaking()
{
using func_t = decltype(&Actor::IsSneaking);
static REL::Relocation<func_t> func{ ID::Actor::IsSneaking };
return func(this);
}

void SetSkinTone(std::uint32_t a_index)
{
using func_t = decltype(&Actor::SetSkinTone);
static REL::Relocation<func_t> func{ ID::Actor::SetSkinTone };
func(this, a_index);
}

void UpdateAppearance(bool a_arg1, std::uint32_t a_flags, bool a_changeRace)
{
using func_t = decltype(&Actor::UpdateAppearance);
static REL::Relocation<func_t> func{ ID::Actor::UpdateAppearance };
func(this, a_arg1, a_flags, a_changeRace);
}

void UpdateChargenAppearance()
{
using func_t = decltype(&Actor::UpdateChargenAppearance);
static REL::Relocation<func_t> func{ ID::Actor::UpdateChargenAppearance };
func(this);
}

[[nodiscard]] bool WornHasKeyword(BGSKeyword* a_keyword)
{
using func_t = decltype(&Actor::WornHasKeyword);
static REL::Relocation<func_t> func{ ID::Actor::WornHasKeyword };
return func(this, a_keyword);
}

// members
REX::EnumSet<BOOL_BITS, std::uint32_t> boolBits; // 200
Expand Down Expand Up @@ -384,4 +464,13 @@ namespace RE
std::uint8_t unk518[88]; // 518
};
static_assert(sizeof(Actor) == 0x578);

class MenuActor :
public Actor
{
public:
SF_RTTI_VTABLE(MenuActor);

virtual ~MenuActor() override; // 00
};
}
21 changes: 18 additions & 3 deletions include/RE/A/ActorEquipManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,25 @@ namespace RE
public BSTEventSource<ActorEquipManagerEvent::SpellEvent> // 30
{
public:
[[nodiscard]] static ActorEquipManager* GetSingleton();
[[nodiscard]] static ActorEquipManager* GetSingleton()
{
static REL::Relocation<ActorEquipManager**> singleton{ ID::ActorEquipManager::Singleton };
return *singleton;
}

bool EquipObject(Actor* a_actor, const BGSObjectInstance& a_object, const BGSEquipSlot* a_slot, bool a_queueEquip, bool a_forceEquip, bool a_playSounds, bool a_applyNow, bool a_locked);
bool UnequipObject(Actor* a_actor, const BGSObjectInstance& a_object, const BGSEquipSlot* a_slot, bool a_queueUnequip, bool a_forceUnequip, bool a_playSounds, bool a_applyNow, const BGSEquipSlot* a_slotBeingReplaced);
bool EquipObject(Actor* a_actor, const BGSObjectInstance& a_object, const BGSEquipSlot* a_slot, bool a_queueEquip, bool a_forceEquip, bool a_playSounds, bool a_applyNow, bool a_locked)
{
using func_t = decltype(&ActorEquipManager::EquipObject);
static REL::Relocation<func_t> func{ ID::ActorEquipManager::EquipObject };
return func(this, a_actor, a_object, a_slot, a_queueEquip, a_forceEquip, a_playSounds, a_applyNow, a_locked);
}

bool UnequipObject(Actor* a_actor, const BGSObjectInstance& a_object, const BGSEquipSlot* a_slot, bool a_queueUnequip, bool a_forceUnequip, bool a_playSounds, bool a_applyNow, const BGSEquipSlot* a_slotBeingReplaced)
{
using func_t = decltype(&ActorEquipManager::UnequipObject);
static REL::Relocation<func_t> func{ ID::ActorEquipManager::UnequipObject };
return func(this, a_actor, a_object, a_slot, a_queueUnequip, a_forceUnequip, a_playSounds, a_applyNow, a_slotBeingReplaced);
}
};
static_assert(sizeof(ActorEquipManager) == 0x58);
}
17 changes: 17 additions & 0 deletions include/RE/A/ActorUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

namespace RE
{
class Actor;
class BGSKeyword;
}

namespace RE::ActorUtils
{
inline bool ChangeAnimArchetype(Actor* a_actor, BGSKeyword* a_keyword)
{
using func_t = decltype(&ActorUtils::ChangeAnimArchetype);
static REL::Relocation<func_t> func{ ID::ActorUtils::ChangeAnimArchetype };
return func(a_actor, a_keyword);
}
}
10 changes: 10 additions & 0 deletions include/RE/B/BSFixedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,13 @@ namespace RE
using BSFixedStringW = detail::BSFixedString<wchar_t, false>;
using BSFixedStringWCS = detail::BSFixedString<wchar_t, true>;
}

template <class CharT, bool CS>
struct std::formatter<RE::detail::BSFixedString<CharT, CS>, CharT> : formatter<std::string_view, CharT>
{
template <class FormatContext>
constexpr auto format(const RE::detail::BSFixedString<CharT, CS>& a_str, FormatContext& a_ctx) const
{
return formatter<std::string_view, CharT>::format(a_str.c_str(), a_ctx);
}
};
4 changes: 2 additions & 2 deletions include/RE/B/BSScriptUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace RE::BSScript
const auto& mappings = _proxy->type->varNameIndexMap;
const auto it = mappings.find(a_name);
if (it != mappings.end()) {
const auto& var = _proxy->variables[it->Value];
const auto& var = _proxy->variables[it->value];
return detail::UnpackVariable<T>(var);
}
}
Expand All @@ -107,7 +107,7 @@ namespace RE::BSScript
auto& mappings = _proxy->type->varNameIndexMap;
const auto it = mappings.find(a_name);
if (it != mappings.end()) {
auto& var = _proxy->variables[it->Value];
auto& var = _proxy->variables[it->value];
detail::PackVariable(var, std::forward<T>(a_val));
return true;
}
Expand Down
Loading

0 comments on commit 12acf2a

Please sign in to comment.