fix bug #12574: problem when offset is 0
This commit is contained in:
parent
bb9d01e43e
commit
3d7023731a
3 changed files with 15 additions and 13 deletions
|
@ -18,7 +18,6 @@
|
|||
#include "halo.hpp"
|
||||
#include "unit.hpp"
|
||||
|
||||
|
||||
struct tag_name_manager {
|
||||
tag_name_manager() : names() {
|
||||
names.push_back("animation");
|
||||
|
@ -815,7 +814,6 @@ void unit_animation::particule::start_animation(int start_time, bool cycles)
|
|||
last_frame_begin_time_ = get_begin_time() -1;
|
||||
}
|
||||
|
||||
|
||||
void unit_animator::add_animation(unit* animated_unit,const std::string& event,
|
||||
const map_location &src , const int value,bool with_bars,bool cycles,
|
||||
const std::string text,const Uint32 text_color,
|
||||
|
@ -832,7 +830,7 @@ void unit_animator::add_animation(unit* animated_unit,const std::string& event,
|
|||
tmp.with_bars= with_bars;
|
||||
tmp.cycles = cycles;
|
||||
tmp.animation = animated_unit->choose_animation(*disp,src,event,value,hit_type,attack,second_attack,swing_num);
|
||||
if(!tmp.animation) return;
|
||||
if(!tmp.animation) return;
|
||||
|
||||
|
||||
|
||||
|
@ -868,14 +866,14 @@ void unit_animator::start_animations()
|
|||
int begin_time = INT_MAX;
|
||||
std::vector<anim_elem>::iterator anim;
|
||||
for(anim = animated_units_.begin(); anim != animated_units_.end();anim++) {
|
||||
if(anim->my_unit->get_animation()) {
|
||||
if(anim->animation) {
|
||||
begin_time = std::min<int>(begin_time,anim->animation->get_begin_time());
|
||||
} else {
|
||||
begin_time = std::min<int>(begin_time,anim->my_unit->get_animation()->get_begin_time());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(anim->my_unit->get_animation()) {
|
||||
if(anim->animation) {
|
||||
begin_time = std::min<int>(begin_time,anim->animation->get_begin_time());
|
||||
} else {
|
||||
begin_time = std::min<int>(begin_time,anim->my_unit->get_animation()->get_begin_time());
|
||||
}
|
||||
}
|
||||
}
|
||||
for(anim = animated_units_.begin(); anim != animated_units_.end();anim++) {
|
||||
if(anim->animation) {
|
||||
anim->my_unit->start_animation(begin_time,anim->src, anim->animation,anim->with_bars, anim->cycles,anim->text,anim->text_color);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "log.hpp"
|
||||
#include "mouse_events.hpp"
|
||||
|
||||
int debug;
|
||||
|
||||
#define LOG_DP LOG_STREAM(info, display)
|
||||
|
||||
|
@ -195,6 +196,7 @@ void unit_attack(
|
|||
const attack_type& attack, const attack_type* secondary_attack,
|
||||
int swing,std::string hit_text,bool drain,std::string att_text)
|
||||
{
|
||||
debug = 1;
|
||||
game_display* disp = game_display::get_singleton();
|
||||
if(!disp || preferences::show_combat() == false) return;
|
||||
unit_map& units = disp->get_units();
|
||||
|
@ -264,6 +266,7 @@ void unit_attack(
|
|||
if(leader_loc.valid() && leader_loc != att->first && leader_loc != def->first) leader->second.set_standing(leader_loc);
|
||||
att->second.set_standing(a);
|
||||
def->second.set_standing(b);
|
||||
debug = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ const frame_parameters frame_builder::parameters(int current_time) const
|
|||
result.blend_with = blend_with_;
|
||||
result.blend_ratio = blend_ratio_.get_current_element(current_time);
|
||||
result.highlight_ratio = highlight_ratio_.get_current_element(current_time,1.0);
|
||||
result.offset = offset_.get_current_element(current_time);
|
||||
result.offset = offset_.get_current_element(current_time,-1000);
|
||||
result.submerge = submerge_.get_current_element(current_time);
|
||||
result.x = x_.get_current_element(current_time);
|
||||
result.y = y_.get_current_element(current_time);
|
||||
|
@ -548,7 +548,8 @@ const frame_parameters unit_frame::merge_parameters(int current_time,const frame
|
|||
if(primary && engine_val.highlight_ratio != 1.0) result.highlight_ratio = result.highlight_ratio +engine_val.highlight_ratio - 1.0; // selected unit
|
||||
|
||||
assert(engine_val.offset == 0);
|
||||
result.offset = current_val.offset?current_val.offset:animation_val.offset;
|
||||
result.offset = (current_val.offset!=-1000)?current_val.offset:animation_val.offset;
|
||||
if(result.offset == -1000) result.offset = 0.0;
|
||||
|
||||
/** engine provides a submerge for units in water */
|
||||
result.submerge = current_val.submerge?current_val.submerge:animation_val.submerge;
|
||||
|
|
Loading…
Add table
Reference in a new issue