From da36f97e1d764e1125deba86a403eee66e937d0b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 19 Apr 2009 18:29:26 +0000 Subject: added jumpdrive capability to shipmodel info message, Makefile.am cleanups, improved map targetting, corrected hud target owner color leak bug --- src/client/map.cc | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/client/map.cc') diff --git a/src/client/map.cc b/src/client/map.cc index 6ad8b23..f10b03c 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -40,7 +40,7 @@ Map::Map(ui::Widget *parent) : ui::Window(parent) set_background(true); set_font(ui::root()->font_small()); - //map_target = 0; + map_target = 0; map_hover = 0; hide(); } @@ -53,7 +53,14 @@ void Map::hide() { ui::Window::hide(); map_hover = 0; - //map_target = 0; + map_target = 0; +} + +void Map::show() +{ + ui::Window::show(); + map_hover = 0; + map_target = targets::current(); } void Map::toggle() @@ -74,6 +81,9 @@ void Map::draw() const float gridsize=16; core::Entity *entity; + const core::Entity *current_target = map_target; + map_target = 0; + math::Color color; math::Vector2f v(global_location()); @@ -123,7 +133,6 @@ void Map::draw() gl::begin(gl::Quads); // draw map icons - bool valid_target = false; for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) { entity = (*it); @@ -139,23 +148,18 @@ void Map::draw() map_hover = entity->id(); } - if (entity == targets::current()) { - valid_target = true; + if (entity == current_target) { + map_target = entity; if (core::application()->time() - floorf(core::application()->time()) < 0.5f) { draw_icon = false; } } if (entity == core::localplayer()->view()) { - valid_target = true; if (core::application()->time() - floorf(core::application()->time()) > 0.5f) { draw_icon = false; } - } - } - - if (entity == core::localcontrol()) { - draw_icon = false; + } } if (draw_icon) { @@ -238,7 +242,7 @@ void Map::draw() gl::end(); - if (targets::current()) { + if (map_target) { l.assign(v); if (h > s ) { @@ -257,7 +261,7 @@ void Map::draw() render::Text::setcolor('B'); render::Text::setfont(font()->name().c_str(), font()->width(), font()->height()); - render::Text::draw(l.x, l.y, targets::current()->name()); + render::Text::draw(l.x, l.y, map_target->name()); render::Text::setcolor('N'); } @@ -270,7 +274,8 @@ bool Map::on_keypress(const int key, const unsigned int modifier) if (hover()) { core::Entity *target = core::localplayer()->zone()->find_entity(hover()); if (is_valid_map_target(target)) { - targets::select_target(target); + map_target = target; + audio::play("ui/target"); } } return true; -- cgit v1.2.3