From 87b02711f4cd0b5a314b95d2532bc88f8853a335 Mon Sep 17 00:00:00 2001 From: Stiffly Date: Tue, 3 Jun 2014 20:05:31 +0200 Subject: [PATCH] Doppler scale ruined everything --- src/GameWorld.cpp | 2 +- src/Systems/SoundSystem.cpp | 2 +- src/Systems/TankSteeringSystem.cpp | 24 +++++++++++++----------- src/Systems/TankSteeringSystem.h | 1 + 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/GameWorld.cpp b/src/GameWorld.cpp index 19af11a..57b8dc8 100755 --- a/src/GameWorld.cpp +++ b/src/GameWorld.cpp @@ -661,7 +661,7 @@ EntityID GameWorld::CreateTank(int playerID) transform->Orientation = glm::angleAxis(-glm::pi() / 2.f, glm::vec3(1, 0, 0)); transform->Scale = glm::vec3(3.f); AddComponent(shot); - auto soundEmitter = AddComponent(shot); + auto soundEmitter = AddComponent(tank); soundEmitter->MinDistance = 1000; soundEmitter->Gain = 1; soundEmitter->Loop = false; diff --git a/src/Systems/SoundSystem.cpp b/src/Systems/SoundSystem.cpp index 7e0333e..c95ac88 100755 --- a/src/Systems/SoundSystem.cpp +++ b/src/Systems/SoundSystem.cpp @@ -20,7 +20,7 @@ void Systems::SoundSystem::Initialize() { LOG_INFO("FMOD initialized successfully"); } - FMOD_System_Set3DSettings(m_System, 1.f, 1.f, 1.f); //dopplerScale, distancefactor, rolloffscale + FMOD_System_Set3DSettings(m_System, 0.f, 1.f, 1.f); //dopplerScale, distancefactor, rolloffscale } diff --git a/src/Systems/TankSteeringSystem.cpp b/src/Systems/TankSteeringSystem.cpp index 41f17c9..2836e74 100644 --- a/src/Systems/TankSteeringSystem.cpp +++ b/src/Systems/TankSteeringSystem.cpp @@ -95,6 +95,11 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit EventBroker->Publish(eSetVelocity); m_TimeSinceLastShot[tankSteeringComponent->Barrel] = 0; + Events::PlaySFX e; + e.Resource = "Sounds/SFX/LongBoom.wav"; + e.Emitter = entity; + e.Loop = false; + EventBroker->Publish(e); auto clonePhysicsComponent = m_World->GetComponent(clone); //1,670m/s @@ -109,17 +114,14 @@ void Systems::TankSteeringSystem::UpdateEntity(double dt, EntityID entity, Entit m_TimeSinceLastShot[tankSteeringComponent->Barrel] += dt; } - auto shot = m_World->GetComponent(entity); - if(shot) - { - if(inputController->Shoot && m_TimeSinceLastShot[tankSteeringComponent->Barrel] > 0.5) - { - Events::PlaySFX e; - e.Resource = "Sounds/SFX/LongBoom.wav"; - e.Emitter = entity; - EventBroker->Publish(e); - } - } +// auto shot = m_World->GetComponent(entity); +// if(shot) +// { +// if(inputController->Shoot && m_TimeSinceLastShot[tankSteeringComponent->Barrel] > 0.5) +// { +// +// } +// } } bool Systems::TankSteeringSystem::OnCollision( const Events::Collision &e ) diff --git a/src/Systems/TankSteeringSystem.h b/src/Systems/TankSteeringSystem.h index a4ed5a9..3c2f58e 100644 --- a/src/Systems/TankSteeringSystem.h +++ b/src/Systems/TankSteeringSystem.h @@ -30,6 +30,7 @@ #include "Components/FrameTimer.h" #include "Events/PlaySFX.h" +#include "Events/PlayBGM.h" #include "Events/Damage.h" #include "Components/Vehicle.h"