Author: alink
Date: Sun Mar 23 18:02:06 2008
New Revision: 25024

URL: http://svn.gna.org/viewcvs/wesnoth?rev=25024&view=rev
Log:
Fix some glitches introduced by the temporary part of layer's code:
Just split the temporary layer in 2 parts (under and on top of units)
This make things less ugly and will help to detect real z-order problems.
(move grid, black stripes, attack indictator... under units, as before)

Modified:
    trunk/src/display.hpp
    trunk/src/editor/editor_display.cpp
    trunk/src/game_display.cpp

Modified: trunk/src/display.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/display.hpp?rev=25024&r1=25023&r2=25024&view=diff
==============================================================================
--- trunk/src/display.hpp (original)
+++ trunk/src/display.hpp Sun Mar 23 18:02:06 2008
@@ -456,6 +456,8 @@
        enum tdrawing_layer{ 
                LAYER_TERRAIN_BG,          //!< Layer for the terrain drawn 
behind the 
                                           //!< unit.
+               LAYER_TERRAIN_TMP_BG,      //!< Layer which holds stuff that 
needs to be
+                                          //!< sorted out further, but under 
units
                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,
@@ -464,10 +466,10 @@
                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_TERRAIN_TMP_FG,      //!< Layer which holds stuff that 
needs to be
+                                          //!< sorted out further, but on top 
of units
                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

Modified: trunk/src/editor/editor_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor_display.cpp?rev=25024&r1=25023&r2=25024&view=diff
==============================================================================
--- trunk/src/editor/editor_display.cpp (original)
+++ trunk/src/editor/editor_display.cpp Sun Mar 23 18:02:06 2008
@@ -88,16 +88,16 @@
 
                        // Draw the grid, if it has been enabled
                        if(grid_ && map_.on_board(*it)) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
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) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos, selected_hex_overlay_));
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
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_));
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos, mouseover_hex_overlay_));
                        }
 
                        drawing_buffer_commit();

Modified: trunk/src/game_display.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_display.cpp?rev=25024&r1=25023&r2=25024&view=diff
==============================================================================
--- trunk/src/game_display.cpp (original)
+++ trunk/src/game_display.cpp Sun Mar 23 18:02:06 2008
@@ -399,7 +399,7 @@
 
                        // Draw the grid, if that's been enabled
                        if(grid_ && !is_shrouded && on_map && !off_map_tile) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        
image::get_image(game_config::grid_image, image::SCALED_TO_HEX)));
                        }
 
@@ -408,13 +408,13 @@
                        // that we want to attack.
                        if (!is_shrouded && !reach_map_.empty()
                                        && reach_map_.find(*it) == 
reach_map_.end() && *it != attack_indicator_dst_) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
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)) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        
image::get_image(game_config::cross_image, image::SCALED_TO_HEX)));
                        }
 
@@ -422,26 +422,26 @@
                        if(!hex_overlay_.empty()) {
                                std::map<gamemap::location, 
surface>::const_iterator itor = hex_overlay_.find(*it);
                                if(itor != hex_overlay_.end())
-                                       drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos, itor->second));
+                                       
drawing_buffer_add(LAYER_TERRAIN_TMP_BG, drawing_order, tblit(xpos, ypos, 
itor->second));
                        }
 
                        // Footsteps indicating a movement path
-                       drawing_buffer_add(LAYER_TERRAIN_TMP, drawing_order, 
tblit(xpos, ypos, footsteps_images(*it)));
+                       drawing_buffer_add(LAYER_TERRAIN_TMP_BG, drawing_order, 
tblit(xpos, ypos, footsteps_images(*it)));
 
                        // Paint selection and mouseover overlays
                        if(*it == selectedHex_ && on_map && 
selected_hex_overlay_ != NULL) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos, selected_hex_overlay_));
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
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_));
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos, mouseover_hex_overlay_));
                        }
 
                        // Draw the attack direction indicator
                        if(on_map && *it == attack_indicator_src_) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
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_) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        
image::get_image("misc/attack-indicator-dst-" + attack_indicator_direction() + 
".png", image::UNMASKED)));
                        }
 
@@ -449,10 +449,10 @@
                        if(is_shrouded) {
                                // We apply void also on off-map tiles
                                // to shroud the half-hexes too
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_FG, 
drawing_order, tblit(xpos, ypos,
                                        image::get_image(shroud_image, 
image::SCALED_TO_HEX)));
                        } else if(fogged(*it)) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_FG, 
drawing_order, tblit(xpos, ypos,
                                        image::get_image(fog_image, 
image::SCALED_TO_HEX)));
                        } 
                        // Linger overlay unconditionally otherwise it might 
give glitches
@@ -464,7 +464,7 @@
                        }
 
                        if(!is_shrouded) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_FG, 
drawing_order, tblit(xpos, ypos,
                                        get_terrain_images(*it, tod.id, 
image::SCALED_TO_HEX, ADJACENT_FOGSHROUD)));
                        }
 
@@ -713,23 +713,23 @@
                        // 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, LAYER_TERRAIN_TMP, 
def_text.str(), 18, color);
+                       draw_text_in_hex(loc, LAYER_TERRAIN_TMP_BG, 
def_text.str(), 18, color);
 
                        int xpos = get_location_x(loc);
                        int ypos = get_location_y(loc);
 
             if (w->second.invisible) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        image::get_image("misc/hidden.png", 
image::UNMASKED)));
                        }
 
                        if (w->second.zoc) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        image::get_image("misc/zoc.png", 
image::UNMASKED)));
                        }
 
                        if (w->second.capture) {
-                               drawing_buffer_add(LAYER_TERRAIN_TMP, 
drawing_order, tblit(xpos, ypos,
+                               drawing_buffer_add(LAYER_TERRAIN_TMP_BG, 
drawing_order, tblit(xpos, ypos,
                                        image::get_image("misc/capture.png", 
image::UNMASKED)));
                        }
 
@@ -737,7 +737,7 @@
                        if (w->second.turns > 1 || loc != route_.steps.back()) {
                                std::stringstream turns_text;
                                turns_text << w->second.turns;
-                               draw_text_in_hex(loc, LAYER_TERRAIN_TMP, 
turns_text.str(), 17, font::NORMAL_COLOUR, 0.5,0.8);
+                               draw_text_in_hex(loc, LAYER_TERRAIN_TMP_BG, 
turns_text.str(), 17, font::NORMAL_COLOUR, 0.5,0.8);
                        }
                        // The hex is full now, so skip the "show enemy moves"
                        return;
@@ -748,7 +748,7 @@
                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, LAYER_TERRAIN_TMP, num, 16, 
font::YELLOW_COLOUR);
+                       draw_text_in_hex(loc, LAYER_TERRAIN_TMP_BG, num, 16, 
font::YELLOW_COLOUR);
                }
        }
 }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to