how could I commit such horrible code in the first place ???
This commit is contained in:
parent
f6630cdca5
commit
f163feee4a
3 changed files with 7 additions and 11 deletions
|
@ -1847,8 +1847,7 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc)
|
|||
}
|
||||
}
|
||||
|
||||
double tmp_offset = current_frame.offset(anim_->get_current_frame_time());
|
||||
if(tmp_offset == -20.0) tmp_offset = offset_;
|
||||
double tmp_offset = current_frame.offset(anim_->get_current_frame_time(),offset_);
|
||||
int d2 = disp.hex_size() / 2;
|
||||
const int x = static_cast<int>(tmp_offset * xdst + (1.0-tmp_offset) * xsrc) + d2;
|
||||
const int y = static_cast<int>(tmp_offset * ydst + (1.0-tmp_offset) * ysrc) + d2 - height_adjust;
|
||||
|
@ -2080,8 +2079,7 @@ std::set<gamemap::location> unit::overlaps(const gamemap::location &loc) const
|
|||
|
||||
// Very early calls, anim not initialized yet
|
||||
double tmp_offset=offset_;
|
||||
if(anim_)tmp_offset= anim_->get_current_frame().offset(anim_->get_animation_time());
|
||||
if(tmp_offset == -20.0) tmp_offset = offset_;
|
||||
if(anim_)tmp_offset= anim_->get_current_frame().offset(anim_->get_animation_time(),offset_);
|
||||
|
||||
// Invalidate adjacent neighbours if we don't stay in our hex
|
||||
if(tmp_offset != 0) {
|
||||
|
|
|
@ -312,11 +312,9 @@ static void unit_attack_ranged(
|
|||
damage >0)
|
||||
){
|
||||
const unit_frame& missile_frame = missile_animation.get_current_frame();
|
||||
double pos = missile_frame.offset(missile_animation.get_current_frame_time());
|
||||
if(pos == -20.0) {
|
||||
pos = double(animation_time -missile_animation.get_begin_time())/
|
||||
double(missile_animation.get_end_time()-missile_animation.get_begin_time());
|
||||
}
|
||||
double pos = missile_frame.offset(missile_animation.get_current_frame_time(),
|
||||
double(animation_time -missile_animation.get_begin_time())/
|
||||
double(missile_animation.get_end_time()-missile_animation.get_begin_time()));
|
||||
disp->invalidate(b);
|
||||
disp->invalidate(a);
|
||||
if(leader_loc.valid()) disp->invalidate(leader_loc);
|
||||
|
|
|
@ -86,8 +86,8 @@ class unit_frame {
|
|||
fixed_t highlight_ratio(int current_time) const
|
||||
{ return ftofxp(highlight_ratio_.get_current_element(current_time)); }
|
||||
|
||||
double offset(int current_time) const
|
||||
{ return offset_.get_current_element(current_time); }
|
||||
double offset(int current_time,double default_val =0.0) const
|
||||
{ return offset_.get_current_element(current_time) == -20 ? default_val : offset_.get_current_element(current_time) ; }
|
||||
|
||||
bool does_not_change() const;
|
||||
private:
|
||||
|
|
Loading…
Add table
Reference in a new issue