Apply a temporary hack to fix headless units for 1.5.0.

But it doesn't fix all glitches for sliding unit behind keep, but at
least static view is cleaner.

This will be reverted after the release.
This commit is contained in:
Ali El Gariani 2008-04-23 13:57:54 +00:00
parent 40fadb5bcb
commit bf477e0cc3
3 changed files with 13 additions and 7 deletions

View file

@ -970,7 +970,7 @@ void display::clear_hex_overlay(const gamemap::location& loc)
}
}
void display::render_unit_image(int x, int y, const bool fake_unit,
void display::render_unit_image(int x, int y, const bool /*fake_unit*/,
const int drawing_order, surface image,
bool hreverse, bool greyscale, fixed_t alpha,
Uint32 blendto, double blend_ratio, double submerged,bool vreverse)
@ -1018,7 +1018,10 @@ void display::render_unit_image(int x, int y, const bool fake_unit,
SDL_Rect srcrect = {0,0,surf->w,submerge_height};
drawing_buffer_add(fake_unit ? LAYER_UNIT_FAKE: LAYER_UNIT_FIRST, drawing_order, tblit(x, y, surf, srcrect));
// NOTE: There is also a LAYER_UNIT_FAKE, but don't work well
// with the hack "foreground terrain in LAYER_UNIT_FIRST"
// (e.g. fake unit moving behind a keep)
drawing_buffer_add(LAYER_UNIT_FIRST, drawing_order, tblit(x, y, surf, srcrect));
if(submerge_height != surf->h) {
surf.assign(adjust_surface_alpha(surf,ftofxp(0.2),false));
@ -1027,7 +1030,7 @@ void display::render_unit_image(int x, int y, const bool fake_unit,
srcrect.h = surf->h-submerge_height;
y += submerge_height;
drawing_buffer_add(fake_unit ? LAYER_UNIT_FAKE: LAYER_UNIT_FIRST, drawing_order, tblit(x, y, surf, srcrect));
drawing_buffer_add(LAYER_UNIT_FIRST, drawing_order, tblit(x, y, surf, srcrect));
}
}

View file

@ -382,7 +382,9 @@ void game_display::draw(bool update,bool force)
}
if(!is_shrouded) {
drawing_buffer_add(LAYER_TERRAIN_FG, drawing_order, tblit(xpos, ypos,
// FIXME: This is a hack, we draw terrain in the unit layer
// but with a higher drawing_order, so it's rendered on top of the unit
drawing_buffer_add(LAYER_UNIT_FIRST, drawing_order+100, tblit(xpos, ypos,
get_terrain_images(*it,tod.id,image_type,ADJACENT_FOREGROUND)));
}

View file

@ -1771,9 +1771,10 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc, const b
ellipse_front.assign(image::get_image(image::locator(buf), image::SCALED_TO_ZOOM));
}
// FIXME: This is a hack, we draw ellipses in the unit layer
// but with a different drawing_order, so it's rendered behind/above unit
if (ellipse_back != NULL) {
disp.drawing_buffer_add(display::LAYER_UNIT_BG, drawing_order,
disp.drawing_buffer_add(display::LAYER_UNIT_FIRST, drawing_order-10,
display::tblit(xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_back));
}
@ -1785,7 +1786,7 @@ void unit::redraw_unit(game_display& disp, const gamemap::location& loc, const b
}
if (ellipse_front != NULL) {
disp.drawing_buffer_add(display::LAYER_UNIT_FG, drawing_order,
disp.drawing_buffer_add(display::LAYER_UNIT_FIRST, drawing_order+10,
display::tblit(xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_front));
}