diff --git a/.github/workflows/maintenance.yml b/.github/workflows/maintenance.yml index 5ef3f142c..2c2bb3ee2 100644 --- a/.github/workflows/maintenance.yml +++ b/.github/workflows/maintenance.yml @@ -14,7 +14,7 @@ jobs: python-version: '3.9' - name: Run clang-format - run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-12 -style=file -i + run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format-14 -style=file -i - name: Glob files run: python ${{ github.workspace }}/scripts/cmake_generate.py diff --git a/include/RE/A/AIProcess.h b/include/RE/A/AIProcess.h index ce14e93d7..d7581313a 100644 --- a/include/RE/A/AIProcess.h +++ b/include/RE/A/AIProcess.h @@ -37,15 +37,14 @@ namespace RE }; static_assert(sizeof(MiddleLowProcessData) == 0x4); - struct CachedValueData { public: // members - float value; // 0 - bool invalid; // 4 - std::uint8_t pad5; // 5 - std::uint16_t pad6; // 6 + float value; // 0 + bool invalid; // 4 + std::uint8_t pad5; // 5 + std::uint16_t pad6; // 6 }; static_assert(sizeof(CachedValueData) == 0x8); @@ -81,20 +80,20 @@ namespace RE kOwnerIsInCombatantFaction = 1 << 3 }; - float cachedRadius; // 00 - float cachedWidth; // 04 - float cachedLength; // 08 - float cachedForwardLength; // 0C - float cachedDPS; // 10 - float cachedEyeLevel; // 14 - float cachedWalkSpeed; // 18 - float cachedRunSpeed; // 1C - float cachedJogSpeed; // 20 - float cachedFastWalkSpeed; // 24 - stl::enumeration booleanValues; // 28 - stl::enumeration flags; // 2C - BSTArray actorValueCache; // 30 - BSTArray maxActorValueCache; // 48 + float cachedRadius; // 00 + float cachedWidth; // 04 + float cachedLength; // 08 + float cachedForwardLength; // 0C + float cachedDPS; // 10 + float cachedEyeLevel; // 14 + float cachedWalkSpeed; // 18 + float cachedRunSpeed; // 1C + float cachedJogSpeed; // 20 + float cachedFastWalkSpeed; // 24 + stl::enumeration booleanValues; // 28 + stl::enumeration flags; // 2C + BSTArray actorValueCache; // 30 + BSTArray maxActorValueCache; // 48 }; static_assert(sizeof(CachedValues) == 0x60); diff --git a/include/RE/B/BSFixedString.h b/include/RE/B/BSFixedString.h index 7f10d1484..17bd60981 100644 --- a/include/RE/B/BSFixedString.h +++ b/include/RE/B/BSFixedString.h @@ -205,15 +205,15 @@ namespace RE [[nodiscard]] inline BSStringPool::Entry* get_proxy() noexcept { return _data ? - reinterpret_cast(const_cast(_data)) - 1 : - nullptr; + reinterpret_cast(const_cast(_data)) - 1 : + nullptr; } [[nodiscard]] inline const BSStringPool::Entry* get_proxy() const noexcept { return _data ? - reinterpret_cast(_data) - 1 : - nullptr; + reinterpret_cast(_data) - 1 : + nullptr; } inline void try_acquire() diff --git a/include/RE/B/BSTTuple.h b/include/RE/B/BSTTuple.h index 6647658c8..cb0c59f98 100644 --- a/include/RE/B/BSTTuple.h +++ b/include/RE/B/BSTTuple.h @@ -205,7 +205,7 @@ namespace RE return a_lhs.first < a_rhs.first ? true : a_rhs.first < a_lhs.first ? false : a_lhs.second < a_rhs.second ? true : - false; + false; } template diff --git a/include/RE/C/ColorUtil.h b/include/RE/C/ColorUtil.h index 546f9f208..d66ef71ea 100644 --- a/include/RE/C/ColorUtil.h +++ b/include/RE/C/ColorUtil.h @@ -141,7 +141,7 @@ namespace RE inline float softLight(float a_src, float a_dest) { return (a_src < 0.5f) ? a_dest - (1.0f - 2.0f * a_src) * a_dest * (1.0f - a_dest) : (a_dest < 0.25f) ? a_dest + (2.0f * a_src - 1.0f) * a_dest * ((16.0f * a_dest - 12.0f) * a_dest + 3.0f) : - a_dest + (2.0f * a_src - 1.0f) * (sqrt(a_dest) - a_dest); + a_dest + (2.0f * a_src - 1.0f) * (sqrt(a_dest) - a_dest); } inline NiColor softLight(const NiColor& a_src, const NiColor& a_dest) @@ -177,7 +177,7 @@ namespace RE inline float pinLight(float a_src, float a_dest) { return (2.0f * a_src - 1.0f > a_dest) ? 2.0f * a_src - 1.0f : (a_src < 0.5f * a_dest) ? 2.0f * a_src : - a_dest; + a_dest; } inline NiColor pinLight(const NiColor& a_src, const NiColor& a_dest) diff --git a/include/RE/D/DualValueModifierEffect.h b/include/RE/D/DualValueModifierEffect.h index 91644d0ab..0a13d1881 100644 --- a/include/RE/D/DualValueModifierEffect.h +++ b/include/RE/D/DualValueModifierEffect.h @@ -26,8 +26,8 @@ namespace RE virtual float GetSecondaryAVWeight() const; // 22 // members - float secondaryAVWeight; // 98 - std::uint32_t pad9C; // 9C + float secondaryAVWeight; // 98 + std::uint32_t pad9C; // 9C }; static_assert(sizeof(DualValueModifierEffect) == 0xA0); } diff --git a/include/RE/G/GridCellArray.h b/include/RE/G/GridCellArray.h index 06bea1389..f2374d1bf 100644 --- a/include/RE/G/GridCellArray.h +++ b/include/RE/G/GridCellArray.h @@ -25,8 +25,8 @@ namespace RE [[nodiscard]] TESObjectCELL* GetCell(std::uint32_t a_x, std::uint32_t a_y) const noexcept { return (a_x < length && a_y < length) ? - cells[(a_x * length) + a_y] : - nullptr; + cells[(a_x * length) + a_y] : + nullptr; }; // members diff --git a/include/RE/M/MemoryManager.h b/include/RE/M/MemoryManager.h index 7d2004212..c9302503c 100644 --- a/include/RE/M/MemoryManager.h +++ b/include/RE/M/MemoryManager.h @@ -99,8 +99,8 @@ namespace RE { auto heap = MemoryManager::GetSingleton(); return heap ? - heap->Allocate(a_size, 0, false) : - nullptr; + heap->Allocate(a_size, 0, false) : + nullptr; } template @@ -119,8 +119,8 @@ namespace RE { auto heap = MemoryManager::GetSingleton(); return heap ? - heap->Allocate(a_size, static_cast(a_alignment), true) : - nullptr; + heap->Allocate(a_size, static_cast(a_alignment), true) : + nullptr; } template @@ -160,8 +160,8 @@ namespace RE { auto heap = MemoryManager::GetSingleton(); return heap ? - heap->Reallocate(a_ptr, a_newSize, 0, false) : - nullptr; + heap->Reallocate(a_ptr, a_newSize, 0, false) : + nullptr; } template @@ -174,8 +174,8 @@ namespace RE { auto heap = MemoryManager::GetSingleton(); return heap ? - heap->Reallocate(a_ptr, a_newSize, static_cast(a_alignment), true) : - nullptr; + heap->Reallocate(a_ptr, a_newSize, static_cast(a_alignment), true) : + nullptr; } template diff --git a/include/RE/R/Renderer.h b/include/RE/R/Renderer.h index cb663df00..0f4eec671 100644 --- a/include/RE/R/Renderer.h +++ b/include/RE/R/Renderer.h @@ -39,32 +39,32 @@ namespace RE { public: // members - std::uint32_t adapter; // 0000 - DirectX::DXGI_RATIONAL desiredRefreshRate; // 0004 - DirectX::DXGI_RATIONAL actualRefreshRate; // 000C - DirectX::DXGI_MODE_SCALING scaleMode; // 0014 - DirectX::DXGI_MODE_SCANLINE_ORDER scanlineOrdering; // 0018 - std::uint32_t isNotWindowed; // 001C - bool fullScreen; // 0020 - bool borderlessDisplay; // 0021 - bool readOnlyDepth; // 0022 - bool instantiated; // 0023 - bool requestedWindowSizeChange; // 0024 - std::uint32_t newWidth; // 0028 - std::uint32_t newHeight; // 002C - std::uint32_t presentInterval; // 0030 - ID3D11Device* forwarder; // 0038 - ID3D11DeviceContext* context; // 0040 - RendererWindow renderWindows[32]; // 0048 - RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]; // 0A48 - DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]; // 1FA8 - CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]; // 26C8 - Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]; // 2708 - float clearColor[4]; // 2768 - std::uint8_t clearStencil; // 2778 - SKSE::WinAPI::CRITICAL_SECTION lock; // 2780 - const char* className; // 27A8 - SKSE::WinAPI::HINSTANCE hInstance; // 27B0 + std::uint32_t adapter; // 0000 + DirectX::DXGI_RATIONAL desiredRefreshRate; // 0004 + DirectX::DXGI_RATIONAL actualRefreshRate; // 000C + DirectX::DXGI_MODE_SCALING scaleMode; // 0014 + DirectX::DXGI_MODE_SCANLINE_ORDER scanlineOrdering; // 0018 + std::uint32_t isNotWindowed; // 001C + bool fullScreen; // 0020 + bool borderlessDisplay; // 0021 + bool readOnlyDepth; // 0022 + bool instantiated; // 0023 + bool requestedWindowSizeChange; // 0024 + std::uint32_t newWidth; // 0028 + std::uint32_t newHeight; // 002C + std::uint32_t presentInterval; // 0030 + ID3D11Device* forwarder; // 0038 + ID3D11DeviceContext* context; // 0040 + RendererWindow renderWindows[32]; // 0048 + RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]; // 0A48 + DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]; // 1FA8 + CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]; // 26C8 + Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]; // 2708 + float clearColor[4]; // 2768 + std::uint8_t clearStencil; // 2778 + SKSE::WinAPI::CRITICAL_SECTION lock; // 2780 + const char* className; // 27A8 + SKSE::WinAPI::HINSTANCE hInstance; // 27B0 }; static_assert(offsetof(RendererData, lock) == 0x2780); diff --git a/include/RE/T/TESForm.h b/include/RE/T/TESForm.h index 88a04f6b8..5141fd0ba 100644 --- a/include/RE/T/TESForm.h +++ b/include/RE/T/TESForm.h @@ -351,6 +351,8 @@ namespace RE [[nodiscard]] bool IsSoulGem() const noexcept { return Is(FormType::SoulGem); } [[nodiscard]] bool IsWeapon() const noexcept { return Is(FormType::Weapon); } + void SetPlayerKnows(bool a_known); + // members TESFileContainer sourceFiles; // 08 std::uint32_t formFlags; // 10 diff --git a/include/REL/Relocation.h b/include/REL/Relocation.h index 76e69e6e9..20b8b7d7e 100644 --- a/include/REL/Relocation.h +++ b/include/REL/Relocation.h @@ -572,10 +572,10 @@ namespace REL { const mapping_t elem{ 0, a_offset }; const auto it = std::lower_bound( - _offset2id.begin(), - _offset2id.end(), - elem, - [](auto&& a_lhs, auto&& a_rhs) { + _offset2id.begin(), + _offset2id.end(), + elem, + [](auto&& a_lhs, auto&& a_rhs) { return a_lhs.offset < a_rhs.offset; }); if (it == _offset2id.end()) { @@ -976,7 +976,7 @@ namespace REL return write_vfunc(a_idx, stl::unrestricted_cast(a_newFunc)); } - private : + private: // clang-format off [[nodiscard]] static std::uintptr_t base() { return Module::get().base(); } // clang-format on diff --git a/include/SKSE/Impl/PCH.h b/include/SKSE/Impl/PCH.h index c8cc5a7c1..58dbd2ba2 100644 --- a/include/SKSE/Impl/PCH.h +++ b/include/SKSE/Impl/PCH.h @@ -302,7 +302,7 @@ namespace SKSE return (_impl & (static_cast(a_args) | ...)) == static_cast(0); } - private : + private: underlying_type _impl{ 0 }; }; diff --git a/include/SKSE/Impl/WinAPI.h b/include/SKSE/Impl/WinAPI.h index 2507ced98..ab6b84cb8 100644 --- a/include/SKSE/Impl/WinAPI.h +++ b/include/SKSE/Impl/WinAPI.h @@ -541,16 +541,16 @@ namespace RE::DirectX enum DXGI_MODE_SCALING : std::uint32_t { - DXGI_MODE_SCALING_UNSPECIFIED = 0, - DXGI_MODE_SCALING_CENTERED = 1, - DXGI_MODE_SCALING_STRETCHED = 2 + DXGI_MODE_SCALING_UNSPECIFIED = 0, + DXGI_MODE_SCALING_CENTERED = 1, + DXGI_MODE_SCALING_STRETCHED = 2 }; enum DXGI_MODE_SCANLINE_ORDER : std::uint32_t { - DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, - DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, - DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, - DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3 + DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, + DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, + DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, + DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3 }; } diff --git a/include/SKSE/Trampoline.h b/include/SKSE/Trampoline.h index 91a00101a..dc2703757 100644 --- a/include/SKSE/Trampoline.h +++ b/include/SKSE/Trampoline.h @@ -19,8 +19,8 @@ namespace SKSE const auto remainder = a_number % a_multiple; return remainder == 0 ? - a_number : - a_number + a_multiple - remainder; + a_number : + a_number + a_multiple - remainder; } [[nodiscard]] constexpr std::size_t rounddown(std::size_t a_number, std::size_t a_multiple) noexcept @@ -31,8 +31,8 @@ namespace SKSE const auto remainder = a_number % a_multiple; return remainder == 0 ? - a_number : - a_number - remainder; + a_number : + a_number - remainder; } } diff --git a/src/RE/A/ActorValueList.cpp b/src/RE/A/ActorValueList.cpp index ad0590037..533f622fb 100644 --- a/src/RE/A/ActorValueList.cpp +++ b/src/RE/A/ActorValueList.cpp @@ -7,8 +7,8 @@ namespace RE ActorValueInfo* ActorValueList::GetActorValue(ActorValue a_actorValue) const { return a_actorValue < ActorValue::kTotal ? - actorValues[stl::to_underlying(a_actorValue)] : - nullptr; + actorValues[stl::to_underlying(a_actorValue)] : + nullptr; } ActorValue ActorValueList::LookupActorValueByName(std::string_view a_enumName) const diff --git a/src/RE/E/ExtraDataList.cpp b/src/RE/E/ExtraDataList.cpp index 1d59640d9..bbf0b83ba 100644 --- a/src/RE/E/ExtraDataList.cpp +++ b/src/RE/E/ExtraDataList.cpp @@ -278,8 +278,8 @@ namespace RE auto xTeleport = GetByType(); return xTeleport && xTeleport->teleportData ? - xTeleport->teleportData->linkedDoor : - ObjectRefHandle(); + xTeleport->teleportData->linkedDoor : + ObjectRefHandle(); } void ExtraDataList::SetCount(std::uint16_t a_count) diff --git a/src/RE/I/InventoryEntryData.cpp b/src/RE/I/InventoryEntryData.cpp index 0cdc7d675..18402da92 100644 --- a/src/RE/I/InventoryEntryData.cpp +++ b/src/RE/I/InventoryEntryData.cpp @@ -38,8 +38,8 @@ namespace RE delete extraLists; extraLists = a_rhs.extraLists ? - new BSSimpleList(*a_rhs.extraLists) : - nullptr; + new BSSimpleList(*a_rhs.extraLists) : + nullptr; countDelta = a_rhs.countDelta; } diff --git a/src/RE/T/TESForm.cpp b/src/RE/T/TESForm.cpp index 3034142e1..ac034abff 100644 --- a/src/RE/T/TESForm.cpp +++ b/src/RE/T/TESForm.cpp @@ -174,4 +174,11 @@ namespace RE return false; } } + + void TESForm::SetPlayerKnows(bool a_known) + { + using func_t = decltype(&TESForm::SetPlayerKnows); + REL::Relocation func{ RELOCATION_ID(14482, 14639) }; + return func(this, a_known); + } } diff --git a/src/RE/T/TESObjectCELL.cpp b/src/RE/T/TESObjectCELL.cpp index 288101fd3..e93c657c9 100644 --- a/src/RE/T/TESObjectCELL.cpp +++ b/src/RE/T/TESObjectCELL.cpp @@ -26,8 +26,8 @@ namespace RE ForEachReference([&](TESObjectREFR& ref) { const auto distance = a_origin.GetSquaredDistance(ref.GetPosition()); return distance <= squaredRadius ? - a_callback(ref) : - BSContainer::ForEachResult::kContinue; + a_callback(ref) : + BSContainer::ForEachResult::kContinue; }); } diff --git a/src/RE/T/TESObjectREFR.cpp b/src/RE/T/TESObjectREFR.cpp index 0ae76986f..0ec42cd9d 100644 --- a/src/RE/T/TESObjectREFR.cpp +++ b/src/RE/T/TESObjectREFR.cpp @@ -347,8 +347,8 @@ namespace RE const auto it = results.find(a_object); const auto entryData = it != results.end() ? - it->second.second.get() : - nullptr; + it->second.second.get() : + nullptr; return entryData ? entryData->IsLeveled() : false; }; diff --git a/src/REL/Relocation.cpp b/src/REL/Relocation.cpp index 8d9a7f36c..940ed6a2c 100644 --- a/src/REL/Relocation.cpp +++ b/src/REL/Relocation.cpp @@ -138,9 +138,9 @@ namespace REL for (std::size_t i = 0; i < size; ++i) { const auto& section = sections[i]; const auto it = std::find_if( - SEGMENTS.begin(), - SEGMENTS.end(), - [&](auto&& a_elem) { + SEGMENTS.begin(), + SEGMENTS.end(), + [&](auto&& a_elem) { constexpr auto size = std::extent_v; const auto len = std::min(a_elem.first.size(), size); return std::memcmp(a_elem.first.data(), section.Name, len) == 0 &&