fix weird side effect of long first frame in standing animations
This commit is contained in:
parent
a8643af13d
commit
ea77b152ca
4 changed files with 12 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
Version 1.7.13+svn:
|
||||
* Graphics:
|
||||
* Fix bug 15344 : missing ice to nothing transition
|
||||
* Fix weird side effect of long first frame in standing anims
|
||||
* Language and i18n:
|
||||
* Updated translations: Czech , Italian
|
||||
* Multiplayer
|
||||
|
|
|
@ -97,9 +97,8 @@ public:
|
|||
protected:
|
||||
friend class unit_animation;
|
||||
int starting_frame_time_;
|
||||
// backward compatibility for teleport anims
|
||||
void remove_frames_until(int starting_time);
|
||||
void remove_frames_after(int ending_time);
|
||||
void set_end_time(int ending_time);
|
||||
|
||||
private:
|
||||
struct frame
|
||||
|
|
|
@ -324,7 +324,7 @@ void animated<T,T_void_value>::remove_frames_until(int new_starting_time)
|
|||
|
||||
}
|
||||
template<typename T, typename T_void_value>
|
||||
void animated<T,T_void_value>::remove_frames_after(int new_ending_time)
|
||||
void animated<T,T_void_value>::set_end_time(int new_ending_time)
|
||||
{
|
||||
int last_start_time = starting_frame_time_;
|
||||
typename std::vector<frame>::iterator current_frame = frames_.begin();
|
||||
|
@ -332,7 +332,10 @@ typename std::vector<frame>::iterator current_frame = frames_.begin();
|
|||
last_start_time += current_frame->duration_;
|
||||
current_frame++;
|
||||
}
|
||||
// at this point last_start_time is set to the beginning of the first frame past the end
|
||||
// or set to frames_.end()
|
||||
frames_.erase(current_frame,frames_.end());
|
||||
frames_.back().duration_ += new_ending_time - last_start_time;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -365,11 +365,11 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
|
|||
animations.back().event_ = utils::split("levelout");
|
||||
|
||||
animations.push_back(*itor);
|
||||
animations.back().unit_anim_.override(0,1,"","",0,"");
|
||||
animations.back().unit_anim_.override(0,1);
|
||||
animations.back().event_ = utils::split("pre_movement");
|
||||
|
||||
animations.push_back(*itor);
|
||||
animations.back().unit_anim_.override(0,1,"","",0,"");
|
||||
animations.back().unit_anim_.override(0,1);
|
||||
animations.back().event_ = utils::split("post_movement");
|
||||
|
||||
animations.push_back(*itor);
|
||||
|
@ -383,7 +383,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
|
|||
animations.back().event_ = utils::split("defend");
|
||||
|
||||
animations.push_back(*itor);
|
||||
animations.back().unit_anim_.override(0,1,"");
|
||||
animations.back().unit_anim_.override(0,1);
|
||||
animations.back().event_ = utils::split("defend");
|
||||
|
||||
animations.push_back(*itor);
|
||||
|
@ -406,7 +406,7 @@ void unit_animation::fill_initial_animations( std::vector<unit_animation> & anim
|
|||
animations.back().sub_anims_["_death_sound"].add_frame(1,frame_builder().sound(cfg["die_sound"]),true);
|
||||
|
||||
animations.push_back(*itor);
|
||||
animations.back().unit_anim_.override(0,1,"","",0,"");
|
||||
animations.back().unit_anim_.override(0,1);
|
||||
animations.back().event_ = utils::split("victory");
|
||||
|
||||
animations.push_back(*itor);
|
||||
|
@ -691,7 +691,7 @@ void unit_animation::add_anims( std::vector<unit_animation> & animations, const
|
|||
if (anim["layer"].empty()) anim["layer"] = default_layer;
|
||||
anim["apply_to"] = "pre_teleport";
|
||||
animations.push_back(unit_animation(anim));
|
||||
animations.back().unit_anim_.remove_frames_after(0);
|
||||
animations.back().unit_anim_.set_end_time(0);
|
||||
anim["apply_to"] ="post_teleport";
|
||||
animations.push_back(unit_animation(anim));
|
||||
animations.back().unit_anim_.remove_frames_until(0);
|
||||
|
@ -713,7 +713,7 @@ void unit_animation::particule::override(int start_time
|
|||
const unit_frame & last_frame = get_last_frame();
|
||||
add_frame(duration -get_animation_duration(), last_frame);
|
||||
} else if(get_animation_duration() > duration) {
|
||||
remove_frames_after(duration);
|
||||
set_end_time(duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue