From: Ricardo Cruz Date: Wed, 8 Sep 2004 13:50:36 +0000 (+0000) Subject: This should fix animations. (bugs in the line of bomb explosions) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ed3fb601b5694a239054a4faf74e249d6ea4e199;p=supertux.git This should fix animations. (bugs in the line of bomb explosions) Though, there are still warnings of out of range animations. Would be nice if someone could have a look at this. SVN-Revision: 1874 --- diff --git a/lib/special/sprite.cpp b/lib/special/sprite.cpp index 4525cfbde..8e8060486 100644 --- a/lib/special/sprite.cpp +++ b/lib/special/sprite.cpp @@ -131,6 +131,9 @@ if(i == actions.end()) return; } action = i->second; + +if((int)frame >= get_frames()) + frame = 0; } void @@ -202,7 +205,7 @@ if(animation_reversed) } else { - float excedent = frame - action->surfaces.size(); + float excedent = frame - (get_frames()+1); if((int)excedent >= 0) { frame = 0; @@ -230,7 +233,7 @@ Sprite::draw(DrawingContext& context, const Vector& pos, int layer, if((int)frame >= get_frames() || (int)frame < 0) std::cerr << "Warning: frame out of range: " << (int)frame - << "/" << get_frames() << " at sprite: " << get_name() + << "/" << get_frames() << " at " << get_name() << "/" << get_action_name() << std::endl; else context.draw_surface(action->surfaces[(int)frame],