diff --git a/source/main/gfx/GfxActor.cpp b/source/main/gfx/GfxActor.cpp index fbfd4d1f48..bdf8dec23d 100644 --- a/source/main/gfx/GfxActor.cpp +++ b/source/main/gfx/GfxActor.cpp @@ -1742,6 +1742,7 @@ void RoR::GfxActor::UpdateSimDataBuffer() m_simbuf.simbuf_node0_velo = m_actor->ar_nodes[0].Velocity; m_simbuf.simbuf_net_username = m_actor->m_net_username; m_simbuf.simbuf_net_colornum = m_actor->m_net_color_num; + m_simbuf.simbuf_smoke_enabled = m_actor->getSmokeEnabled(); // General info m_simbuf.simbuf_actor_state = m_actor->ar_state; diff --git a/source/main/gfx/GfxActor.h b/source/main/gfx/GfxActor.h index 9d5ca92569..17e1d8c39a 100644 --- a/source/main/gfx/GfxActor.h +++ b/source/main/gfx/GfxActor.h @@ -132,6 +132,7 @@ class GfxActor float simbuf_inputshaft_rpm = 0; // Land vehicle only float simbuf_drive_ratio = 0; // Land vehicle only bool simbuf_beaconlight_active = false; + bool simbuf_smoke_enabled = false; float simbuf_hydro_dir_state = 0; // State of steering actuator ('hydro'), for steeringwheel display float simbuf_hydro_aileron_state = 0; float simbuf_hydro_elevator_state = 0; diff --git a/source/main/main.cpp b/source/main/main.cpp index b3f89e23f9..8cb5e0f72a 100644 --- a/source/main/main.cpp +++ b/source/main/main.cpp @@ -641,7 +641,7 @@ int main(int argc, char *argv[]) actor->GetGfxActor()->SetCastShadows(false); actor->muteAllSounds(); // Stop sounds actor->setLightsOff(); // Turn all lights off - + actor->setSmokeEnabled(false); } break; @@ -655,6 +655,7 @@ int main(int argc, char *argv[]) actor->GetGfxActor()->SetAllMeshesVisible(true); actor->GetGfxActor()->SetCastShadows(true); actor->unmuteAllSounds(); // Unmute sounds + actor->setSmokeEnabled(true); } break; diff --git a/source/main/physics/Actor.h b/source/main/physics/Actor.h index 7acd0110ef..cee5c966ee 100644 --- a/source/main/physics/Actor.h +++ b/source/main/physics/Actor.h @@ -123,6 +123,8 @@ class Actor : public ZeroedMemoryAllocator Ogre::String getTransferCaseName(); //! Gets the current transfer case mode name (4WD Hi, ...) void displayTransferCaseMode(); //! Writes info to console/notify area void toggleCustomParticles(); + void setSmokeEnabled(bool enabled) { m_disable_smoke = !enabled; } + bool getSmokeEnabled() const { return !m_disable_smoke; } bool getCustomParticleMode(); void beaconsToggle(); bool getBrakeLightVisible(); @@ -534,7 +536,7 @@ class Actor : public ZeroedMemoryAllocator bool m_beam_deform_debug_enabled:1; //!< Logging state bool m_trigger_debug_enabled:1; //!< Logging state bool m_disable_default_sounds:1; //!< Spawner context; TODO: remove - bool m_disable_smoke:1; //!< Gfx state + bool m_disable_smoke:1; //!< Stops/starts smoke particles (i.e. exhausts, turbojets). struct VehicleForceSensors { diff --git a/source/main/physics/ActorSpawner.cpp b/source/main/physics/ActorSpawner.cpp index 57cc2df323..a58a77ae5e 100644 --- a/source/main/physics/ActorSpawner.cpp +++ b/source/main/physics/ActorSpawner.cpp @@ -656,7 +656,7 @@ void ActorSpawner::ProcessTurbojet(RigDef::Turbojet & def) std::string propname = this->ComposeName("Turbojet", m_actor->ar_num_aeroengines); tj->tjet_visual.SetNodes(front, back, ref); tj->tjet_visual.SetupVisuals(def, m_actor->ar_num_aeroengines, - propname, nozzle_ent, afterburn_ent, m_actor->m_disable_smoke); + propname, nozzle_ent, afterburn_ent); m_actor->ar_aeroengines[m_actor->ar_num_aeroengines]=tj; m_actor->ar_driveable=AIRPLANE; @@ -5749,10 +5749,6 @@ void ActorSpawner::AddExhaust( unsigned int direction_node_idx ) { - if (m_actor->m_disable_smoke) - { - return; - } exhaust_t exhaust; exhaust.emitterNode = emitter_node_idx; exhaust.directionNode = direction_node_idx; diff --git a/source/main/physics/air/TurboJet.cpp b/source/main/physics/air/TurboJet.cpp index 2a1b23122a..121dec559c 100644 --- a/source/main/physics/air/TurboJet.cpp +++ b/source/main/physics/air/TurboJet.cpp @@ -70,7 +70,7 @@ Turbojet::Turbojet(Actor* actor, int tnodefront, int tnodeback, int tnoderef, Ri reset(); } -void TurbojetVisual::SetupVisuals(RigDef::Turbojet & def, int num, std::string const& propname, Ogre::Entity* nozzle, Ogre::Entity* afterburner_flame, bool disable_smoke) +void TurbojetVisual::SetupVisuals(RigDef::Turbojet & def, int num, std::string const& propname, Ogre::Entity* nozzle, Ogre::Entity* afterburner_flame) { m_radius = def.back_diameter / 2.0; m_number = num; @@ -88,23 +88,17 @@ void TurbojetVisual::SetupVisuals(RigDef::Turbojet & def, int num, std::string c m_flame_scenenode->setScale(1.0, def.back_diameter, def.back_diameter); m_flame_scenenode->setVisible(false); } + //smoke visual - if (disable_smoke) + m_smoke_scenenode = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode(); + m_smoke_particle = App::GetGfxScene()->GetSceneManager()->createParticleSystem("SmokeParticle-"+propname, "tracks/TurbopropSmoke"); + if (m_smoke_particle) { - m_smoke_scenenode = 0; - m_smoke_particle = 0; - } - else - { - m_smoke_scenenode = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode(); - m_smoke_particle = App::GetGfxScene()->GetSceneManager()->createParticleSystem("SmokeParticle-"+propname, "tracks/TurbopropSmoke"); - if (m_smoke_particle) - { - m_smoke_particle->setVisibilityFlags(DEPTHMAP_DISABLED); // disable particles in depthmap - m_smoke_scenenode->attachObject(m_smoke_particle); - m_smoke_particle->setCastShadows(false); - } + m_smoke_particle->setVisibilityFlags(DEPTHMAP_DISABLED); // disable particles in depthmap + m_smoke_scenenode->attachObject(m_smoke_particle); + m_smoke_particle->setCastShadows(false); } + } void TurbojetVisual::SetNodes(int front, int back, int ref) @@ -181,8 +175,10 @@ void TurbojetVisual::UpdateVisuals(RoR::GfxActor* gfx_actor) } else m_flame_scenenode->setVisible(false); + //smoke - if (m_smoke_scenenode) + if (m_smoke_particle && + gfx_actor->GetSimDataBuffer().simbuf_smoke_enabled) { m_smoke_scenenode->setPosition(node_buf[m_node_back].AbsPosition); ParticleEmitter* emit = m_smoke_particle->getEmitter(0); diff --git a/source/main/physics/air/TurboJet.h b/source/main/physics/air/TurboJet.h index 3f0481cc0e..394b38cfb1 100644 --- a/source/main/physics/air/TurboJet.h +++ b/source/main/physics/air/TurboJet.h @@ -30,7 +30,7 @@ class TurbojetVisual { public: ~TurbojetVisual(); - void SetupVisuals(RigDef::Turbojet & def, int num, std::string const& propname, Ogre::Entity* nozzle, Ogre::Entity* afterburner_flame, bool disable_smoke); + void SetupVisuals(RigDef::Turbojet & def, int num, std::string const& propname, Ogre::Entity* nozzle, Ogre::Entity* afterburner_flame); void SetNodes(int front, int back, int ref); void UpdateVisuals(RoR::GfxActor* gfx_actor); void SetVisible(bool visible);