removed the now unused tilestack based drawing.
convert the render engine to a z-ordered based engine, this allows to have multiple layers and the calculation and rendering are separated which means things can be drawn in front of units.
This commit is contained in:
parent
069838e0a6
commit
fea178c276
6 changed files with 107 additions and 106 deletions
|
@ -64,6 +64,10 @@ Version 1.5.0-svn:
|
|||
resolutions if compiled with those switches
|
||||
* learn the underlaying terrain so you'll not have a blank like in the unit
|
||||
stats if you encounter a terain aliased to a unencountered terrain
|
||||
* convert the render engine to a z-ordered based engine, this allows to
|
||||
have multiple layers and the calculation and rendering are separated
|
||||
which means things can be drawn in front of units.
|
||||
* removed the now unused tilestack based drawing.
|
||||
|
||||
Version 1.4:
|
||||
* language and i18n:
|
||||
|
|
|
@ -110,7 +110,6 @@ display::display(CVideo& video, const gamemap& map, const config& theme_cfg, con
|
|||
#else
|
||||
drawing_buffer_(),
|
||||
#endif
|
||||
tile_stack_(),
|
||||
fps_handle_(0),
|
||||
idle_anim_(preferences::idle_anim()),
|
||||
idle_anim_rate_(1.0)
|
||||
|
@ -610,38 +609,6 @@ std::vector<surface> display::get_terrain_images(const gamemap::location &loc,
|
|||
return res;
|
||||
}
|
||||
|
||||
void display::tile_stack_append(const surface surf)
|
||||
{
|
||||
if (surf)
|
||||
tile_stack_.push_back(surf);
|
||||
}
|
||||
|
||||
void display::tile_stack_append(const std::vector<surface>& surfaces)
|
||||
{
|
||||
std::vector<surface>::const_iterator itor;
|
||||
for(itor = surfaces.begin(); itor != surfaces.end(); ++itor) {
|
||||
tile_stack_append(*itor);
|
||||
}
|
||||
}
|
||||
|
||||
//! Render a stack of tile surfaces at the specified location.
|
||||
void display::tile_stack_render(int x, int y)
|
||||
{
|
||||
surface const dst(screen_.getSurface());
|
||||
|
||||
std::vector<surface>::const_iterator itor;
|
||||
for(itor=tile_stack_.begin(); itor!=tile_stack_.end(); ++itor) {
|
||||
// Note that dstrect can be changed by SDL_BlitSurface
|
||||
// and so a new instance should be initialized
|
||||
// to pass to each call to SDL_BlitSurface.
|
||||
SDL_Rect dstrect = { x, y, 0, 0 };
|
||||
SDL_BlitSurface(*itor, NULL, dst, &dstrect);
|
||||
}
|
||||
tile_stack_.clear();
|
||||
|
||||
update_rect(x, y, zoom_, zoom_);
|
||||
}
|
||||
|
||||
void display::drawing_buffer_commit()
|
||||
{
|
||||
SDL_Rect clip_rect = map_area();
|
||||
|
@ -688,6 +655,7 @@ void display::drawing_buffer_commit()
|
|||
SDL_BlitSurface(*surface_itor, NULL, dst, &dstrect);
|
||||
}
|
||||
}
|
||||
update_rect(blit_itor->x, blit_itor->y, zoom_, zoom_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -910,11 +878,14 @@ static void draw_background(surface screen, const SDL_Rect& area, const std::str
|
|||
}
|
||||
}
|
||||
|
||||
void display::draw_text_in_hex(const gamemap::location& loc, const std::string& text,
|
||||
void display::draw_text_in_hex(const gamemap::location& loc,
|
||||
const tdrawing_layer layer, const std::string& text,
|
||||
size_t font_size, SDL_Color color, double x_in_hex, double y_in_hex)
|
||||
{
|
||||
if (text.empty()) return;
|
||||
|
||||
const int drawing_order = gamemap::get_drawing_order(loc);
|
||||
|
||||
const size_t font_sz = static_cast<size_t>(font_size * get_zoom_factor()
|
||||
#ifdef USE_TINY_GUI
|
||||
/ 2 // the hex is only half size
|
||||
|
@ -928,14 +899,14 @@ void display::draw_text_in_hex(const gamemap::location& loc, const std::string&
|
|||
const int y = get_location_y(loc) - text_surf->h/2
|
||||
+ static_cast<int>(y_in_hex* hex_size());
|
||||
|
||||
SDL_Rect clip_rect = map_area();
|
||||
for (int dy=-1; dy <= 1; dy++) {
|
||||
for (int dx=-1; dx <= 1; dx++) {
|
||||
if (dx!=0 || dy!=0)
|
||||
video().blit_surface(x+dx, y+dy, back_surf, NULL, &clip_rect);
|
||||
if (dx!=0 || dy!=0) {
|
||||
drawing_buffer_add(layer, drawing_order, tblit(x + dx, y + dy, back_surf));
|
||||
}
|
||||
}
|
||||
}
|
||||
video().blit_surface(x, y, text_surf, NULL, &clip_rect);
|
||||
drawing_buffer_add(layer, drawing_order, tblit(x, y, text_surf));
|
||||
}
|
||||
|
||||
void display::clear_hex_overlay(const gamemap::location& loc)
|
||||
|
|
|
@ -209,12 +209,6 @@ public:
|
|||
//! Toogle to continuously redraw the screen.
|
||||
void toggle_benchmark();
|
||||
|
||||
//! Draw text on a hex. (0.5, 0.5) is the center.
|
||||
//! The font size is adjusted to the zoom factor
|
||||
//! and divided by 2 for tiny-gui.
|
||||
void draw_text_in_hex(const gamemap::location& loc, const std::string& text,
|
||||
size_t font_size, SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5);
|
||||
|
||||
void flip();
|
||||
|
||||
//! Copy the backbuffer to the framebuffer.
|
||||
|
@ -421,12 +415,6 @@ protected:
|
|||
std::set<gamemap::location> highlighted_locations_;
|
||||
CKey keys_;
|
||||
|
||||
//! Composes and draws the terrains on a tile
|
||||
void tile_stack_append(const surface surf);
|
||||
void tile_stack_append(const std::vector<surface>& surfaces);
|
||||
void tile_stack_render(int x, int y);
|
||||
void tile_stack_clear() {tile_stack_.clear();};
|
||||
|
||||
public:
|
||||
//! Helper structure for rendering the terrains.
|
||||
struct tblit{
|
||||
|
@ -445,6 +433,14 @@ public:
|
|||
clip(clip)
|
||||
{}
|
||||
|
||||
tblit(const int x, const int y, const std::vector<surface>& surf,
|
||||
const SDL_Rect& clip = SDL_Rect()) :
|
||||
x(x),
|
||||
y(y),
|
||||
surf(surf),
|
||||
clip(clip)
|
||||
{}
|
||||
|
||||
|
||||
int x; //!< x screen coordinate to render at.
|
||||
int y; //!< y screen coordinate to render at.
|
||||
|
@ -458,19 +454,35 @@ public:
|
|||
//! the layers should be save.
|
||||
//! If needed in WML use the name and map that to the enum value.
|
||||
enum tdrawing_layer{
|
||||
LAYER_TERRAIN_BG, //!< Sample for terrain drawn behind a unit.
|
||||
LAYER_TERRAIN_BG, //!< Layer for the terrain drawn behind the
|
||||
//!< unit.
|
||||
LAYER_UNIT_BG, //!< Used for the ellipse behind the unit.
|
||||
LAYER_UNIT_FIRST, //!< Reserve layeres to be selected for WML.
|
||||
LAYER_UNIT_LAST=LAYER_UNIT_FIRST+100,
|
||||
LAYER_UNIT_FG, //!< Used for the ellipse in front of the unit.
|
||||
LAYER_UNIT_FAKE,
|
||||
LAYER_TERRAIN_FG, //!< Sample for terrain to draw in front of a unit.
|
||||
LAYER_UNIT_FG, //!< Used for the ellipse in front of the
|
||||
//!< unit.
|
||||
LAYER_UNIT_FAKE, //!< The fake unit is drawn on this layer.
|
||||
LAYER_TERRAIN_FG, //!< Layer for the terrain drawn in front of
|
||||
//!< the unit.
|
||||
LAYER_UNIT_BAR, //!< Unit bars and overlays are drawn on
|
||||
//!< this layer (for testing here).
|
||||
LAYER_TERRAIN_TMP, //!< Layer which holds stuff that needs to be
|
||||
//!< sorted out further.
|
||||
LAYER_LINGER_OVERLAY, //!< The overlay used for the linger mode.
|
||||
|
||||
LAYER_LAST_LAYER //!< Don't draw to this layer it's a dummy
|
||||
//! to size the vector.
|
||||
};
|
||||
|
||||
//! Draw text on a hex. (0.5, 0.5) is the center.
|
||||
//! The font size is adjusted to the zoom factor
|
||||
//! and divided by 2 for tiny-gui.
|
||||
void draw_text_in_hex(const gamemap::location& loc,
|
||||
const tdrawing_layer layer, const std::string& text, size_t font_size,
|
||||
SDL_Color color, double x_in_hex=0.5, double y_in_hex=0.5);
|
||||
|
||||
protected:
|
||||
|
||||
// Initially tdrawing_buffer was a vector but profiling showed that a map
|
||||
// was more efficient. Tested with the LAYER_UNIT_LAST for various values
|
||||
// and different types the results were. (Tested with oprofile.)
|
||||
|
@ -538,8 +550,6 @@ protected:
|
|||
void draw_wrap(bool update,bool force,bool changed);
|
||||
|
||||
private:
|
||||
//! Tile stack for terrain rendering.
|
||||
std::vector<surface> tile_stack_;
|
||||
//! Handle for the label which displays frames per second.
|
||||
int fps_handle_;
|
||||
|
||||
|
|
|
@ -73,30 +73,34 @@ void editor_display::draw(bool update,bool force)
|
|||
|
||||
int xpos = int(get_location_x(*it));
|
||||
int ypos = int(get_location_y(*it));
|
||||
int drawing_order = gamemap::get_drawing_order(*it);
|
||||
|
||||
if(xpos >= clip_rect.x + clip_rect.w || ypos >= clip_rect.y + clip_rect.h ||
|
||||
xpos + zoom_ < clip_rect.x || ypos + zoom_ < clip_rect.y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
tile_stack_clear();
|
||||
|
||||
const std::string nodarken = "morning";
|
||||
tile_stack_append(get_terrain_images(*it,nodarken,image_type,ADJACENT_BACKGROUND));
|
||||
tile_stack_append(get_terrain_images(*it,nodarken,image_type,ADJACENT_FOREGROUND));
|
||||
drawing_buffer_add(LAYER_TERRAIN_BG, drawing_order, tblit(xpos, ypos,
|
||||
get_terrain_images(*it,nodarken,image_type,ADJACENT_BACKGROUND)));
|
||||
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos,
|
||||
get_terrain_images(*it,nodarken,image_type,ADJACENT_FOREGROUND)));
|
||||
|
||||
// Draw the grid, if it has been enabled
|
||||
if(grid_ && map_.on_board(*it)) {
|
||||
tile_stack_append(image::get_image(game_config::grid_image, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(game_config::grid_image, image::SCALED_TO_HEX)));
|
||||
}
|
||||
|
||||
// Paint selection and mouseover overlays
|
||||
if(*it == selectedHex_ && map_.on_board(selectedHex_, true) && selected_hex_overlay_ != NULL)
|
||||
tile_stack_append(selected_hex_overlay_);
|
||||
if(*it == mouseoverHex_ && map_.on_board(mouseoverHex_, true) && mouseover_hex_overlay_ != NULL)
|
||||
tile_stack_append(mouseover_hex_overlay_);
|
||||
if(*it == selectedHex_ && map_.on_board(selectedHex_, true) && selected_hex_overlay_ != NULL) {
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, selected_hex_overlay_));
|
||||
}
|
||||
if(*it == mouseoverHex_ && map_.on_board(mouseoverHex_, true) && mouseover_hex_overlay_ != NULL) {
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, mouseover_hex_overlay_));
|
||||
}
|
||||
|
||||
tile_stack_render(xpos, ypos);
|
||||
drawing_buffer_commit();
|
||||
|
||||
// If the tile is at the border, we start to blend it
|
||||
if(!map_.on_board(*it) &&
|
||||
|
|
|
@ -363,41 +363,44 @@ void game_display::draw(bool update,bool force)
|
|||
}
|
||||
*/
|
||||
|
||||
tile_stack_clear();
|
||||
|
||||
if(!is_shrouded) {
|
||||
// unshrouded terrain (the normal case)
|
||||
tile_stack_append(get_terrain_images(*it,tod.id, image_type, ADJACENT_BACKGROUND));
|
||||
drawing_buffer_add(LAYER_TERRAIN_BG, drawing_order, tblit(xpos, ypos,
|
||||
get_terrain_images(*it,tod.id, image_type, ADJACENT_BACKGROUND)));
|
||||
|
||||
// village-control flags.
|
||||
tile_stack_append(get_flag(*it));
|
||||
drawing_buffer_add(LAYER_TERRAIN_BG, drawing_order, tblit(xpos, ypos, get_flag(*it)));
|
||||
|
||||
typedef overlay_map::const_iterator Itor;
|
||||
|
||||
for(std::pair<Itor,Itor> overlays = overlays_.equal_range(*it);
|
||||
overlays.first != overlays.second; ++overlays.first) {
|
||||
|
||||
tile_stack_append(image::get_image(overlays.first->second.image,image_type));
|
||||
drawing_buffer_add(LAYER_TERRAIN_BG, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(overlays.first->second.image,image_type)));
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_shrouded) {
|
||||
tile_stack_append(get_terrain_images(*it,tod.id,image_type,ADJACENT_FOREGROUND));
|
||||
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos,
|
||||
get_terrain_images(*it,tod.id,image_type,ADJACENT_FOREGROUND)));
|
||||
}
|
||||
|
||||
// Draw the time-of-day mask on top of the terrain in the hex.
|
||||
// tod may differ from tod if hex is illuminated.
|
||||
std::string tod_hex_mask = timeofday_at(status_,units_,*it,map_).image_mask;
|
||||
if(tod_hex_mask1 != NULL || tod_hex_mask2 != NULL) {
|
||||
tile_stack_append(tod_hex_mask1);
|
||||
tile_stack_append(tod_hex_mask2);
|
||||
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos, tod_hex_mask1));
|
||||
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos, tod_hex_mask2));
|
||||
} else if(tod_hex_mask != "") {
|
||||
tile_stack_append(image::get_image(tod_hex_mask,image::UNMASKED));
|
||||
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(tod_hex_mask,image::UNMASKED)));
|
||||
}
|
||||
|
||||
// Draw the grid, if that's been enabled
|
||||
if(grid_ && !is_shrouded && on_map && !off_map_tile) {
|
||||
tile_stack_append(image::get_image(game_config::grid_image, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(game_config::grid_image, image::SCALED_TO_HEX)));
|
||||
}
|
||||
|
||||
// Draw reach_map information.
|
||||
|
@ -405,44 +408,52 @@ void game_display::draw(bool update,bool force)
|
|||
// that we want to attack.
|
||||
if (!is_shrouded && !reach_map_.empty()
|
||||
&& reach_map_.find(*it) == reach_map_.end() && *it != attack_indicator_dst_) {
|
||||
tile_stack_append(image::get_image(game_config::unreachable_image,image::UNMASKED));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(game_config::unreachable_image,image::UNMASKED)));
|
||||
}
|
||||
|
||||
// Draw cross images for debug highlights
|
||||
if(game_config::debug && debugHighlights_.count(*it)) {
|
||||
tile_stack_append(image::get_image(game_config::cross_image, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(game_config::cross_image, image::SCALED_TO_HEX)));
|
||||
}
|
||||
|
||||
// Add the top layer overlay surfaces
|
||||
if(!hex_overlay_.empty()) {
|
||||
std::map<gamemap::location, surface>::const_iterator itor = hex_overlay_.find(*it);
|
||||
if(itor != hex_overlay_.end())
|
||||
tile_stack_append(itor->second);
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, itor->second));
|
||||
}
|
||||
|
||||
// Footsteps indicating a movement path
|
||||
tile_stack_append(footsteps_images(*it));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, footsteps_images(*it)));
|
||||
|
||||
// Paint selection and mouseover overlays
|
||||
if(*it == selectedHex_ && on_map && selected_hex_overlay_ != NULL)
|
||||
tile_stack_append(selected_hex_overlay_);
|
||||
if(*it == mouseoverHex_ && on_map && mouseover_hex_overlay_ != NULL)
|
||||
tile_stack_append(mouseover_hex_overlay_);
|
||||
if(*it == selectedHex_ && on_map && selected_hex_overlay_ != NULL) {
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, selected_hex_overlay_));
|
||||
}
|
||||
if(*it == mouseoverHex_ && on_map && mouseover_hex_overlay_ != NULL) {
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos, mouseover_hex_overlay_));
|
||||
}
|
||||
|
||||
// Draw the attack direction indicator
|
||||
if(on_map && *it == attack_indicator_src_) {
|
||||
tile_stack_append(image::get_image("misc/attack-indicator-src-" + attack_indicator_direction() + ".png", image::UNMASKED));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("misc/attack-indicator-src-" + attack_indicator_direction() + ".png", image::UNMASKED)));
|
||||
} else if (on_map && *it == attack_indicator_dst_) {
|
||||
tile_stack_append(image::get_image("misc/attack-indicator-dst-" + attack_indicator_direction() + ".png", image::UNMASKED));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("misc/attack-indicator-dst-" + attack_indicator_direction() + ".png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
// Apply shroud, fog and linger overlay
|
||||
if(is_shrouded) {
|
||||
// We apply void also on off-map tiles
|
||||
// to shroud the half-hexes too
|
||||
tile_stack_append(image::get_image(shroud_image, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(shroud_image, image::SCALED_TO_HEX)));
|
||||
} else if(fogged(*it)) {
|
||||
tile_stack_append(image::get_image(fog_image, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image(fog_image, image::SCALED_TO_HEX)));
|
||||
}
|
||||
// Linger overlay unconditionally otherwise it might give glitches
|
||||
// so it's drawn over the shroud and fog.
|
||||
|
@ -453,11 +464,10 @@ void game_display::draw(bool update,bool force)
|
|||
}
|
||||
|
||||
if(!is_shrouded) {
|
||||
tile_stack_append(get_terrain_images(*it, tod.id, image::SCALED_TO_HEX, ADJACENT_FOGSHROUD));
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
get_terrain_images(*it, tod.id, image::SCALED_TO_HEX, ADJACENT_FOGSHROUD)));
|
||||
}
|
||||
|
||||
tile_stack_render(xpos, ypos);
|
||||
|
||||
// Show def% and turn to reach infos
|
||||
if(!is_shrouded && on_map) {
|
||||
draw_movement_info(*it);
|
||||
|
@ -660,8 +670,8 @@ void game_display::draw_bar(const std::string& image, int xpos, int ypos,
|
|||
SDL_Rect bot = {0,bar_loc.y+skip_rows,surf->w,0};
|
||||
bot.h = surf->w - bot.y;
|
||||
|
||||
drawing_buffer_add(LAYER_UNIT_FG, drawing_order, tblit(xpos, ypos, surf, top));
|
||||
drawing_buffer_add(LAYER_UNIT_FG, drawing_order, tblit(xpos, ypos + top.h, surf, bot));
|
||||
drawing_buffer_add(LAYER_UNIT_BAR, drawing_order, tblit(xpos, ypos, surf, top));
|
||||
drawing_buffer_add(LAYER_UNIT_BAR, drawing_order, tblit(xpos, ypos + top.h, surf, bot));
|
||||
|
||||
const size_t unfilled = static_cast<const size_t>(height*(1.0 - filled));
|
||||
|
||||
|
@ -671,7 +681,7 @@ void game_display::draw_bar(const std::string& image, int xpos, int ypos,
|
|||
surface filled_surf(SDL_CreateRGBSurface(SDL_SWSURFACE, bar_loc.w, height - unfilled, 32, /*col.r << 16, col.g << 8, col.b, 0x44000000*/0xFF0000, 0xFF00, 0xFF, 0 ) );
|
||||
SDL_Rect filled_area = {0, 0, bar_loc.w, height-unfilled};
|
||||
fill_rect_alpha(filled_area, colour, r_alpha, filled_surf);
|
||||
drawing_buffer_add(LAYER_UNIT_FG, drawing_order, tblit(xpos + bar_loc.x, ypos + bar_loc.y + unfilled, filled_surf));
|
||||
drawing_buffer_add(LAYER_UNIT_BAR, drawing_order, tblit(xpos + bar_loc.x, ypos + bar_loc.y + unfilled, filled_surf));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -685,6 +695,8 @@ void game_display::set_game_mode(const tgame_mode game_mode)
|
|||
|
||||
void game_display::draw_movement_info(const gamemap::location& loc)
|
||||
{
|
||||
const int drawing_order = gamemap::get_drawing_order(loc);
|
||||
|
||||
// Search if there is a waypoint here
|
||||
std::map<gamemap::location, paths::route::waypoint>::iterator w = route_.waypoints.find(loc);
|
||||
|
||||
|
@ -701,31 +713,31 @@ void game_display::draw_movement_info(const gamemap::location& loc)
|
|||
// With 11 colors, the last one will be used only for def=100
|
||||
int val = (game_config::defense_color_scale.size()-1) * def/100;
|
||||
SDL_Color color = int_to_color(game_config::defense_color_scale[val]);
|
||||
draw_text_in_hex(loc, def_text.str(), 18, color);
|
||||
draw_text_in_hex(loc, LAYER_TERRAIN_TMP, def_text.str(), 18, color);
|
||||
|
||||
int xpos = get_location_x(loc);
|
||||
int ypos = get_location_y(loc);
|
||||
|
||||
if (w->second.invisible) {
|
||||
surface hidden_surf = image::get_image("misc/hidden.png", image::UNMASKED);
|
||||
video().blit_surface(xpos, ypos, hidden_surf);
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("misc/hidden.png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
if (w->second.zoc) {
|
||||
surface zoc_surf = image::get_image("misc/zoc.png", image::UNMASKED);
|
||||
video().blit_surface(xpos, ypos, zoc_surf);
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("misc/zoc.png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
if (w->second.capture) {
|
||||
surface capture_surf = image::get_image("misc/capture.png", image::UNMASKED);
|
||||
video().blit_surface(xpos, ypos, capture_surf);
|
||||
drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, tblit(xpos, ypos,
|
||||
image::get_image("misc/capture.png", image::UNMASKED)));
|
||||
}
|
||||
|
||||
//we display turn info only if different from a simple last "1"
|
||||
if (w->second.turns > 1 || loc != route_.steps.back()) {
|
||||
std::stringstream turns_text;
|
||||
turns_text << w->second.turns;
|
||||
draw_text_in_hex(loc, turns_text.str(), 17, font::NORMAL_COLOUR, 0.5,0.8);
|
||||
draw_text_in_hex(loc, LAYER_TERRAIN_TMP, turns_text.str(), 17, font::NORMAL_COLOUR, 0.5,0.8);
|
||||
}
|
||||
// The hex is full now, so skip the "show enemy moves"
|
||||
return;
|
||||
|
@ -736,7 +748,7 @@ void game_display::draw_movement_info(const gamemap::location& loc)
|
|||
reach_map::iterator reach = reach_map_.find(loc);
|
||||
if (reach != reach_map_.end() && reach->second > 1) {
|
||||
const std::string num = lexical_cast<std::string>(reach->second);
|
||||
draw_text_in_hex(loc, num, 16, font::YELLOW_COLOUR);
|
||||
draw_text_in_hex(loc, LAYER_TERRAIN_TMP, num, 16, font::YELLOW_COLOUR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1844,7 +1844,7 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc, const b
|
|||
|
||||
surface orb(image::get_image(*movement_file,image::SCALED_TO_ZOOM));
|
||||
if (orb != NULL) {
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_FG,
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
|
||||
drawing_order, display::tblit(xsrc, ysrc_adjusted, orb));
|
||||
}
|
||||
|
||||
|
@ -1880,7 +1880,7 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc, const b
|
|||
//if(bar_alpha != ftofxp(1.0)) {
|
||||
// crown = adjust_surface_alpha(crown, bar_alpha);
|
||||
//}
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_FG,
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
|
||||
drawing_order, display::tblit(xsrc, ysrc_adjusted, crown));
|
||||
}
|
||||
}
|
||||
|
@ -1888,7 +1888,7 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc, const b
|
|||
for(std::vector<std::string>::const_iterator ov = overlays().begin(); ov != overlays().end(); ++ov) {
|
||||
const surface ov_img(image::get_image(*ov, image::SCALED_TO_ZOOM));
|
||||
if(ov_img != NULL) {
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_FG,
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
|
||||
drawing_order, display::tblit(xsrc, ysrc_adjusted, ov_img));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue