From 0b07431b1a1afc3eea5e195f539445309fe9f5dd Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Fri, 30 Mar 2007 17:44:37 +0000 Subject: [PATCH] fix the position of some halos when unit has a height offset (patch #710) --- changelog | 1 + players_changelog | 1 + src/unit.cpp | 27 ++++++++++++--------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/changelog b/changelog index 975be0c111d..040305d390d 100644 --- a/changelog +++ b/changelog @@ -34,6 +34,7 @@ Version 1.3.1+svn: * fix glitches when scrolling the map if zoomed out (bug #8768) * fix the right border glitch of the map when zooming (bug #6060 and others) * flying units are no longer buried in a castle (patch #709) + * fix the position of some halos when unit has a height offset (patch #710) * scenery * added animated windmill, fancy and damaged tents, icepack, and shipwreck * language and i18n: diff --git a/players_changelog b/players_changelog index 6598d746d46..934a9e27173 100644 --- a/players_changelog +++ b/players_changelog @@ -29,6 +29,7 @@ Version 1.3.1+svn: as intended). * Fix some glitches when scrolling or zooming the map. * Flying units are no longer buried in a castle. + * Fixed the position of some halos when a unit was in a keep or castle. * Units changes and balancing: * Converted the cold resistance of the Elvish Sorceress line to a holy diff --git a/src/unit.cpp b/src/unit.cpp index 16fe03a1d65..4474d6abd88 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -1793,21 +1793,18 @@ void unit::redraw_unit(display& disp,gamemap::location hex) unit_anim_halo_ = halo::NO_HALO; } if(!current_frame.halo(anim_->get_current_frame_time()).empty()) { - - if(facing_ == gamemap::location::NORTH_WEST || facing_ == gamemap::location::SOUTH_WEST) { - const int d = disp.hex_size() / 2; - unit_anim_halo_ = halo::add(x+d-static_cast(current_frame.halo_x(anim_->get_current_frame_time())*disp.zoom()), - y+d+static_cast(current_frame.halo_y(anim_->get_current_frame_time())*disp.zoom()), - current_frame.halo(anim_->get_current_frame_time()), - gamemap::location(-1, -1), - halo::HREVERSE); - } else { - const int d = disp.hex_size() / 2; - unit_anim_halo_ = halo::add(x+d+static_cast(current_frame.halo_x(anim_->get_current_frame_time())*disp.zoom()), - y+d+static_cast(current_frame.halo_y(anim_->get_current_frame_time())*disp.zoom()), - current_frame.halo(anim_->get_current_frame_time()), - gamemap::location(-1, -1)); - } + int d = disp.hex_size() / 2; + int ft = anim_->get_current_frame_time(); + int dx = int(current_frame.halo_x(ft) * disp.zoom()); + int hy = y + d - height_adjust + int(current_frame.halo_y(ft) * disp.zoom()); + if (facing_ == gamemap::location::NORTH_WEST || + facing_ == gamemap::location::SOUTH_WEST) + unit_anim_halo_ = halo::add(x + d - dx, hy, + current_frame.halo(ft), gamemap::location(-1, -1), + halo::HREVERSE); + else + unit_anim_halo_ = halo::add(x + d + dx, hy, + current_frame.halo(ft), gamemap::location(-1, -1)); } image::locator loc; loc = current_frame.image();