add a turbo speed setting, thx to EdB

This commit is contained in:
Jérémy Rosen 2006-09-09 08:03:07 +00:00
parent cbd882cf3f
commit 9a649421ad
9 changed files with 142 additions and 67 deletions

View file

@ -15,8 +15,9 @@ Version 1.3-svn:
* unit Art
* added a recruit animation to the skeleton
* user interface
* turn bell moved to sound tab in prefereces
* new slider - bell volume
* add turbo speed setting and change ui according to
* turn bell moved to sound tab in prefereces
* new slider - bell volume
* disable inactive sliders instead of hiding them
* sliders can be adjusted with keyboard left and right
* sidebar reports related to gold, units, villages and time get greyed out

View file

@ -85,7 +85,7 @@ display::display(unit_map& units, CVideo& video, const gamemap& map,
invalidateAll_(true), invalidateUnit_(true),
invalidateGameStatus_(true), panelsDrawn_(false),
currentTeam_(0), activeTeam_(0),
turbo_(false), grid_(false), sidebarScaling_(1.0),
turbo_speed_(1), turbo_(false), grid_(false), sidebarScaling_(1.0),
theme_(theme_cfg,screen_area()), builder_(cfg, level, map),
first_turn_(true), in_game_(false), map_labels_(*this,map),
tod_hex_mask1(NULL), tod_hex_mask2(NULL),
@ -2178,6 +2178,27 @@ void display::set_turbo(bool turbo)
turbo_ = turbo;
}
int display::turbo_speed() const
{
if (turbo_ or keys_[SDLK_LSHIFT] or keys_[SDLK_RSHIFT])
return turbo_speed_;
else
return 1;
}
void display::set_turbo_speed(const int speed)
{
#if 0
// speed < 2 don't make sense
if (speed < 2)
return;
if (speed > 20)
turbo_speed_ = 20;
else
#endif
turbo_speed_ = speed;
}
//Delay routines: use these not SDL_Delay (for --nogui).
void display::non_turbo_delay() const
{

View file

@ -298,6 +298,9 @@ public:
bool turbo() const;
void set_turbo(bool turbo);
int turbo_speed() const;
void set_turbo_speed(const int speed);
//Delay routines: use these not SDL_Delay (for --nogui).
void non_turbo_delay() const;
void delay(unsigned int milliseconds) const;
@ -462,7 +465,7 @@ private:
int turbo_speed_;
bool turbo_, grid_;
double sidebarScaling_;

View file

@ -166,6 +166,16 @@ void _set_turbo(bool ison)
prefs["turbo"] = (ison ? "true" : "false");
}
int turbo_speed()
{
return lexical_cast_default<int>(prefs["turbo_speed"], 1);
}
void save_turbo_speed(int speed)
{
prefs["turbo_speed"] = lexical_cast_default<std::string>(speed, "1");
}
const std::string& language()
{
return prefs["locale"];
@ -238,8 +248,8 @@ void _set_gamma(int gamma)
bool grid()
{
const string_map::const_iterator turbo = prefs.values.find("grid");
return turbo != prefs.values.end() && turbo->second == "true";
const string_map::const_iterator it = prefs.values.find("grid");
return it != prefs.values.end() && it->second == "true";
}
void _set_grid(bool ison)

View file

@ -56,6 +56,9 @@ namespace preferences {
bool turbo();
void _set_turbo(bool ison);
int turbo_speed();
void save_turbo_speed(const int speed);
const std::string& language();
void set_language(const std::string& s);

View file

@ -44,6 +44,7 @@ display_manager::display_manager(display* d)
set_grid(grid());
set_turbo(turbo());
set_turbo_speed(turbo_speed());
set_fullscreen(fullscreen());
set_gamma(gamma());
set_colour_cursors(preferences::get("colour_cursors") == "yes");
@ -122,6 +123,15 @@ void set_turbo(bool ison)
}
}
void set_turbo_speed(const int speed)
{
save_turbo_speed(speed);
if(disp != NULL) {
disp->set_turbo_speed(speed);
}
}
void set_adjust_gamma(bool val)
{
//if we are turning gamma adjustment off, then set it to '1.0'
@ -191,14 +201,16 @@ private:
const config* get_advanced_pref() const;
void set_advanced_menu();
// change
gui::slider music_slider_, sound_slider_, bell_slider_, scroll_slider_, gamma_slider_, chat_lines_slider_;
// change
gui::slider music_slider_, sound_slider_, bell_slider_, scroll_slider_,
gamma_slider_, chat_lines_slider_, turbo_slider_;
gui::button fullscreen_button_, turbo_button_, show_ai_moves_button_,
show_grid_button_, show_lobby_joins_button_, show_floating_labels_button_, turn_dialog_button_,
turn_bell_button_, show_team_colours_button_, show_colour_cursors_button_,
show_haloing_button_, video_mode_button_, theme_button_, hotkeys_button_, gamma_button_,
flip_time_button_, advanced_button_, sound_button_, music_button_, chat_timestamp_button_;
gui::label music_label_, sound_label_, bell_label_, scroll_label_, gamma_label_, chat_lines_label_;
gui::label music_label_, sound_label_, bell_label_, scroll_label_,
gamma_label_, chat_lines_label_, turbo_slider_label_;
unsigned slider_label_width_;
gui::menu advanced_;
@ -215,6 +227,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
: gui::preview_pane(disp.video()),
music_slider_(disp.video()), sound_slider_(disp.video()), bell_slider_(disp.video()),
scroll_slider_(disp.video()), gamma_slider_(disp.video()), chat_lines_slider_(disp.video()),
turbo_slider_(disp.video()),
fullscreen_button_(disp.video(), _("Toggle Full Screen"), gui::button::TYPE_CHECK),
turbo_button_(disp.video(), _("Accelerated Speed"), gui::button::TYPE_CHECK),
show_ai_moves_button_(disp.video(), _("Skip AI Moves"), gui::button::TYPE_CHECK),
@ -236,8 +249,9 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
music_button_(disp.video(), _("Music"), gui::button::TYPE_CHECK),
chat_timestamp_button_(disp.video(), _("Chat Timestamping"), gui::button::TYPE_CHECK),
music_label_(disp.video(), _("Music Volume:")), sound_label_(disp.video(), _("SFX Volume:")),
bell_label_(disp.video(), _("Bell Volume:")),
scroll_label_(disp.video(), _("Scroll Speed:")), gamma_label_(disp.video(), _("Gamma:")), chat_lines_label_(disp.video(), ""),
bell_label_(disp.video(), _("Bell Volume:")), scroll_label_(disp.video(), _("Scroll Speed:")),
gamma_label_(disp.video(), _("Gamma:")), chat_lines_label_(disp.video(), ""),
turbo_slider_label_(disp.video(), _("Speed: ")),
slider_label_width_(0), advanced_(disp.video(),std::vector<std::string>(),false,-1,-1,NULL,&gui::menu::bluebg_style), advanced_selection_(-1),
tab_(GENERAL_TAB), disp_(disp), game_cfg_(game_cfg)
{
@ -245,7 +259,7 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
#ifdef USE_TINY_GUI
set_measurements(180, 180); // FIXME: should compute this, but using what data ?
#else
set_measurements(400, 400);
set_measurements(440, 440);
#endif
@ -274,15 +288,16 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
scroll_slider_.set_value(scroll_speed());
scroll_slider_.set_help_string(_("Change the speed of scrolling around the map"));
chat_lines_slider_.set_min(1);
chat_lines_slider_.set_max(20);
chat_lines_slider_.set_value(chat_lines());
chat_lines_slider_.set_help_string(_("Set the amount of chat lines shown"));
// Have the tooltip appear over the static "Chat lines" label, too.
chat_lines_label_.set_help_string(_("Set the amount of chat lines shown"));
chat_lines_slider_.set_min(1);
chat_lines_slider_.set_max(20);
chat_lines_slider_.set_value(chat_lines());
chat_lines_slider_.set_help_string(_("Set the amount of chat lines shown"));
// Have the tooltip appear over the static "Chat lines" label, too.
chat_lines_label_.set_help_string(_("Set the amount of chat lines shown"));
chat_timestamp_button_.set_check(chat_timestamp());
chat_timestamp_button_.set_help_string(_("Add a timestamp to chat messages"));
chat_timestamp_button_.set_check(chat_timestamp());
chat_timestamp_button_.set_help_string(_("Add a timestamp to chat messages"));
gamma_button_.set_check(adjust_gamma());
gamma_button_.set_help_string(_("Change the brightness of the display"));
@ -298,6 +313,11 @@ preferences_dialog::preferences_dialog(display& disp, const config& game_cfg)
turbo_button_.set_check(turbo());
turbo_button_.set_help_string(_("Make units move and fight faster"));
turbo_slider_.set_min(2);
turbo_slider_.set_max(20);
turbo_slider_.set_value(turbo_speed());
turbo_slider_.set_help_string(_("Units move and fight speed"));
show_ai_moves_button_.set_check(!show_ai_moves());
show_ai_moves_button_.set_help_string(_("Do not animate AI units moving"));
@ -345,6 +365,7 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&scroll_slider_);
h.push_back(&gamma_slider_);
h.push_back(&chat_lines_slider_);
h.push_back(&turbo_slider_);
h.push_back(&fullscreen_button_);
h.push_back(&turbo_button_);
h.push_back(&show_ai_moves_button_);
@ -370,6 +391,7 @@ handler_vector preferences_dialog::handler_members()
h.push_back(&bell_label_);
h.push_back(&scroll_label_);
h.push_back(&gamma_label_);
h.push_back(&turbo_slider_label_);
h.push_back(&chat_lines_label_);
h.push_back(&advanced_);
return h;
@ -383,9 +405,11 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
const int right_border = font::relative_size(10);
#if USE_TINY_GUI
const int top_border = 14;
const int short_interline = 20;
const int item_interline = 20;
#else
const int top_border = 28;
const int short_interline = 20;
const int item_interline = 50;
#endif
@ -396,6 +420,11 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
rect.w - scroll_label_.width() - right_border, 0 };
scroll_slider_.set_location(scroll_rect);
ypos += item_interline; turbo_button_.set_location(rect.x, ypos);
ypos += short_interline; turbo_slider_label_.set_location(rect.x + 50, ypos);
ypos += short_interline;
SDL_Rect turbo_rect = { rect.x + 50, ypos,
rect.w - 50 - right_border, 0 };
turbo_slider_.set_location(turbo_rect);
ypos += item_interline; show_ai_moves_button_.set_location(rect.x, ypos);
ypos += item_interline; turn_dialog_button_.set_location(rect.x, ypos);
ypos += item_interline; show_team_colours_button_.set_location(rect.x, ypos);
@ -439,9 +468,9 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
music_slider_.set_location(music_rect);
// Bell slider
ypos += item_interline;
ypos += item_interline;
turn_bell_button_.set_location(rect.x, ypos);
ypos += item_interline;
bell_label_.set_location(rect.x, ypos);
const SDL_Rect bell_rect = { rect.x + slider_label_width_, ypos,
@ -449,13 +478,13 @@ void preferences_dialog::update_location(SDL_Rect const &rect)
bell_slider_.set_location(bell_rect);
// Multiplayer tab
ypos = rect.y + top_border;
chat_lines_label_.set_location(rect.x, ypos);
SDL_Rect chat_lines_rect = { rect.x + slider_label_width_, ypos,
rect.w - slider_label_width_ - right_border, 0 };
chat_lines_slider_.set_location(chat_lines_rect);
ypos += item_interline; chat_timestamp_button_.set_location(rect.x, ypos);
// Multiplayer tab
ypos = rect.y + top_border;
chat_lines_label_.set_location(rect.x, ypos);
SDL_Rect chat_lines_rect = { rect.x + slider_label_width_, ypos,
rect.w - slider_label_width_ - right_border, 0 };
chat_lines_slider_.set_location(chat_lines_rect);
ypos += item_interline; chat_timestamp_button_.set_location(rect.x, ypos);
ypos += item_interline; show_lobby_joins_button_.set_location(rect.x, ypos);
//Advanced tab
@ -514,7 +543,7 @@ void preferences_dialog::process_event()
sound_button_.set_check(false);
}
set_sound_volume(sound_slider_.value());
set_bell_volume(bell_slider_.value());
set_bell_volume(bell_slider_.value());
if (music_button_.pressed()) {
if(!set_music(music_button_.checked()))
@ -530,12 +559,17 @@ void preferences_dialog::process_event()
set_scroll_speed(scroll_slider_.value());
set_gamma(gamma_slider_.value());
set_chat_lines(chat_lines_slider_.value());
set_chat_lines(chat_lines_slider_.value());
set_turbo_speed(turbo_slider_.value());
// display currently select amount of chat lines
std::stringstream buf;
buf << _("Chat Lines: ") << chat_lines_slider_.value();
chat_lines_label_.set_text(buf.str());
// display currently select amount of chat lines
std::stringstream buf;
buf << _("Chat Lines: ") << chat_lines_slider_.value();
chat_lines_label_.set_text(buf.str());
buf.str("");
buf << _("Speed: ") << turbo_slider_.value();
turbo_slider_label_.set_text(buf.str());
if(advanced_.selection() != advanced_selection_) {
advanced_selection_ = advanced_.selection();
@ -608,6 +642,8 @@ void preferences_dialog::set_selection(int index)
scroll_label_.hide(hide_general);
scroll_slider_.hide(hide_general);
turbo_button_.hide(hide_general);
turbo_slider_label_.hide(hide_general);
turbo_slider_.hide(hide_general);
show_ai_moves_button_.hide(hide_general);
turn_dialog_button_.hide(hide_general);
hotkeys_button_.hide(hide_general);
@ -639,10 +675,10 @@ void preferences_dialog::set_selection(int index)
bell_label_.hide(hide_sound);
bell_slider_.hide(hide_sound);
const bool hide_multiplayer = tab_ != MULTIPLAYER_TAB;
chat_lines_label_.hide(hide_multiplayer);
chat_lines_slider_.hide(hide_multiplayer);
chat_timestamp_button_.hide(hide_multiplayer);
const bool hide_multiplayer = tab_ != MULTIPLAYER_TAB;
chat_lines_label_.hide(hide_multiplayer);
chat_lines_slider_.hide(hide_multiplayer);
chat_timestamp_button_.hide(hide_multiplayer);
show_lobby_joins_button_.hide(hide_multiplayer);
const bool hide_advanced = tab_ != ADVANCED_TAB;

View file

@ -26,6 +26,7 @@ namespace preferences {
void set_fullscreen(bool ison);
void set_resolution(const std::pair<int,int>& res);
void set_turbo(bool ison);
void set_turbo_speed(const int speed);
void set_adjust_gamma(bool val);
void set_gamma(int gamma);
void set_grid(bool ison);

View file

@ -637,7 +637,7 @@ std::vector<Uint32> unit::team_rgb_range() const
}
const std::string& unit::team_color() const
{
return flag_rgb_;
return flag_rgb_;
}
unit_race::GENDER unit::gender() const
{
@ -1146,11 +1146,11 @@ void unit::read(const config& cfg)
if(custom_unit_desc != "") {
cfg_["unit_description"] = custom_unit_desc;
}
if(cfg["profile"] != "" && !id_set) {
cfg_["profile"] = cfg["profile"];
}
std::map<std::string,unit_type>::const_iterator uti = gamedata_->unit_types.find(cfg["type"]);
const unit_type* ut = NULL;
if(uti != gamedata_->unit_types.end()) {
@ -1256,7 +1256,7 @@ void unit::read(const config& cfg)
custom_unit_description_ = generate_description();
cfg_["generate_description"] = "";
}
if(!type_set) {
if(ut) {
defensive_animations_ = ut->defensive_animations_;
@ -1525,7 +1525,7 @@ void unit::write(config& cfg) const
cfg["cost"] = lexical_cast_default<std::string>(unit_value_);
cfg.clear_children("modifications");
cfg.add_child("modifications",modifications_);
}
void unit::assign_role(const std::string& role)
@ -1564,7 +1564,7 @@ const surface unit::still_image() const
return unit_image;
}
void unit::refresh(const display& disp,const gamemap::location& loc)
void unit::refresh(const display& disp,const gamemap::location& loc)
{
if(state_ == STATE_IDLING && anim_->animation_finished()) set_standing(disp, loc);
if(state_ != STATE_STANDING || SDL_GetTicks() < next_idling) return;
@ -1582,7 +1582,7 @@ void unit::set_standing(const display &disp,const gamemap::location& loc, bool w
anim_ = NULL;
}
anim_ = new standing_animation(stand_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),unit_animation::INFINITE_CYCLES,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(),unit_animation::INFINITE_CYCLES,disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
next_idling= SDL_GetTicks() +30000 +rand()%10000;
@ -1613,7 +1613,7 @@ void unit::set_defending(const display &disp,const gamemap::location& loc, int d
anim_time+=100;
}
anim_->add_frame(anim_time);
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1631,7 +1631,7 @@ void unit::set_extra_anim(const display &disp,const gamemap::location& loc, std:
return;
}
anim_ = new unit_animation(*(extra_animation(disp.get_map().underlying_union_terrain(loc),flag)));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1653,7 +1653,7 @@ const unit_animation & unit::set_attacking(const display &disp,const gamemap::lo
hit_type = fighting_animation::MISS;
}
anim_ = new attack_animation(type.animation(disp.get_map().underlying_union_terrain(loc),hit_type,facing_,swing_num));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
return ((attack_animation*)anim_)->get_missile_anim();
@ -1667,7 +1667,7 @@ void unit::set_leading(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new leading_animation(lead_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1680,7 +1680,7 @@ void unit::set_leveling_in(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new levelin_animation(levelingin_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1693,7 +1693,7 @@ void unit::set_leveling_out(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new levelout_animation(levelingout_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1707,7 +1707,7 @@ void unit::set_recruited(const display &disp,const gamemap::location& loc)
}
anim_ = new recruit_animation(recruiting_animation(disp.get_map().underlying_union_terrain(loc),facing_));
// add a fade in effect
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1720,7 +1720,7 @@ void unit::set_healed(const display &disp,const gamemap::location& /*loc*/, int
anim_ = NULL;
}
anim_ = new unit_animation(unit_frame(absolute_image(),0,240,"1.0",display::rgb(255,255,255),"0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30"));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1733,7 +1733,7 @@ void unit::set_poisoned(const display &disp,const gamemap::location& /*loc*/, in
anim_ = NULL;
}
anim_ = new unit_animation(unit_frame(absolute_image(),0,240,"1.0",display::rgb(0,255,0),"0:30,0.5:30,0:30,0.5:30,0:30,0.5:30,0:30,0.5:30"));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1747,7 +1747,7 @@ void unit::set_teleporting(const display &disp,const gamemap::location& /*loc*/)
anim_ = NULL;
}
anim_ = new unit_animation(teleport_animation());
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1765,7 +1765,7 @@ void unit::set_dying(const display &disp,const gamemap::location& loc,const atta
int anim_time =anim_->get_last_frame_time();
anim_->add_frame(0,unit_frame(tmp_image,anim_time,anim_time+600,"1~0:600"));
anim_->add_frame(anim_time+600);
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1778,7 +1778,7 @@ void unit::set_healing(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new healing_animation(heal_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1796,7 +1796,7 @@ void unit::set_walking(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new movement_animation(move_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
}
@ -1810,7 +1810,7 @@ void unit::set_idling(const display &disp,const gamemap::location& loc)
anim_ = NULL;
}
anim_ = new idle_animation(idling_animation(disp.get_map().underlying_union_terrain(loc),facing_));
anim_->start_animation(anim_->get_first_frame_time(),1,disp.turbo()?5:1);
anim_->start_animation(anim_->get_first_frame_time(), 1, disp.turbo_speed());
frame_begin_time = anim_->get_first_frame_time() -1;
anim_->update_current_frame();
}
@ -1818,7 +1818,7 @@ void unit::set_idling(const display &disp,const gamemap::location& loc)
void unit::restart_animation(const display& disp,int start_time) {
if(!anim_) return;
anim_->start_animation(start_time,1,disp.turbo()?5:1);
anim_->start_animation(start_time,1,disp.turbo_speed());
frame_begin_time = start_time -1;
}

View file

@ -74,7 +74,7 @@ void move_unit_between(display& disp, const gamemap& map, const gamemap::locatio
const gamemap::TERRAIN dst_terrain = map.get_terrain(b);
const int acceleration = disp.turbo() ? 5:1;
const int acceleration = disp.turbo_speed();
gamemap::location src_adjacent[6];
get_adjacent_tiles(a, src_adjacent);
@ -212,7 +212,7 @@ bool unit_attack_ranged(display& disp, unit_map& units,
wassert(def != units.end());
unit& defender = def->second;
const int acceleration = disp.turbo() ? 5 : 1;
const int acceleration = disp.turbo_speed();
// more damage shown for longer, but 1s at most for this factor
@ -369,8 +369,8 @@ bool unit_attack_ranged(display& disp, unit_map& units,
if(dead) {
unit_display::unit_die(disp,def->first,def->second,&attack);
if(leader_loc.valid()) leader->second.set_standing(disp,leader_loc);
att->second.set_standing(disp,a);
if(leader_loc.valid()) leader->second.set_standing(disp,leader_loc);
att->second.set_standing(disp,a);
}
disp.update_display();
events::pump();
@ -505,8 +505,8 @@ bool unit_attack(display& disp, unit_map& units,
if(dead) {
unit_display::unit_die(disp,def->first,def->second,&attack);
if(leader_loc.valid()) leader->second.set_standing(disp,leader_loc);
att->second.set_standing(disp,a);
if(leader_loc.valid()) leader->second.set_standing(disp,leader_loc);
att->second.set_standing(disp,a);
}
disp.update_display();
events::pump();