From b780874cf4ab23cf9e48aa23da2394169da24887 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 15 Aug 2008 15:50:28 +0000 Subject: full thruster engine texture if impulse is enabled --- src/model/map.cc | 2 +- src/render/draw.cc | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/model/map.cc b/src/model/map.cc index 0e124c6..960a1f0 100644 --- a/src/model/map.cc +++ b/src/model/map.cc @@ -960,7 +960,7 @@ Model * Map::load(std::string const &name) mapfile.close(); - // reposition lights, flares and engines according to the model center + // reposition docks, lights, flares and engines according to the model center for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) { (*lit)->light_location -= mapfile.map_center; } diff --git a/src/render/draw.cc b/src/render/draw.cc index af19abe..3be18e7 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -572,15 +572,23 @@ void draw_model_fragments(core::Entity *entity) bool use_color_array = true; // glEnableClientState(GL_COLOR_ARRAY) is set bool use_light = true; // gl::disable(GL_LIGHTING) is set + bool power = true; float thrust = 0; - if (entity->type() == core::Entity::Controlable) { - thrust = static_cast(entity)->thrust(); - } - bool power = true; if ((entity->type() == core::Entity::Dynamic) || (entity->type() == core::Entity::Controlable)) { - if ((static_cast(entity)->eventstate() & core::Entity::NoPower) == core::Entity::NoPower) { + + if (static_cast(entity)->eventstate() == core::Entity::NoPower) { power = false; + + } else if (entity->type() == core::Entity::Controlable) { + + core::EntityControlable *ec = static_cast(entity); + + if (ec->eventstate() == core::Entity::Impulse) { + thrust = 1.0f; + } else { + thrust = ec->thrust(); + } } } @@ -631,12 +639,12 @@ void draw_model_fragments(core::Entity *entity) } } - if (power && material & Material::Light) { + if (power && (material & Material::Light)) { if (use_light) { gl::disable(GL_LIGHTING); use_light = false; } - } else if ( power && material & Material::Engine) { + } else if (power && (material & Material::Engine)) { if (use_light) { gl::disable(GL_LIGHTING); use_light = false; -- cgit v1.2.3