2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 00:27:42 +00:00

More AnimSourceReader imps

This commit is contained in:
Jack Andersen
2016-04-11 20:15:32 -10:00
parent faacffba77
commit 41f482daeb
24 changed files with 650 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
#include "CSoundPOINode.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@@ -16,4 +17,44 @@ CSoundPOINode::CSoundPOINode(const std::string& name, u16 a,
: CPOINode(name, a, time, b, c, d, e, f),
x38_sfxId(sfxId), x3c_falloff(falloff), x40_maxDist(maxDist) {}
CSoundPOINode CSoundPOINode::CopyNodeMinusStartTime(const CSoundPOINode& node,
const CCharAnimTime& startTime)
{
CSoundPOINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CSoundPOINode::_getPOIList(const CCharAnimTime& time,
CSoundPOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CSoundPOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount)
{
u32 ret = 0;
if (animInfo.HasPOIData() && stream.size())
{
CCharAnimTime dur = animInfo.GetAnimationDuration();
CCharAnimTime targetTime = curTime + time;
if (targetTime >= dur)
targetTime = dur;
if (passedCount >= stream.size())
return ret;
CCharAnimTime nodeTime = stream[passedCount].GetTime();
while (nodeTime <= targetTime)
{
u32 idx = iterator + ret;
if (idx < capacity)
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
++passedCount;
++ret;
nodeTime = stream[passedCount].GetTime();
}
}
return ret;
}
}