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-08-24 22:55:28 +0000
committerStijn Buys <ingar@osirion.org>2008-08-24 22:55:28 +0000
commit02e623574c4c12c40a0757ed934a93353f34a653 (patch)
tree49fa76c6dd8bab80520601d5d5f0436e7befad5f
parente422dc200a1036ec6c1a93eea2f0b6abdcdadb7a (diff)
impulse disables thrust
-rw-r--r--src/client/targets.cc9
-rw-r--r--src/game/ship.cc10
-rw-r--r--src/render/draw.cc21
3 files changed, 26 insertions, 14 deletions
diff --git a/src/client/targets.cc b/src/client/targets.cc
index e53e530..7e852ad 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -332,11 +332,16 @@ void render_entity_sound(core::EntityControlable *entity)
}
float speed = entity->speed();
- float pitch = 0.2f + entity->thrust() * 0.8f;
+ float pitch = 1.0f;
float gain = 0.0;
- if (entity->thrust() > 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 = 1.0f;
}
+
if (entity->eventstate() == core::Entity::ImpulseInitiate ) {
diff --git a/src/game/ship.cc b/src/game/ship.cc
index 6ca29ba..a5d64f3 100644
--- a/src/game/ship.cc
+++ b/src/game/ship.cc
@@ -210,7 +210,7 @@ void Ship::frame(float seconds)
// FIXME 5 second cooldown
entity_eventstate = core::Entity::Normal;
- } else if (entity_eventstate == core::Entity::ImpulseInitiate) {
+ } else if (entity_eventstate == core::Entity::ImpulseInitiate) {
if (ship_impulsedrive_timer + 1.0f <= core::server()->time()) {
entity_timer -= 1.0f;
@@ -228,7 +228,7 @@ void Ship::frame(float seconds)
}
// clamp input values
- target_thrust = 1.0f;
+ target_thrust = 0.0f;
math::clamp(target_pitch, -1.0f, 1.0f);
math::clamp(target_roll, -1.0f, 1.0f);
math::clamp(target_direction, -1.0f, 1.0f);
@@ -238,7 +238,7 @@ void Ship::frame(float seconds)
} else if (entity_eventstate == core::Entity::Impulse) {
// clamp input values
- target_thrust = 1.0f;
+ target_thrust = 0.0f;
math::clamp(target_pitch, -1.0f, 1.0f);
math::clamp(target_roll, -1.0f, 1.0f);
math::clamp(target_direction, -1.0f, 1.0f);
@@ -356,6 +356,10 @@ void Ship::frame(float seconds)
math::clamp(entity_thrust, 0.0f, 1.0f);
float actual_thrust = entity_thrust + current_target_afterburner * 0.15f;
+ if ((entity_eventstate == core::Entity::ImpulseInitiate) || (entity_eventstate == core::Entity::Impulse)) {
+ actual_thrust = 1.0f;
+ }
+
// update speed
if (entity_speed < actual_thrust * actual_maxspeed) {
entity_speed += actual_acceleration * seconds;
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 3be18e7..9c5a0d0 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -584,7 +584,7 @@ void draw_model_fragments(core::Entity *entity)
core::EntityControlable *ec = static_cast<core::EntityControlable *>(entity);
- if (ec->eventstate() == core::Entity::Impulse) {
+ if ((ec->eventstate() == core::Entity::Impulse) || (ec->eventstate() == core::Entity::ImpulseInitiate)) {
thrust = 1.0f;
} else {
thrust = ec->thrust();
@@ -734,7 +734,8 @@ void draw_pass_model_fx(float elapsed)
float light_size = 0.0f;
float engine_size = 0.0f;
float trail_size = 0.0f;
-
+ bool power = true;
+
math::Vector3f quad[4];
math::Vector3f location;
math::Vector3f offset;
@@ -754,15 +755,17 @@ void draw_pass_model_fx(float elapsed)
for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
core::Entity *entity = (*it);
-
- bool power = true;
- if ((entity->type() == core::Entity::Dynamic) || (entity->type() == core::Entity::Controlable)) {
- if ((static_cast<core::EntityDynamic *>(entity)->eventstate() & core::Entity::NoPower) == core::Entity::NoPower) {
- power = false;
- }
+
+ power = true;
+ if ((entity->type() == core::Entity::Dynamic) &&
+ (static_cast<core::EntityDynamic *>(entity)->eventstate() == core::Entity::NoPower)) {
+ power = false;
+ } else if ((entity->type() == core::Entity::Controlable) &&
+ (static_cast<core::EntityControlable *>(entity)->eventstate() == core::Entity::NoPower)) {
+ power = false;
}
- if (entity->model() && entity->state() && entity->state()->detailvisible() && power) {
+ if (entity->model() && entity->state()->detailvisible() && power) {
// draw model lights
for (model::Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) {
light = (*lit);