mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-05-13 23:11:20 +00:00
Fix CAnimSource reader POI handling
This commit is contained in:
parent
925464dd56
commit
e736d8fa83
@ -41,33 +41,36 @@ CCharAnimTime CAnimSourceInfo::GetAnimationDuration() const
|
|||||||
return x4_token->GetDuration();
|
return x4_token->GetDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, CParticleData::EParentedMode>
|
std::set<std::pair<std::string, s32>>
|
||||||
CAnimSourceReaderBase::GetUniqueParticlePOIs() const
|
CAnimSourceReaderBase::GetUniqueParticlePOIs() const
|
||||||
{
|
{
|
||||||
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
||||||
std::map<std::string, CParticleData::EParentedMode> ret;
|
std::set<std::pair<std::string, s32>> ret;
|
||||||
for (const CParticlePOINode& node : particleNodes)
|
for (const CParticlePOINode& node : particleNodes)
|
||||||
ret[std::string(node.GetString())] = node.GetParticleData().GetParentedMode();
|
if (node.GetUnique())
|
||||||
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, s32>
|
std::set<std::pair<std::string, s32>>
|
||||||
CAnimSourceReaderBase::GetUniqueInt32POIs() const
|
CAnimSourceReaderBase::GetUniqueInt32POIs() const
|
||||||
{
|
{
|
||||||
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
||||||
std::map<std::string, s32> ret;
|
std::set<std::pair<std::string, s32>> ret;
|
||||||
for (const CInt32POINode& node : int32Nodes)
|
for (const CInt32POINode& node : int32Nodes)
|
||||||
ret[std::string(node.GetString())] = node.GetValue();
|
if (node.GetUnique())
|
||||||
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, bool>
|
std::set<std::pair<std::string, s32>>
|
||||||
CAnimSourceReaderBase::GetUniqueBoolPOIs() const
|
CAnimSourceReaderBase::GetUniqueBoolPOIs() const
|
||||||
{
|
{
|
||||||
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
||||||
std::map<std::string, bool> ret;
|
std::set<std::pair<std::string, s32>> ret;
|
||||||
for (const CBoolPOINode& node : boolNodes)
|
for (const CBoolPOINode& node : boolNodes)
|
||||||
ret[std::string(node.GetString())] = node.GetValue();
|
if (node.GetUnique())
|
||||||
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,21 +83,20 @@ void CAnimSourceReaderBase::PostConstruct(const CCharAnimTime& time)
|
|||||||
|
|
||||||
if (x4_sourceInfo->HasPOIData())
|
if (x4_sourceInfo->HasPOIData())
|
||||||
{
|
{
|
||||||
std::map<std::string, bool> boolPOIs = GetUniqueBoolPOIs();
|
std::set<std::pair<std::string, s32>> boolPOIs = GetUniqueBoolPOIs();
|
||||||
std::map<std::string, s32> int32POIs = GetUniqueInt32POIs();
|
std::set<std::pair<std::string, s32>> int32POIs = GetUniqueInt32POIs();
|
||||||
std::map<std::string, CParticleData::EParentedMode> particlePOIs = GetUniqueParticlePOIs();
|
std::set<std::pair<std::string, s32>> particlePOIs = GetUniqueParticlePOIs();
|
||||||
|
|
||||||
|
x24_boolStates.resize(boolPOIs.size());
|
||||||
|
x34_int32States.resize(int32POIs.size());
|
||||||
|
x44_particleStates.resize(particlePOIs.size());
|
||||||
|
|
||||||
x24_boolStates.reserve(boolPOIs.size());
|
|
||||||
for (const auto& poi : boolPOIs)
|
for (const auto& poi : boolPOIs)
|
||||||
x24_boolStates.push_back(poi);
|
x24_boolStates[poi.second] = std::make_pair(poi.first, false);
|
||||||
|
|
||||||
x34_int32States.reserve(int32POIs.size());
|
|
||||||
for (const auto& poi : int32POIs)
|
for (const auto& poi : int32POIs)
|
||||||
x34_int32States.push_back(poi);
|
x34_int32States[poi.second] = std::make_pair(poi.first, 0);
|
||||||
|
|
||||||
x44_particleStates.reserve(particlePOIs.size());
|
|
||||||
for (const auto& poi : particlePOIs)
|
for (const auto& poi : particlePOIs)
|
||||||
x44_particleStates.push_back(poi);
|
x44_particleStates[poi.second] = std::make_pair(poi.first, CParticleData::EParentedMode::Initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharAnimTime tmpTime = time;
|
CCharAnimTime tmpTime = time;
|
||||||
|
@ -46,9 +46,9 @@ protected:
|
|||||||
std::vector<std::pair<std::string, s32>> x34_int32States;
|
std::vector<std::pair<std::string, s32>> x34_int32States;
|
||||||
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particleStates;
|
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particleStates;
|
||||||
|
|
||||||
std::map<std::string, CParticleData::EParentedMode> GetUniqueParticlePOIs() const;
|
std::set<std::pair<std::string, s32>> GetUniqueParticlePOIs() const;
|
||||||
std::map<std::string, s32> GetUniqueInt32POIs() const;
|
std::set<std::pair<std::string, s32>> GetUniqueInt32POIs() const;
|
||||||
std::map<std::string, bool> GetUniqueBoolPOIs() const;
|
std::set<std::pair<std::string, s32>> GetUniqueBoolPOIs() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void PostConstruct(const CCharAnimTime& time);
|
void PostConstruct(const CCharAnimTime& time);
|
||||||
|
@ -9,13 +9,13 @@ namespace urde
|
|||||||
{
|
{
|
||||||
|
|
||||||
CPOINode::CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time,
|
CPOINode::CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time,
|
||||||
s32 index, bool c, float weight, s32 e, s32 f)
|
s32 index, bool unique, float weight, s32 e, s32 f)
|
||||||
: x4_(1),
|
: x4_(1),
|
||||||
x8_name(name),
|
x8_name(name),
|
||||||
x18_type(type),
|
x18_type(type),
|
||||||
x1c_time(time),
|
x1c_time(time),
|
||||||
x24_index(index),
|
x24_index(index),
|
||||||
x28_(c),
|
x28_unique(unique),
|
||||||
x2c_weight(weight),
|
x2c_weight(weight),
|
||||||
x30_charIdx(e),
|
x30_charIdx(e),
|
||||||
x34_flags(f)
|
x34_flags(f)
|
||||||
@ -27,7 +27,7 @@ CPOINode::CPOINode(CInputStream& in)
|
|||||||
x18_type(EPOIType(in.readUint16Big())),
|
x18_type(EPOIType(in.readUint16Big())),
|
||||||
x1c_time(in),
|
x1c_time(in),
|
||||||
x24_index(in.readInt32Big()),
|
x24_index(in.readInt32Big()),
|
||||||
x28_(in.readBool()),
|
x28_unique(in.readBool()),
|
||||||
x2c_weight(in.readFloatBig()),
|
x2c_weight(in.readFloatBig()),
|
||||||
x30_charIdx(in.readInt32Big()),
|
x30_charIdx(in.readInt32Big()),
|
||||||
x34_flags(in.readInt32Big())
|
x34_flags(in.readInt32Big())
|
||||||
|
@ -27,13 +27,13 @@ protected:
|
|||||||
EPOIType x18_type;
|
EPOIType x18_type;
|
||||||
CCharAnimTime x1c_time;
|
CCharAnimTime x1c_time;
|
||||||
s32 x24_index;
|
s32 x24_index;
|
||||||
bool x28_;
|
bool x28_unique;
|
||||||
float x2c_weight;
|
float x2c_weight;
|
||||||
s32 x30_charIdx = -1;
|
s32 x30_charIdx = -1;
|
||||||
s32 x34_flags;
|
s32 x34_flags;
|
||||||
public:
|
public:
|
||||||
CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time,
|
CPOINode(std::string_view name, EPOIType type, const CCharAnimTime& time,
|
||||||
s32 index, bool, float weight, s32 charIdx, s32 flags);
|
s32 index, bool unique, float weight, s32 charIdx, s32 flags);
|
||||||
CPOINode(CInputStream& in);
|
CPOINode(CInputStream& in);
|
||||||
virtual ~CPOINode() = default;
|
virtual ~CPOINode() = default;
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ public:
|
|||||||
void SetTime(const CCharAnimTime& time) { x1c_time = time; }
|
void SetTime(const CCharAnimTime& time) { x1c_time = time; }
|
||||||
EPOIType GetPoiType() const { return x18_type; }
|
EPOIType GetPoiType() const { return x18_type; }
|
||||||
s32 GetIndex() const { return x24_index; }
|
s32 GetIndex() const { return x24_index; }
|
||||||
|
bool GetUnique() const { return x28_unique; }
|
||||||
float GetWeight() const { return x2c_weight; }
|
float GetWeight() const { return x2c_weight; }
|
||||||
s32 GetCharacterIndex() const { return x30_charIdx; }
|
s32 GetCharacterIndex() const { return x30_charIdx; }
|
||||||
s32 GetFlags() const { return x34_flags; }
|
s32 GetFlags() const { return x34_flags; }
|
||||||
|
@ -31,8 +31,6 @@ void CAmbientAI::Accept(IVisitor& visitor)
|
|||||||
|
|
||||||
void CAmbientAI::Think(float dt, CStateManager& mgr)
|
void CAmbientAI::Think(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
if (!GetActive())
|
if (!GetActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -116,8 +114,6 @@ void CAmbientAI::Think(float dt, CStateManager& mgr)
|
|||||||
|
|
||||||
void CAmbientAI::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
void CAmbientAI::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
case EScriptObjectMessage::Reset:
|
case EScriptObjectMessage::Reset:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user