mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-10 19:57:05 +00:00
Updated the border code to use the new non overlapping corner...
...pieces to avoid display glitches.
This commit is contained in:
parent
8f4883633a
commit
3fcb4b1a2a
@ -397,84 +397,89 @@ void game_display::draw(bool update,bool force)
|
|||||||
//simulate_delay += 1;
|
//simulate_delay += 1;
|
||||||
|
|
||||||
// if the tile is at the border we start to blend it
|
// if the tile is at the border we start to blend it
|
||||||
// leave the northern and southern border since they're tricky due
|
// NOTE we assume a half hex border!!!
|
||||||
// to the hex shape of the tile
|
// NOTE everything is hardcoded but it will be moved to the theme code
|
||||||
// note we assume a half time border!!!
|
// in the near future and then also become a separate function
|
||||||
if(!on_map && map_.get_terrain(*it) != t_translation::OFF_MAP_USER) {
|
if(!on_map && map_.get_terrain(*it) != t_translation::OFF_MAP_USER) {
|
||||||
// first handle the corners
|
// first handle the corners
|
||||||
if(it->x == -1 && it->y == -1) {
|
if(it->x == -1 && it->y == -1) { // top left corner
|
||||||
SDL_Rect rect = { xpos + zoom_/4, ypos, 3 * zoom_/4, zoom_ } ;
|
SDL_Rect rect = { xpos + zoom_/4, ypos, 3 * zoom_/4, zoom_ } ;
|
||||||
const surface border(image::get_image("terrain/off-map/fade_corner_topleft.png", image::SCALED_TO_ZOOM));
|
const surface border(image::get_image("terrain/off-map/fade_corner_top_left.png", image::SCALED_TO_ZOOM));
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
} else if(it->x == map_.x() && it->y == -1) {
|
} else if(it->x == map_.x() && it->y == -1) { // top right corner
|
||||||
SDL_Rect rect = { xpos - zoom_/4, ypos, 3 * zoom_/4, zoom_ } ;
|
SDL_Rect rect = { xpos, -1, 3 * zoom_/4, zoom_ } ;
|
||||||
const surface border(image::get_image("terrain/off-map/fade_corner_topright.png", image::SCALED_TO_ZOOM));
|
surface border;
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
|
||||||
|
|
||||||
} else if(it->x == -1 && it->y == map_.y()) {
|
|
||||||
SDL_Rect rect = { xpos + zoom_/4, -1, 3 * zoom_/4, zoom_ } ;
|
|
||||||
if(it->x%2 == 0) {
|
if(it->x%2 == 0) {
|
||||||
rect.y = ypos;
|
rect.y = ypos + zoom_/2;
|
||||||
|
rect.h = zoom_/2;
|
||||||
|
// we use the map idea of odd and even and map coords are internal coords + 1
|
||||||
|
border = image::get_image("terrain/off-map/fade_corner_top_right_odd.png", image::SCALED_TO_ZOOM);
|
||||||
} else {
|
} else {
|
||||||
rect.y = ypos - zoom_/2;
|
|
||||||
}
|
|
||||||
const surface border(image::get_image("terrain/off-map/fade_corner_bottomleft.png", image::SCALED_TO_ZOOM));
|
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
|
||||||
} else if(it->x == map_.x() && it->y == map_.y()) {
|
|
||||||
SDL_Rect rect = { xpos - zoom_/4, -1, 3 * zoom_/4, zoom_ } ;
|
|
||||||
if(it->x%2 == 0) {
|
|
||||||
rect.y = ypos;
|
rect.y = ypos;
|
||||||
} else {
|
border = image::get_image("terrain/off-map/fade_corner_top_right_even.png", image::SCALED_TO_ZOOM);
|
||||||
rect.y = ypos - zoom_/2;
|
}
|
||||||
|
|
||||||
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
|
} else if(it->x == -1 && it->y == map_.y()) { // bottom left corner
|
||||||
|
SDL_Rect rect = { xpos + zoom_/4, ypos, 3 * zoom_/4, zoom_/2 } ;
|
||||||
|
|
||||||
|
const surface border(image::get_image("terrain/off-map/fade_corner_bottom_left.png", image::SCALED_TO_ZOOM));
|
||||||
|
|
||||||
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
|
} else if(it->x == map_.x() && it->y == map_.y()) { // bottom right corner
|
||||||
|
SDL_Rect rect = { xpos, ypos, 3 * zoom_/4, zoom_/2 } ;
|
||||||
|
surface border;
|
||||||
|
if(it->x%2 == 1) {
|
||||||
|
// we use the map idea of odd and even and map coords are internal coords + 1
|
||||||
|
border = image::get_image("terrain/off-map/fade_corner_bottom_right_even.png", image::SCALED_TO_ZOOM);
|
||||||
|
} else {
|
||||||
|
border = image::get_image("terrain/off-map/fade_corner_bottom_right_odd.png", image::SCALED_TO_ZOOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
const surface border(image::get_image("terrain/off-map/fade_corner_bottomright.png", image::SCALED_TO_ZOOM));
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
// now handle the sides
|
// now handle the sides
|
||||||
} else if(it->x == -1) {
|
} else if(it->x == -1) { // left side
|
||||||
SDL_Rect rect = { xpos + zoom_/4 , ypos, zoom_/2, zoom_ } ;
|
SDL_Rect rect = { xpos + zoom_/4 , ypos, zoom_/2, zoom_ } ;
|
||||||
const surface border(image::get_image("terrain/off-map/fade_border_left.png", image::SCALED_TO_ZOOM));
|
const surface border(image::get_image("terrain/off-map/fade_border_left.png", image::SCALED_TO_ZOOM));
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
} else if(it->x == map_.x()) {
|
} else if(it->x == map_.x()) { // right side
|
||||||
SDL_Rect rect = { xpos + zoom_/4 , ypos, zoom_/2, zoom_ } ;
|
SDL_Rect rect = { xpos + zoom_/4 , ypos, zoom_/2, zoom_ } ;
|
||||||
const surface border(image::get_image("terrain/off-map/fade_border_right.png", image::SCALED_TO_ZOOM));
|
const surface border(image::get_image("terrain/off-map/fade_border_right.png", image::SCALED_TO_ZOOM));
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
} else if(it->y == -1) {
|
} else if(it->y == -1) { // top side
|
||||||
SDL_Rect rect = { xpos, -1 , zoom_, -1 } ;
|
SDL_Rect rect = { xpos, -1, zoom_, zoom_/2 } ;
|
||||||
surface border;
|
surface border;
|
||||||
|
|
||||||
if(it->x%2 == 1) {
|
if(it->x%2 == 1) {
|
||||||
rect.y = ypos;
|
rect.y = ypos;
|
||||||
rect.h = zoom_/2;
|
// we use the map idea of odd and even and map coords are internal coords + 1
|
||||||
border = image::get_image("terrain/off-map/fade_border_top_odd.png", image::SCALED_TO_ZOOM);
|
border = image::get_image("terrain/off-map/fade_border_top_odd.png", image::SCALED_TO_ZOOM);
|
||||||
} else {
|
} else {
|
||||||
rect.y = ypos + zoom_/2;
|
rect.y = ypos + zoom_/2;
|
||||||
rect.h = zoom_/2;
|
|
||||||
border = image::get_image("terrain/off-map/fade_border_top_even.png", image::SCALED_TO_ZOOM);
|
border = image::get_image("terrain/off-map/fade_border_top_even.png", image::SCALED_TO_ZOOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
SDL_BlitSurface( border, NULL, screen_.getSurface(), &rect);
|
||||||
|
|
||||||
} else if(it->y == map_.y()) {
|
} else if(it->y == map_.y()) { // bottom side
|
||||||
SDL_Rect rect = { xpos, -1 , zoom_, -1 } ;
|
SDL_Rect rect = { xpos, -1, zoom_, zoom_/2 } ;
|
||||||
surface border;
|
surface border;
|
||||||
|
|
||||||
if(it->x%2 == 1) {
|
if(it->x%2 == 1) {
|
||||||
rect.y = ypos;
|
rect.y = ypos;
|
||||||
rect.h = zoom_/2;
|
// NOTE here is the internal idea off odd and even used
|
||||||
border = image::get_image("terrain/off-map/fade_border_bottom_odd.png", image::SCALED_TO_ZOOM);
|
border = image::get_image("terrain/off-map/fade_border_bottom_odd.png", image::SCALED_TO_ZOOM);
|
||||||
} else {
|
} else {
|
||||||
rect.y = ypos + zoom_/2;
|
rect.y = ypos + zoom_/2;
|
||||||
rect.h = zoom_/2;
|
|
||||||
border = image::get_image("terrain/off-map/fade_border_bottom_even.png", image::SCALED_TO_ZOOM);
|
border = image::get_image("terrain/off-map/fade_border_bottom_even.png", image::SCALED_TO_ZOOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user