- if(animation_reversed)
- frame -= frame_inc;
- else
- frame += frame_inc;
-
- if(animation_reversed) {
- if(frame < 0 || frame >= (float)get_frames()) {
- // last case can happen when not used reverse_animation()
- float excedent = frame - 0;
- frame = get_frames() - 1;
- if(animation_loops > 0)
- {
- animation_loops--;
- if(animation_loops == 0 && !next_action.empty())
- {
- set_action(next_action);
- start_animation(-1);
- }
- }
-
- if(fabsf(excedent) < get_frames())
- frame += excedent;
- }
- }
- else
- {
- if(frame >= (float)get_frames())
- {
- float excedent = frame - get_frames();
+ frame += frame_inc;
+
+ if(frame >= get_frames()) {
+ frame = fmodf(frame+get_frames(), get_frames());
+
+ animation_loops--;
+ if(animation_loops == 0)