Skip to content

Commit

Permalink
feat: Selectable entity for component view debug, hudmenuutils.
Browse files Browse the repository at this point in the history
  • Loading branch information
Force67 committed Jan 23, 2022
1 parent 00152a9 commit 5b2e063
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 250 deletions.
2 changes: 1 addition & 1 deletion Code/client/Games/Primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct GamePtr
return *this;
}

GamePtr& operator=(GamePtr<T>&& acRhs)
GamePtr& operator=(GamePtr<T>&& aRhs)
{
std::swap(m_pPointer, aRhs.m_pPointer);

Expand Down
6 changes: 6 additions & 0 deletions Code/client/Games/References.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ void TESObjectREFR::LockChange() noexcept
ThisCall(RealLockChange, this);
}

const float TESObjectREFR::GetHeight() noexcept
{
auto boundMax = GetBoundMax();
return boundMax.z - GetBoundMin().z;
}

bool ActorState::SetWeaponDrawn(bool aDraw) noexcept
{
TP_THIS_FUNCTION(TSetWeaponState, bool, ActorState, bool aDraw);
Expand Down
26 changes: 26 additions & 0 deletions Code/client/Games/Skyrim/Interface/Menus/HUDMenuUtils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

#include <Games/Skyrim/Interface/Menus/HUDMenuUtils.h>
#include <Games/Skyrim/NetImmerse/NiCamera.h>

namespace HUDMenuUtils
{
static float (*CameraWorldToCam)[4][4] = nullptr;
static const NiRect<float>* CameraPort = nullptr;

bool WorldPtToScreenPt3(const NiPoint3& arWorldPt, NiPoint3& arScreenPt)
{
return NiCamera::WorldPtToScreenPt3(reinterpret_cast<float*>(CameraWorldToCam), CameraPort, &arWorldPt,
&arScreenPt.x, &arScreenPt.y, &arScreenPt.z, 1e-5f);
}
} // namespace HUDMenuUtils

static TiltedPhoques::Initializer s_Init([]() {
POINTER_FALLOUT4(float[4][4], s_matrix, 0x145A66AA0 - 0x140000000);
POINTER_FALLOUT4(NiRect<float>, s_port, 0x145A66B30 - 0x140000000);

POINTER_SKYRIMSE(float[4][4], s_matrix, 0x142FE75F0 - 0x140000000);
POINTER_SKYRIMSE(NiRect<float>, s_port, 0x142FE8B98 - 0x140000000);

HUDMenuUtils::CameraWorldToCam = s_matrix.Get();
HUDMenuUtils::CameraPort = s_port.Get();
});
6 changes: 6 additions & 0 deletions Code/client/Games/Skyrim/Interface/Menus/HUDMenuUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

namespace HUDMenuUtils
{
bool WorldPtToScreenPt3(const NiPoint3& arWorldPt, NiPoint3& arScreenPt);
}
4 changes: 2 additions & 2 deletions Code/client/Games/Skyrim/NetImmerse/NiCamera.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <NetImmerse/NiCamera.h>
#include <TiltedOnlinePCH.h>

using TWorldPtToScreenPt3 = bool(float*, const NiRect<float>*, NiPoint3*, float*, float*, float*, float);
using TWorldPtToScreenPt3 = bool(float*, const NiRect<float>*, const NiPoint3*, float*, float*, float*, float);
static TWorldPtToScreenPt3* s_WorldPtToScreenPt3;

bool NiCamera::WorldPtToScreenPt3(const NiPoint3& in, NiPoint3& out, float tolerance)
Expand All @@ -12,7 +12,7 @@ bool NiCamera::WorldPtToScreenPt3(const NiPoint3& in, NiPoint3& out, float toler
return ThisCall(s_w2s, this, &in, &out.x, &out.y, &out.y, tolerance);
}

bool NiCamera::WorldPtToScreenPt3(float* matrix, const NiRect<float>* port, NiPoint3* p_in, float* x_out, float* y_out,
bool NiCamera::WorldPtToScreenPt3(float* matrix, const NiRect<float>* port, const NiPoint3* p_in, float* x_out, float* y_out,
float* z_out, float zeroTolerance)
{
return s_WorldPtToScreenPt3(matrix, port, p_in, x_out, y_out, z_out, zeroTolerance);
Expand Down
4 changes: 2 additions & 2 deletions Code/client/Games/Skyrim/NetImmerse/NiCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ struct NiCamera : public NiAVObject

bool WorldPtToScreenPt3(const NiPoint3& in, NiPoint3& out, float zeroTolerance = 1e-5f);

static bool WorldPtToScreenPt3(float* matrix, const NiRect<float>* port, NiPoint3* p_in, float* x_out, float* y_out,
float* z_out, float zeroTolerance = 1e-5f);
static bool WorldPtToScreenPt3(float* matrix, const NiRect<float>* port, const NiPoint3* p_in, float* x_out,
float* y_out, float* z_out, float zeroTolerance = 1e-5f);

NiNode* parent;
NiAVObject* unk;
Expand Down
2 changes: 2 additions & 0 deletions Code/client/Games/Skyrim/TESObjectREFR.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ struct TESObjectREFR : TESForm
Lock* CreateLock() noexcept;
void LockChange() noexcept;

const float GetHeight() noexcept;

BSHandleRefObject handleRefObject;
uintptr_t unk1C;
IAnimationGraphManagerHolder animationGraphHolder;
Expand Down
21 changes: 5 additions & 16 deletions Code/client/Services/Debug/TestService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,24 +236,15 @@ void TestService::OnDraw() noexcept
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Engine"))
{
ImGui::MenuItem("Open Rage Tab", NULL, nullptr);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Player"))
{
DrawPlayerDebugView();
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Entities"))
{
ImGui::MenuItem("Open Rage Tab", NULL, nullptr);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Components"))
{
DrawComponentDebugView();
ImGui::MenuItem("Show component list", nullptr, &m_bToggleComponentWindow);
ImGui::MenuItem("Show selected component in world", nullptr, &m_bDrawComponentInScreenSpace);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Containers"))
Expand All @@ -266,13 +257,11 @@ void TestService::OnDraw() noexcept
ImGui::MenuItem("Toggle anim window", nullptr, &g_EnableAnimWindow);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Misc"))
{
ImGui::MenuItem("Open Rage Tab", NULL, nullptr);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();

if (g_EnableAnimWindow)
DrawAnimDebugView();

if (m_bToggleComponentWindow)
DrawComponentDebugView();
}
Loading

0 comments on commit 5b2e063

Please sign in to comment.