Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/soundext.cc110
-rw-r--r--src/ui/console.cc12
-rw-r--r--src/ui/palette.cc6
-rw-r--r--src/ui/ui.cc10
4 files changed, 74 insertions, 64 deletions
diff --git a/src/client/soundext.cc b/src/client/soundext.cc
index 9b15597..4b3e1c7 100644
--- a/src/client/soundext.cc
+++ b/src/client/soundext.cc
@@ -56,10 +56,10 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun
state_impulseloopbuffer = audio::Buffers::load("engines/impulse_loop00");
state_impulsestartbuffer = audio::Buffers::load("engines/impulse_start00");
state_impulsestopbuffer = audio::Buffers::load("engines/impulse_stop00");
- }
- state_engineloopsource = audio::Sources::get();
- state_engineeventsource = audio::Sources::get();
+ state_engineloopsource = audio::Sources::get();
+ state_engineeventsource = audio::Sources::get();
+ }
}
SoundExt::~SoundExt()
@@ -91,59 +91,61 @@ void SoundExt::clear()
void SoundExt::frame(float elapsed)
{
- core::EntityControlable *entity = static_cast<core::EntityControlable *>(this->entity());
-
- float speed = entity->speed();
- float pitch = 1.0f;
- float gain = 0.0;
- if (entity->eventstate() == core::Entity::Impulse) {
- pitch = 1.0f;
- gain = 1.0f;
- } else if (entity->thrust() > 0 ) {
- pitch = 0.2f + entity->thrust() * 0.8f;
- gain = 0.8f;
- }
-
- if (entity->eventstate() == core::Entity::ImpulseInitiate ) {
-
- if (state_engineeventbuffer != state_impulsestartbuffer) {
- audio::update_source(state_engineeventsource,
- entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed);
- state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestartbuffer);
- }
- } else if (entity->eventstate() == core::Entity::Impulse) {
-
- state_engineeventbuffer = state_impulseloopbuffer;
-
- if (state_engineloopbuffer != state_impulseloopbuffer) {
- state_engineloopbuffer = audio::loop(state_engineloopsource, state_impulseloopbuffer, pitch, 0);
- }
- pitch = 1.0f;
- } else {
-
- if (state_engineeventbuffer == state_impulseloopbuffer) {
- audio::update_source(state_engineeventsource,
- entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed);
- state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestopbuffer);
- }
- state_engineeventbuffer = 0;
-
- if (state_engineloopbuffer != state_thusterloopbuffer) {
- state_engineloopbuffer = audio::loop(state_engineloopsource, state_thusterloopbuffer, pitch, 0);
+ if (entity()->type() == core::Entity::Controlable)
+ {
+ core::EntityControlable *entity = static_cast<core::EntityControlable *>(this->entity());
+
+ float speed = entity->speed();
+ float pitch = 1.0f;
+ float gain = 0.0;
+ if (entity->eventstate() == core::Entity::Impulse) {
+ pitch = 1.0f;
+ gain = 1.0f;
+ } else if (entity->thrust() > 0 ) {
+ pitch = 0.2f + entity->thrust() * 0.8f;
+ gain = 0.8f;
+ }
+
+ if (entity->eventstate() == core::Entity::ImpulseInitiate ) {
+
+ if (state_engineeventbuffer != state_impulsestartbuffer) {
+ audio::update_source(state_engineeventsource,
+ entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed);
+ state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestartbuffer);
+ }
+ } else if (entity->eventstate() == core::Entity::Impulse) {
+
+ state_engineeventbuffer = state_impulseloopbuffer;
+
+ if (state_engineloopbuffer != state_impulseloopbuffer) {
+ state_engineloopbuffer = audio::loop(state_engineloopsource, state_impulseloopbuffer, pitch, 0);
+ }
+ pitch = 1.0f;
+ } else {
+
+ if (state_engineeventbuffer == state_impulseloopbuffer) {
+ audio::update_source(state_engineeventsource,
+ entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed);
+ state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestopbuffer);
+ }
+ state_engineeventbuffer = 0;
+
+ if (state_engineloopbuffer != state_thusterloopbuffer) {
+ state_engineloopbuffer = audio::loop(state_engineloopsource, state_thusterloopbuffer, pitch, 0);
+ }
}
+
+
+ float x = entity->radius();
+ if (entity->model())
+ x = entity->model()->maxbbox().x;
+
+ audio::update_source(state_engineloopsource,
+ entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed, pitch, gain);
+
+ audio::update_source(state_engineeventsource,
+ entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed);
}
-
-
- float x = entity->radius();
- if (entity->model())
- x = entity->model()->maxbbox().x;
-
- audio::update_source(state_engineloopsource,
- entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed, pitch, gain);
-
- audio::update_source(state_engineeventsource,
- entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed);
-
}
} // namespace client
diff --git a/src/ui/console.cc b/src/ui/console.cc
index 60eecef..66ddf4e 100644
--- a/src/ui/console.cc
+++ b/src/ui/console.cc
@@ -188,17 +188,15 @@ void Console::draw()
console_input->set_location(4, height() - font()->height() -4);
console_input->set_size(s.x, font()->height());
- std::string version(core::name());
- version += ' ';
- version.append(core::version());
-
- gl::color(0.0f, 1.0f, 0.0f, 0.5f);
-
+ math::Color fancy(palette()->fancy());
+ fancy.a = 0.5f;
+ paint::color(fancy);
+ std::string version(core::name() + ' ' + core::version());
s.assign(version.size() * font()->width(), font()->height());
math::Vector2f l(global_location());
l.x += width() - s.width() -4;
l.y += height() - s.height() -4;
- ui::paint::text(l, s, font(), version);
+ paint::text(l, s, font(), version);
}
void Console::save_history()
diff --git a/src/ui/palette.cc b/src/ui/palette.cc
index f8d16c1..2ee67f3 100644
--- a/src/ui/palette.cc
+++ b/src/ui/palette.cc
@@ -19,7 +19,11 @@ Palette::Palette() :
palette_pointer(0.0f, 0.75f, 0.0f),
palette_active(0.0f, 1.0f, 0.0f),
palette_debug(0.50f, 0.75f),
- palette_mission(1.0f, 0.5f, 1.0f)
+ palette_mission(1.0f, 0.5f, 1.0f),
+ palette_bold(1.0f),
+ palette_fancy(0.0f, 1.0f, 0.0f),
+ palette_warning(1.0f, 1.0f, 0.0f),
+ palette_error(1.0f, 0.0f, 0.0f)
{
}
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index b06e29b..de32db4 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -94,6 +94,7 @@ void func_ui(std::string const &args)
global_ui->list();
} else if (command.compare("restart") == 0) {
global_ui->load();
+ global_ui->apply_render_options();
} else {
help();
}
@@ -370,15 +371,19 @@ void UI::load()
}
} else if (ini.in_section("text")) {
- } else if (ini.got_key_color("bold", color)) {
+
+ if (ini.got_key_color("bold", color)) {
ui_palette->set_bold(color);
+
} else if (ini.got_key_color("fancy", color)) {
ui_palette->set_fancy(color);
+
} else if (ini.got_key_color("warning", color)) {
ui_palette->set_warning(color);
+
} else if (ini.got_key_color("error", color)) {
ui_palette->set_error(color);
- continue;
+ }
}
}
}
@@ -416,6 +421,7 @@ void UI::load()
void UI::apply_render_options()
{
+ con_debug << " initializing text colors" << std::endl;
// apply palette colors
paint::assign_color('N', palette()->text());
paint::assign_color('D', palette()->debug());