diff --git a/Editor/ViewManager.cpp b/Editor/ViewManager.cpp index 553b2a88e..cbb77b3c7 100644 --- a/Editor/ViewManager.cpp +++ b/Editor/ViewManager.cpp @@ -72,6 +72,19 @@ void ViewManager::TestGameView::think() { auto pt = std::div(igt, 3600); overlayText += fmt::format(FMT_STRING("PlayTime: {:02d}:{:02d}:{:02d}.{:03d}\n"), pt.quot, pt.rem / 60, pt.rem % 60, ms); + if (g_StateManager->GetCurrentArea() != nullptr) { + if (m_currentRoom != g_StateManager->GetCurrentArea()) { + m_currentRoom = static_cast(g_StateManager->GetCurrentArea()); + m_lastRoomTime = igt - m_currentRoomStart; + m_currentRoomStart = igt; + } + double currentRoomTime = igt - m_currentRoomStart; + u32 curFrames = std::round(u32(currentRoomTime * 60)); + u32 lastFrames = std::round(u32(m_lastRoomTime * 60)); + overlayText += fmt::format(FMT_STRING("Room Time:{:8.3f}/{:6d}| Last Room:{:8.3f}/{:6d}\n"), + currentRoomTime, curFrames, + m_lastRoomTime, lastFrames); + } } if (g_StateManager->Player() && m_cvarCommons.m_debugOverlayPlayerInfo->toBoolean()) { diff --git a/Editor/ViewManager.hpp b/Editor/ViewManager.hpp index d37a4213c..a4f226860 100644 --- a/Editor/ViewManager.hpp +++ b/Editor/ViewManager.hpp @@ -59,6 +59,9 @@ class ViewManager final : public specter::IViewManager { ViewManager& m_vm; std::unique_ptr m_debugText; hecl::CVarCommons m_cvarCommons; + const void* m_currentRoom = nullptr; + double m_lastRoomTime = 0.f; + double m_currentRoomStart = 0.f; public: TestGameView(ViewManager& vm, specter::ViewResources& res, specter::View& parent, hecl::CVarManager& cvarMgr) diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 82f7e854a..6bb077fa3 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -2845,4 +2845,11 @@ void CStateManager::sub_80044098(const CCollisionResponseData& colRespData, cons TUniqueId uid, const CWeaponMode& weaponMode, u32 w1, u8 thermalFlags) { // TODO implement } + +const CGameArea* CStateManager::GetCurrentArea() const { + if (x850_world == nullptr || x850_world->GetCurrentAreaId() == kInvalidAreaId) { + return nullptr; + } + return x850_world->GetAreaAlways(x850_world->GetCurrentAreaId()); +}; } // namespace urde diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 52ee72a08..953a95140 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -464,6 +464,7 @@ public: void sub_80044098(const CCollisionResponseData& colRespData, const CRayCastResult& rayCast, TUniqueId uid, const CWeaponMode& weaponMode, u32 w1, u8 thermalFlags); + const CGameArea* GetCurrentArea() const; void SetWarping(bool warp) { m_warping = warp; } }; } // namespace urde diff --git a/hecl b/hecl index d2e629b1e..2b75ffed4 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit d2e629b1e90b8c0f7b2b44ae065941b18fe3293f +Subproject commit 2b75ffed470e6f9287da83bca72039ab2598c261 diff --git a/nod b/nod index 2783337c3..d53d67703 160000 --- a/nod +++ b/nod @@ -1 +1 @@ -Subproject commit 2783337c36bacdf832f78182340e4aa6063dece9 +Subproject commit d53d6770386b5944a4e65251bde30596332bdc2c