2016-04-11 07:10:28 +00:00
|
|
|
#include "CPOINode.hpp"
|
2016-08-27 21:16:44 +00:00
|
|
|
#include "CBoolPOINode.hpp"
|
|
|
|
#include "CInt32POINode.hpp"
|
|
|
|
#include "CParticlePOINode.hpp"
|
|
|
|
#include "CSoundPOINode.hpp"
|
|
|
|
#include "CAnimSourceReader.hpp"
|
2016-04-11 07:10:28 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
CPOINode::CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time,
|
2018-05-26 21:30:19 +00:00
|
|
|
s32 index, bool c, float weight, s32 e, s32 f)
|
2016-04-11 07:10:28 +00:00
|
|
|
: x4_(1),
|
|
|
|
x8_name(name),
|
2016-08-21 20:39:18 +00:00
|
|
|
x18_type(type),
|
2016-04-11 07:10:28 +00:00
|
|
|
x1c_time(time),
|
|
|
|
x24_index(index),
|
|
|
|
x28_(c),
|
2016-04-28 04:52:41 +00:00
|
|
|
x2c_weight(weight),
|
2016-08-21 20:39:18 +00:00
|
|
|
x30_charIdx(e),
|
|
|
|
x34_flags(f)
|
2016-04-11 07:10:28 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
CPOINode::CPOINode(CInputStream& in)
|
|
|
|
: x4_(in.readUint16Big()),
|
|
|
|
x8_name(in.readString()),
|
2016-08-21 20:39:18 +00:00
|
|
|
x18_type(EPOIType(in.readUint16Big())),
|
2016-04-11 07:10:28 +00:00
|
|
|
x1c_time(in),
|
2018-05-26 21:30:19 +00:00
|
|
|
x24_index(in.readInt32Big()),
|
2016-04-11 07:10:28 +00:00
|
|
|
x28_(in.readBool()),
|
2016-04-28 04:52:41 +00:00
|
|
|
x2c_weight(in.readFloatBig()),
|
2018-05-02 00:43:31 +00:00
|
|
|
x30_charIdx(in.readInt32Big()),
|
|
|
|
x34_flags(in.readInt32Big())
|
2016-04-11 07:10:28 +00:00
|
|
|
{}
|
|
|
|
|
2016-09-11 18:40:33 +00:00
|
|
|
bool CPOINode::operator>(const CPOINode& other) const
|
|
|
|
{
|
|
|
|
return x1c_time < other.x1c_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CPOINode::operator<(const CPOINode& other) const
|
|
|
|
{
|
|
|
|
return x1c_time > other.x1c_time;
|
|
|
|
}
|
|
|
|
|
2016-08-27 21:16:44 +00:00
|
|
|
template <class T>
|
|
|
|
u32 _getPOIList(const CCharAnimTime& time,
|
|
|
|
T* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<T>& 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();
|
2017-11-27 05:06:53 +00:00
|
|
|
while (passedCount < stream.size() && nodeTime <= targetTime)
|
2016-08-27 21:16:44 +00:00
|
|
|
{
|
|
|
|
u32 idx = iterator + ret;
|
|
|
|
if (idx < capacity)
|
2018-05-16 04:07:38 +00:00
|
|
|
{
|
2016-08-27 21:16:44 +00:00
|
|
|
listOut[idx] = T::CopyNodeMinusStartTime(stream[passedCount], curTime);
|
2018-05-16 04:07:38 +00:00
|
|
|
++ret;
|
|
|
|
}
|
2016-08-27 21:16:44 +00:00
|
|
|
++passedCount;
|
2017-11-27 05:06:53 +00:00
|
|
|
if (passedCount < stream.size())
|
|
|
|
nodeTime = stream[passedCount].GetTime();
|
2016-08-27 21:16:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
u32 _getPOIList(const CCharAnimTime& time,
|
|
|
|
T* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<T>& stream,
|
|
|
|
const CCharAnimTime& curTime)
|
|
|
|
{
|
|
|
|
u32 ret = 0;
|
|
|
|
|
|
|
|
CCharAnimTime targetTime = curTime + time;
|
|
|
|
|
|
|
|
for (u32 it = iterator ; it < stream.size() ; ++it)
|
|
|
|
{
|
2018-05-16 04:07:38 +00:00
|
|
|
CCharAnimTime nodeTime = stream[it].GetTime();
|
2016-08-27 21:16:44 +00:00
|
|
|
if (nodeTime > targetTime)
|
|
|
|
return ret;
|
|
|
|
u32 idx = iterator + ret;
|
2018-05-16 04:07:38 +00:00
|
|
|
if (nodeTime >= curTime && idx < capacity)
|
|
|
|
{
|
|
|
|
listOut[idx] = T::CopyNodeMinusStartTime(stream[it], curTime);
|
|
|
|
++ret;
|
|
|
|
}
|
2016-08-27 21:16:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
template u32 _getPOIList<CBoolPOINode>(const CCharAnimTime& time,
|
|
|
|
CBoolPOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CBoolPOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime,
|
|
|
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
|
|
|
template u32 _getPOIList<CBoolPOINode>(const CCharAnimTime& time,
|
|
|
|
CBoolPOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CBoolPOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime);
|
|
|
|
|
|
|
|
template u32 _getPOIList<CInt32POINode>(const CCharAnimTime& time,
|
|
|
|
CInt32POINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CInt32POINode>& stream,
|
|
|
|
const CCharAnimTime& curTime,
|
|
|
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
|
|
|
template u32 _getPOIList<CInt32POINode>(const CCharAnimTime& time,
|
|
|
|
CInt32POINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CInt32POINode>& stream,
|
|
|
|
const CCharAnimTime& curTime);
|
|
|
|
|
|
|
|
template u32 _getPOIList<CParticlePOINode>(const CCharAnimTime& time,
|
|
|
|
CParticlePOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CParticlePOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime,
|
|
|
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
|
|
|
template u32 _getPOIList<CParticlePOINode>(const CCharAnimTime& time,
|
|
|
|
CParticlePOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CParticlePOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime);
|
|
|
|
|
|
|
|
template u32 _getPOIList<CSoundPOINode>(const CCharAnimTime& time,
|
|
|
|
CSoundPOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CSoundPOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime,
|
|
|
|
const IAnimSourceInfo& animInfo, u32 passedCount);
|
|
|
|
template u32 _getPOIList<CSoundPOINode>(const CCharAnimTime& time,
|
|
|
|
CSoundPOINode* listOut,
|
|
|
|
u32 capacity, u32 iterator, u32 unk1,
|
|
|
|
const std::vector<CSoundPOINode>& stream,
|
|
|
|
const CCharAnimTime& curTime);
|
|
|
|
|
2016-04-11 07:10:28 +00:00
|
|
|
}
|