diff --git a/config/GM8E01_00/symbols.txt b/config/GM8E01_00/symbols.txt index 47a9f76f..1965a351 100644 --- a/config/GM8E01_00/symbols.txt +++ b/config/GM8E01_00/symbols.txt @@ -292,7 +292,7 @@ __dt__Q24rstl43single_ptrFv = .text:0x80010874; __dt__Q27CPlayer19CPlayerStuckTrackerFv = .text:0x800108CC; // type:function size:0x1CC scope:global IsTransparent__7CPlayerCFv = .text:0x80010A98; // type:function size:0x18 scope:global IsEnergyLow__7CPlayerCFRC13CStateManager = .text:0x80010AB0; // type:function size:0x7C scope:global -FinishNewScan__7CPlayerFR13CStateManager = .text:0x80010B2C; // type:function size:0x12C scope:global +UpdateSlideShowUnlocking__7CPlayerFR13CStateManager = .text:0x80010B2C; // type:function size:0x12C scope:global GetAttachedActorStruggle__7CPlayerCFv = .text:0x80010C58; // type:function size:0x8 scope:global StartSamusVoiceSfx__7CPlayerFUssi = .text:0x80010C60; // type:function size:0xD0 scope:global DoPostCameraStuff__7CPlayerFfR13CStateManager = .text:0x80010D30; // type:function size:0x1D4 scope:global @@ -302,7 +302,7 @@ DoSfxEffects__7CPlayerF10CSfxHandle = .text:0x8001118C; // type:function size:0x UpdatePhazonDamage__7CPlayerFfR13CStateManager = .text:0x800111D4; // type:function size:0x578 scope:global __dt__17CCollidableSphereFv = .text:0x8001174C; // type:function size:0x5C scope:global __dt__19CCollisionPrimitiveFv = .text:0x800117A8; // type:function size:0x48 scope:global -UpdatePhazonCameraShake__7CPlayerFfR13CStateManager = .text:0x800117F0; // type:function size:0x154 scope:global +UpdateEnvironmentDamageCameraShake__7CPlayerFfR13CStateManager = .text:0x800117F0; // type:function size:0x154 scope:global DecrementEnvironmentDamage__7CPlayerFv = .text:0x80011944; // type:function size:0x18 scope:global IncrementEnvironmentDamage__7CPlayerFv = .text:0x8001195C; // type:function size:0x24 scope:global DoPreThink__7CPlayerFfR13CStateManager = .text:0x80011980; // type:function size:0x84 scope:global diff --git a/config/GM8E01_01/symbols.txt b/config/GM8E01_01/symbols.txt index 93f332fe..e485b8ec 100644 --- a/config/GM8E01_01/symbols.txt +++ b/config/GM8E01_01/symbols.txt @@ -292,7 +292,7 @@ __dt__Q24rstl43single_ptrFv = .text:0x800108F0; __dt__Q27CPlayer19CPlayerStuckTrackerFv = .text:0x80010948; // type:function size:0x1CC scope:global IsTransparent__7CPlayerCFv = .text:0x80010B14; // type:function size:0x18 scope:global IsEnergyLow__7CPlayerCFRC13CStateManager = .text:0x80010B2C; // type:function size:0x7C scope:global -FinishNewScan__7CPlayerFR13CStateManager = .text:0x80010BA8; // type:function size:0x12C scope:global +UpdateSlideShowUnlocking__7CPlayerFR13CStateManager = .text:0x80010BA8; // type:function size:0x12C scope:global GetAttachedActorStruggle__7CPlayerCFv = .text:0x80010CD4; // type:function size:0x8 scope:global StartSamusVoiceSfx__7CPlayerFUssi = .text:0x80010CDC; // type:function size:0xD0 scope:global DoPostCameraStuff__7CPlayerFfR13CStateManager = .text:0x80010DAC; // type:function size:0x1D4 scope:global @@ -302,7 +302,7 @@ DoSfxEffects__7CPlayerF10CSfxHandle = .text:0x80011208; // type:function size:0x UpdatePhazonDamage__7CPlayerFfR13CStateManager = .text:0x80011250; // type:function size:0x578 scope:global __dt__17CCollidableSphereFv = .text:0x800117C8; // type:function size:0x5C scope:global __dt__19CCollisionPrimitiveFv = .text:0x80011824; // type:function size:0x48 scope:global -UpdatePhazonCameraShake__7CPlayerFfR13CStateManager = .text:0x8001186C; // type:function size:0x154 scope:global +UpdateEnvironmentDamageCameraShake__7CPlayerFfR13CStateManager = .text:0x8001186C; // type:function size:0x154 scope:global DecrementEnvironmentDamage__7CPlayerFv = .text:0x800119C0; // type:function size:0x18 scope:global IncrementEnvironmentDamage__7CPlayerFv = .text:0x800119D8; // type:function size:0x24 scope:global DoPreThink__7CPlayerFfR13CStateManager = .text:0x800119FC; // type:function size:0x84 scope:global diff --git a/config/GM8E01_48/symbols.txt b/config/GM8E01_48/symbols.txt index 79bb3de1..ffa48253 100644 --- a/config/GM8E01_48/symbols.txt +++ b/config/GM8E01_48/symbols.txt @@ -292,7 +292,7 @@ __dt__Q24rstl43single_ptrFv = .text:0x800108E8; __dt__Q27CPlayer19CPlayerStuckTrackerFv = .text:0x80010940; // type:function size:0x1CC IsTransparent__7CPlayerCFv = .text:0x80010B0C; // type:function size:0x18 IsEnergyLow__7CPlayerCFRC13CStateManager = .text:0x80010B24; // type:function size:0x7C -FinishNewScan__7CPlayerFR13CStateManager = .text:0x80010BA0; // type:function size:0x12C +UpdateSlideShowUnlocking__7CPlayerFR13CStateManager = .text:0x80010BA0; // type:function size:0x12C GetAttachedActorStruggle__7CPlayerCFv = .text:0x80010CCC; // type:function size:0x8 StartSamusVoiceSfx__7CPlayerFUssi = .text:0x80010CD4; // type:function size:0xD0 DoPostCameraStuff__7CPlayerFfR13CStateManager = .text:0x80010DA4; // type:function size:0x1D4 @@ -302,7 +302,7 @@ DoSfxEffects__7CPlayerF10CSfxHandle = .text:0x80011200; // type:function size:0x UpdatePhazonDamage__7CPlayerFfR13CStateManager = .text:0x80011248; // type:function size:0x578 __dt__17CCollidableSphereFv = .text:0x800117C0; // type:function size:0x5C __dt__19CCollisionPrimitiveFv = .text:0x8001181C; // type:function size:0x48 -UpdatePhazonCameraShake__7CPlayerFfR13CStateManager = .text:0x80011864; // type:function size:0x154 +UpdateEnvironmentDamageCameraShake__7CPlayerFfR13CStateManager = .text:0x80011864; // type:function size:0x154 DecrementEnvironmentDamage__7CPlayerFv = .text:0x800119B8; // type:function size:0x18 IncrementEnvironmentDamage__7CPlayerFv = .text:0x800119D0; // type:function size:0x24 DoPreThink__7CPlayerFfR13CStateManager = .text:0x800119F4; // type:function size:0x84 diff --git a/include/MetaRender/CCubeRenderer.hpp b/include/MetaRender/CCubeRenderer.hpp index 6cc73387..3d429073 100644 --- a/include/MetaRender/CCubeRenderer.hpp +++ b/include/MetaRender/CCubeRenderer.hpp @@ -1,6 +1,7 @@ #ifndef _CCUBERENDERER #define _CCUBERENDERER +#include "Kyoto/Math/CPlane.hpp" #include "types.h" #include @@ -96,7 +97,7 @@ public: float zfar) override; void SetClippingPlanes(const CFrustumPlanes&) override; void SetViewport(int left, int right, int width, int height) override; - void SetDepthReadWrite(bool read, bool update) override; + void SetDepthReadWrite(const bool read, const bool update) override; void SetBlendMode_AdditiveAlpha() override; void SetBlendMode_AlphaBlended() override; void SetBlendMode_NoColorWrite() override; @@ -144,9 +145,11 @@ public: void AllocatePhazonSuitMaskTexture(); void SetupRendererStates(bool depthWrite); void SetupCGraphicsStates(); + void DrawRenderBucketsDebug(); void SetRequestRGBA6(bool req) { x318_26_requestRGBA6 = req; } CTexture* GetRealReflection(); + const CPlane& GetViewPlane() const { return xb0_viewPlane; } private: CResFactory& x8_factory; diff --git a/include/MetaRender/IRenderer.hpp b/include/MetaRender/IRenderer.hpp index 8c39b3a9..577042d6 100644 --- a/include/MetaRender/IRenderer.hpp +++ b/include/MetaRender/IRenderer.hpp @@ -82,7 +82,7 @@ public: float zfar); virtual void SetClippingPlanes(const CFrustumPlanes&); virtual void SetViewport(int left, int right, int width, int height); - virtual void SetDepthReadWrite(bool read, bool update); + virtual void SetDepthReadWrite(const bool read, const bool update); virtual void SetBlendMode_AdditiveAlpha(); virtual void SetBlendMode_AlphaBlended(); virtual void SetBlendMode_NoColorWrite(); diff --git a/src/MetaRender/CCubeRenderer.cpp b/src/MetaRender/CCubeRenderer.cpp index 402a61f1..890be411 100644 --- a/src/MetaRender/CCubeRenderer.cpp +++ b/src/MetaRender/CCubeRenderer.cpp @@ -219,6 +219,7 @@ void CCubeRenderer::GenerateSphereRampTex() { x220_sphereRamp.UnLock(); } +// TODO non-matching void CCubeRenderer::LoadThermoPalette() { x288_thermalPalette.Lock(); TLockedToken< CTexture > token = xc_objStore.GetObj("TXTR_ThermoPalette"); @@ -307,6 +308,7 @@ void CCubeRenderer::BeginScene() { CGraphics::SetDepthWriteMode(true, kE_LEqual, true); CGraphics::SetBlendMode(kBM_Blend, kBF_SrcAlpha, kBF_InvSrcAlpha, kLO_Clear); #if NONMATCHING + // TODO: double check this float aspect = static_cast< float >(width) / static_cast< float >(height); #else float aspect = 1.3333334f; @@ -346,25 +348,25 @@ void CCubeRenderer::EndScene() { void CCubeRenderer::AddParticleGen(const CParticleGen& gen) { AUTO(bounds, gen.GetBounds()); if (bounds) { - CVector3f closestPoint = bounds->ClosestPointAlongVector(xb0_viewPlane.GetNormal()); + CVector3f closestPoint = bounds->ClosestPointAlongVector(GetViewPlane().GetNormal()); Buckets::Insert(closestPoint, *bounds, kDT_Particle, static_cast< const void* >(&gen), - xb0_viewPlane, 0); + GetViewPlane(), 0); } } void CCubeRenderer::AddParticleGen(const CParticleGen& gen, const CVector3f& pos, const CAABox& bounds) { - Buckets::Insert(pos, bounds, kDT_Particle, static_cast< const void* >(&gen), xb0_viewPlane, 0); + Buckets::Insert(pos, bounds, kDT_Particle, static_cast< const void* >(&gen), GetViewPlane(), 0); } void CCubeRenderer::AddPlaneObject(const void* obj, const CAABox& aabb, const CPlane& plane, int type) { static const CVector3f sOptimalPlane(0.f, 0.f, 1.f); - CVector3f closestPoint = aabb.ClosestPointAlongVector(xb0_viewPlane.GetNormal()); - float closestDist = xb0_viewPlane.GetHeight(closestPoint); - CVector3f furthestPoint = aabb.FurthestPointAlongVector(xb0_viewPlane.GetNormal()); - float furthestDist = xb0_viewPlane.GetHeight(furthestPoint); + CVector3f closestPoint = aabb.ClosestPointAlongVector(GetViewPlane().GetNormal()); + float closestDist = GetViewPlane().GetHeight(closestPoint); + CVector3f furthestPoint = aabb.FurthestPointAlongVector(GetViewPlane().GetNormal()); + float furthestDist = GetViewPlane().GetHeight(furthestPoint); if (closestDist < 0.f && furthestDist < 0.f) { return; } @@ -398,7 +400,7 @@ void CCubeRenderer::AddDrawable(const void* obj, const CVector3f& pos, const CAA if (sorting == IRenderer::kDS_UnsortedCallback) { xa8_drawableCallback(obj, xac_drawableCallbackUserData, mode); } else { - Buckets::Insert(pos, aabb, EDrawableType(mode + 2), obj, xb0_viewPlane, 0); + Buckets::Insert(pos, aabb, EDrawableType(mode + 2), obj, GetViewPlane(), 0); } } @@ -424,6 +426,8 @@ void CCubeRenderer::SetupCGraphicsStates() { CCubeMaterial::EnsureTevsDirect(); } +void CCubeRenderer::DrawRenderBucketsDebug() {} + namespace Renderer { IRenderer* AllocateRenderer(IObjectStore& objStore, COsContext& osContext, CMemorySys& memorySys, CResFactory& resFactory) { @@ -498,14 +502,14 @@ void CCubeRenderer::EndPrimitive() { void CCubeRenderer::SetAmbientColor(const CColor& color) { CGraphics::SetAmbientColor(color); } -void CCubeRenderer::SetPerspective(float fovy, float aspect, float znear, float zfar) { - CGraphics::SetPerspective(fovy, aspect, znear, zfar); -} - void CCubeRenderer::SetPerspective(float fovy, float width, float height, float znear, float zfar) { CGraphics::SetPerspective(fovy, width / height, znear, zfar); } +void CCubeRenderer::SetPerspective(float fovy, float aspect, float znear, float zfar) { + CGraphics::SetPerspective(fovy, aspect, znear, zfar); +} + rstl::pair< CVector2f, CVector2f > CCubeRenderer::SetViewportOrtho(bool centered, float znear, float zfar) { const CViewport& vp = CGraphics::GetViewport(); diff --git a/src/MetroidPrime/Cameras/CCameraFilter.cpp b/src/MetroidPrime/Cameras/CCameraFilter.cpp index 8acf2535..49aa5ee1 100644 --- a/src/MetroidPrime/Cameras/CCameraFilter.cpp +++ b/src/MetroidPrime/Cameras/CCameraFilter.cpp @@ -1,3 +1,5 @@ +#include "Kyoto/Math/CVector2f.hpp" +#include "Kyoto/Math/CVector3f.hpp" #include "MetroidPrime/Cameras/CCameraFilterPass.hpp" #include "Kyoto/Graphics/CGraphics.hpp"