mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:47:43 +00:00
CAnimSourceReader imps
This commit is contained in:
@@ -10,9 +10,46 @@ namespace urde
|
||||
template <class T>
|
||||
class TSegIdMap
|
||||
{
|
||||
std::map<CSegId, T> x0_map;
|
||||
CSegId x0_boneCount = 0;
|
||||
CSegId x1_curPrevBone = 0;
|
||||
u32 x4_capacity = 100;
|
||||
CSegId x8_prevBones[100];
|
||||
T x6c_bones[100];
|
||||
public:
|
||||
const T& AccessElement(const CSegId& id) const {return x0_map[id];}
|
||||
T& operator[](const CSegId& id) {return SetElement(id);}
|
||||
const T& operator[](const CSegId& id) const {return x6c_bones[id];}
|
||||
T& SetElement(const CSegId& id, T&& obj)
|
||||
{
|
||||
x6c_bones[id] = std::move(obj);
|
||||
if (x8_prevBones[id] == 0xff)
|
||||
{
|
||||
x8_prevBones[id] = x1_curPrevBone;
|
||||
x1_curPrevBone = id;
|
||||
++x0_boneCount;
|
||||
}
|
||||
return x6c_bones[id];
|
||||
}
|
||||
T& SetElement(const CSegId& id)
|
||||
{
|
||||
if (x8_prevBones[id] == 0xff)
|
||||
{
|
||||
x8_prevBones[id] = x1_curPrevBone;
|
||||
x1_curPrevBone = id;
|
||||
++x0_boneCount;
|
||||
}
|
||||
return x6c_bones[id];
|
||||
}
|
||||
void DelElement(const CSegId& id)
|
||||
{
|
||||
if (x8_prevBones[id] != 0xff)
|
||||
{
|
||||
if (id == x1_curPrevBone)
|
||||
x1_curPrevBone = x8_prevBones[id];
|
||||
x8_prevBones[id] = 0xff;
|
||||
--x0_boneCount;
|
||||
}
|
||||
}
|
||||
bool HasElement(const CSegId& id) const {return x8_prevBones[id] != 0xff;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user