Skip to content

Commit

Permalink
Misc RE
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 committed May 16, 2024
1 parent 3aa81fe commit 31c4fc4
Show file tree
Hide file tree
Showing 25 changed files with 310 additions and 127 deletions.
2 changes: 2 additions & 0 deletions cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ set(SOURCES
include/RE/G/GWaitCondition.h
include/RE/G/GWaitable.h
include/RE/G/GameSettingCollection.h
include/RE/G/GarbageCollector.h
include/RE/G/GiftMenu.h
include/RE/G/GlobalLocations.h
include/RE/G/GlobalPaths.h
Expand Down Expand Up @@ -1451,6 +1452,7 @@ set(SOURCES
include/RE/T/TESAmmo.h
include/RE/T/TESAttackDamageForm.h
include/RE/T/TESBipedModelForm.h
include/RE/T/TESBookReadEvent.h
include/RE/T/TESBoundAnimObject.h
include/RE/T/TESBoundObject.h
include/RE/T/TESCamera.h
Expand Down
4 changes: 2 additions & 2 deletions include/RE/A/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ namespace RE
bool RemoveSpell(SpellItem* a_spell);
std::int32_t RequestDetectionLevel(Actor* a_target, DETECTION_PRIORITY a_priority = DETECTION_PRIORITY::kNormal);
bool SetDefaultOutfit(BGSOutfit* a_outfit, bool a_update3D);
void SetHeading(float a_angle); // SetRotationZ
void SetLifeState(ACTOR_LIFE_STATE a_lifeState);
void SetLooking(float a_angle); // SetRotationX
bool SetSleepOutfit(BGSOutfit* a_outfit, bool a_update3D);
void SetRotationX(float a_angle);
void SetRotationZ(float a_angle);
void StealAlarm(TESObjectREFR* a_ref, TESForm* a_object, std::int32_t a_num, std::int32_t a_total, TESForm* a_owner, bool a_allowWarning);
void StopAlarmOnActor();
void StopInteractingQuick(bool a_unk02);
Expand Down
13 changes: 7 additions & 6 deletions include/RE/B/BSSceneGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace RE
{
class NiCamera;
class NiVisibleArray;

class BSSceneGraph : public NiNode
{
Expand All @@ -23,12 +24,12 @@ namespace RE
virtual void SetViewDistanceBasedOnFrameRate(float a_frameRate); // 40

// members
NiPointer<NiCamera> camera; // 128
std::uint64_t unk130; // 130 - 0x18
bool unk138; // 138
std::uint8_t pad139; // 139
std::uint16_t pad13A; // 13A
float cameraFOV; // 13C
NiPointer<NiCamera> camera; // 128
NiVisibleArray* visArray; // 130 - 0x18
bool menuSceneGraph; // 138
std::uint8_t pad139; // 139
std::uint16_t pad13A; // 13A
float cameraFOV; // 13C
};
static_assert(sizeof(BSSceneGraph) == 0x140);
}
28 changes: 15 additions & 13 deletions include/RE/B/BookMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ namespace RE
{
struct BSAnimationGraphEvent;

class BSGeometry;
class ExtraDataList;
class NiAVObject;
class NiSourceTexture;
class TESObjectBOOK;
class TESObjectREFR;

Expand Down Expand Up @@ -48,19 +50,19 @@ namespace RE
static void OpenBookMenu(const BSString& a_description, const ExtraDataList* a_extraList, TESObjectREFR* a_ref, TESObjectBOOK* a_book, const NiPoint3& a_pos, const NiMatrix3& a_rot, float a_scale, bool a_useDefaultPos);

// members
BSTArray<BSScaleformExternalTexture> bookTextures; // 50
GPtr<GFxMovieView> book; // 68
NiPointer<NiAVObject> book3D; // 70
std::uint32_t unk78; // 78
std::uint32_t pad7C; // 7C
std::uint64_t unk80; // 80
void* unk88; // 88 - smart ptr
std::uint16_t unk90; // 90
std::uint16_t unk92; // 92
bool closeMenu; // 94
bool isNote; // 95
std::uint8_t unk96; // 96
std::uint8_t pad97; // 97
BSTArray<BSScaleformExternalTexture> bookTextures; // 50
GPtr<GFxMovieView> book; // 68
NiPointer<NiAVObject> bookModel; // 70
std::uint32_t numRenderTargets; // 78
std::uint32_t pad7C; // 7C
NiSourceTexture* pageTexture; // 80
NiPointer<BSGeometry> pageTextGeo; // 88 - smart ptr
std::uint16_t unk90; // 90
std::uint16_t startAnimating; // 92
bool closeMenu; // 94
bool isNote; // 95
bool bookInitialized; // 96
std::uint8_t pad97; // 97
};
static_assert(sizeof(BookMenu) == 0x98);
}
9 changes: 9 additions & 0 deletions include/RE/C/ConcreteFormFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ namespace RE
{
return static_cast<ConcreteFormFactory<T, T::FORMTYPE>*>(GetFormFactoryByType(T::FORMTYPE));
}

template <class T>
[[nodiscard]] T* IFormFactory::Create()
{
auto factory = IFormFactory::GetConcreteFormFactoryByType<T>();
auto form = factory ? factory->Create() : nullptr;

return form ? form->As<T>() : nullptr;
}
}
69 changes: 69 additions & 0 deletions include/RE/G/GarbageCollector.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once

#include "RE/B/BSAtomic.h"
#include "RE/B/BSPointerHandle.h"
#include "RE/B/BSTArray.h"
#include "RE/B/BSTEvent.h"
#include "RE/B/BSTSingleton.h"
#include "RE/N/NiSmartPointer.h"

namespace RE
{
class BSAnimationGraphManager;
class BSCloneReserver;
class BSTempEffect;
class BipedAnim;
class NavMesh;
class NiAVObject;
class QueuedFile;
class TESBoundObject;
class TESObjectREFR;

struct GarbageCollection
{
public:
// members
BSSpinLock lock; // 00
BSTArray<BSTSmartPointer<BSAnimationGraphManager>> animations; // 08
BSTArray<TESBoundObject*> baseObjects; // 20
BSTArray<ObjectRefHandle> objectHandles; // 38
BSTArray<NiPointer<NiAVObject>> actorNodes; // 50
BSTArray<BSTSmartPointer<BipedAnim>> bipedAnims; // 68
BSTArray<NiPointer<BSTempEffect>> tempEffects; // 80
BSTArray<NiPointer<QueuedFile>> queuedFiles; // 98
BSTArray<NiPointer<BSCloneReserver>> cloneReservers; // B0
BSTArray<BSTSmartPointer<NavMesh>> navMeshes; // C8
bool deleting; // E0
};
static_assert(sizeof(GarbageCollection) == 0xE8);

class GarbageCollector :
public BSTSingletonSDM<GarbageCollector>,
public BSTEventSink<PositionPlayerEvent>
{
public:
inline static constexpr auto RTTI = RTTI_GarbageCollector;

~GarbageCollector() override; // 00

// override (BSTEventSink<PositionPlayerEvent>)
BSEventNotifyControl ProcessEvent(const PositionPlayerEvent* a_event, BSTEventSource<PositionPlayerEvent>* a_eventSource) override; // 01

static GarbageCollector* GetSingleton()
{
REL::Relocation<GarbageCollector**> singleton{ RELOCATION_ID(514180, 400329) };
return *singleton;
}

void Add(TESObjectREFR* a_object, bool a_removeFromCell)
{
using func_t = decltype(&GarbageCollector::Add);
REL::Relocation<func_t> func{ RELOCATION_ID(35492, 36459) };
return func(this, a_object, a_removeFromCell);
}

// members
GarbageCollection* garbageCollection; // 10
};
static_assert(sizeof(GarbageCollector) == 0x18);
}
2 changes: 2 additions & 0 deletions include/RE/I/IFormFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ namespace RE
static ConcreteFormFactory<T, T::FORMTYPE>* GetConcreteFormFactoryByType();

TESForm* Create();
template <class T>
static T* Create();
};
static_assert(sizeof(IFormFactory) == 0x8);
}
10 changes: 6 additions & 4 deletions include/RE/I/Inventory3DManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ namespace RE

static Inventory3DManager* GetSingleton();

void UpdateItem3D(InventoryEntryData* a_objDesc);
void UpdateMagic3D(TESForm* a_form, std::uint32_t a_arg2);
void Clear3D();
void Render();
void Begin3D(INTERFACE_LIGHT_SCHEME a_scheme);
void End3D();
void LoadInventoryItem(InventoryEntryData* a_objDesc);
void LoadInventoryItem(TESBoundObject* a_object, ExtraDataList* a_extraDataList);
void Render();
bool ToggleItemZoom();
void UnloadInventoryItem();

// members
std::uint8_t unk011; // 011
Expand Down
4 changes: 4 additions & 0 deletions include/RE/M/MagicSystem.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#pragma once

#include "RE/B/BSString.h"

namespace RE
{
class BGSSoundDescriptorForm;
class MagicItem;

namespace MagicSystem
{
Expand Down Expand Up @@ -92,5 +95,6 @@ namespace RE
const char* GetCannotCastString(CannotCastReason a_reason);
float GetMagicCasterTargetUpdateInterval();
BGSSoundDescriptorForm* GetMagicFailureSound(SpellType a_type);
void GetMagicItemDescription(BSString& a_out, MagicItem* a_magicItem, const char* a_beginTagFormat, const char* a_endTagFormat);
}
}
4 changes: 2 additions & 2 deletions include/RE/M/MapMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace RE
TESWorldSpace* worldSpace; // 30538
GFxValue unk30540; // 30540
std::uint32_t unk30558; // 30558
NiPoint3 unk3055C; // 3055C
NiPoint3 unk30568; // 30568
NiPoint3 cameraPickOrigin; // 3055C
NiPoint3 cameraPickDirection; // 30568
BSSoundHandle unk30574; // 30574
std::uint64_t unk30580; // 30580
std::uint64_t unk30588; // 30588
Expand Down
3 changes: 2 additions & 1 deletion include/RE/M/MiddleHighProcessData.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace RE
class bhkCharacterController;
class bhkRagdollPenetrationUtil;
class BSAnimationGraphManager;
class BSCloneReserver;
class BSFaceGenAnimationData;
class BSFaceGenNiNode;
class BSLightingShaderProperty;
Expand Down Expand Up @@ -185,7 +186,7 @@ namespace RE
InventoryEntryData* rightHand; // 260
InventoryEntryData* bothHands; // 268
NiPointer<QueuedFile> bodyPartPreload; // 270
void* unk278; // 278
NiPointer<BSCloneReserver> unk278; // 278
TESIdleForm* lastIdlePlayed; // 280
AIPerkData* perkData; // 288
std::uint32_t unk290; // 290
Expand Down
3 changes: 2 additions & 1 deletion include/RE/N/NiAVObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "RE/B/BSFixedString.h"
#include "RE/B/BSShaderMaterial.h"
#include "RE/C/CollisionLayers.h"
#include "RE/H/hkpMotion.h"
#include "RE/N/NiBound.h"
#include "RE/N/NiObjectNET.h"
#include "RE/N/NiSmartPointer.h"
Expand Down Expand Up @@ -126,7 +127,7 @@ namespace RE
void SetAppCulled(bool a_cull);
void SetCollisionLayer(COL_LAYER a_collisionLayer);
void SetCollisionLayerAndGroup(COL_LAYER a_collisionLayer, std::uint32_t a_group);
bool SetMotionType(std::uint32_t a_motionType, bool a_arg2 = true, bool a_arg3 = false, bool a_allowActivate = true);
bool SetMotionType(hkpMotion::MotionType a_motionType, bool a_recurse = true, bool a_force = false, bool a_allowActivate = true);
bool SetProjectedUVData(const NiColorA& a_projectedUVParams, const NiColor& a_projectedUVColor, bool a_isSnow);
void TintScenegraph(const NiColorA& a_color);
void Update(NiUpdateData& a_data);
Expand Down
5 changes: 2 additions & 3 deletions include/RE/N/NiCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ namespace RE
void UpdateWorldBound() override; // 2F - { return; }
void UpdateWorldData(NiUpdateData* a_data) override; // 30

bool WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance);

static bool BoundInFrustum(const NiBound& a_bound, NiCamera* a_camera);
static bool NodeInFrustum(NiAVObject* a_node, NiCamera* a_camera);
static bool PointInFrustum(const NiPoint3& a_point, NiCamera* a_camera, float a_radius);

bool WindowPointToRay(std::int32_t a_x, std::int32_t a_y, NiPoint3& a_origin, NiPoint3& a_dir, float a_windowWidth, float a_windowHeight);
bool WorldPtToScreenPt3(const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance);
static bool WorldPtToScreenPt3(const float a_matrix[4][4], const NiRect<float>& a_port, const NiPoint3& a_point, float& a_xOut, float& a_yOut, float& a_zOut, float a_zeroTolerance);

// members
Expand Down
15 changes: 7 additions & 8 deletions include/RE/R/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ namespace RE

struct ScreenSize
{
uint32_t width; // 00
uint32_t height; // 04
std::uint32_t width; // 00
std::uint32_t height; // 04
};
static_assert(sizeof(ScreenSize) == 0x8);

Expand Down Expand Up @@ -118,17 +118,16 @@ namespace RE
[[nodiscard]] static REX::W32::ID3D11Device* GetDevice();
[[nodiscard]] static RendererWindow* GetCurrentRenderWindow();

// members
std::uint64_t unk00; // 00
std::uint64_t unk08; // 08
RendererData data; // 10

private:
void Begin(std::uint32_t windowID);
void Init(RendererInitOSData* a_data, ApplicationWindowProperties* a_windowProps, REX::W32::HWND a_window);
void End();
void Shutdown();

public:
// members
std::uint64_t unk00; // 00
std::uint64_t unk08; // 08
RendererData data; // 10
};
}
}
Loading

0 comments on commit 31c4fc4

Please sign in to comment.