[Super-tux-commit] supertux/lib/special sprite.cpp,1.9,1.10
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-08-14 18:45:34
|
Update of /cvsroot/super-tux/supertux/lib/special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28247/lib/special Modified Files: sprite.cpp Log Message: We could been losting frames. Fixed. Index: sprite.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- sprite.cpp 14 Aug 2004 11:50:24 -0000 1.9 +++ sprite.cpp 14 Aug 2004 18:45:25 -0000 1.10 @@ -141,31 +141,39 @@ if(animation_loops == 0) return; -float inc_frame = (action->fps/1000) * (SDL_GetTicks() - last_tick); +float frame_inc = (action->fps/1000.0) * (SDL_GetTicks() - last_tick); if(animation_reversed) - frame -= inc_frame; + frame -= frame_inc; else - frame += inc_frame; + frame += frame_inc; last_tick = SDL_GetTicks(); if(animation_reversed) { - if((unsigned int)frame < 0) + float expedient = frame - 0; + if(expedient < 0) { frame = get_frames()-1; if(animation_loops > 0) animation_loops--; + + if(expedient > -get_frames()) + frame -= expedient; } } else { - if((unsigned int)frame >= action->surfaces.size()) + float expedient = frame - action->surfaces.size(); + if(expedient >= 0) { frame = 0; if(animation_loops > 0) animation_loops--; + + if(expedient < get_frames()) + frame += expedient; } } } |