metaforce/Runtime/Character/CInt32POINode.cpp

54 lines
1.7 KiB
C++
Raw Normal View History

2016-04-11 07:10:28 +00:00
#include "CInt32POINode.hpp"
2016-04-12 06:15:32 +00:00
#include "CAnimSourceReader.hpp"
2016-04-11 07:10:28 +00:00
namespace urde
{
CInt32POINode::CInt32POINode()
2016-08-21 20:39:18 +00:00
: CPOINode("root", EPOIType::EmptyInt32, CCharAnimTime(), -1, false, 1.f, -1, 0), x38_val(0), x3c_locatorName("root") {}
2016-04-11 07:10:28 +00:00
CInt32POINode::CInt32POINode(CInputStream& in)
2016-04-28 04:52:41 +00:00
: CPOINode(in), x38_val(in.readUint32Big()), x3c_locatorName(in.readString()) {}
2016-04-11 07:10:28 +00:00
2016-04-12 06:15:32 +00:00
CInt32POINode CInt32POINode::CopyNodeMinusStartTime(const CInt32POINode& node,
const CCharAnimTime& startTime)
{
CInt32POINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CInt32POINode::_getPOIList(const CCharAnimTime& time,
CInt32POINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CInt32POINode>& 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;
}
2016-04-11 07:10:28 +00:00
}