use value and value_second to allow movement anims...

...to be filtered on number of steps done and steps left. This allows
take-off and landing anims
This commit is contained in:
Jérémy Rosen 2009-08-22 20:56:10 +00:00
parent 909f082dd1
commit 6ca963eaa4
2 changed files with 7 additions and 3 deletions

View file

@ -17,6 +17,8 @@ Version 1.7.3+svn:
to story text instead
* Fixed 100% CPU usage on storyscreens with no text (e.g. map screens)
* Fix ODR issues in gui2
* Animations
* Movement have the number of steps done in value and the number of step left in value_second, this allows take-off and landing animations
Version 1.7.3:
* AI:

View file

@ -61,7 +61,7 @@ static void teleport_unit_between( const map_location& a, const map_location& b,
events::pump();
}
static void move_unit_between(const map_location& a, const map_location& b, unit& temp_unit)
static void move_unit_between(const map_location& a, const map_location& b, unit& temp_unit,unsigned int step_num,unsigned int step_left)
{
game_display* disp = game_display::get_singleton();
if(!disp || disp->video().update_locked() || disp->video().faked() || (disp->fogged(a) && disp->fogged(b))) {
@ -69,11 +69,13 @@ static void move_unit_between(const map_location& a, const map_location& b, unit
}
temp_unit.set_location(a);
disp->place_temporary_unit(temp_unit);
temp_unit.set_facing(a.get_relative_dir(b));
unit_animator animator;
animator.replace_anim_if_invalid(&temp_unit,"movement",a,b);
animator.replace_anim_if_invalid(&temp_unit,"movement",a,b,step_num,
false,false,"",0,unit_animation::INVALID,NULL,NULL,step_left);
animator.start_animations();
animator.pause_animation();
disp->scroll_to_tiles(a,b,game_display::ONSCREEN,true,0.0,false);
@ -180,7 +182,7 @@ void move_unit(const std::vector<map_location>& path, unit& u, const std::vector
}
if(tiles_adjacent(path[i], path[i+1])) {
move_unit_between(path[i],path[i+1],temp_unit);
move_unit_between(path[i],path[i+1],temp_unit,i,path.size()-2-i);
} else if (path[i] != path[i+1]) {
teleport_unit_between(path[i],path[i+1],temp_unit);
} else {