Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/view.cc44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/client/view.cc b/src/client/view.cc
index 24cd72e..a737988 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -408,6 +408,14 @@ void draw_status()
Text::draw(4, video::height - Text::fontheight()*3-4, statestr);
}
+ core::Entity *target = targets::current();
+ float d = 0;
+ std::stringstream strdistance;
+
+ if (target) {
+ d = math::distance(core::localcontrol()->location(), target->state()->location()) - target->radius() - core::localcontrol()->radius();
+ }
+
if (draw_devinfo->value()) {
std::stringstream devinfo;
devinfo << std::fixed << std::setprecision(2)
@@ -417,24 +425,28 @@ void draw_status()
devinfo << "^Nthurst:^B " << core::localcontrol()->thrust() << " "
<< "^Nspeed:^B " << core::localcontrol()->speed() << '\n';
+ if (target)
+ devinfo << "^Ndist:^B " << d << '\n';
Text::draw(4, 4 + Text::fontheight(), devinfo);
}
float y = 1.0f;
- core::Entity *entity = targets::current();
- if (entity) {
- std::stringstream target;
- target << "^B" << entity->name() << "\n";
- target << "^Ndist ^B";
-
- math::Vector3f v = entity->state()->location() - core::localcontrol()->state()->location();
- float d = v.length() - entity->radius() - core::localcontrol()->radius();
- if (d > 0 )
- target << std::fixed << std::setprecision(2) << std::setfill(' ') << std::setw(8) << d;
- else
- target << " --";
-
- Text::draw(video::width - 4-Text::fontwidth()*32, video::height - Text::fontheight()*2 -4, target);
+ if (target) {
+ std::stringstream strtarget;
+ strtarget << "^B" << target->name() << "\n^B";
+
+ if (d > 0 ) {
+ strtarget << "^Ndist:^B ";
+ if (d > 100.0f) {
+ strtarget << roundf(d * 0.1f) << "km";
+ } else {
+ strtarget << roundf(d * 100.0f) << "m";
+ }
+ } else {
+ strtarget << " --";
+ }
+ strtarget << '\n';
+ Text::draw(video::width - 4-Text::fontwidth()*32, video::height - Text::fontheight()*2 -4, strtarget);
y = 3.0f;
}
@@ -460,6 +472,10 @@ void draw_status()
gl::end();
float u = core::localcontrol()->thrust();
+ if (core::localcontrol()->eventstate() == core::Entity::Impulse) {
+ u = 1.0;
+ }
+
if (( u > 0) || (core::localcontrol()->eventstate() == core::Entity::Impulse)) {
if (core::localcontrol()->eventstate() == core::Entity::Impulse) {