Add an "Animate Map" switch in advanced preferences.
(temporary location) I wait to see where other future animation switch will go This stops flags and animated terrains in the first frame, for simplicity and because the low use of animation prevent to test what is the best solution But this choice also allow to choose the default frame. e.g. a geyser terrain may want to always show the active (or sleeping) state
This commit is contained in:
parent
2cff4bf3dd
commit
302b40e40e
5 changed files with 34 additions and 15 deletions
|
@ -45,6 +45,13 @@
|
|||
default=yes
|
||||
[/advanced_preference]
|
||||
|
||||
[advanced_preference]
|
||||
field=animate_map
|
||||
name=_"Animate Map"
|
||||
type=boolean
|
||||
default=yes
|
||||
[/advanced_preference]
|
||||
|
||||
[advanced_preference]
|
||||
field=mouse_scrolling
|
||||
name=_"Mouse Scrolling"
|
||||
|
|
|
@ -525,7 +525,8 @@ std::vector<surface> display::get_terrain_images(const gamemap::location &loc,
|
|||
for(std::vector<animated<image::locator> >::const_iterator it =
|
||||
terrains->begin(); it != terrains->end(); ++it) {
|
||||
|
||||
image::locator image = it->get_current_frame();
|
||||
image::locator image = preferences::animate_map() ?
|
||||
it->get_current_frame() : it->get_first_frame();
|
||||
|
||||
// We prevent ToD colouring and brightening of off-map tiles,
|
||||
// except if we are not in_game and so in the editor.
|
||||
|
|
|
@ -724,7 +724,9 @@ surface game_display::get_flag(const gamemap::location& loc)
|
|||
(!fogged(loc) || !teams_[currentTeam_].is_enemy(i+1)))
|
||||
{
|
||||
flags_[i].update_last_draw_time();
|
||||
return image::get_image(flags_[i].get_current_frame(), image::SCALED_TO_HEX);
|
||||
image::locator image_flag = preferences::animate_map() ?
|
||||
flags_[i].get_current_frame() : flags_[i].get_first_frame();
|
||||
return image::get_image(image_flag, image::SCALED_TO_HEX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -928,6 +930,21 @@ void game_display::invalidate(const gamemap::location& loc)
|
|||
void game_display::invalidate_animations()
|
||||
{
|
||||
new_animation_frame();
|
||||
|
||||
unit_map::iterator unit;
|
||||
for(unit=units_.begin() ; unit != units_.end() ; unit++) {
|
||||
if (unit->second.get_animation() && unit->second.get_animation()->need_update())
|
||||
invalidate(unit->first);
|
||||
unit->second.refresh(*this,unit->first);
|
||||
}
|
||||
if (temp_unit_ ) {
|
||||
if (temp_unit_->get_animation() && temp_unit_->get_animation()->need_update())
|
||||
invalidate(temp_unit_loc_);
|
||||
temp_unit_->refresh(*this, temp_unit_loc_);
|
||||
}
|
||||
|
||||
if (!preferences::animate_map()) {return;}
|
||||
|
||||
gamemap::location topleft;
|
||||
gamemap::location bottomright;
|
||||
get_visible_hex_bounds(topleft, bottomright);
|
||||
|
@ -946,19 +963,6 @@ void game_display::invalidate_animations()
|
|||
}
|
||||
}
|
||||
}
|
||||
unit_map::iterator unit;
|
||||
for(unit=units_.begin() ; unit != units_.end() ; unit++) {
|
||||
if (unit->second.get_animation() && unit->second.get_animation()->need_update())
|
||||
invalidate(unit->first);
|
||||
unit->second.refresh(*this,unit->first);
|
||||
}
|
||||
if (temp_unit_ ) {
|
||||
if (temp_unit_->get_animation() && temp_unit_->get_animation()->need_update())
|
||||
invalidate(temp_unit_loc_);
|
||||
temp_unit_->refresh(*this, temp_unit_loc_);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void game_display::debug_highlight(const gamemap::location& loc, fixed_t amount)
|
||||
|
|
|
@ -425,6 +425,11 @@ void enable_mouse_scroll(bool value)
|
|||
set("mouse_scrolling", value ? "yes" : "no");
|
||||
}
|
||||
|
||||
bool animate_map()
|
||||
{
|
||||
return utils::string_bool(preferences::get("animate_map"), true);
|
||||
}
|
||||
|
||||
bool show_fps()
|
||||
{
|
||||
return fps;
|
||||
|
|
|
@ -113,6 +113,8 @@ namespace preferences {
|
|||
int draw_delay();
|
||||
void set_draw_delay(int value);
|
||||
|
||||
bool animate_map();
|
||||
|
||||
bool show_fps();
|
||||
void set_show_fps(bool value);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue