Skip to content

Commit

Permalink
Merge pull request #90 from TESRSkywind/dev
Browse files Browse the repository at this point in the history
Github Actions Fix and TESForm::Playerknows flag function
  • Loading branch information
powerof3 authored Nov 13, 2023
2 parents 32ecbf5 + 428df60 commit f18a645
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 18 additions & 19 deletions include/RE/A/AIProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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<BooleanValue, std::uint32_t> booleanValues; // 28
stl::enumeration<Flags, std::uint32_t> flags; // 2C
BSTArray<CachedValueData> actorValueCache; // 30
BSTArray<CachedValueData> 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<BooleanValue, std::uint32_t> booleanValues; // 28
stl::enumeration<Flags, std::uint32_t> flags; // 2C
BSTArray<CachedValueData> actorValueCache; // 30
BSTArray<CachedValueData> maxActorValueCache; // 48
};
static_assert(sizeof(CachedValues) == 0x60);

Expand Down
8 changes: 4 additions & 4 deletions include/RE/B/BSFixedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ namespace RE
[[nodiscard]] inline BSStringPool::Entry* get_proxy() noexcept
{
return _data ?
reinterpret_cast<BSStringPool::Entry*>(const_cast<pointer>(_data)) - 1 :
nullptr;
reinterpret_cast<BSStringPool::Entry*>(const_cast<pointer>(_data)) - 1 :
nullptr;
}

[[nodiscard]] inline const BSStringPool::Entry* get_proxy() const noexcept
{
return _data ?
reinterpret_cast<const BSStringPool::Entry*>(_data) - 1 :
nullptr;
reinterpret_cast<const BSStringPool::Entry*>(_data) - 1 :
nullptr;
}

inline void try_acquire()
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BSTTuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class T1, class T2>
Expand Down
4 changes: 2 additions & 2 deletions include/RE/C/ColorUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions include/RE/D/DualValueModifierEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions include/RE/G/GridCellArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions include/RE/M/MemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class T>
Expand All @@ -119,8 +119,8 @@ namespace RE
{
auto heap = MemoryManager::GetSingleton();
return heap ?
heap->Allocate(a_size, static_cast<std::int32_t>(a_alignment), true) :
nullptr;
heap->Allocate(a_size, static_cast<std::int32_t>(a_alignment), true) :
nullptr;
}

template <class T>
Expand Down Expand Up @@ -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 <class T>
Expand All @@ -174,8 +174,8 @@ namespace RE
{
auto heap = MemoryManager::GetSingleton();
return heap ?
heap->Reallocate(a_ptr, a_newSize, static_cast<std::int32_t>(a_alignment), true) :
nullptr;
heap->Reallocate(a_ptr, a_newSize, static_cast<std::int32_t>(a_alignment), true) :
nullptr;
}

template <class T>
Expand Down
52 changes: 26 additions & 26 deletions include/RE/R/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions include/RE/T/TESForm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions include/REL/Relocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -976,7 +976,7 @@ namespace REL
return write_vfunc(a_idx, stl::unrestricted_cast<std::uintptr_t>(a_newFunc));
}

private :
private:
// clang-format off
[[nodiscard]] static std::uintptr_t base() { return Module::get().base(); }
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion include/SKSE/Impl/PCH.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ namespace SKSE
return (_impl & (static_cast<underlying_type>(a_args) | ...)) == static_cast<underlying_type>(0);
}

private :
private:
underlying_type _impl{ 0 };
};

Expand Down
14 changes: 7 additions & 7 deletions include/SKSE/Impl/WinAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
8 changes: 4 additions & 4 deletions include/SKSE/Trampoline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/RE/A/ActorValueList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/RE/E/ExtraDataList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ namespace RE
auto xTeleport = GetByType<ExtraTeleport>();

return xTeleport && xTeleport->teleportData ?
xTeleport->teleportData->linkedDoor :
ObjectRefHandle();
xTeleport->teleportData->linkedDoor :
ObjectRefHandle();
}

void ExtraDataList::SetCount(std::uint16_t a_count)
Expand Down
4 changes: 2 additions & 2 deletions src/RE/I/InventoryEntryData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ namespace RE
delete extraLists;
extraLists =
a_rhs.extraLists ?
new BSSimpleList<ExtraDataList*>(*a_rhs.extraLists) :
nullptr;
new BSSimpleList<ExtraDataList*>(*a_rhs.extraLists) :
nullptr;

countDelta = a_rhs.countDelta;
}
Expand Down
7 changes: 7 additions & 0 deletions src/RE/T/TESForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,11 @@ namespace RE
return false;
}
}

void TESForm::SetPlayerKnows(bool a_known)
{
using func_t = decltype(&TESForm::SetPlayerKnows);
REL::Relocation<func_t> func{ RELOCATION_ID(14482, 14639) };
return func(this, a_known);
}
}
4 changes: 2 additions & 2 deletions src/RE/T/TESObjectCELL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/RE/T/TESObjectREFR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
Loading

0 comments on commit f18a645

Please sign in to comment.