made it so a unit's defense is shown over a hex when the unit is selected...

...and a hex is moused-over; also made it so different footprints are
used dependent on unit speed
This commit is contained in:
Dave White 2005-05-06 01:07:59 +00:00
parent 2ef83e10f0
commit 683c1c4b50
8 changed files with 63 additions and 30 deletions

View file

@ -1,5 +1,6 @@
CVS HEAD:
* user interface improvements:
* made it so a unit's defense in a terrain is displayed over the terrain when choosing to move the unit
* added 'Advanced' preferences section with 'binary save files' and 'show combat' as initial options
* fix editor file chooser when starting directory has many files (#11698)
* made it so network dialogs show progress of data transfers again

BIN
images/misc/foot-left-n-slow.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/misc/foot-left-nw-slow.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,012 B

BIN
images/misc/foot-right-n-slow.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,012 B

View file

@ -1647,26 +1647,37 @@ void display::draw_footstep(const gamemap::location& loc, int xloc, int yloc)
}
}
static const std::string left_nw(game_config::foot_left_nw);
static const std::string left_n(game_config::foot_left_n);
static const std::string right_nw(game_config::foot_right_nw);
static const std::string right_n(game_config::foot_right_n);
const std::vector<std::string>* image_category = NULL;
const std::string* image_str = &left_nw;
if(left_foot) {
if(direction == gamemap::location::NORTH ||
direction == gamemap::location::SOUTH) {
image_str = &left_n;
image_category = &game_config::foot_left_n;
} else {
image_str = &left_nw;
image_category = &game_config::foot_left_nw;
}
} else {
if(direction == gamemap::location::NORTH ||
direction == gamemap::location::SOUTH) {
image_str = &right_n;
image_category = &game_config::foot_right_n;
} else {
image_str = &right_nw;
image_category = &game_config::foot_right_nw;
}
}
if(image_category == NULL || image_category->empty()) {
return;
}
const std::string* image_str = &image_category->front();
const unit_map::const_iterator un = units_.find(route_.steps.front());
if(un != units_.end()) {
const int move_cost = un->second.movement_cost(map_,map_.get_terrain(loc)) - 1;
if(move_cost >= int(image_category->size())) {
image_str = &image_category->back();
} else if(move_cost > 0) {
image_str = &(*image_category)[move_cost];
}
}
@ -1687,24 +1698,42 @@ void display::draw_footstep(const gamemap::location& loc, int xloc, int yloc)
draw_unit(xloc,yloc,image,vflip,ftofxp(0.5));
if(show_time && route_.move_left > 0 && route_.move_left < 10) {
if(show_time == false) {
return;
}
std::stringstream text;
#ifndef USE_TINY_GUI
if(un != units_.end() && zoom_ >= DefaultZoom) {
text << (100-un->second.defense_modifier(map_,map_.get_terrain(loc))) << "%";
}
#endif
if(route_.move_left > 0 && route_.move_left < 10) {
text << " (" << char('1' + route_.move_left) << ")";
}
const std::string& str = text.str();
if(str.empty() == false) {
const SDL_Rect& rect = map_area();
std::string str(1,'x');
str[0] = '1' + route_.move_left;
const SDL_Rect& text_area = font::text_area(str,font::SIZE_LARGE);
const SDL_Rect& text_area = font::text_area(str,font::SIZE_PLUS);
const int x = xloc + zoom_/2 - text_area.w/2;
const int y = yloc + zoom_/2 - text_area.h/2;
//draw the text with a black outline
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y-1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x-1,y+1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x,y-1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y-1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x+1,y+1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::DARK_COLOUR,str,x,y+1);
font::draw_text(&screen_,rect,font::SIZE_LARGE,font::YELLOW_COLOUR,str,x,y);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y-1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x-1,y+1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x,y-1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y-1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x+1,y+1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::DARK_COLOUR,str,x,y+1);
font::draw_text(&screen_,rect,font::SIZE_PLUS,font::YELLOW_COLOUR,str,x,y);
}
}

View file

@ -11,11 +11,12 @@
See the COPYING file for more details.
*/
#include "config.hpp"
#include "global.hpp"
#include "config.hpp"
#include "game_config.hpp"
#include "wesconfig.h"
#include "serialization/string_utils.hpp"
#include <cstdlib>
@ -56,7 +57,7 @@ namespace game_config
std::string dot_image = "misc/dot.png";
std::string cross_image = "misc/cross.png";
std::string foot_left_nw, foot_left_n, foot_right_nw, foot_right_n;
std::vector<std::string> foot_left_nw, foot_left_n, foot_right_nw, foot_right_n;
std::string observer_image;
@ -126,10 +127,10 @@ namespace game_config
cross_image = v["cross_image"];
dot_image = v["dot_image"];
foot_left_nw = v["footprint_left_nw"];
foot_left_n = v["footprint_left_n"];
foot_right_nw = v["footprint_right_nw"];
foot_right_n = v["footprint_right_n"];
foot_left_nw = utils::split(v["footprint_left_nw"]);
foot_left_n = utils::split(v["footprint_left_n"]);
foot_right_nw = utils::split(v["footprint_right_nw"]);
foot_right_n = utils::split(v["footprint_right_n"]);
missile_n_image = v["missile_n_image"];
missile_ne_image = v["missile_ne_image"];

View file

@ -16,6 +16,7 @@
class config;
#include <string>
#include <vector>
//basic game configuration information is here.
namespace game_config
@ -39,11 +40,12 @@ namespace game_config
extern std::string game_icon, game_title, game_logo, title_music, map_image, rightside_image, rightside_image_bot,
moved_energy_image, unmoved_energy_image, partmoved_energy_image,
enemy_energy_image,ally_energy_image,flag_image,
dot_image,cross_image,
foot_left_nw,foot_left_n,foot_right_nw,foot_right_n,
dot_image,cross_image,
missile_n_image,missile_ne_image,terrain_mask_image,observer_image,download_campaign_image,
checked_menu_image,unchecked_menu_image;
extern std::vector<std::string> foot_left_nw,foot_left_n,foot_right_nw,foot_right_n;
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding, title_tip_x, title_tip_y, title_tip_width, title_tip_padding;
namespace sounds {