Support for overwritting hp_bar_scaling and xp_bar_scaling.
This commit is contained in:
parent
36ceb3e643
commit
e8e9412d4d
2 changed files with 9 additions and 2 deletions
10
src/unit.cpp
10
src/unit.cpp
|
@ -189,6 +189,8 @@ unit::unit(const unit& o):
|
|||
refreshing_(o.refreshing_),
|
||||
hidden_(o.hidden_),
|
||||
draw_bars_(o.draw_bars_),
|
||||
hp_bar_scaling_(o.hp_bar_scaling_),
|
||||
xp_bar_scaling_(o.xp_bar_scaling_),
|
||||
|
||||
modifications_(o.modifications_),
|
||||
invisibility_cache_()
|
||||
|
@ -263,6 +265,8 @@ unit::unit(const config &cfg, bool use_traits, game_state* state, const vconfig*
|
|||
refreshing_(false),
|
||||
hidden_(false),
|
||||
draw_bars_(false),
|
||||
hp_bar_scaling_(cfg["hp_bar_scaling"].blank() ? type_->hp_bar_scaling() : cfg["hp_bar_scaling"]),
|
||||
xp_bar_scaling_(cfg["xp_bar_scaling"].blank() ? type_->xp_bar_scaling() : cfg["xp_bar_scaling"]),
|
||||
modifications_(),
|
||||
invisibility_cache_()
|
||||
{
|
||||
|
@ -806,6 +810,8 @@ void unit::advance_to(const config &old_cfg, const unit_type &u_type,
|
|||
alignment_ = new_type.alignment();
|
||||
alpha_ = new_type.alpha();
|
||||
max_hit_points_ = new_type.hitpoints();
|
||||
hp_bar_scaling_ = new_type.hp_bar_scaling();
|
||||
xp_bar_scaling_ = new_type.xp_bar_scaling();
|
||||
max_movement_ = new_type.movement();
|
||||
vision_ = new_type.vision(true);
|
||||
jamming_ = new_type.jamming();
|
||||
|
@ -2074,7 +2080,7 @@ void unit::redraw_unit()
|
|||
unit_energy = double(hitpoints())/double(max_hitpoints());
|
||||
}
|
||||
const int bar_shift = static_cast<int>(-5*disp.get_zoom_factor());
|
||||
const int hp_bar_height = static_cast<int>(max_hitpoints()*game_config::hp_bar_scaling);
|
||||
const int hp_bar_height = static_cast<int>(max_hitpoints() * hp_bar_scaling_);
|
||||
|
||||
const fixed_t bar_alpha = (loc_ == disp.mouseover_hex() || loc_ == disp.selected_hex()) ? ftofxp(1.0): ftofxp(0.8);
|
||||
|
||||
|
@ -2084,7 +2090,7 @@ void unit::redraw_unit()
|
|||
if(experience() > 0 && can_advance()) {
|
||||
const double filled = double(experience())/double(max_experience());
|
||||
|
||||
const int xp_bar_height = static_cast<int>(max_experience()*game_config::xp_bar_scaling / std::max<int>(level_,1));
|
||||
const int xp_bar_height = static_cast<int>(max_experience() * xp_bar_scaling_ / std::max<int>(level_,1));
|
||||
|
||||
SDL_Color color=xp_color();
|
||||
disp.draw_bar(*energy_file, xsrc, ysrc +adjusted_params.y,
|
||||
|
|
|
@ -508,6 +508,7 @@ private:
|
|||
bool refreshing_; // avoid infinite recursion
|
||||
bool hidden_;
|
||||
bool draw_bars_;
|
||||
double hp_bar_scaling_, xp_bar_scaling_;
|
||||
|
||||
config modifications_;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue