diff -Naur irrlamb/src/engine/audio.h irrlamb.tpg/src/engine/audio.h --- irrlamb/src/engine/audio.h 2007-07-01 07:18:07.000000000 +0000 +++ irrlamb.tpg/src/engine/audio.h 2008-06-03 16:24:28.000000000 +0000 @@ -14,64 +14,65 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. -**************************************************************************************/ -#ifndef AUDIO_H -#define AUDIO_H - -// Libraries -#include <map> -#include <audiere.h> -#include <irrlicht/irrlicht.h> -#include "singleton.h" - -// Namespaces -using namespace irr; -using namespace core; -using namespace scene; -using namespace video; -using namespace io; -using namespace gui; - -// Classes -class AudioClass { - - public: - - AudioClass() { } - ~AudioClass() { } - - int Init(bool TEnabled); - int Close(); - - int Load(const stringc &TName, const stringc &TFile, bool TStream, float TVolume = 1.0f, bool TRepeat = false); - void CloseAll(); - - int Play(const stringc &TName); - int Stop(const stringc &TName); - void StopAll(); - - private: - - audiere::OutputStream *FindSound(const stringc &TName); - void CapVolume(float *TVolume); - - audiere::AudioDevicePtr Device; - bool AudioEnabled; - - std::map<stringc, audiere::OutputStreamPtr> Sounds; - std::map<stringc, audiere::OutputStreamPtr>::iterator SoundIterator; - -}; - -// Limits a volume to 0-1 -inline void AudioClass::CapVolume(float *TVolume) { - if(*TVolume < 0.0f) - *TVolume = 0.0f; - else if(*TVolume > 1.0f) - *TVolume = 1.0f; -} - -// Singletons -typedef Singleton<AudioClass> Audio; - -#endif +**************************************************************************************/ +#ifndef AUDIO_H +#define AUDIO_H + +// Libraries +#include <string.h> +#include <map> +#include <audiere.h> +#include <irrlicht/irrlicht.h> +#include "singleton.h" + +// Namespaces +using namespace irr; +using namespace core; +using namespace scene; +using namespace video; +using namespace io; +using namespace gui; + +// Classes +class AudioClass { + + public: + + AudioClass() { } + ~AudioClass() { } + + int Init(bool TEnabled); + int Close(); + + int Load(const stringc &TName, const stringc &TFile, bool TStream, float TVolume = 1.0f, bool TRepeat = false); + void CloseAll(); + + int Play(const stringc &TName); + int Stop(const stringc &TName); + void StopAll(); + + private: + + audiere::OutputStream *FindSound(const stringc &TName); + void CapVolume(float *TVolume); + + audiere::AudioDevicePtr Device; + bool AudioEnabled; + + std::map<stringc, audiere::OutputStreamPtr> Sounds; + std::map<stringc, audiere::OutputStreamPtr>::iterator SoundIterator; + +}; + +// Limits a volume to 0-1 +inline void AudioClass::CapVolume(float *TVolume) { + if(*TVolume < 0.0f) + *TVolume = 0.0f; + else if(*TVolume > 1.0f) + *TVolume = 1.0f; +} + +// Singletons +typedef Singleton<AudioClass> Audio; + +#endif diff -Naur irrlamb/src/engine/physics.cpp irrlamb.tpg/src/engine/physics.cpp --- irrlamb/src/engine/physics.cpp 2007-08-10 06:38:08.000000000 +0000 +++ irrlamb.tpg/src/engine/physics.cpp 2008-06-03 16:07:16.000000000 +0000 @@ -36,10 +36,11 @@ SimulationSpeed = 1.0f; // Set up physics modules + CollisionConfiguration = new btDefaultCollisionConfiguration(); BroadPhase = new btAxisSweep3(btVector3(-1000, -1000, -1000), btVector3(1000, 1000, 1000), 32766); - Dispatcher = new btCollisionDispatcher(); + Dispatcher = new btCollisionDispatcher(CollisionConfiguration); Solver = new btSequentialImpulseConstraintSolver(); - World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver); + World = new btDiscreteDynamicsWorld(Dispatcher, BroadPhase, Solver, CollisionConfiguration); World->setGravity(btVector3(0.0f, -9.81f, 0.0f)); } @@ -54,6 +55,7 @@ delete Solver; delete Dispatcher; delete BroadPhase; + delete CollisionConfiguration; } return 1; @@ -63,6 +65,7 @@ void PhysicsClass::Update(u32 TDeltaTime) { if(Enabled) { + World->stepSimulation(TDeltaTime * 0.001f * SimulationSpeed, 10); // Handle collision callbacks @@ -110,7 +113,6 @@ btQuaternion QuaternionRotation(TRotation.Y * DEGTORAD, TRotation.X * DEGTORAD, TRotation.Z * DEGTORAD); // Transform - TTransform; TTransform.setIdentity(); TTransform.setOrigin(btVector3(TPosition.X, TPosition.Y, TPosition.Z)); TTransform.setRotation(QuaternionRotation); diff -Naur irrlamb/src/engine/physics.h irrlamb.tpg/src/engine/physics.h --- irrlamb/src/engine/physics.h 2007-08-10 06:38:08.000000000 +0000 +++ irrlamb.tpg/src/engine/physics.h 2008-06-03 16:07:20.000000000 +0000 @@ -71,8 +71,9 @@ private: + btDefaultCollisionConfiguration *CollisionConfiguration; btCollisionDispatcher *Dispatcher; - btOverlappingPairCache *BroadPhase; + btBroadphaseInterface *BroadPhase; btSequentialImpulseConstraintSolver *Solver; btDiscreteDynamicsWorld *World; diff -Naur irrlamb/src/objects/basicjoint.cpp irrlamb.tpg/src/objects/basicjoint.cpp --- irrlamb/src/objects/basicjoint.cpp 2007-08-10 06:38:08.000000000 +0000 +++ irrlamb.tpg/src/objects/basicjoint.cpp 2008-06-03 16:02:06.000000000 +0000 @@ -39,7 +39,7 @@ TransformB = btTransform::getIdentity(); // Create joint - btGeneric6DofConstraint *NewJoint = new btGeneric6DofConstraint(*TObject.BodyA->GetBody(), *TObject.BodyB->GetBody(), TransformA, TransformB); + btGeneric6DofConstraint *NewJoint = new btGeneric6DofConstraint(*TObject.BodyA->GetBody(), *TObject.BodyB->GetBody(), TransformA, TransformB, true); // Set limits NewJoint->setLinearLowerLimit(TObject.LinearLimit[0]);