mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 12:27:43 +00:00
IAnimReader: Make use of size_t for capacity and iterators
Allows using container sizes and capacities without needing to cast them, allowing for dehardcoding of array sizes in some scenarios.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "Runtime/Character/CSequenceHelper.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Runtime/Character/CAnimSysContext.hpp"
|
||||
#include "Runtime/Character/CBoolPOINode.hpp"
|
||||
#include "Runtime/Character/CInt32POINode.hpp"
|
||||
@@ -45,37 +47,41 @@ CSequenceFundamentals CSequenceHelper::ComputeSequenceFundamentals() {
|
||||
if (x10_treeNodes.size() > 0) {
|
||||
std::shared_ptr<CAnimTreeNode> node = CAnimTreeNode::Cast(x10_treeNodes[0]->Clone());
|
||||
for (size_t i = 0; i < x10_treeNodes.size(); ++i) {
|
||||
CBoolPOINode boolNodeArr[64];
|
||||
u32 numBools = node->GetBoolPOIList(CCharAnimTime::Infinity(), boolNodeArr, 64, 0, 0);
|
||||
std::array<CBoolPOINode, 64> boolNodeArr;
|
||||
const size_t numBools =
|
||||
node->GetBoolPOIList(CCharAnimTime::Infinity(), boolNodeArr.data(), boolNodeArr.size(), 0, 0);
|
||||
boolNodes.reserve(boolNodes.size() + numBools);
|
||||
for (u32 j = 0; j < numBools; ++j) {
|
||||
for (size_t j = 0; j < numBools; ++j) {
|
||||
CBoolPOINode& n = boolNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
boolNodes.push_back(n);
|
||||
}
|
||||
|
||||
CInt32POINode int32NodeArr[64];
|
||||
u32 numInt32s = node->GetInt32POIList(CCharAnimTime::Infinity(), int32NodeArr, 64, 0, 0);
|
||||
std::array<CInt32POINode, 64> int32NodeArr;
|
||||
const size_t numInt32s =
|
||||
node->GetInt32POIList(CCharAnimTime::Infinity(), int32NodeArr.data(), int32NodeArr.size(), 0, 0);
|
||||
int32Nodes.reserve(int32Nodes.size() + numInt32s);
|
||||
for (u32 j = 0; j < numInt32s; ++j) {
|
||||
for (size_t j = 0; j < numInt32s; ++j) {
|
||||
CInt32POINode& n = int32NodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
int32Nodes.push_back(n);
|
||||
}
|
||||
|
||||
CParticlePOINode particleNodeArr[64];
|
||||
u32 numParticles = node->GetParticlePOIList(CCharAnimTime::Infinity(), particleNodeArr, 64, 0, 0);
|
||||
std::array<CParticlePOINode, 64> particleNodeArr;
|
||||
const size_t numParticles =
|
||||
node->GetParticlePOIList(CCharAnimTime::Infinity(), particleNodeArr.data(), particleNodeArr.size(), 0, 0);
|
||||
particleNodes.reserve(particleNodes.size() + numParticles);
|
||||
for (u32 j = 0; j < numParticles; ++j) {
|
||||
for (size_t j = 0; j < numParticles; ++j) {
|
||||
CParticlePOINode& n = particleNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
particleNodes.push_back(n);
|
||||
}
|
||||
|
||||
CSoundPOINode soundNodeArr[64];
|
||||
u32 numSounds = node->GetSoundPOIList(CCharAnimTime::Infinity(), soundNodeArr, 64, 0, 0);
|
||||
std::array<CSoundPOINode, 64> soundNodeArr;
|
||||
const size_t numSounds =
|
||||
node->GetSoundPOIList(CCharAnimTime::Infinity(), soundNodeArr.data(), soundNodeArr.size(), 0, 0);
|
||||
soundNodes.reserve(soundNodes.size() + numSounds);
|
||||
for (u32 j = 0; j < numSounds; ++j) {
|
||||
for (size_t j = 0; j < numSounds; ++j) {
|
||||
CSoundPOINode& n = soundNodeArr[j];
|
||||
n.SetTime(n.GetTime() + duration);
|
||||
soundNodes.push_back(n);
|
||||
|
||||
Reference in New Issue
Block a user