Skip to content

Commit

Permalink
feat: misc alpha (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix authored Nov 6, 2024
1 parent 9f4ee8d commit 4665572
Show file tree
Hide file tree
Showing 42 changed files with 1,308 additions and 579 deletions.
2 changes: 1 addition & 1 deletion include/RE/A/AIProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "RE/B/BSPointerHandle.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTList.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"
#include "RE/N/NiSmartPointer.h"

namespace RE
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BGSAimDownSightModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "RE/B/BGSBaseForm.h"
#include "RE/I/IBGSBaseFormData.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"

namespace RE
{
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BGSAimModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "RE/B/BGSBaseForm.h"
#include "RE/I/IBGSBaseFormData.h"
#include "RE/N/NiPoint2.h"
#include "RE/N/NiPoint.h"

namespace RE
{
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BGSBodyPartData.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "RE/B/BGSBodyPartDefs.h"
#include "RE/B/BGSPreloadable.h"
#include "RE/B/BSFixedString.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"
#include "RE/T/TESForm.h"
#include "RE/T/TESModel.h"

Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BGSSnapTemplateNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "RE/B/BGSKeywordForm.h"
#include "RE/B/BGSModelMaterialSwap.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"
#include "RE/T/TESBoundObject.h"

namespace RE
Expand Down
2 changes: 1 addition & 1 deletion include/RE/B/BGSTransform.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"
#include "RE/T/TESForm.h"

namespace RE
Expand Down
74 changes: 74 additions & 0 deletions include/RE/C/Calendar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#pragma once

#include "RE/B/BSTSingleton.h"
#include "RE/T/TESGlobal.h"

namespace RE
{
class Calendar :
public BSTSingletonSDM<Calendar>
{
public:
[[nodiscard]] static auto GetSingleton()
{
static REL::Relocation<Calendar**> singleton{ ID::Calendar::Singleton };
return *singleton;
}

std::uint32_t GetDay() const noexcept
{
return gameDay ? static_cast<std::uint32_t>(gameDay->value) : 17u;
}

std::uint32_t GetDaysPassed() const noexcept
{
return gameDaysPassed ? static_cast<std::uint32_t>(gameDaysPassed->value) : 0u;
}

float GetDaysPassedExact() const noexcept
{
return gameDaysPassed ? gameDaysPassed->value : 0.0f;
}

float GetHour() const noexcept
{
return gameHour ? gameHour->value : 12.0f;
}

float GetHourFromDaysPassed(float a_daysPassed) const noexcept
{
return std::fmodf(a_daysPassed, 1.0f) * 24.0f;
}

float GetHoursPassedExact() const noexcept
{
return gameDaysPassed ? gameDaysPassed->value * 24.0f : 0.0f;
}

std::uint16_t GetMonth() const noexcept
{
return gameMonth ? static_cast<std::uint16_t>(gameMonth->value) : 8u;
}

float GetTimeScale() const
{
return timeScale->value;
}

std::uint32_t GetYear() const noexcept
{
return gameYear ? static_cast<std::uint32_t>(gameYear->value) : 77u;
}

// members
TESGlobal* gameYear; // 08
TESGlobal* gameMonth; // 10
TESGlobal* gameDay; // 18
TESGlobal* gameHour; // 20
TESGlobal* gameDaysPassed; // 28
TESGlobal* timeScale; // 30
std::uint32_t midnightsPassed; // 38
float rawDaysPassed; // 3C
};
static_assert(sizeof(Calendar) == 0x40);
}
2 changes: 1 addition & 1 deletion include/RE/D/DetectionState.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "RE/A/AITimeStamp.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"
#include "RE/N/NiRefObject.h"

namespace RE
Expand Down
6 changes: 6 additions & 0 deletions include/RE/IDs.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ namespace RE::ID
inline constexpr REL::ID deallocate{ 34440 };
}

namespace Calendar
{
inline constexpr REL::ID Singleton{ 878435 };
}

namespace ConsoleLog
{
inline constexpr REL::ID Singleton{ 879277 };
Expand Down Expand Up @@ -479,6 +484,7 @@ namespace RE::ID

namespace TES
{
inline constexpr REL::ID GetDeadCount{ 84704 };
inline constexpr REL::ID Singleton{ 881024 };
}

Expand Down
2 changes: 1 addition & 1 deletion include/RE/L/Location.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "RE/B/BSTSmartPointer.h"
#include "RE/N/NiPoint3.h"
#include "RE/N/NiPoint.h"

namespace RE
{
Expand Down
24 changes: 7 additions & 17 deletions include/RE/M/Main.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#pragma once

#include "RE/B/BSTEvent.h"
#include "RE/N/NiSmartPointer.h"
#include "RE/S/SceneGraph.h"

namespace RE
{
class NiAVObject;
class NiCamera;

struct PositionPlayerEvent;

class Main :
Expand All @@ -15,15 +14,6 @@ namespace RE
public:
SF_RTTI_VTABLE(Main);

struct SceneGraphRoot
{
// members
std::byte pad00[0x78]; // 00
NiAVObject* worldCameraRoot; // 78 - NiNode
NiCamera* worldCamera; // 80
};
// static_assert(offsetof(SceneGraphRoot, SceneGraphRoot::worldCamera) == 0x80); // FIXME: clang-cl chokes on this assertion

virtual ~Main(); // 00

// override
Expand All @@ -35,15 +25,15 @@ namespace RE
return *singleton;
}

[[nodiscard]] static SceneGraphRoot* GetWorldRoot()
[[nodiscard]] static SceneGraph* GetWorldRoot()
{
static REL::Relocation<SceneGraphRoot**> worldRoot{ ID::Main::WorldRoot };
return *worldRoot;
static REL::Relocation<SceneGraph**> ptr{ ID::Main::WorldRoot };
return *ptr;
}

[[nodiscard]] static NiCamera* GetWorldRootCamera()
[[nodiscard]] static NiPointer<NiCamera> GetWorldRootCamera()
{
return GetWorldRoot()->worldCamera;
return GetWorldRoot()->camera;
}

// members
Expand Down
Loading

0 comments on commit 4665572

Please sign in to comment.