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>2013-11-06 00:37:32 +0000
committerStijn Buys <ingar@osirion.org>2013-11-06 00:37:32 +0000
commit66746168f710cfdfbb0853947985fa0c552e81fb (patch)
treef556ee8468125be1c652b915a443d177687a93aa /src/client
parentc7455f12589b97612ebe928ed11881edf4c4aacc (diff)
Corrected a number of minor HUD target issues.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/hud.cc12
-rw-r--r--src/client/hudplayerstatus.cc9
-rw-r--r--src/client/hudtargetstatus.cc12
3 files changed, 24 insertions, 9 deletions
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);
diff --git a/src/client/hudplayerstatus.cc b/src/client/hudplayerstatus.cc
index e1f921a..0dba3c8 100644
--- a/src/client/hudplayerstatus.cc
+++ b/src/client/hudplayerstatus.cc
@@ -37,7 +37,14 @@ void HUDPlayerStatus::draw()
std::ostringstream playerinfostr;
playerinfostr << "^B" << core::localplayer()->name() << '\n';
- playerinfostr << "^B" << core::localcontrol()->name() << '\n';
+
+ if (core::localcontrol()->info()) {
+ core::game()->request_info(core::localcontrol()->info()->id());
+ playerinfostr << "^B" << core::localcontrol()->info()->name() << '\n';
+ } else {
+ playerinfostr << '\n';
+ }
+
playerinfostr << "^NCredits: " << core::localplayer()->credits();
ui::Paint::set_color(palette()->foreground());
diff --git a/src/client/hudtargetstatus.cc b/src/client/hudtargetstatus.cc
index f002b2a..893d816 100644
--- a/src/client/hudtargetstatus.cc
+++ b/src/client/hudtargetstatus.cc
@@ -45,14 +45,22 @@ void HUDTargetStatus::draw()
const core::EntityControlable *target_controlable = static_cast<const core::EntityControlable *>(target);
if (target_controlable->owner()) {
targetinfostr << "^B" << target_controlable->owner()->name() << "\n";
- targetinfostr << "^B" << target->name() << "\n";
} else {
targetinfostr << "^B" << target->name() << "\n";
+ }
+ if (target->info()) {
+ targetinfostr << "^B" << target->info()->name() << "\n";
+ } else {
targetinfostr << "\n";
}
} else {
targetinfostr << "^B" << target->name() << "\n";
- targetinfostr << "\n";
+ if (target->info()) {
+ core::game()->request_info(target->info()->id());
+ targetinfostr << "^B" << target->info()->name() << "\n";
+ } else {
+ targetinfostr << "\n";
+ }
}
float d = math::distance(core::localcontrol()->location(), target->location())