Update of /cvsroot/super-tux/supertux/lib/special
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28921/lib/special
Modified Files:
sprite.cpp
Log Message:
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.
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- sprite.cpp 27 Aug 2004 20:34:01 -0000 1.21
+++ sprite.cpp 8 Sep 2004 13:50:36 -0000 1.22
@@ -131,6 +131,9 @@
return;
}
action = i->second;
+
+if((int)frame >= get_frames())
+ frame = 0;
}
void
@@ -202,7 +205,7 @@
}
else
{
- float excedent = frame - action->surfaces.size();
+ float excedent = frame - (get_frames()+1);
if((int)excedent >= 0)
{
frame = 0;
@@ -230,7 +233,7 @@
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],
|