2.50:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 8 Jun 2009 20:08:19 +0000 (20:08 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 8 Jun 2009 20:08:19 +0000 (20:08 +0000)
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD

Notes:
* Game and sequencer RNA, and sequencer header are now out of date
  a bit after changes in trunk.
* I didn't know how to port these bugfixes, most likely they are
  not needed anymore.
  * Fix "duplicate strip" always increase the user count for ipo.
  * IPO pinning on sequencer strips was lost during Undo.

594 files changed:
1  2 
CMake/macros.cmake
CMakeLists.txt
config/irix6-config.py
config/linux2-config.py
extern/CMakeLists.txt
extern/Makefile
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
extern/bullet2/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
extern/bullet2/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h
extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
extern/bullet2/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp
extern/bullet2/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h
extern/bullet2/src/CMakeLists.txt
extern/bullet2/src/LinearMath/btScalar.h
extern/libopenjpeg/jp2.c
intern/CMakeLists.txt
intern/SoundSystem/fmod/Makefile
intern/SoundSystem/fmod/SND_FmodDevice.cpp
intern/SoundSystem/fmod/SND_FmodDevice.h
intern/SoundSystem/openal/SND_OpenALDevice.cpp
intern/SoundSystem/sdl/SND_SDLCDDevice.cpp
intern/ghost/intern/GHOST_SystemCarbon.cpp
intern/ghost/intern/GHOST_SystemCarbon.h
intern/guardedalloc/intern/mmap_win.c
projectfiles_vc9/gameengine/converter/KX_converter.vcproj
projectfiles_vc9/gameengine/expression/EXP_expressions.vcproj
projectfiles_vc9/gameengine/gamelogic/SCA_GameLogic.vcproj
projectfiles_vc9/gameengine/gameplayer/ghost/GP_ghost.vcproj
projectfiles_vc9/gameengine/ketsji/KX_ketsji.vcproj
projectfiles_vc9/gameengine/ketsji/network/KX_network.vcproj
projectfiles_vc9/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj
projectfiles_vc9/gameengine/rasterizer/RAS_rasterizer.vcproj
projectfiles_vc9/gameengine/rasterizer/openglrasterizer/RAS_openglrasterizer.vcproj
projectfiles_vc9/gameengine/scenegraph/SG_SceneGraph.vcproj
projectfiles_vc9/gameengine/videotexture/TEX_Video.vcproj
release/Makefile
release/datafiles/splash.jpg
release/scripts/3ds_export.py
release/scripts/3ds_import.py
release/scripts/DirectX8Exporter.py
release/scripts/add_mesh_torus.py
release/scripts/animation_clean.py
release/scripts/bpymodules/BPyMathutils.py
release/scripts/bpymodules/BPyMesh.py
release/scripts/bpymodules/BPyMesh_octree.py
release/scripts/bpymodules/BPyMesh_redux.py
release/scripts/bpymodules/BPyWindow.py
release/scripts/bpymodules/dxfLibrary.py
release/scripts/bpymodules/mesh_gradient.py
release/scripts/bpymodules/paths_svg2obj.py
release/scripts/c3d_import.py
release/scripts/console.py
release/scripts/envelope_symmetry.py
release/scripts/export_dxf.py
release/scripts/export_fbx.py
release/scripts/export_obj.py
release/scripts/help_bpy_api.py
release/scripts/help_getting_started.py
release/scripts/help_manual.py
release/scripts/help_release_notes.py
release/scripts/help_tutorials.py
release/scripts/help_web_blender.py
release/scripts/help_web_devcomm.py
release/scripts/help_web_eshop.py
release/scripts/help_web_usercomm.py
release/scripts/image_2d_cutout.py
release/scripts/import_dxf.py
release/scripts/import_obj.py
release/scripts/import_web3d.py
release/scripts/lightwave_export.py
release/scripts/md2_export.py
release/scripts/mesh_mirror_tool.py
release/scripts/mesh_poly_reduce_grid.py
release/scripts/mesh_skin.py
release/scripts/mesh_unfolder.py
release/scripts/object_active_to_other.py
release/scripts/object_cookie_cutter.py
release/scripts/object_drop.py
release/scripts/ply_import.py
release/scripts/rvk1_torvk2.py
release/scripts/scripttemplate_gamelogic.py
release/scripts/scripttemplate_gamelogic_basic.py
release/scripts/scripttemplate_gamelogic_module.py
release/scripts/textplugin_convert_ge.py
release/scripts/uvcalc_quad_clickproj.py
release/scripts/uvcalc_smart_project.py
release/scripts/vertexpaint_selfshadow_ao.py
release/scripts/wizard_bolt_factory.py
release/scripts/wizard_curve2tree.py
release/scripts/wizard_landscape_ant.py
release/scripts/xfig_export.py
release/ui/space_sequencer.py
source/CMakeLists.txt
source/Makefile
source/blender/CMakeLists.txt
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/BKE_sequence.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/Makefile
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/bmfont.c
source/blender/blenkernel/intern/bullet.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/sca.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequence.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/world.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/BLI_string.h
source/blender/blenlib/BLI_vfontdata.h
source/blender/blenlib/intern/storage.c
source/blender/blenlib/intern/string.c
source/blender/blenlib/intern/util.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/animation/anim_ipo_utils.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/poseobject.c
source/blender/editors/armature/reeb.c
source/blender/editors/curve/editfont.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/mesh/editdeform.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_edit.c
source/blender/editors/physics/editparticle.c
source/blender/editors/preview/previewrender.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_buttons.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/gpu/GPU_material.h
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/IMB_imbuf.h
source/blender/imbuf/intern/anim.c
source/blender/imbuf/intern/imageprocess.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/rotate.c
source/blender/imbuf/intern/scaling.c
source/blender/makesdna/CMakeLists.txt
source/blender/makesdna/DNA_actuator_types.h
source/blender/makesdna/DNA_controller_types.h
source/blender/makesdna/DNA_object_force.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_sensor_types.h
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesrna/CMakeLists.txt
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/nodes/intern/CMP_nodes/CMP_normalize.c
source/blender/nodes/intern/CMP_nodes/CMP_scale.c
source/blender/nodes/intern/SHD_nodes/SHD_dynamic.c
source/blender/nodes/intern/SHD_nodes/SHD_material.c
source/blender/nodes/intern/SHD_nodes/SHD_math.c
source/blender/nodes/intern/SHD_nodes/SHD_vectMath.c
source/blender/nodes/intern/TEX_nodes/TEX_bricks.c
source/blender/nodes/intern/TEX_nodes/TEX_translate.c
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/texture.c
source/blender/windowmanager/intern/wm_cursors.c
source/creator/CMakeLists.txt
source/creator/buildinfo.c
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
source/gameengine/CMakeLists.txt
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ActionActuator.h
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/BL_ArmatureObject.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_DeformableGameObject.cpp
source/gameengine/Converter/BL_DeformableGameObject.h
source/gameengine/Converter/BL_MeshDeformer.cpp
source/gameengine/Converter/BL_MeshDeformer.h
source/gameengine/Converter/BL_ModifierDeformer.cpp
source/gameengine/Converter/BL_ModifierDeformer.h
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/BL_ShapeActionActuator.h
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/BL_ShapeDeformer.h
source/gameengine/Converter/BL_SkinDeformer.cpp
source/gameengine/Converter/BL_SkinDeformer.h
source/gameengine/Converter/BL_SkinMeshObject.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.h
source/gameengine/Converter/KX_ConvertActuators.cpp
source/gameengine/Converter/KX_ConvertActuators.h
source/gameengine/Converter/KX_ConvertControllers.cpp
source/gameengine/Converter/KX_ConvertControllers.h
source/gameengine/Converter/KX_ConvertProperties.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/Converter/KX_ConvertSensors.h
source/gameengine/Expressions/BoolValue.cpp
source/gameengine/Expressions/BoolValue.h
source/gameengine/Expressions/CMakeLists.txt
source/gameengine/Expressions/EmptyValue.cpp
source/gameengine/Expressions/ErrorValue.cpp
source/gameengine/Expressions/ErrorValue.h
source/gameengine/Expressions/FloatValue.cpp
source/gameengine/Expressions/FloatValue.h
source/gameengine/Expressions/IfExpr.cpp
source/gameengine/Expressions/InputParser.cpp
source/gameengine/Expressions/InputParser.h
source/gameengine/Expressions/IntValue.cpp
source/gameengine/Expressions/IntValue.h
source/gameengine/Expressions/ListValue.cpp
source/gameengine/Expressions/ListValue.h
source/gameengine/Expressions/Makefile
source/gameengine/Expressions/PyObjectPlus.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/SConscript
source/gameengine/Expressions/StringValue.cpp
source/gameengine/Expressions/StringValue.h
source/gameengine/Expressions/Value.cpp
source/gameengine/Expressions/Value.h
source/gameengine/Expressions/VectorValue.cpp
source/gameengine/Expressions/VectorValue.h
source/gameengine/GameLogic/CMakeLists.txt
source/gameengine/GameLogic/Joystick/Makefile
source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
source/gameengine/GameLogic/Joystick/SCA_Joystick.h
source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
source/gameengine/GameLogic/Makefile
source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
source/gameengine/GameLogic/SCA_2DFilterActuator.h
source/gameengine/GameLogic/SCA_ANDController.cpp
source/gameengine/GameLogic/SCA_ANDController.h
source/gameengine/GameLogic/SCA_ActuatorEventManager.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.cpp
source/gameengine/GameLogic/SCA_ActuatorSensor.h
source/gameengine/GameLogic/SCA_AlwaysEventManager.cpp
source/gameengine/GameLogic/SCA_AlwaysSensor.cpp
source/gameengine/GameLogic/SCA_AlwaysSensor.h
source/gameengine/GameLogic/SCA_DelaySensor.cpp
source/gameengine/GameLogic/SCA_DelaySensor.h
source/gameengine/GameLogic/SCA_EventManager.cpp
source/gameengine/GameLogic/SCA_EventManager.h
source/gameengine/GameLogic/SCA_ExpressionController.cpp
source/gameengine/GameLogic/SCA_ExpressionController.h
source/gameengine/GameLogic/SCA_IActuator.cpp
source/gameengine/GameLogic/SCA_IActuator.h
source/gameengine/GameLogic/SCA_IController.cpp
source/gameengine/GameLogic/SCA_IController.h
source/gameengine/GameLogic/SCA_ILogicBrick.cpp
source/gameengine/GameLogic/SCA_ILogicBrick.h
source/gameengine/GameLogic/SCA_IObject.cpp
source/gameengine/GameLogic/SCA_IObject.h
source/gameengine/GameLogic/SCA_IScene.cpp
source/gameengine/GameLogic/SCA_IScene.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickManager.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GameLogic/SCA_KeyboardManager.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
source/gameengine/GameLogic/SCA_KeyboardSensor.h
source/gameengine/GameLogic/SCA_LogicManager.cpp
source/gameengine/GameLogic/SCA_LogicManager.h
source/gameengine/GameLogic/SCA_MouseManager.cpp
source/gameengine/GameLogic/SCA_MouseSensor.cpp
source/gameengine/GameLogic/SCA_MouseSensor.h
source/gameengine/GameLogic/SCA_NANDController.cpp
source/gameengine/GameLogic/SCA_NANDController.h
source/gameengine/GameLogic/SCA_NORController.cpp
source/gameengine/GameLogic/SCA_NORController.h
source/gameengine/GameLogic/SCA_ORController.cpp
source/gameengine/GameLogic/SCA_ORController.h
source/gameengine/GameLogic/SCA_PropertyActuator.cpp
source/gameengine/GameLogic/SCA_PropertyActuator.h
source/gameengine/GameLogic/SCA_PropertyEventManager.cpp
source/gameengine/GameLogic/SCA_PropertySensor.cpp
source/gameengine/GameLogic/SCA_PropertySensor.h
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/GameLogic/SCA_PythonController.h
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GameLogic/SCA_RandomActuator.h
source/gameengine/GameLogic/SCA_RandomEventManager.cpp
source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
source/gameengine/GameLogic/SCA_RandomSensor.cpp
source/gameengine/GameLogic/SCA_RandomSensor.h
source/gameengine/GameLogic/SCA_TimeEventManager.cpp
source/gameengine/GameLogic/SCA_XNORController.cpp
source/gameengine/GameLogic/SCA_XNORController.h
source/gameengine/GameLogic/SCA_XORController.cpp
source/gameengine/GameLogic/SCA_XORController.h
source/gameengine/GameLogic/SConscript
source/gameengine/GamePlayer/CMakeLists.txt
source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/BL_BlenderShader.cpp
source/gameengine/Ketsji/BL_BlenderShader.h
source/gameengine/Ketsji/BL_Material.cpp
source/gameengine/Ketsji/BL_Material.h
source/gameengine/Ketsji/BL_Shader.cpp
source/gameengine/Ketsji/BL_Shader.h
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
source/gameengine/Ketsji/KXNetwork/Makefile
source/gameengine/Ketsji/KXNetwork/SConscript
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.h
source/gameengine/Ketsji/KX_CDActuator.cpp
source/gameengine/Ketsji/KX_CDActuator.h
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_CameraActuator.cpp
source/gameengine/Ketsji/KX_CameraActuator.h
source/gameengine/Ketsji/KX_ClientObjectInfo.h
source/gameengine/Ketsji/KX_ConstraintActuator.cpp
source/gameengine/Ketsji/KX_ConstraintActuator.h
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.h
source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_Dome.cpp
source/gameengine/Ketsji/KX_Dome.h
source/gameengine/Ketsji/KX_GameActuator.cpp
source/gameengine/Ketsji/KX_GameActuator.h
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_IPhysicsController.cpp
source/gameengine/Ketsji/KX_IPhysicsController.h
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_IpoActuator.h
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h
source/gameengine/Ketsji/KX_Light.cpp
source/gameengine/Ketsji/KX_Light.h
source/gameengine/Ketsji/KX_MeshProxy.cpp
source/gameengine/Ketsji/KX_MeshProxy.h
source/gameengine/Ketsji/KX_MotionState.cpp
source/gameengine/Ketsji/KX_MotionState.h
source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.h
source/gameengine/Ketsji/KX_NearSensor.cpp
source/gameengine/Ketsji/KX_NearSensor.h
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_ObjectActuator.h
source/gameengine/Ketsji/KX_OdePhysicsController.h
source/gameengine/Ketsji/KX_ParentActuator.cpp
source/gameengine/Ketsji/KX_ParentActuator.h
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.cpp
source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolyProxy.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
source/gameengine/Ketsji/KX_PyMath.cpp
source/gameengine/Ketsji/KX_PyMath.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/KX_PythonInit.h
source/gameengine/Ketsji/KX_PythonInitTypes.cpp
source/gameengine/Ketsji/KX_PythonSeq.cpp
source/gameengine/Ketsji/KX_PythonSeq.h
source/gameengine/Ketsji/KX_RadarSensor.cpp
source/gameengine/Ketsji/KX_RadarSensor.h
source/gameengine/Ketsji/KX_RayEventManager.cpp
source/gameengine/Ketsji/KX_RaySensor.cpp
source/gameengine/Ketsji/KX_RaySensor.h
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
source/gameengine/Ketsji/KX_SCA_DynamicActuator.cpp
source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.cpp
source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.cpp
source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Ketsji/KX_Scene.h
source/gameengine/Ketsji/KX_SceneActuator.cpp
source/gameengine/Ketsji/KX_SceneActuator.h
source/gameengine/Ketsji/KX_SoundActuator.cpp
source/gameengine/Ketsji/KX_SoundActuator.h
source/gameengine/Ketsji/KX_StateActuator.cpp
source/gameengine/Ketsji/KX_StateActuator.h
source/gameengine/Ketsji/KX_SumoPhysicsController.h
source/gameengine/Ketsji/KX_TouchEventManager.cpp
source/gameengine/Ketsji/KX_TouchSensor.cpp
source/gameengine/Ketsji/KX_TouchSensor.h
source/gameengine/Ketsji/KX_TrackToActuator.cpp
source/gameengine/Ketsji/KX_TrackToActuator.h
source/gameengine/Ketsji/KX_VehicleWrapper.cpp
source/gameengine/Ketsji/KX_VehicleWrapper.h
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/Ketsji/KX_VertexProxy.h
source/gameengine/Ketsji/KX_VisibilityActuator.cpp
source/gameengine/Ketsji/KX_VisibilityActuator.h
source/gameengine/Ketsji/SConscript
source/gameengine/Network/NG_NetworkScene.cpp
source/gameengine/Physics/BlOde/OdePhysicsController.cpp
source/gameengine/Physics/BlOde/OdePhysicsController.h
source/gameengine/Physics/BlOde/OdePhysicsEnvironment.cpp
source/gameengine/Physics/BlOde/OdePhysicsEnvironment.h
source/gameengine/Physics/Bullet/CMakeLists.txt
source/gameengine/Physics/Bullet/CcdGraphicController.cpp
source/gameengine/Physics/Bullet/CcdGraphicController.h
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
source/gameengine/Physics/Bullet/Makefile
source/gameengine/Physics/Bullet/SConscript
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.cpp
source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
source/gameengine/Physics/Sumo/SumoPhysicsController.cpp
source/gameengine/Physics/Sumo/SumoPhysicsController.h
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.cpp
source/gameengine/Physics/Sumo/SumoPhysicsEnvironment.h
source/gameengine/Physics/common/PHY_IGraphicController.h
source/gameengine/Physics/common/PHY_IMotionState.h
source/gameengine/Physics/common/PHY_IPhysicsController.h
source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
source/gameengine/PyDoc/API_intro.py
source/gameengine/PyDoc/BL_ActionActuator.py
source/gameengine/PyDoc/BL_Shader.py
source/gameengine/PyDoc/BL_ShapeActionActuator.py
source/gameengine/PyDoc/CListValue.py
source/gameengine/PyDoc/GameKeys.py
source/gameengine/PyDoc/GameLogic.py
source/gameengine/PyDoc/GameTypes.py
source/gameengine/PyDoc/KX_BlenderMaterial.py
source/gameengine/PyDoc/KX_CDActuator.py
source/gameengine/PyDoc/KX_Camera.py
source/gameengine/PyDoc/KX_CameraActuator.py
source/gameengine/PyDoc/KX_ConstraintActuator.py
source/gameengine/PyDoc/KX_ConstraintWrapper.py
source/gameengine/PyDoc/KX_GameActuator.py
source/gameengine/PyDoc/KX_GameObject.py
source/gameengine/PyDoc/KX_IpoActuator.py
source/gameengine/PyDoc/KX_LightObject.py
source/gameengine/PyDoc/KX_MeshProxy.py
source/gameengine/PyDoc/KX_MouseFocusSensor.py
source/gameengine/PyDoc/KX_NearSensor.py
source/gameengine/PyDoc/KX_NetworkMessageActuator.py
source/gameengine/PyDoc/KX_NetworkMessageSensor.py
source/gameengine/PyDoc/KX_ObjectActuator.py
source/gameengine/PyDoc/KX_ParentActuator.py
source/gameengine/PyDoc/KX_PhysicsObjectWrapper.py
source/gameengine/PyDoc/KX_PolyProxy.py
source/gameengine/PyDoc/KX_PolygonMaterial.py
source/gameengine/PyDoc/KX_RadarSensor.py
source/gameengine/PyDoc/KX_RaySensor.py
source/gameengine/PyDoc/KX_SCA_AddObjectActuator.py
source/gameengine/PyDoc/KX_SCA_DynamicActuator.py
source/gameengine/PyDoc/KX_SCA_EndObjectActuator.py
source/gameengine/PyDoc/KX_SCA_ReplaceMeshActuator.py
source/gameengine/PyDoc/KX_Scene.py
source/gameengine/PyDoc/KX_SceneActuator.py
source/gameengine/PyDoc/KX_SoundActuator.py
source/gameengine/PyDoc/KX_StateActuator.py
source/gameengine/PyDoc/KX_TouchSensor.py
source/gameengine/PyDoc/KX_TrackToActuator.py
source/gameengine/PyDoc/KX_VehicleWrapper.py
source/gameengine/PyDoc/KX_VertexProxy.py
source/gameengine/PyDoc/KX_VisibilityActuator.py
source/gameengine/PyDoc/Rasterizer.py
source/gameengine/PyDoc/SCA_2DFilterActuator.py
source/gameengine/PyDoc/SCA_ANDController.py
source/gameengine/PyDoc/SCA_ActuatorSensor.py
source/gameengine/PyDoc/SCA_AlwaysSensor.py
source/gameengine/PyDoc/SCA_DelaySensor.py
source/gameengine/PyDoc/SCA_IActuator.py
source/gameengine/PyDoc/SCA_IController.py
source/gameengine/PyDoc/SCA_ILogicBrick.py
source/gameengine/PyDoc/SCA_ISensor.py
source/gameengine/PyDoc/SCA_JoystickSensor.py
source/gameengine/PyDoc/SCA_KeyboardSensor.py
source/gameengine/PyDoc/SCA_MouseSensor.py
source/gameengine/PyDoc/SCA_NANDController.py
source/gameengine/PyDoc/SCA_NORController.py
source/gameengine/PyDoc/SCA_ORController.py
source/gameengine/PyDoc/SCA_PropertyActuator.py
source/gameengine/PyDoc/SCA_PropertySensor.py
source/gameengine/PyDoc/SCA_PythonController.py
source/gameengine/PyDoc/SCA_RandomActuator.py
source/gameengine/PyDoc/SCA_RandomSensor.py
source/gameengine/PyDoc/SCA_XNORController.py
source/gameengine/PyDoc/SCA_XORController.py
source/gameengine/PyDoc/WhatsNew.py
source/gameengine/PyDoc/bge_api_validate_py.txt
source/gameengine/PyDoc/epy_docgen.sh
source/gameengine/Rasterizer/CMakeLists.txt
source/gameengine/Rasterizer/Makefile
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
source/gameengine/Rasterizer/RAS_BucketManager.cpp
source/gameengine/Rasterizer/RAS_BucketManager.h
source/gameengine/Rasterizer/RAS_CameraData.h
source/gameengine/Rasterizer/RAS_Deformer.h
source/gameengine/Rasterizer/RAS_FramingManager.cpp
source/gameengine/Rasterizer/RAS_FramingManager.h
source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
source/gameengine/Rasterizer/RAS_IRasterizer.h
source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
source/gameengine/Rasterizer/RAS_MaterialBucket.h
source/gameengine/Rasterizer/RAS_MeshObject.cpp
source/gameengine/Rasterizer/RAS_MeshObject.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/Makefile
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
source/gameengine/Rasterizer/RAS_TexVert.cpp
source/gameengine/Rasterizer/SConscript
source/gameengine/SceneGraph/SG_DList.h
source/gameengine/SceneGraph/SG_IObject.cpp
source/gameengine/SceneGraph/SG_IObject.h
source/gameengine/SceneGraph/SG_Node.cpp
source/gameengine/SceneGraph/SG_Node.h
source/gameengine/SceneGraph/SG_QList.h
source/gameengine/SceneGraph/SG_Spatial.cpp
source/gameengine/SceneGraph/SG_Spatial.h
source/gameengine/VideoTexture/BlendType.h
source/gameengine/VideoTexture/FilterBlueScreen.cpp
source/gameengine/VideoTexture/FilterColor.cpp
source/gameengine/VideoTexture/FilterNormal.cpp
source/gameengine/VideoTexture/FilterSource.cpp
source/gameengine/VideoTexture/ImageBase.cpp
source/gameengine/VideoTexture/ImageBuff.cpp
source/gameengine/VideoTexture/ImageMix.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/PyTypeList.cpp
source/gameengine/VideoTexture/Texture.cpp
source/gameengine/VideoTexture/VideoBase.cpp
source/gameengine/VideoTexture/VideoBase.h
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/VideoFFmpeg.h
source/gameengine/VideoTexture/blendVideoTex.cpp
source/kernel/gen_system/GEN_HashedPtr.cpp
source/nan_definitions.mk
tools/Blender.py
tools/btools.py

@@@ -59,26 -59,9 +59,43 @@@ ENDMACRO(SETUP_LIBDIRS
  MACRO(SETUP_LIBLINKS
    target)
    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
--  TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
++  #TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
++
++  TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
++
++  # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
++
++  IF(WIN32)
++
++            TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
++
++            TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
++
++  ELSE(WIN32)
++
++            TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
++
++  ENDIF(WIN32)
++
 +
 +  TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
 +  TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIB})
 +
 +  # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
 +
 +  IF(WIN32)
 +
 +            TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
 +
 +            TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
 +
 +            ELSE(WIN32)
 +
 +            TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
 +
 +  ENDIF(WIN32)
 +
    IF(WITH_INTERNATIONAL)
 -    TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIB})
      TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
    ENDIF(WITH_INTERNATIONAL)
    IF(WITH_OPENAL)
diff --cc CMakeLists.txt
@@@ -99,20 -99,20 +99,6 @@@ IF(UNIX
      ENDIF(OPENAL_FOUND)
    ENDIF(WITH_OPENAL)
  
--  FIND_LIBRARY(ALUT_LIBRARY
--    NAMES alut
--    PATHS
--    /usr/local/lib
--    /usr/lib
--    /sw/lib
--    /opt/local/lib
--    /opt/csw/lib
--    /opt/lib
--  )
--  IF(ALUT_LIBRARY)
--    SET(OPENAL_LIB ${OPENAL_LIB} ${ALUT_LIBRARY})
--  ENDIF(ALUT_LIBRARY)
--
    FIND_LIBRARY(INTL_LIBRARY
      NAMES intl
      PATHS
@@@ -288,7 -285,7 +274,7 @@@ IF(WIN32
  
    SET(FFMPEG ${LIBDIR}/ffmpeg)
    SET(FFMPEG_INC ${FFMPEG}/include)
--  SET(FFMPEG_LIB avcodec-51 avformat-52 avdevice-52 avutil-49 swscale-0)
++  SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
    SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
  
    IF(CMAKE_CL_64)
@@@ -468,20 -464,20 +454,18 @@@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS
  #-----------------------------------------------------------------------------
  # Libraries
  FILE(WRITE ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt "")
--SUBDIRS(
--  intern
--  extern
--  source
--)
++ADD_SUBDIRECTORY(intern)
++ADD_SUBDIRECTORY(extern)
++ADD_SUBDIRECTORY(source)
  
  
  #-----------------------------------------------------------------------------
  # Blender Application
--SUBDIRS(source/creator)
++ADD_SUBDIRECTORY(source/creator)
  
  
  #-----------------------------------------------------------------------------
  # Blender Player
  IF(WITH_PLAYER)
--  SUBDIRS(blenderplayer)
++  ADD_SUBDIRECTORY(blenderplayer)
  ENDIF(WITH_PLAYER)
@@@ -20,11 -24,11 +20,6 @@@ BF_OPENAL_LIB = 'openal
  BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
  BF_OPENAL_LIBPATH = LIBDIR + '/lib'
  
--# some distros have a separate libalut
--# if you get linker complaints, you need to uncomment the line below
--# BF_OPENAL_LIB = 'openal alut'  
--# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
--
  BF_CXX = '/usr'
  WITH_BF_STATICCXX = 'false'
  BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
@@@ -1,9 -1,11 +1,17 @@@
  LCGDIR = '../lib/linux2'
  LIBDIR = "${LCGDIR}"
  
 -WITH_BF_VERSE = False
 -BF_VERSE_INCLUDE = "#extern/verse/dist"
++def py_version_string():
++      '''
++      returns py version - "2.5", "2.6" etc
++      '''
++      import platform
++      ver = platform.python_version_tuple()
++      return '%d.%d' % (int(ver[0]), int(ver[1])) # py2.5 uses strings, 2.6 ints
  BF_PYTHON = '/usr'
 -BF_PYTHON_VERSION = '2.5'
 +BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
- BF_PYTHON_VERSION = '2.5'
++BF_PYTHON_VERSION = py_version_string()
  WITH_BF_STATICPYTHON = False
  BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
  BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
@@@ -18,11 -20,11 +26,6 @@@ BF_OPENAL_INC = '${BF_OPENAL}/include
  BF_OPENAL_LIB = 'openal'
  BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
  
--# some distros have a separate libalut
--# if you get linker complaints, you need to uncomment the line below
--# BF_OPENAL_LIB = 'openal alut'  
--# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
--
  BF_CXX = '/usr'
  WITH_BF_STATICCXX = False
  BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
@@@ -71,7 -73,12 +74,8 @@@ BF_GETTEXT_INC = '${BF_GETTEXT}/include
  BF_GETTEXT_LIB = 'gettextlib'
  BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
  
 -WITH_BF_FTGL = True
 -BF_FTGL = '#extern/bFTGL'
 -BF_FTGL_INC = '${BF_FTGL}/include'
 -BF_FTGL_LIB = 'extern_ftgl'
 -
--WITH_BF_GAMEENGINE=False
++WITH_BF_GAMEENGINE = True
++WITH_BF_PLAYER = True
  
  WITH_BF_ODE = False
  BF_ODE = LIBDIR + '/ode'
  # ***** END GPL LICENSE BLOCK *****
  
  IF(WITH_GAMEENGINE)
--  SUBDIRS(qhull solid)
++  ADD_SUBDIRECTORY(qhull)
++  ADD_SUBDIRECTORY(solid)
  ENDIF(WITH_GAMEENGINE)
  
  IF(WITH_BULLET)
--  SUBDIRS(bullet2)
++  ADD_SUBDIRECTORY(bullet2)
  ENDIF(WITH_BULLET)
  
 -IF(WITH_INTERNATIONAL)
 -  SUBDIRS(bFTGL)
 -ENDIF(WITH_INTERNATIONAL)
 -
 -IF(WITH_VERSE)
 -  SUBDIRS(verse)
 -ENDIF(WITH_VERSE)
 -
  IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
--  SUBDIRS(binreloc)
++  ADD_SUBDIRECTORY(binreloc)
  ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
  
--SUBDIRS(glew)
++ADD_SUBDIRECTORY(glew)
  
  IF(WITH_OPENJPEG)
--  SUBDIRS(libopenjpeg)
++  ADD_SUBDIRECTORY(libopenjpeg)
  ENDIF(WITH_OPENJPEG)
diff --cc extern/Makefile
@@@ -41,9 -45,13 +41,10 @@@ ifeq ($(NAN_FFMPEG), $(LCGDIR)/gcc/ffmp
  endif
  endif
  
 -ifeq ($(WITH_VERSE), true)
 -   DIRS += verse
 -endif
 -
--ifneq ($(NAN_NO_KETSJI), true)
--    DIRS += bullet2
--endif
++# Cloth requires it
++#ifneq ($(NAN_NO_KETSJI), true)
++DIRS += bullet2
++#endif
  
  ifeq ($(WITH_BINRELOC), true)
      DIRS += binreloc
@@@ -22,12 -22,12 +22,13 @@@ Written by: Marcus Henni
  #include "LinearMath/btMinMax.h"
  #include <new>
  
--//-----------------------------------------------------------------------------
  
++
++//#define CONETWIST_USE_OBSOLETE_SOLVER true
  #define CONETWIST_USE_OBSOLETE_SOLVER false
  #define CONETWIST_DEF_FIX_THRESH btScalar(.05f)
  
--//-----------------------------------------------------------------------------
++
  
  btConeTwistConstraint::btConeTwistConstraint()
  :btTypedConstraint(CONETWIST_CONSTRAINT_TYPE),
@@@ -63,13 -63,13 +64,13 @@@ void btConeTwistConstraint::init(
        m_bMotorEnabled = false;
        m_maxMotorImpulse = btScalar(-1);
  
--      setLimit(btScalar(1e30), btScalar(1e30), btScalar(1e30));
++      setLimit(btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT), btScalar(BT_LARGE_FLOAT));
        m_damping = btScalar(0.01);
        m_fixThresh = CONETWIST_DEF_FIX_THRESH;
  }
  
  
--//-----------------------------------------------------------------------------
++
  
  void btConeTwistConstraint::getInfo1 (btConstraintInfo1* info)
  {
                        info->nub--;
                }
        }
--} // btConeTwistConstraint::getInfo1()
++}
        
--//-----------------------------------------------------------------------------
++
  
  void btConeTwistConstraint::getInfo2 (btConstraintInfo2* info)
  {
        }
  }
        
--//-----------------------------------------------------------------------------
++
  
  void  btConeTwistConstraint::buildJacobian()
  {
                m_appliedImpulse = btScalar(0.);
                m_accTwistLimitImpulse = btScalar(0.);
                m_accSwingLimitImpulse = btScalar(0.);
++              m_accMotorImpulse = btVector3(0.,0.,0.);
  
                if (!m_angularOnly)
                {
        }
  }
  
--//-----------------------------------------------------------------------------
++
  
  void  btConeTwistConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
  {
  
                        }
                }
--              else // no motor: do a little damping
++              else if (m_damping > SIMD_EPSILON) // no motor: do a little damping
                {
--                      const btVector3& angVelA = getRigidBodyA().getAngularVelocity();
--                      const btVector3& angVelB = getRigidBodyB().getAngularVelocity();
++                      btVector3 angVelA; bodyA.getAngularVelocity(angVelA);
++                      btVector3 angVelB; bodyB.getAngularVelocity(angVelB);
                        btVector3 relVel = angVelB - angVelA;
                        if (relVel.length2() > SIMD_EPSILON)
                        {
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  void  btConeTwistConstraint::updateRHS(btScalar       timeStep)
  {
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btConeTwistConstraint::calcAngleInfo()
  {
                        m_twistAxis.normalize();
                }
        }
--} // btConeTwistConstraint::calcAngleInfo()
++}
  
  
  static btVector3 vTwist(1,0,0); // twist axis in constraint's space
  
--//-----------------------------------------------------------------------------
++
  
  void btConeTwistConstraint::calcAngleInfo2()
  {
        m_twistLimitSign = btScalar(0.);
        m_solveTwistLimit = false;
        m_solveSwingLimit = false;
++      // compute rotation of A wrt B (in constraint space)
++      if (m_bMotorEnabled && (!m_useSolveConstraintObsolete))
++      {       // it is assumed that setMotorTarget() was alredy called 
++              // and motor target m_qTarget is within constraint limits
++              // TODO : split rotation to pure swing and pure twist
++              // compute desired transforms in world
++              btTransform trPose(m_qTarget);
++              btTransform trA = getRigidBodyA().getCenterOfMassTransform() * m_rbAFrame;
++              btTransform trB = getRigidBodyB().getCenterOfMassTransform() * m_rbBFrame;
++              btTransform trDeltaAB = trB * trPose * trA.inverse();
++              btQuaternion qDeltaAB = trDeltaAB.getRotation();
++              btVector3 swingAxis =   btVector3(qDeltaAB.x(), qDeltaAB.y(), qDeltaAB.z());
++              m_swingAxis = swingAxis;
++              m_swingAxis.normalize();
++              m_swingCorrection = qDeltaAB.getAngle();
++              if(!btFuzzyZero(m_swingCorrection))
++              {
++                      m_solveSwingLimit = true;
++              }
++              return;
++      }
++
  
        {
                // compute rotation of A wrt B (in constraint space)
                btQuaternion qA = getRigidBodyA().getCenterOfMassTransform().getRotation() * m_rbAFrame.getRotation();
                btQuaternion qB = getRigidBodyB().getCenterOfMassTransform().getRotation() * m_rbBFrame.getRotation();
                btQuaternion qAB = qB.inverse() * qA;
--
                // split rotation into cone and twist
                // (all this is done from B's perspective. Maybe I should be averaging axes...)
                btVector3 vConeNoTwist = quatRotate(qAB, vTwist); vConeNoTwist.normalize();
                        m_twistAngle = btScalar(0.f);
                }
        }
--} // btConeTwistConstraint::calcAngleInfo2()
++}
  
  
  
@@@ -982,8 -982,8 +1005,5 @@@ void btConeTwistConstraint::setMotorTar
  }
  
  
--//-----------------------------------------------------------------------------
--//-----------------------------------------------------------------------------
--//-----------------------------------------------------------------------------
  
  
@@@ -17,6 -17,6 +17,22 @@@ Written by: Marcus Henni
  
  
  
++/*
++Overview:
++
++btConeTwistConstraint can be used to simulate ragdoll joints (upper arm, leg etc).
++It is a fixed translation, 3 degree-of-freedom (DOF) rotational "joint".
++It divides the 3 rotational DOFs into swing (movement within a cone) and twist.
++Swing is divided into swing1 and swing2 which can have different limits, giving an elliptical shape.
++(Note: the cone's base isn't flat, so this ellipse is "embedded" on the surface of a sphere.)
++
++In the contraint's frame of reference:
++twist is along the x-axis,
++and swing 1 and 2 are along the z and y axes respectively.
++*/
++
++
++
  #ifndef CONETWISTCONSTRAINT_H
  #define CONETWISTCONSTRAINT_H
  
@@@ -141,7 -141,7 +157,18 @@@ public
                };
        }
  
--      void    setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan,  btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f)
++      // setLimit(), a few notes:
++      // _softness:
++      //              0->1, recommend ~0.8->1.
++      //              describes % of limits where movement is free.
++      //              beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached.
++      // _biasFactor:
++      //              0->1?, recommend 0.3 +/-0.3 or so.
++      //              strength with which constraint resists zeroth order (angular, not angular velocity) limit violation.
++      // __relaxationFactor:
++      //              0->1, recommend to stay near 1.
++      //              the lower the value, the less the constraint will fight velocities which violate the angular limits.
++      void    setLimit(btScalar _swingSpan1,btScalar _swingSpan2,btScalar _twistSpan, btScalar _softness = 1.f, btScalar _biasFactor = 0.3f, btScalar _relaxationFactor = 1.0f)
        {
                m_swingSpan1 = _swingSpan1;
                m_swingSpan2 = _swingSpan2;
@@@ -77,7 -77,7 +77,7 @@@ struct btContactSolverInfo : public btC
                m_splitImpulsePenetrationThreshold = -0.02f;
                m_linearSlop = btScalar(0.0);
                m_warmstartingFactor=btScalar(0.85);
--              m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD ;//SOLVER_RANDMIZE_ORDER
++              m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_USE_2_FRICTION_DIRECTIONS |SOLVER_SIMD | SOLVER_RANDMIZE_ORDER;
                m_restingContactRestitutionThreshold = 2;//resting contact lifetime threshold to disable restitution
        }
  };
@@@ -22,11 -22,11 +22,13 @@@ http://gimpact.sf.ne
  #include "btGeneric6DofConstraint.h"
  #include "BulletDynamics/Dynamics/btRigidBody.h"
  #include "LinearMath/btTransformUtil.h"
++#include "LinearMath/btTransformUtil.h"
  #include <new>
  
  
++
  #define D6_USE_OBSOLETE_METHOD false
--//-----------------------------------------------------------------------------
++
  
  btGeneric6DofConstraint::btGeneric6DofConstraint()
  :btTypedConstraint(D6_CONSTRAINT_TYPE),
@@@ -35,7 -35,7 +37,7 @@@ m_useSolveConstraintObsolete(D6_USE_OBS
  {
  }
  
--//-----------------------------------------------------------------------------
++
  
  btGeneric6DofConstraint::btGeneric6DofConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
  : btTypedConstraint(D6_CONSTRAINT_TYPE, rbA, rbB)
@@@ -46,12 -46,12 +48,12 @@@ m_useSolveConstraintObsolete(D6_USE_OBS
  {
  
  }
--//-----------------------------------------------------------------------------
++
  
  
  #define GENERIC_D6_DISABLE_WARMSTARTING 1
  
--//-----------------------------------------------------------------------------
++
  
  btScalar btGetMatrixElem(const btMatrix3x3& mat, int index);
  btScalar btGetMatrixElem(const btMatrix3x3& mat, int index)
@@@ -61,7 -61,7 +63,7 @@@
        return mat[i][j];
  }
  
--//-----------------------------------------------------------------------------
++
  
  ///MatrixToEulerXYZ from http://www.geometrictools.com/LibFoundation/Mathematics/Wm4Matrix3.inl.html
  bool  matrixToEulerXYZ(const btMatrix3x3& mat,btVector3& xyz);
@@@ -129,7 -129,7 +131,7 @@@ int btRotationalLimitMotor::testLimitVa
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  btScalar btRotationalLimitMotor::solveAngularLimits(
        btScalar timeStep,btVector3& axis,btScalar jacDiagABInv,
  
  
        // sort with accumulated impulses
--      btScalar        lo = btScalar(-1e30);
--      btScalar        hi = btScalar(1e30);
++      btScalar        lo = btScalar(-BT_LARGE_FLOAT);
++      btScalar        hi = btScalar(BT_LARGE_FLOAT);
  
        btScalar oldaccumImpulse = m_accumulatedImpulse;
        btScalar sum = oldaccumImpulse + clippedMotorImpulse;
@@@ -249,9 -249,9 +251,9 @@@ int btTranslationalLimitMotor::testLimi
        m_currentLimit[limitIndex] = 0;//Free from violation
        m_currentLimitError[limitIndex] = btScalar(0.f);
        return 0;
--} // btTranslationalLimitMotor::testLimitValue()
++}
++
  
--//-----------------------------------------------------------------------------
  
  btScalar btTranslationalLimitMotor::solveLinearAxis(
        btScalar timeStep,
  
        //positional error (zeroth order error)
        btScalar depth = -(pointInA - pointInB).dot(axis_normal_on_a);
--      btScalar        lo = btScalar(-1e30);
--      btScalar        hi = btScalar(1e30);
++      btScalar        lo = btScalar(-BT_LARGE_FLOAT);
++      btScalar        hi = btScalar(BT_LARGE_FLOAT);
  
        btScalar minLimit = m_lowerLimit[limit_index];
        btScalar maxLimit = m_upperLimit[limit_index];
@@@ -372,7 -372,7 +374,7 @@@ void btGeneric6DofConstraint::calculate
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::calculateTransforms()
  {
        calculateAngleInfo();
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::buildLinearJacobian(
        btJacobianEntry & jacLinear,const btVector3 & normalWorld,
          m_rbB.getInvMass());
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::buildAngularJacobian(
        btJacobianEntry & jacAngular,const btVector3 & jointAxisW)
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  bool btGeneric6DofConstraint::testAngularLimitMotor(int axis_index)
  {
        btScalar angle = m_calculatedAxisAngleDiff[axis_index];
++      m_angularLimits[axis_index].m_currentPosition = angle;
        //test limits
        m_angularLimits[axis_index].testLimitValue(angle);
        return m_angularLimits[axis_index].needApplyTorques();
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::buildJacobian()
  {
        }
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::getInfo1 (btConstraintInfo1* info)
  {
        }
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::getInfo2 (btConstraintInfo2* info)
  {
        setAngularLimits(info, row);
  }
  
--//-----------------------------------------------------------------------------
++
  
  int btGeneric6DofConstraint::setLinearLimits(btConstraintInfo2* info)
  {
                { // re-use rotational motor code
                        limot.m_bounce = btScalar(0.f);
                        limot.m_currentLimit = m_linearLimits.m_currentLimit[i];
++                      limot.m_currentPosition = m_linearLimits.m_currentLinearDiff[i];
                        limot.m_currentLimitError  = m_linearLimits.m_currentLimitError[i];
                        limot.m_damping  = m_linearLimits.m_damping;
                        limot.m_enableMotor  = m_linearLimits.m_enableMotor[i];
        return row;
  }
  
--//-----------------------------------------------------------------------------
++
  
  int btGeneric6DofConstraint::setAngularLimits(btConstraintInfo2 *info, int row_offset)
  {
        return row;
  }
  
--//-----------------------------------------------------------------------------
++
  
  void btGeneric6DofConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar        timeStep)
  {
        }
  }
  
--//-----------------------------------------------------------------------------
++
  
  void  btGeneric6DofConstraint::updateRHS(btScalar     timeStep)
  {
  
  }
  
--//-----------------------------------------------------------------------------
++
  
  btVector3 btGeneric6DofConstraint::getAxis(int axis_index) const
  {
        return m_calculatedAxis[axis_index];
  }
  
--//-----------------------------------------------------------------------------
  
--btScalar btGeneric6DofConstraint::getAngle(int axis_index) const
++btScalar      btGeneric6DofConstraint::getRelativePivotPosition(int axisIndex) const
  {
--      return m_calculatedAxisAngleDiff[axis_index];
++      return m_calculatedLinearDiff[axisIndex];
  }
  
--//-----------------------------------------------------------------------------
++
++btScalar btGeneric6DofConstraint::getAngle(int axisIndex) const
++{
++      return m_calculatedAxisAngleDiff[axisIndex];
++}
++
++
  
  void btGeneric6DofConstraint::calcAnchorPos(void)
  {
        const btVector3& pB = m_calculatedTransformB.getOrigin();
        m_AnchorPos = pA * weight + pB * (btScalar(1.0) - weight);
        return;
--} // btGeneric6DofConstraint::calcAnchorPos()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btGeneric6DofConstraint::calculateLinearInfo()
  {
        m_calculatedLinearDiff = m_calculatedTransformA.getBasis().inverse() * m_calculatedLinearDiff;
        for(int i = 0; i < 3; i++)
        {
++              m_linearLimits.m_currentLinearDiff[i] = m_calculatedLinearDiff[i];
                m_linearLimits.testLimitValue(i, m_calculatedLinearDiff[i]);
        }
--} // btGeneric6DofConstraint::calculateLinearInfo()
++}
++
  
--//-----------------------------------------------------------------------------
  
  int btGeneric6DofConstraint::get_limit_motor_info2(
        btRotationalLimitMotor * limot,
              J2[srow+1] = -ax1[1];
              J2[srow+2] = -ax1[2];
          }
--        if((!rotational) && limit)
++        if((!rotational))
          {
                        btVector3 ltd;  // Linear Torque Decoupling vector
                        btVector3 c = m_calculatedTransformB.getOrigin() - body0->getCenterOfMassPosition();
              info->cfm[srow] = 0.0f;
              if(!limit)
              {
--                info->m_constraintError[srow] += limot->m_targetVelocity;
++                              btScalar tag_vel = rotational ? limot->m_targetVelocity : -limot->m_targetVelocity;
++
++                              btScalar mot_fact = getMotorFactor(     limot->m_currentPosition, 
++                                                                                                      limot->m_loLimit,
++                                                                                                      limot->m_hiLimit, 
++                                                                                                      tag_vel, 
++                                                                                                      info->fps * info->erp);
++                              info->m_constraintError[srow] += mot_fact * limot->m_targetVelocity;
                  info->m_lowerLimit[srow] = -limot->m_maxMotorForce;
                  info->m_upperLimit[srow] = limot->m_maxMotorForce;
              }
      else return 0;
  }
  
--//-----------------------------------------------------------------------------
--//-----------------------------------------------------------------------------
--//-----------------------------------------------------------------------------
++
++
++
++btGeneric6DofSpringConstraint::btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA)
++      : btGeneric6DofConstraint(rbA, rbB, frameInA, frameInB, useLinearReferenceFrameA)
++{
++      for(int i = 0; i < 6; i++)
++      {
++              m_springEnabled[i] = false;
++              m_equilibriumPoint[i] = btScalar(0.f);
++              m_springStiffness[i] = btScalar(0.f);
++              m_springDamping[i] = btScalar(1.f);
++      }
++}
++
++
++void btGeneric6DofSpringConstraint::enableSpring(int index, bool onOff)
++{
++      btAssert((index >= 0) && (index < 6));
++      m_springEnabled[index] = onOff;
++      if(index < 3)
++      {
++              m_linearLimits.m_enableMotor[index] = onOff;
++      }
++      else
++      {
++              m_angularLimits[index - 3].m_enableMotor = onOff;
++      }
++}
++
++
++
++void btGeneric6DofSpringConstraint::setStiffness(int index, btScalar stiffness)
++{
++      btAssert((index >= 0) && (index < 6));
++      m_springStiffness[index] = stiffness;
++}
++
++
++void btGeneric6DofSpringConstraint::setDamping(int index, btScalar damping)
++{
++      btAssert((index >= 0) && (index < 6));
++      m_springDamping[index] = damping;
++}
++
++
++void btGeneric6DofSpringConstraint::setEquilibriumPoint()
++{
++      calculateTransforms();
++      for(int i = 0; i < 3; i++)
++      {
++              m_equilibriumPoint[i] = m_calculatedLinearDiff[i];
++      }
++      for(int i = 0; i < 3; i++)
++      {
++              m_equilibriumPoint[i + 3] = m_calculatedAxisAngleDiff[i];
++      }
++}
++
++
++
++void btGeneric6DofSpringConstraint::setEquilibriumPoint(int index)
++{
++      btAssert((index >= 0) && (index < 6));
++      calculateTransforms();
++      if(index < 3)
++      {
++              m_equilibriumPoint[index] = m_calculatedLinearDiff[index];
++      }
++      else
++      {
++              m_equilibriumPoint[index + 3] = m_calculatedAxisAngleDiff[index];
++      }
++}
++
++
++
++void btGeneric6DofSpringConstraint::internalUpdateSprings(btConstraintInfo2* info)
++{
++      calculateTransforms();
++      // it is assumed that calculateTransforms() have been called before this call
++      int i;
++      btVector3 relVel = m_rbB.getLinearVelocity() - m_rbA.getLinearVelocity();
++      for(i = 0; i < 3; i++)
++      {
++              if(m_springEnabled[i])
++              {
++                      // get current position of constraint
++                      btScalar currPos = m_calculatedLinearDiff[i];
++                      // calculate difference
++                      btScalar delta = currPos - m_equilibriumPoint[i];
++                      // spring force is (delta * m_stiffness) according to Hooke's Law
++                      btScalar force = delta * m_springStiffness[i];
++                      btScalar velFactor = info->fps * m_springDamping[i];
++                      m_linearLimits.m_targetVelocity[i] =  velFactor * force;
++                      m_linearLimits.m_maxMotorForce[i] =  btFabs(force) / info->fps;
++              }
++      }
++      for(i = 0; i < 3; i++)
++      {
++              if(m_springEnabled[i + 3])
++              {
++                      // get current position of constraint
++                      btScalar currPos = m_calculatedAxisAngleDiff[i];
++                      // calculate difference
++                      btScalar delta = currPos - m_equilibriumPoint[i+3];
++                      // spring force is (-delta * m_stiffness) according to Hooke's Law
++                      btScalar force = -delta * m_springStiffness[i+3];
++                      btScalar velFactor = info->fps * m_springDamping[i+3];
++                      m_angularLimits[i].m_targetVelocity = velFactor * force;
++                      m_angularLimits[i].m_maxMotorForce = btFabs(force) / info->fps;
++              }
++      }
++}
++
++
++void btGeneric6DofSpringConstraint::getInfo2(btConstraintInfo2* info)
++{
++      // this will be called by constraint solver at the constraint setup stage
++      // set current motor parameters
++      internalUpdateSprings(info);
++      // do the rest of job for constraint setup
++      btGeneric6DofConstraint::getInfo2(info);
++}
++
++
++
++
@@@ -54,6 -54,6 +54,7 @@@ public
      //! temp_variables
      //!@{
      btScalar m_currentLimitError;//!  How much is violated this limit
++    btScalar m_currentPosition;     //!  current value of angle 
      int m_currentLimit;//!< 0=free, 1=at lo limit, 2=at hi limit
      btScalar m_accumulatedImpulse;
      //!@}
@@@ -134,6 -134,6 +135,7 @@@ public
      btVector3 m_targetVelocity;//!< target motor velocity
      btVector3 m_maxMotorForce;//!< max force on motor
      btVector3 m_currentLimitError;//!  How much is violated this limit
++    btVector3 m_currentLinearDiff;//!  Current relative offset of constraint frames
      int                       m_currentLimit[3];//!< 0=free, 1=at lower limit, 2=at upper limit
  
      btTranslationalLimitMotor()
@@@ -380,14 -380,14 +382,21 @@@ public
  
      //! Get the relative Euler angle
      /*!
--      \pre btGeneric6DofConstraint.buildJacobian must be called previously.
++      \pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
        */
      btScalar getAngle(int axis_index) const;
  
++      //! Get the relative position of the constraint pivot
++    /*!
++      \pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
++      */
++      btScalar getRelativePivotPosition(int axis_index) const;
++
++
        //! Test angular limit.
        /*!
        Calculates angular correction and returns true if limit needs to be corrected.
--      \pre btGeneric6DofConstraint.buildJacobian must be called previously.
++      \pre btGeneric6DofConstraint::calculateTransforms() must be called previously.
        */
      bool testAngularLimitMotor(int axis_index);
  
  
  };
  
++
++/// Generic 6 DOF constraint that allows to set spring motors to any translational and rotational DOF
++
++/// DOF index used in enableSpring() and setStiffness() means:
++/// 0 : translation X
++/// 1 : translation Y
++/// 2 : translation Z
++/// 3 : rotation X (3rd Euler rotational around new position of X axis, range [-PI+epsilon, PI-epsilon] )
++/// 4 : rotation Y (2nd Euler rotational around new position of Y axis, range [-PI/2+epsilon, PI/2-epsilon] )
++/// 5 : rotation Z (1st Euler rotational around Z axis, range [-PI+epsilon, PI-epsilon] )
++
++class btGeneric6DofSpringConstraint : public btGeneric6DofConstraint
++{
++protected:
++      bool            m_springEnabled[6];
++      btScalar        m_equilibriumPoint[6];
++      btScalar        m_springStiffness[6];
++      btScalar        m_springDamping[6]; // between 0 and 1 (1 == no damping)
++      void internalUpdateSprings(btConstraintInfo2* info);
++public: 
++    btGeneric6DofSpringConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
++      void enableSpring(int index, bool onOff);
++      void setStiffness(int index, btScalar stiffness);
++      void setDamping(int index, btScalar damping);
++      void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
++      void setEquilibriumPoint(int index);  // set the current constraint position/orientation as an equilibrium point for given DOF
++      virtual void getInfo2 (btConstraintInfo2* info);
++};
++
++
  #endif //GENERIC_6DOF_CONSTRAINT_H
@@@ -490,7 -490,7 +490,7 @@@ void       btSequentialImpulseConstraintSolve
  
  
                                ///warm starting (or zero if disabled)
--                              if (0)//infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING)
++                              if (infoGlobal.m_solverMode & SOLVER_USE_WARMSTARTING)
                                {
                                        solverConstraint.m_appliedImpulse = cp.m_appliedImpulse * infoGlobal.m_warmstartingFactor;
                                        if (rb0)
                                                if (!(infoGlobal.m_solverMode & SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION) && lat_rel_vel > SIMD_EPSILON)
                                                {
                                                        cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel);
--                                                      applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
--                                                      applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
--                                                      addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
                                                        if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
                                                        {
                                                                cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB);
                                                                applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
                                                                addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
                                                        }
++
++                                                      applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
++                                                      applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
++                                                      addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
                                                        cp.m_lateralFrictionInitialized = true;
                                                } else
                                                {
                                                        //re-calculate friction direction every frame, todo: check if this is really needed
                                                        btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2);
--                                                      applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
--                                                      applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
--
--                                                      addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
                                                        if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS))
                                                        {
                                                                applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
                                                                applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
                                                                addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
                                                        }
++
++                                                      applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
++                                                      applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
++                                                      addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
++
                                                        cp.m_lateralFrictionInitialized = true;
                                                }
  
@@@ -18,14 -18,14 +18,14 @@@ Added by Roman Ponomarev (rponom@gmail.
  April 04, 2008
  */
  
--//-----------------------------------------------------------------------------
++
  
  #include "btSliderConstraint.h"
  #include "BulletDynamics/Dynamics/btRigidBody.h"
  #include "LinearMath/btTransformUtil.h"
  #include <new>
  
--//-----------------------------------------------------------------------------
++
  
  void btSliderConstraint::initParams()
  {
@@@ -62,9 -62,9 +62,9 @@@
      m_maxAngMotorForce = btScalar(0.);
        m_accumulatedAngMotorImpulse = btScalar(0.0);
  
--} // btSliderConstraint::initParams()
++}
++
  
--//-----------------------------------------------------------------------------
  
  btSliderConstraint::btSliderConstraint()
          :btTypedConstraint(SLIDER_CONSTRAINT_TYPE),
@@@ -73,9 -73,9 +73,9 @@@
  //            m_useSolveConstraintObsolete(true)
  {
        initParams();
--} // btSliderConstraint::btSliderConstraint()
++}
++
  
--//-----------------------------------------------------------------------------
  
  btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB, bool useLinearReferenceFrameA)
          : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, rbA, rbB)
  //            m_useSolveConstraintObsolete(true)
  {
        initParams();
--} // btSliderConstraint::btSliderConstraint()
++}
++
++
++static btRigidBody s_fixed(0, 0, 0);
++btSliderConstraint::btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB)
++        : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, s_fixed, rbB)
++        ,
++        m_frameInB(frameInB),
++              m_useLinearReferenceFrameA(useLinearReferenceFrameB),
++              m_useSolveConstraintObsolete(false)
++//            m_useSolveConstraintObsolete(true)
++{
++      ///not providing rigidbody B means implicitly using worldspace for body B
++//    m_frameInA.getOrigin() = m_rbA.getCenterOfMassTransform()(m_frameInA.getOrigin());
++
++      initParams();
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::buildJacobian()
  {
        {
                buildJacobianInt(m_rbB, m_rbA, m_frameInB, m_frameInA);
        }
--} // btSliderConstraint::buildJacobian()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::buildJacobianInt(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB)
  {
        // clear accumulator for motors
        m_accumulatedLinMotorImpulse = btScalar(0.0);
        m_accumulatedAngMotorImpulse = btScalar(0.0);
--} // btSliderConstraint::buildJacobianInt()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::getInfo1(btConstraintInfo1* info)
  {
                        info->nub--; 
                }
        }
--} // btSliderConstraint::getInfo1()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::getInfo2(btConstraintInfo2* info)
  {
                        info->m_constraintError[srow] *= getSoftnessLimAng();
                } // if(limit)
        } // if angular limit or powered
--} // btSliderConstraint::getInfo2()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::solveConstraintObsolete(btSolverBody& bodyA,btSolverBody& bodyB,btScalar timeStep)
  {
                        solveConstraintInt(m_rbB,bodyB, m_rbA,bodyA);
                }
        }
--} // btSliderConstraint::solveConstraint()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::solveConstraintInt(btRigidBody& rbA, btSolverBody& bodyA,btRigidBody& rbB, btSolverBody& bodyB)
  {
                        bodyB.applyImpulse(btVector3(0,0,0), rbB.getInvInertiaTensorWorld()*axisA,-angImpulse);
                }
        }
--} // btSliderConstraint::solveConstraint()
++}
++
++
  
--//-----------------------------------------------------------------------------
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::calculateTransforms(void){
        if(m_useLinearReferenceFrameA || (!m_useSolveConstraintObsolete))
                normalWorld = m_calculatedTransformA.getBasis().getColumn(i);
                m_depth[i] = m_delta.dot(normalWorld);
      }
--} // btSliderConstraint::calculateTransforms()
++}
   
--//-----------------------------------------------------------------------------
++
  
  void btSliderConstraint::testLinLimits(void)
  {
        {
                m_depth[0] = btScalar(0.);
        }
--} // btSliderConstraint::testLinLimits()
++}
++
  
--//-----------------------------------------------------------------------------
  
  void btSliderConstraint::testAngLimits(void)
  {
                        m_solveAngLim = true;
                }
        }
--} // btSliderConstraint::testAngLimits()
++}
        
--//-----------------------------------------------------------------------------
++
  
  btVector3 btSliderConstraint::getAncorInA(void)
  {
        ancorInA = m_realPivotAInW + (m_lowerLinLimit + m_upperLinLimit) * btScalar(0.5) * m_sliderAxis;
        ancorInA = m_rbA.getCenterOfMassTransform().inverse() * ancorInA;
        return ancorInA;
--} // btSliderConstraint::getAncorInA()
++}
++
  
--//-----------------------------------------------------------------------------
  
  btVector3 btSliderConstraint::getAncorInB(void)
  {
        btVector3 ancorInB;
        ancorInB = m_frameInB.getOrigin();
        return ancorInB;
--} // btSliderConstraint::getAncorInB();
++}
@@@ -25,23 -25,23 +25,23 @@@ TODO
  #ifndef SLIDER_CONSTRAINT_H
  #define SLIDER_CONSTRAINT_H
  
--//-----------------------------------------------------------------------------
++
  
  #include "LinearMath/btVector3.h"
  #include "btJacobianEntry.h"
  #include "btTypedConstraint.h"
  
--//-----------------------------------------------------------------------------
++
  
  class btRigidBody;
  
--//-----------------------------------------------------------------------------
++
  
  #define SLIDER_CONSTRAINT_DEF_SOFTNESS                (btScalar(1.0))
  #define SLIDER_CONSTRAINT_DEF_DAMPING         (btScalar(1.0))
  #define SLIDER_CONSTRAINT_DEF_RESTITUTION     (btScalar(0.7))
  
--//-----------------------------------------------------------------------------
++
  
  class btSliderConstraint : public btTypedConstraint
  {
@@@ -126,6 -126,6 +126,7 @@@ protected
  public:
        // constructors
      btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA);
++    btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB);
      btSliderConstraint();
        // overrides
      virtual void      buildJacobian();
        btVector3 getAncorInB(void);
  };
  
--//-----------------------------------------------------------------------------
++
  
  #endif //SLIDER_CONSTRAINT_H
  
@@@ -1,1 -1,1 +1,4 @@@
--SUBDIRS( BulletCollision BulletDynamics LinearMath BulletSoftBody )
++ADD_SUBDIRECTORY(BulletCollision)
++ADD_SUBDIRECTORY(BulletDynamics)
++ADD_SUBDIRECTORY(LinearMath)
++ADD_SUBDIRECTORY(BulletSoftBody )
@@@ -168,8 -168,8 +168,12 @@@ inline int        btGetVersion(
  ///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
  #if defined(BT_USE_DOUBLE_PRECISION)
  typedef double btScalar;
++//this number could be bigger in double precision
++#define BT_LARGE_FLOAT 1e30
  #else
  typedef float btScalar;
++//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX
++#define BT_LARGE_FLOAT 1e18f
  #endif
  
  
@@@ -561,6 -561,6 +561,7 @@@ opj_image_t* jp2_decode(opj_jp2_t *jp2
        image = j2k_decode(jp2->j2k, cio, cstr_info);
        if(!image) {
                opj_event_msg(cinfo, EVT_ERROR, "Failed to decode J2K image\n");
++              return NULL;
        }
  
        /* Set Image Color Space */
  #
  # ***** END GPL LICENSE BLOCK *****
  
- SUBDIRS(SoundSystem string ghost guardedalloc moto container memutil decimation iksolver boolop opennl)
 -SUBDIRS(SoundSystem string ghost guardedalloc bmfont moto container memutil decimation iksolver boolop opennl)
++ADD_SUBDIRECTORY(SoundSystem)
++ADD_SUBDIRECTORY(string)
++ADD_SUBDIRECTORY(ghost)
++ADD_SUBDIRECTORY(guardedalloc)
++ADD_SUBDIRECTORY(moto)
++ADD_SUBDIRECTORY(container)
++ADD_SUBDIRECTORY(memutil)
++ADD_SUBDIRECTORY(decimation)
++ADD_SUBDIRECTORY(iksolver)
++ADD_SUBDIRECTORY(boolop)
++ADD_SUBDIRECTORY(opennl)
  
  IF(WITH_ELBEEM)
--  SUBDIRS(elbeem)
++  ADD_SUBDIRECTORY(elbeem)
  ENDIF(WITH_ELBEEM)
  
--SUBDIRS(bsp)
++ADD_SUBDIRECTORY(bsp)
diff --cc intern/SoundSystem/fmod/Makefile
index 47bc034,47bc034..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,43 -1,43 +1,0 @@@
--#
--# $Id$
--#
--# ***** BEGIN GPL LICENSE BLOCK *****
--#
--# This program is free software; you can redistribute it and/or
--# modify it under the terms of the GNU General Public License
--# as published by the Free Software Foundation; either version 2
--# of the License, or (at your option) any later version.
--#
--# This program is distributed in the hope that it will be useful,
--# but WITHOUT ANY WARRANTY; without even the implied warranty of
--# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--# GNU General Public License for more details.
--#
--# You should have received a copy of the GNU General Public License
--# along with this program; if not, write to the Free Software Foundation,
--# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
--#
--# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
--# All rights reserved.
--#
--# The Original Code is: all of this file.
--#
--# Contributor(s): none yet.
--#
--# ***** END GPL LICENSE BLOCK *****
--#
--#
--
--LIBNAME = FmodSoundSystem
--DIR = $(OCGDIR)/intern/$(LIBNAME)
--
--include nan_compile.mk
--
--CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
--
--CPPFLAGS += -I$(NAN_FMOD)/include    
--CPPFLAGS += -I$(NAN_STRING)/include    
--CPPFLAGS += -I$(NAN_MOTO)/include
--CPPFLAGS += -I../intern
--CPPFLAGS += -I..
--CPPFLAGS += -I.
diff --cc intern/SoundSystem/fmod/SND_FmodDevice.cpp
index 3ba0802,3ba0802..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,574 -1,574 +1,0 @@@
--/*
-- * $Id$
-- *
-- * ***** BEGIN GPL LICENSE BLOCK *****
-- *
-- * This program is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU General Public License
-- * as published by the Free Software Foundation; either version 2
-- * of the License, or (at your option) any later version.
-- *
-- * This program is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software Foundation,
-- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-- *
-- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-- * All rights reserved.
-- *
-- * The Original Code is: all of this file.
-- *
-- * Contributor(s): none yet.
-- *
-- * ***** END GPL LICENSE BLOCK *****
-- * SND_FmodDevice derived from SND_IAudioDevice
-- */
--
--#ifdef HAVE_CONFIG_H
--#include <config.h>
--#endif
--
--#ifdef WIN32
--#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
--#endif //WIN32
--
--#include "SND_FmodDevice.h"
--#include "SoundDefines.h"
--#include "SND_Utils.h"
--
--SND_FmodDevice::SND_FmodDevice()
--{
--    /* Removed the functionality for checking if noaudio was provided on */
--    /* the commandline. */
--      m_dspunit = NULL;
--
--      m_audio = true;
--
--      // let's check if we can get fmod to initialize...
--      if (m_audio)
--      {
--              signed char MinHardwareChannels = FSOUND_SetMinHardwareChannels(NUM_FMOD_MIN_HW_CHANNELS);
--              signed char MaxHardwareChannels = FSOUND_SetMaxHardwareChannels(NUM_FMOD_MAX_HW_CHANNELS);
--
--              if (FSOUND_Init(MIXRATE, NUM_SOURCES, 0))
--              {
--                      m_max_channels = FSOUND_GetMaxChannels();
--                      m_num_hardware_channels = FSOUND_GetNumHardwareChannels();
--                      m_num_software_channels = NUM_SOURCES;
--
--                      // let's get us a wavecache
--                      m_wavecache = new SND_WaveCache();
--                      
--                      int i;
--                      for (i = 0; i < NUM_BUFFERS; i++)
--                              m_buffers[i] = NULL;
--
--                      for (i = 0; i < NUM_SOURCES; i++)
--                      {
--                              m_sources[i] = NULL;
--                              m_frequencies[i] = 0;
--                              m_channels[i] = 0;
--                      }
--              }
--              else
--              {
--                      m_audio = false;
--              }
--      }
--      
--#ifdef ONTKEVER
--      int numdrivers = FSOUND_GetNumDrivers();
--      int output = FSOUND_GetOutput();
--      int oputputrate = FSOUND_GetOutputRate();
--      int mixer = FSOUND_GetMixer();
--
--      printf("maxchannels is: %d\n", m_max_channels);
--      printf("num hw channels is: %d\n", m_num_hardware_channels);
--      printf("num sw channels is: %d\n", m_num_software_channels);
--      printf("numdrivers is: %d\n", numdrivers);
--      printf("output is: %d\n", output);
--      printf("oputputrate is: %d\n", oputputrate);
--      printf("mixer is: %d\n", mixer);
--#endif
--}
--
--
--
--SND_FmodDevice::~SND_FmodDevice()
--{
--      // let's see if we used the cd. if not, just leave it alone
--      SND_CDObject* pCD = SND_CDObject::Instance();
--      
--      if (pCD)
--      {
--              this->StopCD();
--              SND_CDObject::DisposeSystem();
--      }
--
--      StopUsingDSP();
--
--      FSOUND_Close();
--}
--
--
--
--void SND_FmodDevice::UseCD() const
--{
--      // only fmod has CD support, so only create it here
--      SND_CDObject::CreateSystem();
--}
--
--
--
--void SND_FmodDevice::MakeCurrent() const
--{
--      // empty
--}
--
--
--
--SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name,
--                                                                               void* memlocation,
--                                                                               int size)
--{
--      SND_WaveSlot* waveslot = NULL;
--      STR_String samplename = name;
--      
--      if (m_audio)
--      {
--              /* first check if the sample is supported */
--              if (SND_IsSampleValid(name, memlocation))
--              {
--                      /* create the waveslot */
--                      waveslot = m_wavecache->GetWaveSlot(samplename);
--                      
--                      if (waveslot)
--                      {
--                              int buffer = waveslot->GetBuffer();
--                              
--                              /* load the sample from memory? */
--                              if (size && memlocation)
--                              {
--                                      m_buffers[buffer] = FSOUND_Sample_Load(buffer, (char*)memlocation, FSOUND_LOADMEMORY, size);
--                                      
--                                      /* if the loading succeeded, fill the waveslot with info */
--                                      if (m_buffers[buffer])
--                                      {
--                                              int sampleformat = SND_GetSampleFormat(memlocation);
--                                              int numberofchannels = SND_GetNumberOfChannels(memlocation);
--                                              int samplerate = SND_GetSampleRate(memlocation);
--                                              int bitrate = SND_GetBitRate(memlocation);
--                                              int numberofsamples = SND_GetNumberOfSamples(memlocation, size);
--                                              
--                                              waveslot->SetFileSize(size);
--                                              waveslot->SetData(memlocation);
--                                              waveslot->SetSampleFormat(sampleformat);
--                                              waveslot->SetNumberOfChannels(numberofchannels);
--                                              waveslot->SetSampleRate(samplerate);
--                                              waveslot->SetBitRate(bitrate);
--                                              waveslot->SetNumberOfSamples(numberofsamples);
--                                      }
--                              }
--                              /* or from file? */
--                              else
--                              {
--                                      m_buffers[buffer] = FSOUND_Sample_Load(buffer, samplename.Ptr(), FSOUND_LOOP_NORMAL, NULL);
--                              }
--                              
--#ifdef ONTKEVER
--                              int error = FSOUND_GetError();
--                              printf("sample load: errornumber is: %d\n", error);
--#endif
--                              
--                              /* if the loading succeeded, mark the waveslot */
--                              if (m_buffers[buffer])
--                              {
--                                      waveslot->SetLoaded(true);
--                              }
--                              /* or when it failed, free the waveslot */
--                              else
--                              {
--                                      m_wavecache->RemoveSample(waveslot->GetSampleName(), waveslot->GetBuffer());
--                                      waveslot = NULL;
--                              }
--                      }
--              }
--      }
--      
--      return waveslot;
--}
--
--
--
--
--// listener's and general stuff //////////////////////////////////////////////////////
--
--
--
--/* sets the global dopplervelocity */
--void SND_FmodDevice::SetDopplerVelocity(MT_Scalar dopplervelocity) const
--{
--      /* not supported by fmod */
--      FSOUND_3D_Listener_SetDopplerFactor(dopplervelocity);
--}
--
--
--
--/* sets the global dopplerfactor */
--void SND_FmodDevice::SetDopplerFactor(MT_Scalar dopplerfactor) const
--{
--      FSOUND_3D_Listener_SetDopplerFactor(dopplerfactor);
--}
--
--
--
--/* sets the global rolloff factor */
--void SND_FmodDevice::SetListenerRollOffFactor(MT_Scalar rollofffactor) const
--{
--      // not implemented in openal
--}
--
--
--
--void SND_FmodDevice::NextFrame() const
--{
--      FSOUND_3D_Update();
--}
--
--
--
--// set the gain for the listener
--void SND_FmodDevice::SetListenerGain(float gain) const
--{
--      int fmod_gain = (int)(gain * 255);
--      FSOUND_SetSFXMasterVolume(fmod_gain);
--}
--
--
--
--void SND_FmodDevice::InitListener()
--{
--      // initialize the listener with these values that won't change
--      // (as long as we can have only one listener)
--      // now we can superimpose all listeners on each other (for they
--      // have the same settings)
--      float lispos[3] = {0,0,0};
--      float lisvel[3] = {0,0,0};
--
--      FSOUND_3D_Listener_SetAttributes(lispos, lisvel, 0, -1, 0, 0, 0, 1);
--}
--
--
--
--// source playstate stuff ////////////////////////////////////////////////////////////
--
--
--
--// check if the sound's still playing
--int SND_FmodDevice::GetPlayState(int id)
--{
--      int result = SND_STOPPED;
--
--      // klopt niet, fixen
--      signed char isplaying = FSOUND_IsPlaying(id);
--   
--      if (isplaying)
--      {
--              result = SND_PLAYING;
--      }
--
--/* hi reevan, just swap // of these 2 lines */
--//    return result;
--      return 0;
--}
--
--
--
--/* sets the buffer */
--void SND_FmodDevice::SetObjectBuffer(int id, unsigned int buffer)
--{
--      m_sources[id] = m_buffers[buffer];
--}
--
--
--
--// make the source play
--void SND_FmodDevice::PlayObject(int id)
--{
--      m_channels[id] = FSOUND_PlaySound(FSOUND_FREE, m_sources[id]);
--      m_frequencies[id] = FSOUND_GetFrequency(m_channels[id]);
--//    printf("fmod: play \n");
--}
--
--
--
--// make the source stop
--void SND_FmodDevice::StopObject(int id) const
--{
--      FSOUND_StopSound(m_channels[id]);
--//    printf("fmod: stop \n");
--}
--
--
--
--// stop all sources
--void SND_FmodDevice::StopAllObjects()
--{
--      FSOUND_StopSound(FSOUND_ALL);
--}
--
--
--
--// pause the source
--void SND_FmodDevice::PauseObject(int id) const
--{
--      FSOUND_StopSound(m_channels[id]);
--}
--
--
--
--// source properties stuff ////////////////////////////////////////////////////////////
--
--
--
--// give openal the object's pitch
--void SND_FmodDevice::SetObjectPitch(int id, MT_Scalar pitch) const
--{
--      pitch = pitch * m_frequencies[id];
--      char result = FSOUND_SetFrequency(m_channels[id], (int)pitch);
--}
--
--
--
--// give openal the object's gain
--void SND_FmodDevice::SetObjectGain(int id, MT_Scalar gain) const
--{
--      int vol = (int)(gain * 255);
--      FSOUND_SetVolume(m_channels[id], vol);
--}
--
--
--
--// give openal the object's looping
--void SND_FmodDevice::SetObjectLoop(int id, unsigned int loopmode) const
--{
--//    printf("loopmode: %d\n", loopmode);
--      switch (loopmode)
--      {
--      case SND_LOOP_OFF:
--              {
--#ifndef __APPLE__
--                      char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
--#else
--                      char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
--#endif
--//                    char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_OFF);
--                      break;
--              }
--      case SND_LOOP_NORMAL:
--              {
--#ifndef __APPLE__
--                      char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
--#else
--                      char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
--#endif
--//                    char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
--                      break;
--              }
--      case SND_LOOP_BIDIRECTIONAL:
--              {
--#ifndef __APPLE__
--                      char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
--#else
--                      char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
--#endif
--//                    char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
--                      break;
--              }
--      default:
--              break;
--      }
--}
--
--
--
--void SND_FmodDevice::SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const
--{
--      FSOUND_Sample_SetLoopPoints(m_sources[id], loopstart, loopend);
--}
--
--
--
--void SND_FmodDevice::SetObjectMinGain(int id, MT_Scalar mingain) const
--{
--      /* not supported by fmod */
--}
--
--
--
--void SND_FmodDevice::SetObjectMaxGain(int id, MT_Scalar maxgain) const
--{
--      /* not supported by fmod */
--}
--
--
--
--void SND_FmodDevice::SetObjectRollOffFactor(int id, MT_Scalar rollofffactor) const
--{
--      /* not supported by fmod */
--}
--
--
--
--void SND_FmodDevice::SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const
--{
--      /* not supported by fmod */
--}
--
--
--
--// give openal the object's position
--void SND_FmodDevice::ObjectIs2D(int id) const
--{
--      float obpos[3] = {0,0,0};
--      float obvel[3] = {0,0,0};
--      
--      FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
--}
--
--
--
--void SND_FmodDevice::SetObjectTransform(int id,
--                                                                                const MT_Vector3& position,
--                                                                                const MT_Vector3& velocity,
--                                                                                const MT_Matrix3x3& orientation,
--                                                                                const MT_Vector3& lisposition,
--                                                                                const MT_Scalar& rollofffactor) const 
--{
--      float obpos[3];
--      float obvel[3];
--
--      obpos[0] = (float)position[0] * (float)rollofffactor;   //x (l/r)
--      obpos[1] = (float)position[1] * (float)rollofffactor;
--      obpos[2] = (float)position[2] * (float)rollofffactor;
--
--      velocity.getValue(obvel);
--      FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
--}
--
--
--
--// cd support stuff ////////////////////////////////////////////////////////////
--
--
--void SND_FmodDevice::PlayCD(int track) const
--{
--#ifndef __APPLE__
--      signed char result = FSOUND_CD_Play(track);
--#else
--      signed char result = FSOUND_CD_Play(0, track);
--#endif
--
--#ifdef ONTKEVER
--      printf("SND_FmodDevice::PlayCD(): track=%d, result=%d\n", track, (int)result);
--#endif
--}
--
--
--
--void SND_FmodDevice::PauseCD(bool pause) const
--{
--#ifndef __APPLE__
--      signed char result = FSOUND_CD_SetPaused(pause);
--#else
--      signed char result = FSOUND_CD_SetPaused(0, pause);
--#endif
--
--#ifdef ONTKEVER
--      printf("SND_FmodDevice::PauseCD(): pause=%d, result=%d\n", pause, (int)result);
--#endif
--}
--
--
--
--void SND_FmodDevice::StopCD() const
--{
--      SND_CDObject* pCD = SND_CDObject::Instance();
--
--      if (pCD)
--      {
--              if (pCD->GetUsed())
--              {
--#ifndef __APPLE__
--                      signed char result = FSOUND_CD_Stop();
--#else
--                      signed char result = FSOUND_CD_Stop(0);
--#endif
--
--#ifdef ONTKEVER
--                      printf("SND_FmodDevice::StopCD(): result=%d\n", (int)result);
--#endif
--              }
--      }
--}
--
--
--
--void SND_FmodDevice::SetCDPlaymode(int playmode) const
--{
--#ifndef __APPLE__
--      FSOUND_CD_SetPlayMode(playmode);
--#else
--      FSOUND_CD_SetPlayMode(0, playmode);
--#endif
--
--#ifdef ONTKEVER
--      printf("SND_FmodDevice::SetCDPlaymode(): playmode=%d,\n", playmode);
--#endif
--}
--
--
--
--void SND_FmodDevice::SetCDGain(MT_Scalar gain) const
--{
--      int volume = gain * 255;
--#ifndef __APPLE__
--      signed char result = FSOUND_CD_SetVolume(volume);
--#else
--      signed char result = FSOUND_CD_SetVolume(0, volume);
--#endif
--
--#ifdef ONTKEVER
--      printf("SND_FmodDevice::SetCDGain(): gain=%f, volume=%d, result=%d\n", gain, volume, (int)result);
--#endif
--}
--
--
--
--void SND_FmodDevice::StartUsingDSP()
--{
--      m_dspunit = FSOUND_DSP_GetFFTUnit();
--
--      FSOUND_DSP_SetActive(m_dspunit, true);
--}
--
--
--
--float* SND_FmodDevice::GetSpectrum()
--{
--      m_spectrum = FSOUND_DSP_GetSpectrum();
--
--      return m_spectrum;
--}
--
--
--
--void SND_FmodDevice::StopUsingDSP()
--{
--      if (m_dspunit)
--              FSOUND_DSP_SetActive(m_dspunit, false);
--}
diff --cc intern/SoundSystem/fmod/SND_FmodDevice.h
index 294ee4e,294ee4e..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,103 -1,103 +1,0 @@@
--/**
-- * $Id$
-- *
-- * ***** BEGIN GPL LICENSE BLOCK *****
-- *
-- * This program is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU General Public License
-- * as published by the Free Software Foundation; either version 2
-- * of the License, or (at your option) any later version.
-- *
-- * This program is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- * GNU General Public License for more details.
-- *
-- * You should have received a copy of the GNU General Public License
-- * along with this program; if not, write to the Free Software Foundation,
-- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-- *
-- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-- * All rights reserved.
-- *
-- * The Original Code is: all of this file.
-- *
-- * Contributor(s): none yet.
-- *
-- * ***** END GPL LICENSE BLOCK *****
-- */
--#ifndef SND_FMODDEVICE
--#define SND_FMODDEVICE
--
--#include "fmod.h"
--#include "SND_AudioDevice.h"
--#include "SoundDefines.h"
--
--class SND_FmodDevice : public SND_AudioDevice
--{
--public:
--      SND_FmodDevice();
--      ~SND_FmodDevice();
--
--      SND_WaveSlot* LoadSample(const STR_String& samplename,
--                                                       void* memlocation,
--                                                       int size);
--
--      void InitListener();
--      void SetListenerGain(float gain) const;
--      void SetDopplerVelocity(MT_Scalar dopplervelocity) const;
--      void SetDopplerFactor(MT_Scalar dopplerfactor) const;
--      void SetListenerRollOffFactor(MT_Scalar rollofffactor) const;
--
--      void MakeCurrent() const;
--      void NextFrame() const;
--      void UseCD() const;
--
--      void SetObjectBuffer(int id, unsigned int buffer); 
--      int GetPlayState(int id);
--      void PlayObject(int id);
--      void StopObject(int id) const;
--      void StopAllObjects();
--      void PauseObject(int id) const;
--
--      void SetObjectLoop(int id, unsigned int loopmode) const;
--      void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const;
--      void SetObjectPitch(int id, MT_Scalar pitch) const;
--      void SetObjectGain(int id, MT_Scalar gain) const;
--      void SetObjectMinGain(int id, MT_Scalar mingain) const;
--      void SetObjectMaxGain(int id, MT_Scalar maxgain) const;
--      void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const;
--      void SetObjectReferenceDistance(int id, MT_Scalar distance) const;
--
--      void SetObjectTransform(int id,
--                                                      const MT_Vector3& position,
--                                                      const MT_Vector3& velocity,
--                                                      const MT_Matrix3x3& orientation,        
--                                                      const MT_Vector3& lisposition,
--                                                      const MT_Scalar& rollofffactor) const;
--      void ObjectIs2D(int id) const;
--
--      void PlayCD(int track) const;
--      void PauseCD(bool pause) const;
--      void StopCD() const;
--      void SetCDPlaymode(int playmode) const;
--      void SetCDGain(MT_Scalar gain) const;
--
--      void StartUsingDSP();
--      float* GetSpectrum();
--      void StopUsingDSP();
--
--private:
--      FSOUND_SAMPLE*  m_buffers[NUM_BUFFERS];
--      FSOUND_SAMPLE*  m_sources[NUM_SOURCES];
--      FSOUND_DSPUNIT* m_dspunit;
--      int                             m_frequencies[NUM_SOURCES];
--      int                             m_max_channels;
--      int                             m_num_hardware_channels;
--      int                             m_num_software_channels;
--      int                             m_channels[NUM_SOURCES];
--      float*                  m_spectrum;
--};
--
--#endif //SND_FMODDEVICE
--
  #ifdef APPLE_FRAMEWORK_FIX
  #include <al.h>
  #include <alc.h>
--#include <alut.h>
  #else
  #include <AL/al.h>
  #include <AL/alc.h>
--#include <AL/alut.h>
  #endif
  
  #include <stdio.h>
  
  #include <signal.h>
  
--/* untill openal gets unified we need this hack for non-windows systems */
--#if !defined(WIN32) && !defined(ALC_MAJOR_VERSION)
++/*************************** ALUT replacement *****************************/
  
--#include <malloc.h>
++/* instead of relying on alut, we just implement our own
++ * WAV loading functions, hopefully more reliable */
  
--ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop);
--ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq);
++#include <stdlib.h>
  
  typedef struct                                  /* WAV File-header */
  {
@@@ -120,93 -120,93 +117,189 @@@ typedef struc
    ALuint   Size;
  } WAVChunkHdr_Struct;
  
--ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
++static void *SND_loadFileIntoMemory(const char *filename, int *len_r)
++{
++      FILE *fp= fopen(filename, "rb");
++      void *data;
++
++      if (!fp) {
++              *len_r= -1;
++              return NULL;
++      }
++
++      fseek(fp, 0L, SEEK_END);
++      *len_r= ftell(fp);
++      fseek(fp, 0L, SEEK_SET);
++
++      data= malloc(*len_r);
++      if (!data) {
++              *len_r= -1;
++              return NULL;
++      }
++
++      if (fread(data, *len_r, 1, fp)!=1) {
++              *len_r= -1;
++              free(data);
++              return NULL;
++      }
++
++      return data;
++}
++
++#define TEST_SWITCH_INT(a) if(big_endian) { \
++    char s_i, *p_i; \
++    p_i= (char *)&(a); \
++    s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
++    s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
++
++#define TEST_SWITCH_SHORT(a) if(big_endian) { \
++    char s_i, *p_i; \
++    p_i= (char *)&(a); \
++    s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
++
++static int stream_read(void *out, ALbyte **stream, ALsizei size, ALsizei *memsize)
++{
++      if(size <= *memsize) {
++              memcpy(out, *stream, size);
++              return 1;
++      }
++      else {
++              memset(out, 0, size);
++              return 0;
++      }
++}
++
++static int stream_skip(ALbyte **stream, ALsizei size, ALsizei *memsize)
++{
++      if(size <= *memsize) {
++              *stream += size;
++              *memsize -= size;
++              return 1;
++      }
++      else
++              return 0;
++}
++
++ALvoid SND_alutLoadWAVMemory(ALbyte *memory,ALsizei memsize,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
  {
        WAVChunkHdr_Struct ChunkHdr;
        WAVFmtExHdr_Struct FmtExHdr;
        WAVFileHdr_Struct FileHdr;
        WAVSmplHdr_Struct SmplHdr;
        WAVFmtHdr_Struct FmtHdr;
--      ALbyte *Stream;
++      ALbyte *Stream= memory;
++      int test_endian= 1;
++      int big_endian= !((char*)&test_endian)[0];
        
        *format=AL_FORMAT_MONO16;
        *data=NULL;
        *size=0;
        *freq=22050;
        *loop=AL_FALSE;
--      if (memory)
++
++      if(!Stream)
++              return;
++ 
++      stream_read(&FileHdr,&Stream,sizeof(WAVFileHdr_Struct),&memsize);
++      stream_skip(&Stream,sizeof(WAVFileHdr_Struct),&memsize);
++
++      TEST_SWITCH_INT(FileHdr.Size);
++      FileHdr.Size=((FileHdr.Size+1)&~1)-4;
++
++      while((FileHdr.Size!=0) && stream_read(&ChunkHdr,&Stream,sizeof(WAVChunkHdr_Struct),&memsize))
        {
--              Stream=memory;
--              if (Stream)
++              TEST_SWITCH_INT(ChunkHdr.Size);
++              stream_skip(&Stream,sizeof(WAVChunkHdr_Struct),&memsize);
++
++              if (!memcmp(ChunkHdr.Id,"fmt ",4))
                {
--                      memcpy(&FileHdr,Stream,sizeof(WAVFileHdr_Struct));
--                      Stream+=sizeof(WAVFileHdr_Struct);
--                      FileHdr.Size=((FileHdr.Size+1)&~1)-4;
--                      while ((FileHdr.Size!=0)&&(memcpy(&ChunkHdr,Stream,sizeof(WAVChunkHdr_Struct))))
++                      stream_read(&FmtHdr,&Stream,sizeof(WAVFmtHdr_Struct),&memsize);
++
++                      TEST_SWITCH_SHORT(FmtHdr.Format);
++                      TEST_SWITCH_SHORT(FmtHdr.Channels);
++                      TEST_SWITCH_INT(FmtHdr.SamplesPerSec);
++                      TEST_SWITCH_INT(FmtHdr.BytesPerSec);
++                      TEST_SWITCH_SHORT(FmtHdr.BlockAlign);
++                      TEST_SWITCH_SHORT(FmtHdr.BitsPerSample);
++
++                      if (FmtHdr.Format==0x0001)
                        {
--                              Stream+=sizeof(WAVChunkHdr_Struct);
--                              if (!memcmp(ChunkHdr.Id,"fmt ",4))
--                              {
--                                      memcpy(&FmtHdr,Stream,sizeof(WAVFmtHdr_Struct));
--                                      if (FmtHdr.Format==0x0001)
--                                      {
--                                              *format=(FmtHdr.Channels==1?
--                                                              (FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
--                                                              (FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
--                                              *freq=FmtHdr.SamplesPerSec;
--                                              Stream+=ChunkHdr.Size;
--                                      } 
--                                      else
--                                      {
--                                              memcpy(&FmtExHdr,Stream,sizeof(WAVFmtExHdr_Struct));
--                                              Stream+=ChunkHdr.Size;
--                                      }
--                              }
--                              else if (!memcmp(ChunkHdr.Id,"data",4))
++                              *format=(FmtHdr.Channels==1?
++                                              (FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
++                                              (FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
++                              *freq=FmtHdr.SamplesPerSec;
++                      } 
++                      else
++                      {
++                              stream_read(&FmtExHdr,&Stream,sizeof(WAVFmtExHdr_Struct),&memsize);
++                              TEST_SWITCH_SHORT(FmtExHdr.Size);
++                              TEST_SWITCH_SHORT(FmtExHdr.SamplesPerBlock);
++                      }
++              }
++              else if (!memcmp(ChunkHdr.Id,"data",4))
++              {
++                      if (FmtHdr.Format==0x0001)
++                      {
++                              if((ALsizei)ChunkHdr.Size <= memsize)
                                {
--                                      if (FmtHdr.Format==0x0001)
--                                      {
--                                              *size=ChunkHdr.Size;
--                                              *data=malloc(ChunkHdr.Size+31);
--                                              if (*data) memcpy(*data,Stream,ChunkHdr.Size);
++                                      *size=ChunkHdr.Size;
++                                      *data=malloc(ChunkHdr.Size+31);
++
++                                      if (*data) {
++                                              stream_read(*data,&Stream,ChunkHdr.Size,&memsize);
                                                memset(((char *)*data)+ChunkHdr.Size,0,31);
--                                              Stream+=ChunkHdr.Size;
--                                      }
--                                      else if (FmtHdr.Format==0x0011)
--                                      {
--                                              //IMA ADPCM
--                                      }
--                                      else if (FmtHdr.Format==0x0055)
--                                      {
--                                              //MP3 WAVE
++
++                                              if(FmtHdr.BitsPerSample == 16 && big_endian) {
++                                                      int a, len= *size/2;
++                                                      short *samples= (short*)*data;
++
++                                                      for(a=0; a<len; a++) {
++                                                              TEST_SWITCH_SHORT(samples[a])
++                                                      }
++                                              }
                                        }
                                }
--                              else if (!memcmp(ChunkHdr.Id,"smpl",4))
--                              {
--                                      memcpy(&SmplHdr,Stream,sizeof(WAVSmplHdr_Struct));
--                                      *loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
--                                      Stream+=ChunkHdr.Size;
--                              }
--                              else Stream+=ChunkHdr.Size;
--                              Stream+=ChunkHdr.Size&1;
--                              FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
++                      }
++                      else if (FmtHdr.Format==0x0011)
++                      {
++                              //IMA ADPCM
++                      }
++                      else if (FmtHdr.Format==0x0055)
++                      {
++                              //MP3 WAVE
                        }
                }
++              else if (!memcmp(ChunkHdr.Id,"smpl",4))
++              {
++                      stream_read(&SmplHdr,&Stream,sizeof(WAVSmplHdr_Struct),&memsize);
++
++                      TEST_SWITCH_INT(SmplHdr.Manufacturer);
++                      TEST_SWITCH_INT(SmplHdr.Product);
++                      TEST_SWITCH_INT(SmplHdr.SamplePeriod);
++                      TEST_SWITCH_INT(SmplHdr.Note);
++                      TEST_SWITCH_INT(SmplHdr.FineTune);
++                      TEST_SWITCH_INT(SmplHdr.SMPTEFormat);
++                      TEST_SWITCH_INT(SmplHdr.SMPTEOffest);
++      &n