Skip to content

Commit

Permalink
Merge pull request #104 from Zebrina/dev
Browse files Browse the repository at this point in the history
AIProcess::forms = list of equipped forms + equipslot
  • Loading branch information
powerof3 authored Feb 23, 2024
2 parents 37c738c + c3c9df7 commit 51f4a71
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/RE/A/AIProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ namespace RE
};
using Hand = Hands::Hand;

struct EquippedObject
{
TESForm* object; // 00
BGSEquipSlot* slot; // 08
};
static_assert(sizeof(EquippedObject) == 0x10);

struct Data0B8
{
public:
Expand Down Expand Up @@ -202,7 +209,7 @@ namespace RE
float deathTime; // 094
float trackedDamage; // 098
std::uint32_t pad09C; // 09C
BSTArray<TESForm*> forms; // 0A0
BSTArray<EquippedObject> equippedForms; // 0A0
Data0B8 unk0B8; // 0B8
TESForm* equippedObjects[Hand::kTotal]; // 0F0
std::uint64_t unk100; // 100
Expand Down
1 change: 1 addition & 0 deletions include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ namespace RE
const TESShout* GetCurrentShout() const;
InventoryEntryData* GetEquippedEntryData(bool a_leftHand) const;
TESForm* GetEquippedObject(bool a_leftHand) const;
TESForm* GetEquippedObjectInSlot(const BGSEquipSlot* slot) const;
float GetEquippedWeight();
std::int32_t GetFactionRank(TESFaction* a_faction, bool a_isPlayer);
std::int32_t GetGoldAmount(bool a_noInit = false);
Expand Down
15 changes: 15 additions & 0 deletions src/RE/A/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,21 @@ namespace RE
}
}

TESForm* Actor::GetEquippedObjectInSlot(const BGSEquipSlot* slot) const
{
if (!currentProcess) {
return nullptr;
}

for (const auto& equippedObject : currentProcess->equippedForms) {
if (equippedObject.slot == slot) {
return equippedObject.object;
}
}

return nullptr;
}

float Actor::GetEquippedWeight()
{
if (equippedWeight < 0.0f) {
Expand Down

0 comments on commit 51f4a71

Please sign in to comment.