diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 0b2fb9f74..83b59bb51 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -1841,6 +1841,7 @@ set(SOURCES src/RE/H/HUDMeter.cpp src/RE/H/HUDObject.cpp src/RE/H/HeapBlock.cpp + src/RE/H/HeldStateHandler.cpp src/RE/H/hkBaseTypes.cpp src/RE/H/hkReferencedObject.cpp src/RE/H/hkStringPtr.cpp diff --git a/include/RE/A/AttackBlockHandler.h b/include/RE/A/AttackBlockHandler.h index ffa80859c..f776f005c 100644 --- a/include/RE/A/AttackBlockHandler.h +++ b/include/RE/A/AttackBlockHandler.h @@ -8,6 +8,7 @@ namespace RE { public: inline static constexpr auto RTTI = RTTI_AttackBlockHandler; + inline static constexpr auto VTABLE = VTABLE_AttackBlockHandler; enum class AttackType : std::uint8_t { diff --git a/include/RE/H/HeldStateHandler.h b/include/RE/H/HeldStateHandler.h index 98c1cf1e5..c547c7621 100644 --- a/include/RE/H/HeldStateHandler.h +++ b/include/RE/H/HeldStateHandler.h @@ -10,17 +10,17 @@ namespace RE inline static constexpr auto RTTI = RTTI_HeldStateHandler; inline static constexpr auto VTABLE = VTABLE_HeldStateHandler; - ~HeldStateHandler() override; // 00 + ~HeldStateHandler() override = default; // 00 // add virtual void UpdateHeldStateActive(const ButtonEvent* a_event); // 05 - virtual void SetHeldStateActive(bool a_flag); // 06 - { heldStateActive = a_flag; } + virtual void SetHeldStateActive(bool a_flag); // 06 // members - bool heldStateActive; // 10 - bool triggerReleaseEvent; // 11 - std::uint16_t pad12; // 12 - std::uint32_t pad14; // 14 + bool heldStateActive{ false }; // 10 + bool triggerReleaseEvent{ false }; // 11 + std::uint16_t pad12{ 0 }; // 12 + std::uint32_t pad14{ 0 }; // 14 }; static_assert(sizeof(HeldStateHandler) == 0x18); } diff --git a/include/RE/P/PlayerInputHandler.h b/include/RE/P/PlayerInputHandler.h index 70fc99f24..f2657206c 100644 --- a/include/RE/P/PlayerInputHandler.h +++ b/include/RE/P/PlayerInputHandler.h @@ -13,21 +13,21 @@ namespace RE public: inline static constexpr auto RTTI = RTTI_PlayerInputHandler; - virtual ~PlayerInputHandler(); // 00 + virtual ~PlayerInputHandler() = default; // 00 - virtual bool CanProcess(InputEvent* a_event) = 0; // 01 - virtual void ProcessThumbstick(ThumbstickEvent* a_event, PlayerControlsData* a_data); // 02 - { return; } - virtual void ProcessMouseMove(MouseMoveEvent* a_event, PlayerControlsData* a_data); // 03 - { return; } - virtual void ProcessButton(ButtonEvent* a_event, PlayerControlsData* a_data); // 04 - { return; } + virtual bool CanProcess(InputEvent* a_event) = 0; // 01 + virtual void ProcessThumbstick([[maybe_unused]] ThumbstickEvent* a_event, [[maybe_unused]] PlayerControlsData* a_data) {} // 02 + virtual void ProcessMouseMove([[maybe_unused]] MouseMoveEvent* a_event, [[maybe_unused]] PlayerControlsData* a_data) {} // 03 + virtual void ProcessButton([[maybe_unused]] ButtonEvent* a_event, [[maybe_unused]] PlayerControlsData* a_data) {} // 04 [[nodiscard]] bool IsInputEventHandlingEnabled() const; void SetInputEventHandlingEnabled(bool a_enabled); // members - bool inputEventHandlingEnabled; // 08 - std::uint8_t pad09; // 09 - std::uint16_t pad0A; // 0A - std::uint32_t pad0C; // 0C + bool inputEventHandlingEnabled{ true }; // 08 + std::uint8_t pad09{ 0 }; // 09 + std::uint16_t pad0A{ 0 }; // 0A + std::uint32_t pad0C{ 0 }; // 0C }; static_assert(sizeof(PlayerInputHandler) == 0x10); } diff --git a/src/RE/H/HeldStateHandler.cpp b/src/RE/H/HeldStateHandler.cpp new file mode 100644 index 000000000..0641ea35a --- /dev/null +++ b/src/RE/H/HeldStateHandler.cpp @@ -0,0 +1,16 @@ +#include "RE/H/HeldStateHandler.h" + +#include "RE/B/ButtonEvent.h" + +namespace RE +{ + void HeldStateHandler::UpdateHeldStateActive(const ButtonEvent* a_event) + { + heldStateActive = a_event->value != 0.0f || a_event->heldDownSecs < 0.0f; + } + + void HeldStateHandler::SetHeldStateActive(bool a_flag) + { + heldStateActive = a_flag; + } +}