diff --git a/src/display3d.cpp b/src/display3d.cpp index 93fd7b4ecad..6bbf5dbe82b 100644 --- a/src/display3d.cpp +++ b/src/display3d.cpp @@ -366,12 +366,13 @@ bool drawShape(BASE_OBJECT *psObj, iIMDShape *strImd, int colour, PIELIGHT build } if (strImd->objanimframes) { - const int elapsed = graphicsTime - psObj->timeAnimationStarted; + int elapsed = graphicsTime - psObj->timeAnimationStarted; if (elapsed < 0) { - return false; // Animation hasn't started yet. + elapsed = 0; // Animation hasn't started yet. } const int frame = (elapsed / strImd->objanimtime) % strImd->objanimframes; + ASSERT(frame < strImd->objanimframes, "Bad index %d >= %d", frame, strImd->objanimframes); const ANIMFRAME &state = strImd->objanimdata.at(frame); if (state.scale.x == -1.0f) // disabled frame, for implementing key frame animation {