Skip to content

Commit

Permalink
feat: Events
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed Oct 5, 2024
1 parent a7cc0af commit 0af341a
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 14 deletions.
7 changes: 7 additions & 0 deletions include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ namespace RE
struct PerkEntryUpdatedEvent;
}

enum class ACTOR_COMBAT_STATE : std::int32_t
{
kNone = 0,
kCombat = 1,
kSearching = 2,
};

enum class ACTOR_CRITICAL_STAGE
{
kNone = 0,
Expand Down
176 changes: 162 additions & 14 deletions include/RE/E/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
namespace RE
{
class Actor;
class TESBoundObject;
class TESObjectBOOK;
class TESObjectCELL;
class TESObjectREFR;

enum class ACTOR_COMBAT_STATE : std::int32_t;

struct TESLoadGameEvent
{
[[nodiscard]] static BSTEventSource<TESLoadGameEvent>* GetEventSource()
Expand Down Expand Up @@ -100,11 +104,11 @@ namespace RE
}

// members
NiPointer<TESObjectREFR> actor;
TESFormID baseObject;
TESFormID origRef;
std::uint16_t uniqueID;
bool equipped;
NiPointer<Actor> actor; // 00
TESFormID baseObject; // 08
TESFormID origRef; // 0C
std::uint16_t uniqueID; // 10
bool equipped; // 12
};
static_assert(sizeof(TESEquipEvent) == 0x18);

Expand Down Expand Up @@ -180,10 +184,11 @@ namespace RE
}

// members
NiPointer<TESObjectREFR> source;
NiPointer<TESObjectREFR> target;
std::uint32_t state;
NiPointer<Actor> source; // 00
NiPointer<Actor> target; // 08 - nullptr when combat state is none
ACTOR_COMBAT_STATE state; // 10
};
static_assert(sizeof(TESCombatEvent) == 0x18);

struct UpdateActivateListenerEvent
{
Expand All @@ -209,13 +214,27 @@ namespace RE
{
struct Event
{
enum class Type : std::int32_t
{
kFirst,
kThird,
};

[[nodiscard]] static BSTEventSource<FirstThirdPersonSwitch::Event>* GetEventSource()
{
using func_t = decltype(&FirstThirdPersonSwitch::Event::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(34458) };
return func();
}

[[nodiscard]] constexpr bool IsFirst() const noexcept { return type == Type::kFirst; }
[[nodiscard]] constexpr bool IsThird() const noexcept { return type == Type::kThird; }

// members
Type oldType;
Type type;
};
static_assert(sizeof(FirstThirdPersonSwitch::Event) == 0x8);
};

struct HideSubtitleEvent
Expand Down Expand Up @@ -280,7 +299,13 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(86518) };
return func();
}

// members
TESBoundObject* item;
NiPointer<TESObjectREFR> itemRef;
NiPointer<Actor> actor;
};
static_assert(sizeof(TESHarvestEvent::ItemHarvested) == 0x18);
};

struct HUDNotification_MissionActiveWidgetUpdate
Expand Down Expand Up @@ -325,13 +350,26 @@ namespace RE

struct CellAttachDetachEvent
{
enum class Type : std::int32_t
{
kPreAttach,
kPostAttach,
kPreDetach,
kPostDetach
};

[[nodiscard]] static BSTEventSource<CellAttachDetachEvent>* GetEventSource()
{
using func_t = decltype(&CellAttachDetachEvent::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(84784) };
return func();
}

// members
TESObjectCELL* cell; // 00
Type type; // 08
};
static_assert(sizeof(CellAttachDetachEvent) == 0x10);

namespace BGSPlanet
{
Expand Down Expand Up @@ -2070,6 +2108,26 @@ namespace RE
}
};

struct CharGen_RollOffLocomotion
{
[[nodiscard]] static BSTEventSource<CharGen_RollOffLocomotion>* GetEventSource()
{
using func_t = decltype(&CharGen_RollOffLocomotion::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(141208) };
return func();
}
};

struct CharGen_RollOnLocomotion
{
[[nodiscard]] static BSTEventSource<CharGen_RollOnLocomotion>* GetEventSource()
{
using func_t = decltype(&CharGen_RollOnLocomotion::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(141209) };
return func();
}
};

struct CharGen_RotatePaperdoll
{
[[nodiscard]] static BSTEventSource<CharGen_RotatePaperdoll>* GetEventSource()
Expand Down Expand Up @@ -2100,6 +2158,16 @@ namespace RE
}
};

struct CharGen_SetBlockInputUnderPopup
{
[[nodiscard]] static BSTEventSource<CharGen_SetBlockInputUnderPopup>* GetEventSource()
{
using func_t = decltype(&CharGen_SetBlockInputUnderPopup::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(141213) };
return func();
}
};

struct CharGen_SetBodyValues
{
[[nodiscard]] static BSTEventSource<CharGen_SetBodyValues>* GetEventSource()
Expand Down Expand Up @@ -2220,6 +2288,16 @@ namespace RE
}
};

struct CharGen_SwitchLocomotion
{
[[nodiscard]] static BSTEventSource<CharGen_SwitchLocomotion>* GetEventSource()
{
using func_t = decltype(&CharGen_SwitchLocomotion::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(141226) };
return func();
}
};

struct CharGen_TeethChange
{
[[nodiscard]] static BSTEventSource<CharGen_TeethChange>* GetEventSource()
Expand Down Expand Up @@ -3457,6 +3535,9 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(103540) };
return func();
}

// members
TESObjectBOOK* book; // 00
};
};

Expand All @@ -3483,7 +3564,12 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(106834) };
return func();
}

// members
NiPointer<Actor> source; // 00
NiPointer<TESObjectREFR> target; // 08
};
static_assert(sizeof(Activation::Event) == 0x10);
};

struct ActorCellChangeEvent
Expand All @@ -3498,7 +3584,7 @@ namespace RE
}

// members
NiPointer<Actor> actor;
NiPointer<Actor> actor; // 00
};
};

Expand Down Expand Up @@ -3550,7 +3636,12 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(107136) };
return func();
}

// members
NiPointer<TESObjectREFR> target; // 00
NiPointer<TESObjectREFR> source; // 08
};
static_assert(sizeof(TESActivateEvent) == 0x10);

struct TESBookReadEvent
{
Expand All @@ -3560,7 +3651,10 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(107141) };
return func();
}
};

// members
NiPointer<TESObjectREFR> ref; // 00
};

struct TESCellFullyLoadedEvent
{
Expand All @@ -3572,7 +3666,7 @@ namespace RE
}

// members
NiPointer<TESObjectCELL> cell;
NiPointer<TESObjectCELL> cell; // 00
};

struct TESContainerChangedEvent
Expand Down Expand Up @@ -3606,9 +3700,9 @@ namespace RE
}

// members
NiPointer<TESObjectREFR> actorDying; // 00
NiPointer<TESObjectREFR> actorKiller; // 08
bool dead; // 10
NiPointer<Actor> actorDying; // 00
NiPointer<Actor> actorKiller; // 08
bool dead; // 10
};
static_assert(sizeof(TESDeathEvent) == 0x18);

Expand All @@ -3624,6 +3718,7 @@ namespace RE
// members
TESFormID formID;
};
static_assert(sizeof(TESFormDeleteEvent) == 0x4);

struct TESFormIDRemapEvent
{
Expand All @@ -3638,16 +3733,32 @@ namespace RE
TESFormID oldFormID;
TESFormID newFormID;
};
static_assert(sizeof(TESFormIDRemapEvent) == 0x8);

struct TESFurnitureEvent
{
enum class Type : std::int32_t
{
kEnter,
kExit
};

[[nodiscard]] static BSTEventSource<TESFurnitureEvent>* GetEventSource()
{
using func_t = decltype(&TESFurnitureEvent::GetEventSource);
static REL::Relocation<func_t> func{ REL::ID(107168) };
return func();
}

[[nodiscard]] constexpr bool IsEnter() const noexcept { return type == Type::kEnter; }
[[nodiscard]] constexpr bool IsExit() const noexcept { return type == Type::kExit; }

// members
std::byte pad00[0x8]; // 00 - wtf is this now? it used to be an NiPointer<Actor> in previous games
NiPointer<TESObjectREFR> furniture; // 08
Type type; // 10
};
static_assert(sizeof(TESFurnitureEvent) == 0x18);

struct TESGrabReleaseEvent
{
Expand All @@ -3657,7 +3768,12 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(107169) };
return func();
}

// members
NiPointer<TESObjectREFR> target; // 00
bool grabbed; // 08
};
static_assert(sizeof(TESGrabReleaseEvent) == 0x10);

struct TESMissionAcceptedEvent
{
Expand Down Expand Up @@ -3704,6 +3820,9 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(107193) };
return func();
}

// members
NiPointer<TESObjectREFR> ref; // 00
};

struct TESResolveNPCTemplatesEvent
Expand Down Expand Up @@ -3752,6 +3871,10 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(151162) };
return func();
}

// members
TESBoundObject* item; // 00
NiPointer<Actor> actor; // 08
};
};

Expand All @@ -3778,7 +3901,13 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(153651) };
return func();
}

// members
TESFaction* faction; // 00
std::int32_t bounty; // 08
std::int32_t oldBounty; // 0C
};
static_assert(sizeof(Bounty::Event) == 0x10);
};

struct CriticalHitEvent
Expand Down Expand Up @@ -3830,7 +3959,11 @@ namespace RE
static REL::Relocation<func_t> func{ REL::ID(153662) };
return func();
}

// members
std::uint32_t level;
};
static_assert(sizeof(LevelIncrease::Event) == 0x4);
};

struct PlayerAmmoChanged
Expand All @@ -3848,6 +3981,7 @@ namespace RE
std::uint32_t clipCount;
std::uint32_t reserveCount;
};
static_assert(sizeof(PlayerAmmoChanged::Event) == 0x8);
};

struct TerminalHacked
Expand All @@ -3862,4 +3996,18 @@ namespace RE
}
};
};

struct WeaponFiredEvent
{
[[nodiscard]] static auto GetEventSource()
{
static REL::Relocation<BSTEventSource<WeaponFiredEvent>*> ptr{ REL::ID(773902) };
return ptr.get();
}

// members
void* unk00; // 00
void* unk08; // 08
NiPointer<Actor> actor; // 10
};
}

0 comments on commit 0af341a

Please sign in to comment.