mirror of https://github.com/AxioDL/metaforce.git
Various AutoMapper render fixes
This commit is contained in:
parent
21505e46ce
commit
a914e121ea
|
@ -417,9 +417,42 @@ void CAutoMapper::BeginMapperStateTransition(EAutoMapperState state, const CStat
|
|||
}
|
||||
}
|
||||
|
||||
void CAutoMapper::CompleteMapperStateTransition(const CStateManager&)
|
||||
void CAutoMapper::CompleteMapperStateTransition(const CStateManager& mgr)
|
||||
{
|
||||
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||
TransformRenderStatesUniverseToWorld();
|
||||
|
||||
if (x1c0_nextState == EAutoMapperState::MapScreen)
|
||||
{
|
||||
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||
x24_world->IGetMapWorld()->RecalculateWorldSphere(mwInfo, *x24_world);
|
||||
x1d8_flashTimer = 0.f;
|
||||
x1dc_playerFlashPulse = 0.f;
|
||||
}
|
||||
|
||||
if (x1c0_nextState == EAutoMapperState::MiniMap)
|
||||
{
|
||||
x28_frmeMapScreen = TLockedToken<CGuiFrame>();
|
||||
m_frmeInitialized = false;
|
||||
x2fc_textpane_hint = nullptr;
|
||||
x300_textpane_instructions = nullptr;
|
||||
x304_textpane_instructions1 = nullptr;
|
||||
x308_textpane_instructions2 = nullptr;
|
||||
x2f8_textpane_areaname = nullptr;
|
||||
x30c_basewidget_leftPane = nullptr;
|
||||
x310_basewidget_yButtonPane = nullptr;
|
||||
x314_basewidget_bottomPane = nullptr;
|
||||
SetResLockState(x210_lstick, false);
|
||||
SetResLockState(x25c_cstick, false);
|
||||
SetResLockState(x2a8_ltrigger, false);
|
||||
SetResLockState(x2bc_rtrigger, false);
|
||||
SetResLockState(x2d0_abutton, false);
|
||||
}
|
||||
|
||||
if (x1c0_nextState == EAutoMapperState::MapScreenUniverse && x328_ == 1)
|
||||
LeaveMapScreen(mgr);
|
||||
|
||||
x1bc_state = x1c0_nextState;
|
||||
}
|
||||
|
||||
void CAutoMapper::ResetInterpolationTimer(float t)
|
||||
|
@ -812,7 +845,7 @@ void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, const CStateMa
|
|||
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
||||
if (x1bc_state == EAutoMapperState::MapScreen)
|
||||
{
|
||||
if (input.PA() && !x328_ && HasCurrentMapUniverseWorld())
|
||||
if (input.PA() && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
||||
}
|
||||
else if (x1bc_state == EAutoMapperState::MapScreenUniverse && input.PA())
|
||||
|
@ -981,7 +1014,7 @@ float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) con
|
|||
const IGameArea* area = x24_world->IGetAreaAlways(xa0_curAreaId);
|
||||
const CMapArea* mapa = mw->GetMapArea(xa0_curAreaId);
|
||||
bool oneMiniMapArea = g_tweakAutoMapper->GetShowOneMiniMapArea();
|
||||
for (int i = -1 ; i < (oneMiniMapArea ? 0 : area->IGetNumAttachedAreas()) ; ++i)
|
||||
for (int i = -1 ; i < (oneMiniMapArea ? 0 : int(area->IGetNumAttachedAreas())) ; ++i)
|
||||
{
|
||||
TAreaId aid = i == -1 ? xa0_curAreaId : area->IGetAttachedAreaId(i);
|
||||
const CMapArea* attMapa = mw->GetMapArea(aid);
|
||||
|
@ -1032,7 +1065,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
|||
CheckDummyWorldLoad(mgr);
|
||||
else if (x1e0_hintSteps.size())
|
||||
UpdateHintNavigation(input.DeltaTime(), mgr);
|
||||
else if (!x328_)
|
||||
else if (x328_ == 0)
|
||||
ProcessMapScreenInput(input, mgr);
|
||||
}
|
||||
}
|
||||
|
@ -1150,7 +1183,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
|||
|
||||
if (input.PZ() || input.PB())
|
||||
{
|
||||
if (!x328_)
|
||||
if (x328_ == 0)
|
||||
{
|
||||
if (CanLeaveMapScreenInternal(mgr))
|
||||
LeaveMapScreen(mgr);
|
||||
|
|
|
@ -363,7 +363,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
|||
std::sort(sortInfos.begin(), sortInfos.end(),
|
||||
[](const CMapObjectSortInfo& a, const CMapObjectSortInfo& b)
|
||||
{
|
||||
return a.GetZDistance() < b.GetZDistance();
|
||||
return a.GetZDistance() > b.GetZDistance();
|
||||
});
|
||||
|
||||
int lastAreaIdx = -1;
|
||||
|
|
|
@ -73,10 +73,9 @@ zeus::CTransform CMappableObject::AdjustTransformForType()
|
|||
}
|
||||
else if (x0_type >= EMappableObjectType::BlueDoor || x0_type <= EMappableObjectType::PlasmaDoorFloor2)
|
||||
{
|
||||
zeus::CMatrix4f tmp = x10_transform.toMatrix4f().transposed();
|
||||
return zeus::CTransform::Translate(tmp.m[1][0], tmp.m[2][1], tmp[3][2]);
|
||||
}
|
||||
return x10_transform;
|
||||
}
|
||||
return zeus::CTransform::Translate(x10_transform.origin);
|
||||
}
|
||||
|
||||
std::pair<zeus::CColor, zeus::CColor>
|
||||
|
@ -155,8 +154,8 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo,
|
|||
line.Reset();
|
||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.Render();
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +228,8 @@ void CMappableObject::DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo,
|
|||
line.Reset();
|
||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||
line.Render();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
CLineRenderer m_outline;
|
||||
DoorSurface(boo::IGraphicsDataFactory::Context& ctx)
|
||||
: m_surface(ctx, g_doorVbo, g_doorIbo),
|
||||
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineStrip, 5, nullptr, false)
|
||||
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false)
|
||||
{}
|
||||
};
|
||||
std::experimental::optional<DoorSurface> m_doorSurface;
|
||||
|
|
|
@ -179,40 +179,17 @@ void CCameraBlurPass::Draw()
|
|||
if (x10_curType == EBlurType::NoBlur)
|
||||
return;
|
||||
|
||||
SClipScreenRect rect(g_Viewport);
|
||||
CGraphics::ResolveSpareTexture(rect);
|
||||
|
||||
if (x10_curType == EBlurType::Xray)
|
||||
{
|
||||
float blurX = x1c_curValue * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||
float blurY = x1c_curValue * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
float iflt = i;
|
||||
float uvScale = (1.f - (blurX * iflt + blurY * iflt * iflt));
|
||||
float uvOffset = uvScale * -0.5f + 0.5f;
|
||||
}
|
||||
if (!m_xrayShader)
|
||||
m_xrayShader.emplace(x0_paletteTex);
|
||||
m_xrayShader->draw(x1c_curValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<7 ; ++i)
|
||||
{
|
||||
float amtX = 0.f;
|
||||
float amtY = 0.f;
|
||||
if (i)
|
||||
{
|
||||
float tmp = i - 1;
|
||||
tmp *= 2.f * M_PIF;
|
||||
tmp /= 6.f;
|
||||
|
||||
amtX = std::cos(tmp);
|
||||
amtX *= x1c_curValue / 640.f;
|
||||
|
||||
amtY = std::sin(tmp);
|
||||
amtY *= x1c_curValue / 448.f;
|
||||
}
|
||||
}
|
||||
if (!m_shader)
|
||||
m_shader.emplace();
|
||||
m_shader->draw(x1c_curValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "zeus/CColor.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "Graphics/Shaders/CCameraBlurFilter.hpp"
|
||||
#include "Graphics/Shaders/CXRayBlurFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -103,6 +105,9 @@ class CCameraBlurPass
|
|||
//bool x2d_noPersistentCopy = false;
|
||||
//u32 x30_persistentBuf = 0;
|
||||
|
||||
mutable std::experimental::optional<CCameraBlurFilter> m_shader;
|
||||
mutable std::experimental::optional<CXRayBlurFilter> m_xrayShader;
|
||||
|
||||
public:
|
||||
void Draw();
|
||||
void Update(float dt);
|
||||
|
|
|
@ -91,7 +91,7 @@ CMapSurfaceShader::Initialize(boo::GLDataFactory::Context& ctx)
|
|||
const char* uniNames[] = {"MapSurfaceUniform"};
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true,
|
||||
false, boo::CullMode::Backface);
|
||||
return new CMapSurfaceShaderGLDataBindingFactory;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
|||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||
return new CMapSurfaceShaderVulkanDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ CMapSurfaceShader::Initialize(boo::ID3DDataFactory::Context& ctx)
|
|||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, nullptr, s_VtxFmt,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||
return new CMapSurfaceShaderD3DDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ CMapSurfaceShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||
return new CMapSurfaceShaderMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,8 @@ void CXRayBlurFilter::draw(float amount)
|
|||
{
|
||||
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
|
||||
|
||||
float blurL = amount * 0.0014f * 0.25f;
|
||||
float blurQ = amount * 0.0000525f * 0.25f;
|
||||
//float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||
//float blurQ = amount * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||
float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||
float blurQ = amount * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
|
|
|
@ -319,7 +319,7 @@ void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue)
|
|||
{
|
||||
if (x1c0_nextState != EInGameGuiState::PauseGame && x1c0_nextState != EInGameGuiState::PauseLogBook)
|
||||
{
|
||||
if (x48_pauseScreen->IsTransitioning())
|
||||
if (x48_pauseScreen && x48_pauseScreen->IsTransitioning())
|
||||
return;
|
||||
x48_pauseScreen.reset();
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ void CInGameGuiManager::Update(CStateManager& stateMgr, float dt, CArchitectureQ
|
|||
{
|
||||
if (x1c0_nextState == EInGameGuiState::Zero || x1c0_nextState == EInGameGuiState::InGame)
|
||||
TryReloadAreaTextures();
|
||||
if ((x1bc_prevState == x1c0_nextState || !x1e8_enableAutoMapper) &&
|
||||
if ((!x38_autoMapper->IsInMapperStateTransition() || !x1e8_enableAutoMapper) &&
|
||||
x3c_pauseScreenBlur->IsNotTransitioning())
|
||||
OnNewPauseScreenState(archQueue);
|
||||
}
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 7fe1cb8320ee23d115a222980bba96508a139920
|
||||
Subproject commit 97734162b1cbebac86078c07f4586a977091a9a7
|
Loading…
Reference in New Issue