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-10-11 09:37:23 +0000
committerStijn Buys <ingar@osirion.org>2008-10-11 09:37:23 +0000
commit0d831968949b1119db48530a86c2d1651c6cbfc6 (patch)
tree925e02481149fa8ac227017af74818176b166a41 /src/client
parent02fcd22d8cde355aa898a8c6bb4773d9434b8e9a (diff)
zonechange events, menu previous command
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.cc47
-rw-r--r--src/client/client.h2
-rw-r--r--src/client/input.cc3
-rw-r--r--src/client/view.cc78
4 files changed, 47 insertions, 83 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index 81aba9d..3f368a7 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -141,8 +141,9 @@ void Client::run()
// default framerate 125fps, 8 milliseconds
Uint32 client_frame_lenght = 8;
- Uint32 client_previous_timestamp = 0;
Uint32 client_current_timestamp = 0;
+ Uint32 client_previous_timestamp = 0;
+
console()->flush();
console()->clear_notify();
@@ -158,7 +159,7 @@ void Client::run()
(*cl_framerate) = 1000.0f;
}
- if (cl_framerate->value()) {
+ if (cl_framerate->value()) {
client_frame_lenght = (Uint32) roundf(1000.0f / cl_framerate->value());
} else {
client_frame_lenght = 0;
@@ -234,14 +235,28 @@ void Client::shutdown()
quit(0);
}
-void Client::notify_sound(const char * name)
+/* -- notifications from core::Application ------------------------- */
+
+void Client::notify_connect()
{
- audio::play(name);
+ ui::root()->hide_window();
}
-void Client::notify_remove_sound(size_t source)
+void Client::notify_disconnect()
{
- audio::Sources::remove(source);
+ // FIXME unload sounds
+ //audio::reset();
+ render::reset();
+}
+
+void Client::notify_zonechange()
+{
+ render::unload();
+}
+
+void Client::notify_sound(const char * name)
+{
+ audio::play(name);
}
void Client::notify_message(core::Message::Channel const channel, std::string const message)
@@ -270,26 +285,18 @@ void Client::notify_message(core::Message::Channel const channel, std::string co
break;
}
- con_print << message << std::endl;
+ con_print << message << std::endl;
console()->notify(message);
}
-void Client::notify_zoneclear(core::Zone *zone)
-{
- view::clear_zone(zone);
-}
+/* FIXME
-void Client::notify_disconnect()
-{
- // FIXME unload sounds
- render::unload();
- view::clear_zone(0);
-}
+ these notifications are hacks and need to be fixed
+*/
-void Client::notify_connect()
+void Client::notify_remove_sound(size_t source)
{
- ui::root()->hide_window();
- view::clear_zone(0);
+ audio::Sources::remove(source);
}
} // namespace client
diff --git a/src/client/client.h b/src/client/client.h
index dc4f05f..bd7af6b 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -38,7 +38,7 @@ public:
virtual void notify_remove_sound(size_t source);
/// clear zone notification
- virtual void notify_zoneclear(core::Zone *zone);
+ virtual void notify_zonechange();
/// connect notification
virtual void notify_connect();
diff --git a/src/client/input.cc b/src/client/input.cc
index 31d514f..d2a53e1 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -20,6 +20,7 @@
#include "math/functions.h"
#include "render/camera.h"
#include "render/draw.h"
+#include "render/dust.h"
#include "render/text.h"
#include "ui/ui.h"
@@ -659,10 +660,10 @@ void reset()
mouse_x = video::width / 2;
mouse_y = video::height / 2;
render::Camera::reset();
+ render::Dust::reset();
mouse_control_override = false;
mouse_control_override_time = 0;
targets::reset();
- render::reset();
for (Keyboard::iterator it = keyboard->begin(); it != keyboard->end(); it++) {
Key *key = (*it).second;
diff --git a/src/client/view.cc b/src/client/view.cc
index 38d22d4..15f70bc 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -30,15 +30,16 @@
namespace client
{
-core::Cvar *draw_ui = 0;
-core::Cvar *draw_stats = 0;
-core::Cvar *draw_devinfo = 0;
-core::Cvar *draw_keypress = 0;
+core::Cvar *draw_ui = 0;
+core::Cvar *draw_stats = 0;
+core::Cvar *draw_devinfo = 0;
+core::Cvar *draw_keypress = 0;
-core::Cvar *ui_pointercolor = 0;
-core::Cvar *ui_pointerhovercolor =0;
+core::Cvar *ui_pointercolor = 0;
+core::Cvar *ui_pointerhovercolor = 0;
/* -- DevInfo------------------------------------------------------- */
+
DevInfo::DevInfo(ui::Widget *parent) : ui::Widget(parent)
{
set_label("devinfo");
@@ -213,6 +214,8 @@ void View::draw()
view_devinfo->set_visible(draw_devinfo->value() ? true : false);
view_stats->set_visible(draw_stats->value() ? true : false);
view_keypress->set_visible(draw_keypress->value() ? true : false);
+
+ //draw_world();
}
/* -- namespace view ----------------------------------------------- */
@@ -220,8 +223,6 @@ void View::draw()
namespace view
{
-core::Zone *current_zone = 0;
-
void init()
{
// FIXME integrate with libui
@@ -242,31 +243,6 @@ void shutdown()
targets::shutdown();
}
-void clear_zone(core::Zone *zone)
-{
- if (!zone) {
- current_zone = 0;
- return;
- }
-
- for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
- core:: Entity *entity = (*it);
-
- if (entity->type() == core::Entity::Globe) {
- core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity);
- if (globe->render_texture) {
- render::Textures::unload(globe->render_texture);
- globe->render_texture = 0;
- }
- }
- }
-
- if (zone->sky_texture()) {
- render::Textures::unload(zone->sky_texture());
- zone->set_sky_texture(0);
- }
-}
-
/*
FIXME should be merged with the render passes
and in the bbox pass
@@ -483,7 +459,7 @@ void draw_entity_target(core::Entity *entity, bool is_active_target)
}
}
-void draw_status()
+void draw_hud()
{
using namespace render;
std::stringstream status;
@@ -525,32 +501,17 @@ void draw_status()
}
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)
- << "^Nx:^B" << core::localcontrol()->location().x << " "
- << "^Ny:^B" << core::localcontrol()->location().y << " "
- << "^Nz:^B" << core::localcontrol()->location().z << '\n';
-
- 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 d = 0;
float y = 1.0f;
+
if (target) {
std::stringstream strtarget;
strtarget << "^B" << target->name() << "\n^B";
+ d = math::distance(core::localcontrol()->location(), target->state()->location())
+ - target->radius() - core::localcontrol()->radius();
+
if (d > 0 ) {
strtarget << "^Ndist:^B ";
if (d > 100.0f) {
@@ -833,11 +794,6 @@ void frame(float seconds)
render::Stats::clear();
if (core::application()->connected() && core::game()->serverframetime()) {
- if (core::localplayer()->zone() != current_zone) {
- if (current_zone)
- clear_zone(current_zone);
- current_zone = core::localplayer()->zone();
- }
render::draw(seconds); // draw the world
targets::draw(); // validate current target, render sound
@@ -870,8 +826,8 @@ void frame(float seconds)
if (draw_ui->value()) {
Text::setfont("gui", 12, 18);
- // draw the player status
- draw_status();
+ // draw the hud
+ draw_hud();
// draw the chat box
chat::draw();