Skip to content

Commit

Permalink
feat: BSUtilities
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed May 26, 2024
1 parent 9201367 commit 28d2241
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
1 change: 1 addition & 0 deletions CommonLibF4/cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ set(SOURCES
include/RE/Bethesda/BSTextureStreamer.h
include/RE/Bethesda/BSThread.h
include/RE/Bethesda/BSTimer.h
include/RE/Bethesda/BSUtilities.h
include/RE/Bethesda/BSVisit.h
include/RE/Bethesda/CELLJobs.h
include/RE/Bethesda/CRC.h
Expand Down
32 changes: 32 additions & 0 deletions CommonLibF4/include/RE/Bethesda/BSUtilities.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "RE/Bethesda/BSFixedString.h"

namespace RE
{
class NiAVObject;
}

namespace RE::BSUtilities
{
inline std::uint16_t ConvertFloatToHalf(float a_value)
{
using func_t = decltype(&ConvertFloatToHalf);
static REL::Relocation<func_t> func{ REL::ID(2212098) };
return func(a_value);
}

inline float ConvertHalfToFloat(std::uint16_t a_value)
{
using func_t = decltype(&ConvertHalfToFloat);
static REL::Relocation<func_t> func{ REL::ID(2195843) };
return func(a_value);
}

inline NiAVObject* GetObjectByName(NiAVObject* a_root, const BSFixedString& a_name, bool a_tryInternal, bool a_dontAttach)
{
using func_t = decltype(&GetObjectByName);
static REL::Relocation<func_t> func{ REL::ID(843650) };
return func(a_root, a_name, a_tryInternal, a_dontAttach);
}
}
10 changes: 0 additions & 10 deletions CommonLibF4/include/RE/Bethesda/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@

namespace RE
{
namespace BSUtilities
{
inline NiAVObject* GetObjectByName(NiAVObject* a_root, const BSFixedString& a_name, bool a_tryInternal, bool a_dontAttach)
{
using func_t = decltype(&GetObjectByName);
REL::Relocation<func_t> func{ REL::ID(843650) };
return func(a_root, a_name, a_tryInternal, a_dontAttach);
}
}

namespace CombatUtilities
{
inline bool CalculateProjectileLOS(
Expand Down
1 change: 1 addition & 0 deletions CommonLibF4/include/RE/Fallout.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
#include "RE/Bethesda/BSTextureStreamer.h"
#include "RE/Bethesda/BSThread.h"
#include "RE/Bethesda/BSTimer.h"
#include "RE/Bethesda/BSUtilities.h"
#include "RE/Bethesda/BSVisit.h"
#include "RE/Bethesda/CELLJobs.h"
#include "RE/Bethesda/CRC.h"
Expand Down

0 comments on commit 28d2241

Please sign in to comment.