Use image::locator instead of game_config strings for hexes rendering.
This commit is contained in:
parent
39faaf3fa2
commit
c143c82cdf
5 changed files with 33 additions and 20 deletions
|
@ -2036,10 +2036,12 @@ void display::draw_hex(const map_location& loc) {
|
|||
|
||||
// Draw the grid, if that's been enabled
|
||||
if(grid_ && on_map && !off_map_tile) {
|
||||
static const image::locator grid_top(game_config::images::grid_top);
|
||||
drawing_buffer_add(LAYER_GRID_TOP, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::grid_top, image::SCALED_TO_HEX)));
|
||||
image::get_image(grid_top, image::SCALED_TO_HEX)));
|
||||
static const image::locator grid_bottom(game_config::images::grid_bottom);
|
||||
drawing_buffer_add(LAYER_GRID_BOTTOM, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::grid_bottom, image::SCALED_TO_HEX)));
|
||||
image::get_image(grid_bottom, image::SCALED_TO_HEX)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,9 @@ void editor_display::draw_hex(const map_location& loc)
|
|||
}
|
||||
|
||||
if(loc == mouseoverHex_ && !game_config::images::mouseover.empty()) {
|
||||
drawing_buffer_add(LAYER_MOVE_INFO, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::mouseover, image::UNMASKED)));
|
||||
static const image::locator mouseover(game_config::images::mouseover);
|
||||
drawing_buffer_add(LAYER_MOVE_INFO, loc, tblit(xpos, ypos,
|
||||
image::get_image(mouseover, image::UNMASKED)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,8 +357,9 @@ void game_display::draw_hex(const map_location& loc)
|
|||
// that we want to attack.
|
||||
if (!is_shrouded && !reach_map_.empty()
|
||||
&& reach_map_.find(loc) == reach_map_.end() && loc != attack_indicator_dst_) {
|
||||
static const image::locator unreachable(game_config::images::unreachable);
|
||||
drawing_buffer_add(LAYER_REACHMAP, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::unreachable,image::UNMASKED)));
|
||||
image::get_image(unreachable,image::UNMASKED)));
|
||||
}
|
||||
|
||||
resources::whiteboard->draw_hex(loc);
|
||||
|
@ -383,19 +384,22 @@ void game_display::draw_hex(const map_location& loc)
|
|||
// Linger overlay unconditionally otherwise it might give glitches
|
||||
// so it's drawn over the shroud and fog.
|
||||
if(game_mode_ != RUNNING) {
|
||||
blit.surf.push_back(image::get_image(game_config::images::linger, image::SCALED_TO_HEX));
|
||||
static const image::locator linger(game_config::images::linger);
|
||||
blit.surf.push_back(image::get_image(linger, image::SCALED_TO_HEX));
|
||||
drawing_buffer_add(LAYER_LINGER_OVERLAY, loc, blit);
|
||||
blit.surf.clear();
|
||||
}
|
||||
|
||||
if(on_map && loc == selectedHex_ && !game_config::images::selected.empty()) {
|
||||
static const image::locator selected(game_config::images::selected);
|
||||
drawing_buffer_add(LAYER_MOVE_INFO, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::selected, image::UNMASKED)));
|
||||
image::get_image(selected, image::UNMASKED)));
|
||||
}
|
||||
|
||||
if(on_map && loc == mouseoverHex_ && !game_config::images::mouseover.empty()) {
|
||||
static const image::locator mouseover(game_config::images::mouseover);
|
||||
drawing_buffer_add(LAYER_MOVE_INFO, loc, tblit(xpos, ypos,
|
||||
image::get_image(game_config::images::mouseover, image::UNMASKED)));
|
||||
image::get_image(mouseover, image::UNMASKED)));
|
||||
}
|
||||
|
||||
// Show def% and turn to reach infos
|
||||
|
|
|
@ -477,7 +477,8 @@ surface locator::load_image_file() const
|
|||
surface locator::load_image_sub_file() const
|
||||
{
|
||||
const surface mother_surface(get_image(val_.filename_, UNSCALED));
|
||||
const surface mask(get_image(game_config::images::terrain_mask, UNSCALED));
|
||||
static const image::locator terrain_mask(game_config::images::terrain_mask);
|
||||
const surface mask(get_image(terrain_mask, UNSCALED));
|
||||
|
||||
if(mother_surface == NULL)
|
||||
return surface(NULL);
|
||||
|
@ -968,8 +969,8 @@ static surface get_hexed(const locator& i_locator)
|
|||
{
|
||||
surface image(get_image(i_locator, UNSCALED));
|
||||
// Re-cut scaled tiles according to a mask.
|
||||
const surface hex(get_image(game_config::images::terrain_mask,
|
||||
UNSCALED));
|
||||
static const image::locator terrain_mask(game_config::images::terrain_mask);
|
||||
const surface hex(get_image(terrain_mask, UNSCALED));
|
||||
return mask_surface(image, hex);
|
||||
}
|
||||
|
||||
|
|
23
src/unit.cpp
23
src/unit.cpp
|
@ -1878,30 +1878,35 @@ void unit::redraw_unit()
|
|||
disp.drawing_buffer_add(display::LAYER_UNIT_FIRST, loc_,
|
||||
display::tblit(xsrc, ysrc +adjusted_params.y-ellipse_floating, ellipse_front));
|
||||
}
|
||||
|
||||
if(draw_bars) {
|
||||
const std::string* movement_file = NULL;
|
||||
const image::locator* orb_img = NULL;
|
||||
static const image::locator enemy_ball(game_config::images::enemy_ball);
|
||||
static const image::locator ally_ball(game_config::images::ally_ball);
|
||||
static const image::locator moved_ball(game_config::images::moved_ball);
|
||||
static const image::locator unmoved_ball(game_config::images::unmoved_ball);
|
||||
static const image::locator partmoved_ball(game_config::images::partmoved_ball);
|
||||
|
||||
const std::string* energy_file = &game_config::images::energy;
|
||||
|
||||
if(size_t(side()) != disp.viewing_team()+1) {
|
||||
if(disp.team_valid() &&
|
||||
disp.get_teams()[disp.viewing_team()].is_enemy(side())) {
|
||||
movement_file = &game_config::images::enemy_ball;
|
||||
orb_img = &enemy_ball;
|
||||
} else {
|
||||
movement_file = &game_config::images::ally_ball;
|
||||
orb_img = &ally_ball;
|
||||
}
|
||||
} else {
|
||||
movement_file = &game_config::images::moved_ball;
|
||||
orb_img = &moved_ball;
|
||||
if(disp.playing_team() == disp.viewing_team() && !user_end_turn()) {
|
||||
if (movement_left() == total_movement()) {
|
||||
movement_file = &game_config::images::unmoved_ball;
|
||||
orb_img = &unmoved_ball;
|
||||
} else if (unit_can_move(*this)) {
|
||||
movement_file = &game_config::images::partmoved_ball;
|
||||
orb_img = &partmoved_ball;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
surface orb(image::get_image(*movement_file,image::SCALED_TO_ZOOM));
|
||||
assert(orb_img != NULL);
|
||||
surface orb(image::get_image(*orb_img,image::SCALED_TO_ZOOM));
|
||||
if (orb != NULL) {
|
||||
disp.drawing_buffer_add(display::LAYER_UNIT_BAR,
|
||||
loc_, display::tblit(xsrc, ysrc +adjusted_params.y, orb));
|
||||
|
|
Loading…
Add table
Reference in a new issue