From ecad7c2996e5b0625bbdcd01d3207464fe3c4f8e Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Wed, 4 Feb 2015 20:13:06 -0500 Subject: [PATCH] Mark some emitters as important so that they are never disabled by options, fixes #1808 --- src/graphics/particle_emitter.cpp | 4 ++- src/graphics/particle_emitter.hpp | 5 +++- src/karts/abstract_kart.hpp | 2 ++ src/karts/kart.cpp | 3 ++ src/karts/kart.hpp | 3 ++ src/karts/kart_gfx.cpp | 49 ++++++++++++++++++------------- src/karts/kart_gfx.hpp | 2 +- 7 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/graphics/particle_emitter.cpp b/src/graphics/particle_emitter.cpp index 50380e1ab..5ba8d0342 100644 --- a/src/graphics/particle_emitter.cpp +++ b/src/graphics/particle_emitter.cpp @@ -288,7 +288,8 @@ public: ParticleEmitter::ParticleEmitter(const ParticleKind* type, const Vec3 &position, scene::ISceneNode* parent, - bool randomize_initial_y) + bool randomize_initial_y, + bool important) : m_position(position) { assert(type != NULL); @@ -300,6 +301,7 @@ ParticleEmitter::ParticleEmitter(const ParticleKind* type, m_emission_decay_rate = 0; m_is_glsl = CVS->isGLSL(); m_randomize_initial_y = randomize_initial_y; + m_important = important; setParticleType(type); diff --git a/src/graphics/particle_emitter.hpp b/src/graphics/particle_emitter.hpp index e45654ae3..4e360d5c9 100644 --- a/src/graphics/particle_emitter.hpp +++ b/src/graphics/particle_emitter.hpp @@ -76,6 +76,8 @@ private: bool m_randomize_initial_y; + bool m_important; + public: LEAK_CHECK() @@ -83,7 +85,8 @@ public: ParticleEmitter (const ParticleKind* type, const Vec3 &position, scene::ISceneNode* parent = NULL, - bool randomize_initial_y = false); + bool randomize_initial_y = false, + bool important = false); virtual ~ParticleEmitter(); virtual void update (float dt); void setCreationRateAbsolute(float fraction); diff --git a/src/karts/abstract_kart.hpp b/src/karts/abstract_kart.hpp index 47188cafb..e47285daf 100644 --- a/src/karts/abstract_kart.hpp +++ b/src/karts/abstract_kart.hpp @@ -233,6 +233,8 @@ public: * skidding related values). */ virtual const Skidding *getSkidding() const = 0; // ------------------------------------------------------------------------ + virtual RaceManager::KartType getType() const = 0; + // ------------------------------------------------------------------------ /** Returns the skidding object for this kart (which can be used to query * skidding related values), non-const. */ virtual Skidding *getSkidding() = 0; diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index a885883d3..ea446fe6e 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -132,6 +132,7 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id, m_fire_clicked = 0; m_wrongway_counter = 0; m_nitro_light = NULL; + m_type = RaceManager::KT_AI; m_view_blocked_by_plunger = 0; m_has_caught_nolok_bubblegum = false; @@ -178,6 +179,8 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id, */ void Kart::init(RaceManager::KartType type) { + m_type = type; + // In multiplayer mode, sounds are NOT positional if (race_manager->getNumLocalPlayers() > 1) { diff --git a/src/karts/kart.hpp b/src/karts/kart.hpp index 37bcc3b4b..7c685d66d 100644 --- a/src/karts/kart.hpp +++ b/src/karts/kart.hpp @@ -217,6 +217,7 @@ private: SFXBase *m_goo_sound; SFXBase *m_boing_sound; float m_time_last_crash; + RaceManager::KartType m_type; /** To prevent using nitro in too short bursts */ float m_min_nitro_time; @@ -359,6 +360,8 @@ public: * skidding related values) - non-const. */ virtual Skidding *getSkidding() { return m_skidding; } // ------------------------------------------------------------------------ + virtual RaceManager::KartType getType() const { return m_type; } + // ------------------------------------------------------------------------ /** Returns the bullet vehicle which represents this kart. */ virtual btKart *getVehicle() const {return m_vehicle; } // ------------------------------------------------------------------------ diff --git a/src/karts/kart_gfx.cpp b/src/karts/kart_gfx.cpp index cb144167a..19bf92bf0 100644 --- a/src/karts/kart_gfx.cpp +++ b/src/karts/kart_gfx.cpp @@ -24,6 +24,8 @@ #include "graphics/particle_kind.hpp" #include "graphics/particle_kind_manager.hpp" #include "karts/abstract_kart.hpp" +#include "karts/controller/controller.hpp" +#include "karts/kart.hpp" #include "karts/kart_properties.hpp" #include "karts/skidding.hpp" #include "physics/btKart.hpp" @@ -33,12 +35,12 @@ KartGFX::KartGFX(const AbstractKart *kart) { - if(!UserConfigParams::m_graphical_effects) - { - for(unsigned int i=0; igetType() == RaceManager::KT_AI)) + { + m_all_emitters.push_back(NULL); + return; + } + const ParticleKind *kind = NULL; ParticleEmitter *emitter = NULL; try @@ -113,9 +122,9 @@ void KartGFX::addEffect(KartGFXType type, const std::string &file_name, else if(type==KGFX_TERRAIN) // Terrain is NOT a child of the kart, since bullet returns the // raycast info in world coordinates - emitter = new ParticleEmitter(kind, position); + emitter = new ParticleEmitter(kind, position, NULL, false, important); else - emitter = new ParticleEmitter(kind, position, m_kart->getNode()); + emitter = new ParticleEmitter(kind, position, m_kart->getNode(), false, important); } catch (std::runtime_error& e) { @@ -293,8 +302,6 @@ void KartGFX::updateTerrain(const ParticleKind *pk) */ void KartGFX::update(float dt) { - if(!UserConfigParams::m_graphical_effects) return; - m_wheel_toggle = 1 - m_wheel_toggle; for(unsigned int i=0; i