mirror of
https://github.com/simtactics/niotso.git
synced 2025-03-22 10:52:20 +00:00
Fixed writing to Skeleton.Bones[-1] when FindBone() returns -1 because, say, PELVISPOLY does not exist
This commit is contained in:
parent
e3f6880ed2
commit
6df7a494a1
1 changed files with 17 additions and 14 deletions
|
@ -217,7 +217,9 @@ void AdvanceFrame(Skeleton_t& Skeleton, Animation_t& Animation){
|
||||||
static unsigned Frame = 0;
|
static unsigned Frame = 0;
|
||||||
|
|
||||||
for(unsigned i=0; i<Animation.MotionsCount; i++){
|
for(unsigned i=0; i<Animation.MotionsCount; i++){
|
||||||
Bone_t& Bone = Skeleton.Bones[FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount)];
|
unsigned BoneIndex = FindBone(Skeleton, Animation.Motions[i].BoneName, Skeleton.BoneCount);
|
||||||
|
if(BoneIndex != (unsigned)-1){
|
||||||
|
Bone_t& Bone = Skeleton.Bones[BoneIndex];
|
||||||
|
|
||||||
if(Animation.Motions[i].HasTranslation){
|
if(Animation.Motions[i].HasTranslation){
|
||||||
Translation_t& Translation = Animation.Motions[i].Translations[Frame];
|
Translation_t& Translation = Animation.Motions[i].Translations[Frame];
|
||||||
|
@ -233,6 +235,7 @@ void AdvanceFrame(Skeleton_t& Skeleton, Animation_t& Animation){
|
||||||
Bone.Rotation.w = Rotation.w;
|
Bone.Rotation.w = Rotation.w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(++Frame >= Animation.Motions[0].FrameCount) Frame = 0;
|
if(++Frame >= Animation.Motions[0].FrameCount) Frame = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue