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>2008-11-15 19:24:55 +0000
committerStijn Buys <ingar@osirion.org>2008-11-15 19:24:55 +0000
commit28ba97bdd8fb6ca352dc49dba01a66bd155ad523 (patch)
treeeb4abd0505eb842e15201783529814bda1ae6e76 /src/client/view.cc
parent1f0dbeeabdffff096908473168898c5fa63bcff0 (diff)
entity extensions
Diffstat (limited to 'src/client/view.cc')
-rw-r--r--src/client/view.cc31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/client/view.cc b/src/client/view.cc
index 90a30ef..0f981ca 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -77,7 +77,7 @@ void DevInfo::draw()
<< "^Nspeed ^B" << core::localcontrol()->speed() << '\n';
if (target) {
- d = math::distance(core::localcontrol()->location(), target->state()->location()) - target->radius() - core::localcontrol()->radius();
+ d = math::distance(core::localcontrol()->location(), target->location()) - target->radius() - core::localcontrol()->radius();
textstream << "^Ndist ^B" << d << '\n';
}
}
@@ -298,14 +298,14 @@ void draw_entity_world_target(core::Entity *entity)
if (!model->docks().size())
return;
- float d = math::distance(core::localcontrol()->location(), entity->state()->location()) - entity->radius() - core::localcontrol()->radius();
+ float d = math::distance(core::localcontrol()->location(), entity->location()) - entity->radius() - core::localcontrol()->radius();
if (d > 100.0f)
return;
gl::enable(GL_DEPTH_TEST);
gl::push();
- gl::translate(entity->state()->location());
- gl::multmatrix(entity->state()->axis());
+ gl::translate(entity->location());
+ gl::multmatrix(entity->axis());
gl::color(0, 1.0f, 1.0f, 1.0f);
@@ -355,7 +355,7 @@ void draw_entity_world_target(core::Entity *entity)
void draw_entity_offscreen_target(core::Entity *entity, bool is_active_target)
{
- math::Vector3f target(entity->state()->location() - render::Camera::eye());
+ math::Vector3f target(entity->location() - render::Camera::eye());
target = render::Camera::axis().transpose() * target;
float cx = 0;
@@ -414,11 +414,11 @@ void draw_entity_target(core::Entity *entity, bool is_active_target)
using math::Vector3f;
// don't draw target if we're very close to it
- if (entity->state()->distance() < 0.001f)
+ if (ext_render(entity)->distance() < 0.001f)
return;
// don't draw target if it is outside the visible cone
- Vector3f target(entity->state()->location() - render::Camera::eye());
+ Vector3f target(entity->location() - render::Camera::eye());
if (math::dotproduct(render::Camera::axis().forward(), Vector3f::normalized(target)) < 0.75 ) {
draw_entity_offscreen_target(entity, is_active_target);
return;
@@ -492,7 +492,7 @@ void draw_entity_target(core::Entity *entity, bool is_active_target)
if (is_active_target) {
// entity name and distance
std::stringstream strdistance;
- float d = math::distance(core::localcontrol()->location(), entity->state()->location()) - entity->radius() - core::localcontrol()->radius();
+ float d = math::distance(core::localcontrol()->location(), entity->location()) - entity->radius() - core::localcontrol()->radius();
if (d > 0 ) {
if (d > 100.0f) {
strdistance << roundf(d * 0.1f) << "km";
@@ -572,7 +572,7 @@ void draw_hud()
std::stringstream strtarget;
strtarget << "^B" << target->name() << "\n^B";
- d = math::distance(core::localcontrol()->location(), target->state()->location())
+ d = math::distance(core::localcontrol()->location(), target->location())
- target->radius() - core::localcontrol()->radius();
if (d > 0 ) {
@@ -582,12 +582,23 @@ void draw_hud()
} else {
strtarget << roundf(d * 100.0f) << "m";
}
+
+ if (core::localcontrol()->speed() > 0.1f) {
+ strtarget << "^N eta:^B ";
+ float eta = floorf(d / core::localcontrol()->speed() );
+ if (eta > 60.0f) {
+ float etamin = floorf(eta / 60.0f);
+ strtarget << etamin << "min ";
+ eta -= etamin * 60;
+ }
+ strtarget << eta << "sec";
+ }
} else {
strtarget << " --";
}
strtarget << '\n';
Text::draw(render::State::width() - 4-Text::fontwidth()*32, render::State::height() - Text::fontheight()*2 -4, strtarget);
- y = 3.0f;
+ y += 2.0f;
}
Text::setcolor('N'); //set normal color