From 66746168f710cfdfbb0853947985fa0c552e81fb Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 6 Nov 2013 00:37:32 +0000 Subject: Corrected a number of minor HUD target issues. --- src/client/hud.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/client/hud.cc') diff --git a/src/client/hud.cc b/src/client/hud.cc index 8c33014..d402cb2 100644 --- a/src/client/hud.cc +++ b/src/client/hud.cc @@ -203,10 +203,10 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) // calculate the intersection between the line (0,0,0)-target and the frustum front float t = (render::FRUSTUMFRONT + 0.001f) / target.x(); - Vector3f center(target *t); + Vector3f center(target * t); - float cx = render::State::width() * (0.5 - center.y()); - float cy = render::State::height() * (0.5 - center.z() * render::State::aspect()); + float cx = roundf(render::State::width() * (0.5 - center.y())); + float cy = roundf(render::State::height() * (0.5 - center.z() * render::State::aspect())); if ((cx < 0) || (cy < 0) || (cx > render::State::width()) || (cy > render::State::height())) { draw_offscreen_target(entity, is_active_target); @@ -308,7 +308,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) if (is_active_target) { std::ostringstream strdistance; - if (controlable) { + if (controlable && controlable->owner()) { strdistance << "^B"; } else if (entity->has_flag(core::Entity::Dockable)) { strdistance << "^B"; @@ -327,7 +327,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) strdistance << "--"; } - label_location.assign(cx - bitmap_radius, cy + bitmap_radius); + label_location.assign(cx - bitmap_radius, cy - bitmap_radius); ui::Paint::draw_label(label_location, label_size, label_font, strdistance.str()); } @@ -345,7 +345,7 @@ void HUD::draw_target(core::Entity *entity, bool is_active_target) math::Vector2f pos; pos[0] = cx - bitmap_radius; pos[0] += bitmap_radius - 0.5f * hb_width; - pos[1] = cy + bitmap_radius - hb_height * 0.5f; + pos[1] = cy + bitmap_radius - 1.5f * hb_height; // health bar gl::color(0, 1, 0, 1); -- cgit v1.2.3