fix animation wide color blending not working properly
This commit is contained in:
parent
25a7e1dcd6
commit
4d09f05618
4 changed files with 18 additions and 8 deletions
|
@ -524,9 +524,10 @@ int unit_animation::crude_animation::halo_y(const int default_val) const
|
|||
}
|
||||
double unit_animation::crude_animation::blend_ratio(const double default_val) const
|
||||
{
|
||||
|
||||
return get_current_frame().blend_ratio(
|
||||
get_current_frame_time(),
|
||||
ftofxp(blend_ratio_.get_current_element(get_animation_time() - get_begin_time(),default_val)));
|
||||
blend_ratio_.get_current_element(get_animation_time() - get_begin_time(),default_val));
|
||||
}
|
||||
|
||||
Uint32 unit_animation::crude_animation::blend_with(const Uint32 default_val) const
|
||||
|
@ -594,7 +595,7 @@ unit_animation::crude_animation::crude_animation(
|
|||
halo_x_ = progressive_int(cfg[frame_string+"halo_x"],get_animation_duration());
|
||||
halo_y_ = progressive_int(cfg[frame_string+"halo_y"],get_animation_duration());
|
||||
std::vector<std::string> tmp_blend=utils::split(cfg[frame_string+"blend_color"]);
|
||||
if(tmp_blend.size() ==3) blend_with_= display::rgb(atoi(tmp_blend[0].c_str()),atoi(tmp_blend[1].c_str()),atoi(tmp_blend[2].c_str()));
|
||||
if(tmp_blend.size() ==3) {blend_with_= display::rgb(atoi(tmp_blend[0].c_str()),atoi(tmp_blend[1].c_str()),atoi(tmp_blend[2].c_str()));};
|
||||
blend_ratio_ = progressive_double(cfg[frame_string+"blend_ratio"],get_animation_duration());
|
||||
highlight_ratio_ = progressive_double(cfg[frame_string+"alpha"],get_animation_duration());
|
||||
offset_ = progressive_double(cfg[frame_string+"offset"],get_animation_duration());
|
||||
|
|
|
@ -58,11 +58,11 @@ class unit_animation
|
|||
image::locator image() const { return unit_anim_.get_current_frame().image() ; }
|
||||
image::locator image_diagonal() const { return unit_anim_.get_current_frame().image_diagonal() ; }
|
||||
std::string sound() const { return unit_anim_.get_current_frame().sound() ; };
|
||||
Uint32 blend_with() const{ return unit_anim_.get_current_frame().blend_with(0) ; };
|
||||
Uint32 blend_with(const Uint32 default_val=0) const{ return unit_anim_.blend_with(default_val) ; };
|
||||
const std::string &halo(const std::string&default_val ="") const{ return unit_anim_.halo(default_val); };
|
||||
int halo_x(const int default_val = 0) const{ return unit_anim_.halo_x(default_val); };
|
||||
int halo_y(const int default_val = 0) const{ return unit_anim_.halo_y(default_val); };
|
||||
double blend_ratio(const double default_val = 0) const{ return unit_anim_.blend_ratio(default_val); };
|
||||
double blend_ratio(const double default_val = 0.0) const{ return unit_anim_.blend_ratio(default_val); };
|
||||
fixed_t highlight_ratio(const float default_val = 1.0) const{ return unit_anim_.highlight_ratio(default_val); };
|
||||
public:
|
||||
double offset(double default_val =0.0) const{ return unit_anim_.offset(default_val); };
|
||||
|
@ -94,7 +94,7 @@ class unit_animation
|
|||
const std::string &halo(const std::string&default_val ="") const;
|
||||
int halo_x(const int default_val = 0) const;
|
||||
int halo_y(const int default_val = 0) const;
|
||||
double blend_ratio(const double default_val = 0) const;
|
||||
double blend_ratio(const double default_val = 0.0) const;
|
||||
Uint32 blend_with(const Uint32 default_val = 0) const;
|
||||
fixed_t highlight_ratio(const float default_val = 1.0) const;
|
||||
double offset(double default_val =0.0) const;
|
||||
|
|
|
@ -188,7 +188,12 @@ unit_frame::unit_frame(const config& cfg)
|
|||
sound_ = cfg["sound"];
|
||||
text_ = cfg["text"];
|
||||
std::vector<std::string> tmp_string_vect=utils::split(cfg["text_color"]);
|
||||
if(tmp_string_vect.size() ==3) text_color_ = display::rgb(atoi(tmp_string_vect[0].c_str()),atoi(tmp_string_vect[1].c_str()),atoi(tmp_string_vect[2].c_str()));
|
||||
if(tmp_string_vect.size() ==3) {
|
||||
text_color_ = display::rgb(atoi(tmp_string_vect[0].c_str()),atoi(tmp_string_vect[1].c_str()),atoi(tmp_string_vect[2].c_str()));
|
||||
} else {
|
||||
text_color_ = 0;
|
||||
}
|
||||
|
||||
if(!cfg["duration"].empty()) {
|
||||
duration_ = atoi(cfg["duration"].c_str());
|
||||
} else {
|
||||
|
@ -198,7 +203,11 @@ unit_frame::unit_frame(const config& cfg)
|
|||
halo_x_ = progressive_int(cfg["halo_x"],duration_);
|
||||
halo_y_ = progressive_int(cfg["halo_y"],duration_);
|
||||
tmp_string_vect=utils::split(cfg["blend_color"]);
|
||||
if(tmp_string_vect.size() ==3) blend_with_= display::rgb(atoi(tmp_string_vect[0].c_str()),atoi(tmp_string_vect[1].c_str()),atoi(tmp_string_vect[2].c_str()));
|
||||
if(tmp_string_vect.size() ==3) {
|
||||
blend_with_= display::rgb(atoi(tmp_string_vect[0].c_str()),atoi(tmp_string_vect[1].c_str()),atoi(tmp_string_vect[2].c_str()));
|
||||
} else {
|
||||
blend_with_ = 0;
|
||||
}
|
||||
blend_ratio_ = progressive_double(cfg["blend_ratio"],duration_);
|
||||
highlight_ratio_ = progressive_double(cfg["alpha"],duration_);
|
||||
offset_ = progressive_double(cfg["offset"],duration_);
|
||||
|
|
|
@ -81,7 +81,7 @@ class unit_frame {
|
|||
int halo_y(int current_time,const int default_val=0) const { return halo_y_.get_current_element(current_time,default_val); }
|
||||
int duration() const { return duration_; }
|
||||
Uint32 blend_with(const Uint32 default_val) const { return blend_with_?blend_with_:default_val; }
|
||||
double blend_ratio(int current_time,const fixed_t default_val=0.0) const
|
||||
double blend_ratio(int current_time,const double default_val=0.0) const
|
||||
{ return blend_ratio_.get_current_element(current_time,default_val); }
|
||||
|
||||
fixed_t highlight_ratio(int current_time,double default_val =0.0) const
|
||||
|
|
Loading…
Add table
Reference in a new issue