diff --git a/Runtime/Graphics/CGraphics.cpp b/Runtime/Graphics/CGraphics.cpp index 6c80656e5..d868b0028 100644 --- a/Runtime/Graphics/CGraphics.cpp +++ b/Runtime/Graphics/CGraphics.cpp @@ -386,7 +386,8 @@ void CGraphics::SetDepthRange(float znear, float zfar) } CTimeProvider* CGraphics::g_ExternalTimeProvider = nullptr; -float CGraphics::g_DefaultSeconds; +float CGraphics::g_DefaultSeconds = 0.f; +u32 CGraphics::g_RenderTimings = 0; float CGraphics::GetSecondsMod900() { @@ -395,6 +396,12 @@ float CGraphics::GetSecondsMod900() return g_ExternalTimeProvider->x0_currentTime; } +void CGraphics::TickRenderTimings() +{ + g_RenderTimings++; + g_DefaultSeconds = float(g_RenderTimings) / 60.f; +} + boo::IGraphicsDataFactory::Platform CGraphics::g_BooPlatform = boo::IGraphicsDataFactory::Platform::Null; boo::IGraphicsDataFactory* CGraphics::g_BooFactory = nullptr; boo::IGraphicsCommandQueue* CGraphics::g_BooMainCommandQueue = nullptr; diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 4e0342ead..fbefc62ec 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -154,6 +154,7 @@ enum class ETexelFormat class CGraphics { public: + struct CProjectionState { bool x0_persp; @@ -193,6 +194,7 @@ public: static void SetDepthWriteMode(bool test, ERglEnum comp, bool write); static void SetBlendMode(ERglBlendMode, ERglBlendFactor, ERglBlendFactor, ERglLogicOp); static void SetCullMode(ERglCullMode); + static void BeginScene(); static void EndScene(); static void SetAlphaCompare(ERglAlphaFunc comp0, u8 ref0, ERglAlphaOp op, ERglAlphaFunc comp1, u8 ref1); static void SetViewPointMatrix(const zeus::CTransform& xf); @@ -221,9 +223,11 @@ public: static CTimeProvider* g_ExternalTimeProvider; static float g_DefaultSeconds; + static u32 g_RenderTimings; static void SetExternalTimeProvider(CTimeProvider* provider) {g_ExternalTimeProvider = provider;} static float GetSecondsMod900(); + static void TickRenderTimings(); static boo::IGraphicsDataFactory::Platform g_BooPlatform; static boo::IGraphicsDataFactory* g_BooFactory; diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index ea59366dd..223ed9358 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -41,6 +41,7 @@ protected: bool xe4_27_ : 1; bool xe4_28_ : 1; bool xe4_29_ : 1; + bool xe4_30_ : 1; bool xe5_0_opaque : 1; bool xe5_26_muted : 1; bool xe5_27_useInSortedLists : 1; @@ -63,6 +64,8 @@ public: const CActorParameters&, TUniqueId); virtual void Accept(IVisitor&) /*= 0*/; + virtual void AddToRenderer(const zeus::CFrustum&, CStateManager&) {} + virtual void Render(CStateManager&) {} virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {} virtual void SetActive(bool active) { diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index 74cabfef5..def94dd27 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -40,6 +40,9 @@ public: const zeus::CAABox&, const SMoverData&, const CActorParameters&, float, float); + void AddToRenderer(const zeus::CFrustum &, CStateManager &){} + void Render(CStateManager& mgr) { CActor::Render(mgr); } + float GetCollisionAccuracyModifier() { return x248_collisionAccuracyModifier; } diff --git a/Runtime/World/CScriptDoor.cpp b/Runtime/World/CScriptDoor.cpp index e0e763667..c9cf79844 100644 --- a/Runtime/World/CScriptDoor.cpp +++ b/Runtime/World/CScriptDoor.cpp @@ -43,6 +43,12 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat { } +void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr) +{ + if (!xe4_30_) + CPhysicsActor::Render(mgr); +} + /* ORIGINAL 0-00 OFFSET: 8007E0BC */ void CScriptDoor::ForceClosed(CStateManager & mgr) { diff --git a/Runtime/World/CScriptDoor.hpp b/Runtime/World/CScriptDoor.hpp index 58ee01cf7..b30825fda 100644 --- a/Runtime/World/CScriptDoor.hpp +++ b/Runtime/World/CScriptDoor.hpp @@ -54,6 +54,9 @@ public: zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const; void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr); + void AddToRenderer(const zeus::CFrustum&, CStateManager& mgr); + zeus::CAABox GetTouchBounds() const {} + void Render(const CStateManager&) {} void ForceClosed(CStateManager&); bool IsConnectedToArea(const CStateManager& mgr, TAreaId area); void OpenDoor(TUniqueId, CStateManager&);