Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-04-19 18:29:26 +0000
committerStijn Buys <ingar@osirion.org>2009-04-19 18:29:26 +0000
commitda36f97e1d764e1125deba86a403eee66e937d0b (patch)
tree8e51fe43780b216920dfeffcb359977a52fe2adc /src/client/map.cc
parent6ab4021827e91303ac6fe2276f5567810b7e0496 (diff)
added jumpdrive capability to shipmodel info message,
Makefile.am cleanups, improved map targetting, corrected hud target owner color leak bug
Diffstat (limited to 'src/client/map.cc')
-rw-r--r--src/client/map.cc33
1 files changed, 19 insertions, 14 deletions
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;