mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 21:47:42 +00:00
Animation transitions and pause screen fixes
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "CAnimTreeTweenBase.hpp"
|
||||
#include "CSegStatementSet.hpp"
|
||||
#include "CSegIdList.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
@@ -10,7 +12,7 @@ CAnimTreeTweenBase::CAnimTreeTweenBase(bool b1, const std::weak_ptr<CAnimTreeNod
|
||||
: CAnimTreeDoubleChild(a, b, name), x1c_flags(flags)
|
||||
{
|
||||
x20_24_b1 = b1;
|
||||
x20_25_ = 0;
|
||||
x20_25_cullSelector = 0;
|
||||
}
|
||||
|
||||
void CAnimTreeTweenBase::VGetWeightedReaders(
|
||||
@@ -21,16 +23,86 @@ void CAnimTreeTweenBase::VGetWeightedReaders(
|
||||
x18_b->VGetWeightedReaders(out, weight * w);
|
||||
}
|
||||
|
||||
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const {}
|
||||
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const
|
||||
{
|
||||
float w = GetBlendingWeight();
|
||||
static int sStack = 0;
|
||||
++sStack;
|
||||
if (w >= 1.f)
|
||||
{
|
||||
x18_b->VGetSegStatementSet(list, setOut);
|
||||
}
|
||||
else if (sStack > 3)
|
||||
{
|
||||
auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
n->GetBestUnblendedChild()->VGetSegStatementSet(list, setOut);
|
||||
}
|
||||
else
|
||||
{
|
||||
CSegStatementSet setA, setB;
|
||||
x14_a->VGetSegStatementSet(list, setA);
|
||||
x18_b->VGetSegStatementSet(list, setB);
|
||||
for (CSegId id : list.GetList())
|
||||
{
|
||||
if (w < 0.0001f)
|
||||
{
|
||||
setOut[id].x0_rotation = setA[id].x0_rotation;
|
||||
if (setA[id].x1c_hasOffset)
|
||||
{
|
||||
setOut[id].x10_offset = setA[id].x10_offset;
|
||||
setOut[id].x1c_hasOffset = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setOut[id].x0_rotation = zeus::CQuaternion::slerpShort(setA[id].x0_rotation, setB[id].x0_rotation, w);
|
||||
if (setA[id].x1c_hasOffset && setB[id].x1c_hasOffset)
|
||||
{
|
||||
setOut[id].x10_offset = zeus::CVector3f::lerp(setA[id].x10_offset, setB[id].x10_offset, w);
|
||||
setOut[id].x1c_hasOffset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
--sStack;
|
||||
}
|
||||
|
||||
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut,
|
||||
const CCharAnimTime& time) const
|
||||
{
|
||||
float w = GetBlendingWeight();
|
||||
static int sStack = 0;
|
||||
++sStack;
|
||||
if (w >= 1.f)
|
||||
{
|
||||
x18_b->VGetSegStatementSet(list, setOut, time);
|
||||
}
|
||||
else if (sStack > 3)
|
||||
{
|
||||
auto& n = w > 0.5f ? x18_b : x14_a;
|
||||
n->GetBestUnblendedChild()->VGetSegStatementSet(list, setOut, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
CSegStatementSet setA, setB;
|
||||
x14_a->VGetSegStatementSet(list, setA, time);
|
||||
x18_b->VGetSegStatementSet(list, setB, time);
|
||||
for (CSegId id : list.GetList())
|
||||
{
|
||||
setOut[id].x0_rotation = zeus::CQuaternion::slerpShort(setA[id].x0_rotation, setB[id].x0_rotation, w);
|
||||
if (setA[id].x1c_hasOffset && setB[id].x1c_hasOffset)
|
||||
{
|
||||
setOut[id].x10_offset = zeus::CVector3f::lerp(setA[id].x10_offset, setB[id].x10_offset, w);
|
||||
setOut[id].x1c_hasOffset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
--sStack;
|
||||
}
|
||||
|
||||
bool CAnimTreeTweenBase::VHasOffset(const CSegId& seg) const
|
||||
{
|
||||
return (x14_a->VHasOffset(seg) || x18_b->VHasOffset(seg));
|
||||
return (x14_a->VHasOffset(seg) && x18_b->VHasOffset(seg));
|
||||
}
|
||||
|
||||
zeus::CVector3f CAnimTreeTweenBase::VGetOffset(const CSegId& seg) const
|
||||
@@ -57,7 +129,7 @@ zeus::CQuaternion CAnimTreeTweenBase::VGetRotation(const CSegId& seg) const
|
||||
|
||||
std::experimental::optional<std::unique_ptr<IAnimReader>> CAnimTreeTweenBase::VSimplified()
|
||||
{
|
||||
if (x20_25_ == 0)
|
||||
if (x20_25_cullSelector == 0)
|
||||
{
|
||||
auto simpA = x14_a->Simplified();
|
||||
auto simpB = x18_b->Simplified();
|
||||
@@ -72,7 +144,7 @@ std::experimental::optional<std::unique_ptr<IAnimReader>> CAnimTreeTweenBase::VS
|
||||
}
|
||||
else
|
||||
{
|
||||
auto tmp = (x20_25_ == 1) ? x18_b : x14_a;
|
||||
auto tmp = (x20_25_cullSelector == 1) ? x18_b : x14_a;
|
||||
auto tmpUnblended = tmp->GetBestUnblendedChild();
|
||||
if (!tmpUnblended)
|
||||
return {tmp->Clone()};
|
||||
|
||||
Reference in New Issue
Block a user