2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 14:24:56 +00:00

Various AutoMapper render fixes

This commit is contained in:
Jack Andersen
2017-11-15 22:05:10 -10:00
parent 21505e46ce
commit a914e121ea
12 changed files with 64 additions and 52 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 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();
}

View File

@@ -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;