implemented Li'sar's suggestion for an xp gauge

This commit is contained in:
Dave White 2004-05-05 16:00:56 +00:00
parent ea525df783
commit 6942537776
7 changed files with 26 additions and 2 deletions

View file

@ -804,7 +804,7 @@ enemy_unit_sighted="Unit
enemy_units_sighted="%enemies unité(s) ennemie(s) en vue !"
error_no_campaigns="Il n'y a pas de campagne disponible"
error_no_mp_sides="Aucuns côtés multijoueurs."
fifty_percent="50% de l'or est gardé pour le prochain scénario"
fifty_percent="80% de l'or est gardé pour le prochain scénario"
floating_labels_button="Afficher les étiquettes"
fog_of_war="Brouillard de guerre"
forest="Forêts"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 654 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 809 B

View file

@ -1223,7 +1223,28 @@ void display::draw_unit_on_tile(int x, int y, SDL_Surface* unit_image_override,
if(skip_energy_rows + lost_energy < energy_bar_loc.h) {
SDL_Rect filled_energy_area = { xpos + energy_bar_loc.x, ypos+show_energy_after,
energy_bar_loc.w, energy_bar_loc.h - skip_energy_rows - lost_energy };
const int xp_percent = (it->second.experience()*100)/it->second.max_experience();
const int xp_loss = ((100 - xp_percent)*(energy_bar_loc.h - skip_energy_rows))/100;
const bool show_xp = xp_percent > 0 && xp_percent < 100 && it->second.type().advances_to().empty() == false;
SDL_Rect filled_xp_area = { filled_energy_area.x, ypos + energy_bar_loc.y + xp_loss,
filled_energy_area.w, energy_bar_loc.h - skip_energy_rows - xp_loss };
if(filled_energy_area.y < filled_xp_area.y && show_xp) {
filled_energy_area.h = filled_xp_area.y - filled_energy_area.y;
} else {
filled_xp_area.h = filled_energy_area.y - filled_xp_area.y;
}
SDL_FillRect(dst,&filled_energy_area,energy_colour);
if(show_xp) {
const bool nearly_advanced = it->second.max_experience() - it->second.experience() <= game_config::kill_experience*it->second.type().level();
const Uint16 xp_colour = ::SDL_MapRGB(screen_.getSurface()->format,nearly_advanced ? 255 : 0,0,255);
SDL_FillRect(dst,&filled_xp_area,xp_colour);
}
}
}
@ -1820,7 +1841,10 @@ void display::draw_unit(int x, int y, SDL_Surface* image,
}
struct is_energy_colour {
bool operator()(Uint32 colour) const { return (colour&0xFF000000) < 0x99000000 && (colour&0x00FF0000) > 0x00990000; }
bool operator()(Uint32 colour) const { return (colour&0xFF000000) < 0x50000000 &&
(colour&0x00FF0000) > 0x00990000 &&
(colour&0x0000FF00) > 0x00009900 &&
(colour&0x000000FF) > 0x00000099; }
};
const SDL_Rect& display::calculate_energy_bar()