mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-18 18:54:58 +00:00
Fix crash when AnimationLayer is missing
This commit is contained in:
parent
18034bcc18
commit
b98e2532ed
1 changed files with 3 additions and 6 deletions
|
@ -1694,18 +1694,15 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
||||||
|
|
||||||
Animation *SkeletalSprite::getCurrentAnimation(int layer)
|
Animation *SkeletalSprite::getCurrentAnimation(int layer)
|
||||||
{
|
{
|
||||||
return animLayers[layer].getCurrentAnimation();
|
return layer < animLayers.size() ? animLayers[layer].getCurrentAnimation() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletalSprite::setTime(float time, int layer)
|
void SkeletalSprite::setTime(float time, int layer)
|
||||||
{
|
{
|
||||||
|
if(layer < animLayers.size())
|
||||||
animLayers[layer].timer = time;
|
animLayers[layer].timer = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack:
|
|
||||||
// calculate based on frames
|
|
||||||
const int lerpAvg = 3;
|
|
||||||
|
|
||||||
void AnimationLayer::updateBones()
|
void AnimationLayer::updateBones()
|
||||||
{
|
{
|
||||||
if (!animating && !(&s->animLayers[0] == this) && fallThru == 0) return;
|
if (!animating && !(&s->animLayers[0] == this) && fallThru == 0) return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue