Finish to make the use of update_last_draw_time() consistent.
We update it before get the current frame, because if the redraw is trigerred by a need_update, we need to draw the new frame not the old one. I think that the previous use just caused a tiny lag when we redraw every x ms, but can cause a "duration of the frame" delay if we redraw only when an update is needed (which is the good optimal behavior). This also can prevent skipping of the last frame (if after drawing, we update a new frame but finish the anim) PS: other game objects already use update_last_draw_time() like that.
This commit is contained in:
parent
4d95ea11c5
commit
25e4ad6c94
1 changed files with 2 additions and 1 deletions
|
@ -647,6 +647,8 @@ void unit_animation::crude_animation::redraw()
|
|||
|
||||
double tmp_offset = offset();
|
||||
int d2 = game_display::get_singleton()->hex_size() / 2;
|
||||
|
||||
update_last_draw_time();
|
||||
const unit_frame& current_frame= get_current_frame();
|
||||
if(!current_frame.sound().empty() && get_current_frame_begin_time() != last_frame_begin_time_ ) {
|
||||
sound::play_sound(current_frame.sound());
|
||||
|
@ -714,7 +716,6 @@ void unit_animation::crude_animation::redraw()
|
|||
orientation);
|
||||
}
|
||||
}
|
||||
update_last_draw_time();
|
||||
}
|
||||
unit_animation::crude_animation::~crude_animation()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue