mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixed: Animation errors should not lead to hanging
This commit is contained in:
committed by
Andrii Danylchenko
parent
0427fa45dd
commit
1ce7701168
@@ -210,12 +210,17 @@ bool CCreatureAnimation::incrementFrame(float timePassed)
|
|||||||
{
|
{
|
||||||
elapsedTime += timePassed;
|
elapsedTime += timePassed;
|
||||||
currentFrame += timePassed * speed;
|
currentFrame += timePassed * speed;
|
||||||
|
const auto framesNumber = framesInGroup(type);
|
||||||
|
|
||||||
if (currentFrame >= float(framesInGroup(type)))
|
if(framesNumber <= 0)
|
||||||
|
{
|
||||||
|
endAnimation();
|
||||||
|
}
|
||||||
|
else if(currentFrame >= float(framesNumber))
|
||||||
{
|
{
|
||||||
// just in case of extremely low fps (or insanely high speed)
|
// just in case of extremely low fps (or insanely high speed)
|
||||||
while (currentFrame >= float(framesInGroup(type)))
|
while(currentFrame >= float(framesNumber))
|
||||||
currentFrame -= framesInGroup(type);
|
currentFrame -= framesNumber;
|
||||||
|
|
||||||
if(once)
|
if(once)
|
||||||
setType(CCreatureAnim::HOLDING);
|
setType(CCreatureAnim::HOLDING);
|
||||||
|
Reference in New Issue
Block a user