This commit is contained in:
Jack Andersen 2016-09-11 11:20:21 -10:00
commit 3de9a61ef1
13 changed files with 114 additions and 31 deletions

View File

@ -12,7 +12,7 @@ static void AthenaExc(athena::error::Level level, const char* file,
{
va_list ap;
va_start(ap, fmt);
AthenaLog.reportSource(logvisor::Level(level), file, line, fmt, ap);
AthenaLog.report(logvisor::Level(level), fmt, ap);
va_end(ap);
}
@ -60,9 +60,7 @@ struct Application : boo::IApplicationCallback
void initialize(boo::IApplication* /*app*/)
{
zeus::detectCPU();
#ifndef WIN32 /* Console issue with Win32 */
hecl::VerbosityLevel = 1;
#endif
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);

View File

@ -542,7 +542,7 @@ SAdvancementDeltas CAnimData::Advance(float dt, const zeus::CVector3f& scale,
{
if (node.GetCharacterIndex() == -1 || node.GetCharacterIndex() == x204_charIdx)
{
x120_particleDB.StartEffect(node.GetName(), node.GetFlags(), node.GetParticleData(),
x120_particleDB.StartEffect(node.GetString(), node.GetFlags(), node.GetParticleData(),
scale, stateMgr, aid, x21c_);
}
}

View File

@ -46,7 +46,7 @@ CAnimSourceReaderBase::GetUniqueParticlePOIs() const
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
std::map<std::string, CParticleData::EParentedMode> ret;
for (const CParticlePOINode& node : particleNodes)
ret[node.GetName()] = node.GetParticleData().GetParentedMode();
ret[node.GetString()] = node.GetParticleData().GetParentedMode();
return ret;
}
@ -56,7 +56,7 @@ CAnimSourceReaderBase::GetUniqueInt32POIs() const
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
std::map<std::string, s32> ret;
for (const CInt32POINode& node : int32Nodes)
ret[node.GetName()] = node.GetValue();
ret[node.GetString()] = node.GetValue();
return ret;
}
@ -66,7 +66,7 @@ CAnimSourceReaderBase::GetUniqueBoolPOIs() const
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
std::map<std::string, bool> ret;
for (const CBoolPOINode& node : boolNodes)
ret[node.GetName()] = node.GetValue();
ret[node.GetString()] = node.GetValue();
return ret;
}

View File

@ -16,42 +16,69 @@ SAdvancementResults CAnimTreeDoubleChild::VAdvanceView(const CCharAnimTime& a)
}
u32 CAnimTreeDoubleChild::VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut,
u32 capacity, u32 iterator, u32) const
u32 capacity, u32 iterator, u32 unk) const
{
return 0;
u32 newCapacity = x14_a->GetBoolPOIList(time, listOut, capacity, iterator, unk);
newCapacity += x18_b->GetBoolPOIList(time, listOut, capacity, newCapacity + iterator, unk);
if (newCapacity > capacity)
newCapacity = capacity;
std::sort(listOut, listOut + newCapacity, CPOINode::compare);
return newCapacity;
}
u32 CAnimTreeDoubleChild::VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut,
u32 capacity, u32 iterator, u32) const
u32 capacity, u32 iterator, u32 unk) const
{
return 0;
u32 newCapacity = x14_a->GetInt32POIList(time, listOut, capacity, iterator, unk);
newCapacity += x18_b->GetInt32POIList(time, listOut, capacity, newCapacity + iterator, unk);
if (newCapacity > capacity)
newCapacity = capacity;
std::sort(listOut, listOut + newCapacity, CPOINode::compare);
return newCapacity;
}
u32 CAnimTreeDoubleChild::VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut,
u32 capacity, u32 iterator, u32) const
u32 capacity, u32 iterator, u32 unk) const
{
return 0;
u32 newCapacity = x14_a->GetParticlePOIList(time, listOut, capacity, iterator, unk);
newCapacity += x18_b->GetParticlePOIList(time, listOut, capacity, newCapacity + iterator, unk);
if (newCapacity > capacity)
newCapacity = capacity;
std::sort(listOut, listOut + newCapacity, CPOINode::compare);
return newCapacity;
}
u32 CAnimTreeDoubleChild::VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut,
u32 capacity, u32 iterator, u32) const
u32 capacity, u32 iterator, u32 unk) const
{
return 0;
u32 newCapacity = x14_a->GetSoundPOIList(time, listOut, capacity, iterator, unk);
newCapacity += x18_b->GetSoundPOIList(time, listOut, capacity, newCapacity + iterator, unk);
if (newCapacity > capacity)
newCapacity = capacity;
std::sort(listOut, listOut + newCapacity, CPOINode::compare);
return newCapacity;
}
bool CAnimTreeDoubleChild::VGetBoolPOIState(const char* name) const
{
return false;
return x18_b->VGetBoolPOIState(name);
}
s32 CAnimTreeDoubleChild::VGetInt32POIState(const char* name) const
{
return 0;
return x18_b->VGetBoolPOIState(name);
}
CParticleData::EParentedMode CAnimTreeDoubleChild::VGetParticlePOIState(const char* name) const
{
return CParticleData::EParentedMode::Initial;
return x18_b->VGetParticlePOIState(name);
}
void CAnimTreeDoubleChild::VSetPhase(float)

View File

@ -11,14 +11,15 @@ class CAnimTreeDoubleChild : public CAnimTreeNode
protected:
std::shared_ptr<CAnimTreeNode> x14_a;
std::shared_ptr<CAnimTreeNode> x18_b;
public:
CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a,
const std::weak_ptr<CAnimTreeNode>& b,
CAnimTreeDoubleChild(const std::weak_ptr<CAnimTreeNode>& a, const std::weak_ptr<CAnimTreeNode>& b,
const std::string& name);
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator,
u32) const;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
bool VGetBoolPOIState(const char* name) const;
s32 VGetInt32POIState(const char* name) const;
@ -31,15 +32,14 @@ public:
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const;
void VGetWeightedReaders(std::vector<std::pair<float, std::weak_ptr<IAnimReader>>>& out, float w) const;
virtual float VGetLeftChildWeight() const=0;
virtual float VGetLeftChildWeight() const = 0;
float GetLeftChildWeight() const { return VGetLeftChildWeight(); }
virtual float VGetRightChildWeight() const=0;
virtual float VGetRightChildWeight() const = 0;
float GetRightChildWeight() const { return VGetRightChildWeight(); }
const std::shared_ptr<CAnimTreeNode>& GetLeftChild() const { return x14_a; }
const std::shared_ptr<CAnimTreeNode>& GetRightChild() const { return x18_b; }
};
}
#endif // __URDE_CANIMTREEDOUBLECHILD_HPP__

View File

@ -24,18 +24,46 @@ CAnimTreeTransition::CAnimTreeTransition(bool b1, const std::weak_ptr<CAnimTreeN
{
}
CCharAnimTime CAnimTreeTransition::VGetTimeRemaining() const { return {}; }
std::shared_ptr<IAnimReader> CAnimTreeTransition::VGetBestUnblendedChild() const
{
std::shared_ptr<IAnimReader> child = x18_b->GetBestUnblendedChild();
return (child ? child : x18_b);
}
CCharAnimTime CAnimTreeTransition::VGetTimeRemaining() const
{
CCharAnimTime time = x24_ * x2c_;
CCharAnimTime bTimeRem = x18_b->VGetTimeRemaining();
if (time < bTimeRem)
return bTimeRem;
return time;
}
CSteadyStateAnimInfo CAnimTreeTransition::VGetSteadyStateAnimInfo() const
{
CSteadyStateAnimInfo bInfo = x18_b->VGetSteadyStateAnimInfo();
if (x24_ < bInfo.GetDuration())
return CSteadyStateAnimInfo(bInfo.IsLooping(), bInfo.GetDuration(), bInfo.GetOffset());
return CSteadyStateAnimInfo(bInfo.IsLooping(), x24_, bInfo.GetOffset());
}
std::shared_ptr<IAnimReader> CAnimTreeTransition::VClone() const
{
return std::make_shared<CAnimTreeTransition>(x20_31_b1, std::static_pointer_cast<CAnimTreeNode>(x14_a->Clone()),
std::static_pointer_cast<CAnimTreeNode>(x18_b->Clone()), x24_, x2c_,
x34_, x35_, x1c_flags, x4_name, x36_);
}
SAdvancementResults CAnimTreeTransition::VAdvanceView(const CCharAnimTime& time) const
{
return {};
}
std::shared_ptr<IAnimReader> CAnimTreeTransition::VClone() const { return {}; }
void CAnimTreeTransition::SetBlendingWeight(float w)
{
static_cast<CAnimTreeTweenBase*>(x18_b.get())->SetBlendingWeight(w);
std::static_pointer_cast<CAnimTreeTweenBase>(x18_b)->SetBlendingWeight(w);
}
float CAnimTreeTransition::VGetBlendingWeight() const

View File

@ -23,9 +23,11 @@ public:
const CCharAnimTime&, const CCharAnimTime&, bool, bool, int, const std::string&, bool);
CAnimTreeTransition(bool, const std::weak_ptr<CAnimTreeNode>&, const std::weak_ptr<CAnimTreeNode>&,
const CCharAnimTime&, bool, int, const std::string&);
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const;
CCharAnimTime VGetTimeRemaining() const;
CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const;
std::shared_ptr<IAnimReader> VClone() const;
SAdvancementResults VAdvanceView(const CCharAnimTime& a) const;
void SetBlendingWeight(float w);
float VGetBlendingWeight() const;
};

View File

@ -3,6 +3,8 @@
namespace urde
{
s32 CAnimTreeTweenBase::sAdvancementDepth = 0;
CAnimTreeTweenBase::CAnimTreeTweenBase(bool b1, const std::weak_ptr<CAnimTreeNode>& a,
const std::weak_ptr<CAnimTreeNode>& b, int flags, const std::string& name)
: CAnimTreeDoubleChild(a, b, name), x1c_flags(flags), x20_31_b1(b1)

View File

@ -8,6 +8,7 @@ namespace urde
class CAnimTreeTweenBase : public CAnimTreeDoubleChild
{
static s32 sAdvancementDepth;
protected:
int x1c_flags;
bool x20_31_b1;
@ -34,6 +35,9 @@ public:
std::shared_ptr<IAnimReader> VSimplified();
bool ShouldCullTree() const { return false; }
static void IncAdvancementDepth() { sAdvancementDepth++; }
static void DecAdvancementDepth() { sAdvancementDepth--; }
};
}

View File

@ -33,6 +33,23 @@ CPOINode::CPOINode(CInputStream& in)
x34_flags(in.readUint32Big())
{}
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;
}
bool CPOINode::compare(const CPOINode& a, const CPOINode& b)
{
if (a > b)
return 1;
return (a < b);
}
template <class T>
u32 _getPOIList(const CCharAnimTime& time,
T* listOut,

View File

@ -37,13 +37,18 @@ public:
CPOINode(CInputStream& in);
virtual ~CPOINode() = default;
const std::string& GetName() const {return x8_name;}
const std::string& GetString() const {return x8_name;}
const CCharAnimTime& GetTime() const {return x1c_time;}
void SetTime(const CCharAnimTime& time) { x1c_time = time; }
EPOIType GetPoiType() const { return x18_type; }
u32 GetIndex() const {return x24_index;}
float GetWeight() const { return x2c_weight; }
u32 GetCharacterIndex() const { return x30_charIdx; }
u32 GetFlags() const { return x34_flags; }
bool operator>(const CPOINode& other) const;
bool operator<(const CPOINode& other) const;
static bool compare(const CPOINode& a, const CPOINode& b);
};
template <class T>

View File

@ -47,7 +47,7 @@ CCharAnimTime IMetaAnim::GetTime(const CPreAdvanceIndicator& ind, const IAnimRea
for (u32 i=0 ; i<count ; ++i)
{
CBoolPOINode& node = nodes[i];
if (node.GetName().compare(cmpStr) || !node.GetValue())
if (node.GetString().compare(cmpStr) || !node.GetValue())
continue;
return node.GetTime();
}

View File

@ -6,7 +6,7 @@
namespace urde
{
class CModelFlags;
struct CModelFlags;
class CScriptColorModulate : public CEntity
{
public: