Right now we figure out which animation frame to use
based on a static counter variable. Since it's static
instead of per-object, if there are multiple instances
it ends up counting up too fast.
We could:
1) make it per-object state
2) drop it and use the ifdef'd out alternative implementation
that potentially drops frames if the machine is sluggish
This commit chooses 2, but we may end up going to one if the
frame dropping turns out to be problematic.
Based on deductive work from Kevin Murphy.
animation->previous_time = animation->now;
animation->now = ply_get_timestamp ();
-#ifdef REAL_TIME_ANIMATION
should_continue = animate_at_time (animation,
animation->now - animation->start_time);
-#else
- static double time = 0.0;
- time += 1.0 / FRAMES_PER_SECOND;
- should_continue = animate_at_time (animation, time);
-#endif
sleep_time = 1.0 / FRAMES_PER_SECOND;
sleep_time = MAX (sleep_time - (ply_get_timestamp () - animation->now),
bool should_continue;
throbber->now = ply_get_timestamp ();
-#ifdef REAL_TIME_ANIMATION
should_continue = animate_at_time (throbber,
- throbber->now - throbber->start_time);
-#else
- static double time = 0.0;
- time += 1.0 / FRAMES_PER_SECOND;
- should_continue = animate_at_time (throbber, time);
-#endif
+ throbber->now - throbber->start_time);
sleep_time = 1.0 / FRAMES_PER_SECOND;
sleep_time = MAX (sleep_time - (ply_get_timestamp () - throbber->now),