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

EVNT extraction fix

This commit is contained in:
Jack Andersen
2018-10-27 15:22:55 -10:00
parent 427f5d8786
commit 3147b49b3d
9 changed files with 49 additions and 37 deletions

View File

@@ -103,7 +103,7 @@ static bool IntersectLines(const zeus::CVector2f& pa1, const zeus::CVector2f& pa
zeus::CVector3f& intersect)
{
float det = (pa1.x - pa2.x) * (pb1.y - pb2.y) - (pa1.y - pa2.y) * (pb1.x - pb2.x);
if (std::fabs(det) < 0.01f)
if (std::fabs(det) < 0.000001f)
return false;
float c0 = pa1.x * pa2.y - pa1.y * pa2.x;
float c1 = pb1.x * pb2.y - pb1.y * pb2.x;
@@ -184,13 +184,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
zeus::CVector3f intersect1;
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
m_lastPos.toVec2f() + dvb, projPt.toVec2f() + dvb, intersect1);
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good1 = false;
zeus::CVector3f intersect2;
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
m_lastPos.toVec2f() - dvb, projPt.toVec2f() - dvb, intersect2);
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good2 = false;
if (good1 && good2)
@@ -231,13 +231,13 @@ void CLineRenderer::AddVertex(const zeus::CVector3f& position, const zeus::CColo
zeus::CVector3f intersect1;
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
m_lastPos.toVec2f() + dvb, projPt.toVec2f() + dvb, intersect1);
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good1 = false;
zeus::CVector3f intersect2;
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
m_lastPos.toVec2f() - dvb, projPt.toVec2f() - dvb, intersect2);
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good2 = false;
if (good1 && good2)
@@ -307,13 +307,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
zeus::CVector3f intersect1;
bool good1 = IntersectLines(m_lastPos2.toVec2f() + dva, m_lastPos.toVec2f() + dva,
m_lastPos.toVec2f() + dvb, m_firstPos.toVec2f() + dvb, intersect1);
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect1.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good1 = false;
zeus::CVector3f intersect2;
bool good2 = IntersectLines(m_lastPos2.toVec2f() - dva, m_lastPos.toVec2f() - dva,
m_lastPos.toVec2f() - dvb, m_firstPos.toVec2f() - dvb, intersect2);
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 4.f)
if ((intersect2.toVec2f() - m_lastPos.toVec2f()).magnitude() > m_lastWidth * 2.f)
good2 = false;
if (m_textured)
@@ -367,13 +367,13 @@ void CLineRenderer::Render(const zeus::CColor& moduColor)
zeus::CVector3f intersect1;
bool good1 = IntersectLines(m_lastPos.toVec2f() + dva, m_firstPos.toVec2f() + dva,
m_firstPos.toVec2f() + dvb, m_secondPos.toVec2f() + dvb, intersect1);
if ((intersect1.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 4.f)
if ((intersect1.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 2.f)
good1 = false;
zeus::CVector3f intersect2;
bool good2 = IntersectLines(m_lastPos.toVec2f() - dva, m_firstPos.toVec2f() - dva,
m_firstPos.toVec2f() - dvb, m_secondPos.toVec2f() - dvb, intersect2);
if ((intersect2.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 4.f)
if ((intersect2.toVec2f() - m_firstPos.toVec2f()).magnitude() > m_firstWidth * 2.f)
good2 = false;
if (m_textured)

View File

@@ -575,7 +575,7 @@ float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatri
void CActor::EnsureRendered(const CStateManager& mgr) const
{
zeus::CAABox aabb = GetSortingBounds(mgr);
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.origin), aabb);
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.basis[1]), aabb);
}
void CActor::EnsureRendered(const CStateManager& stateMgr, const zeus::CVector3f& pos,

View File

@@ -31,7 +31,6 @@ void CScriptActorKeyframe::Accept(IVisitor& visitor)
void CScriptActorKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
if (msg == EScriptObjectMessage::Action)
{
if (GetActive())

View File

@@ -52,9 +52,11 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
CActor::SetMaterialFilter(CMaterialFilter::MakeIncludeExclude(
CMaterialList(EMaterialTypes::Solid),
CMaterialList(EMaterialTypes::NoStaticCollision, EMaterialTypes::NoPlatformCollision, EMaterialTypes::Platform)));
xf8_24_movable = false;
if (HasModelData() && ModelData()->HasAnimData())
ModelData()->AnimationData()->EnableLooping(true);
if (x304_treeGroupContainer)
x314_treeGroup = std::make_unique<CCollidableOBBTreeGroup>(x304_treeGroupContainer->GetObj(), x68_material);
}
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }