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/view.cc')
-rw-r--r--src/client/view.cc77
1 files changed, 10 insertions, 67 deletions
diff --git a/src/client/view.cc b/src/client/view.cc
index 34fe3fa..8f01ad5 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -11,13 +11,11 @@
#include <sstream>
#include <iomanip>
-#include "audio/audio.h"
-#include "audio/sources.h"
#include "client/client.h"
#include "client/chat.h"
#include "client/console.h"
#include "client/input.h"
-#include "client/radar.h"
+#include "client/targets.h"
#include "client/video.h"
#include "render/draw.h"
#include "render/render.h"
@@ -34,9 +32,7 @@ namespace client
core::Cvar *draw_ui = 0;
core::Cvar *draw_stats = 0;
core::Cvar *draw_location = 0;
-core::Cvar *draw_radar = 0;
-core::Cvar *snd_engines = 0;
core::Cvar *cl_crosshaircolor = 0;
namespace view
@@ -55,18 +51,15 @@ void init()
draw_ui = core::Cvar::get("draw_ui", "1", core::Cvar::Archive);
draw_ui->set_info("[bool] draw the user interface");
- draw_radar = core::Cvar::get("draw_radar", "1", core::Cvar::Archive);
- draw_radar->set_info("[bool] draw the radar view");
-
cl_crosshaircolor = core::Cvar::get("cl_crosshaircolor", "1 1 1", core::Cvar::Archive);
cl_crosshaircolor->set_info("[r g b] crosshairs color");
- snd_engines = core::Cvar::get("snd_engines", "1", core::Cvar::Archive);
- snd_engines->set_info("[bool] enable or disable engine sounds");
+ targets::init();
}
void shutdown()
{
+ targets::shutdown();
}
void draw_loader()
@@ -288,56 +281,6 @@ void reset()
}
-// render ingame sounds
-void render_sound()
-{
- if (!(snd_engines && snd_engines->value()))
- return;
-
- math::Vector3f velocity(0, 0 ,0);
-
- if (core::localcontrol()) {
- velocity.assign(core::localcontrol()->state()->axis().forward() * core::localcontrol()->speed());
- }
-
- audio::update_listener(render::Camera::eye(), render::Camera::axis(), velocity);
-
- for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) {
- core::Entity *entity = (*it).second;
- core::ClientState *state = entity->state();
-
- if ((entity->type() == core::Entity::Controlable)) {
- core::EntityControlable *entitycontrolable = (core::EntityControlable *) entity;
-
- if (entity->model() && state->detailvisible() && entitycontrolable->thrust() > 0 ) {
-
- float speed = entitycontrolable->speed();
- float pitch = 0.2f + entitycontrolable->thrust() * 0.8f;
-
- if (!state->state_enginesound) {
- if ((state->state_enginesound = audio::Sources::get()) > 0 ) {
-
- size_t enginesound = 0;
- if (entity->model())
- enginesound = entity->model()->enginesound();
-
- std::stringstream soundname;
- soundname << "engines/loop" << std::setfill('0') << std::setw(2) << enginesound;
- audio::loop(state->state_enginesound, soundname.str().c_str(), pitch, 0);
- }
- }
-
- if (state->state_enginesound) {
- audio::update_source(state->state_enginesound,
- state->location() - state->axis().forward() * entity->model()->maxbbox().y , state->axis().forward() * speed, pitch);
- }
- } else {
- entity->state()->clearsound();
- }
- }
- }
-}
-
void frame(float seconds)
{
using namespace render;
@@ -356,8 +299,6 @@ void frame(float seconds)
if (core::application()->connected() && core::game()->serverframetime()) {
render::draw(seconds); // draw the world
-
- render_sound();
}
// switch to ortographic projection to draw the GUI
@@ -387,16 +328,18 @@ void frame(float seconds)
if (draw_ui->value()) {
Text::setfont("bitmaps/fonts/gui", 16, 24);
-
- draw_status();
- if (draw_radar->value()) {
- Radar::draw();
- }
+ // draw the player status
+ draw_status();
// draw the mouse cursor
draw_cursor();
}
+
+ // render sound and gui targets
+ if (core::application()->connected() && core::game()->serverframetime()) {
+ targets::draw();
+ }
Text::setfont("bitmaps/fonts/console", 12, 18);
chat::draw();