Revision: 2781
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2781&view=rev
Author:   ulteq
Date:     2012-06-05 22:21:15 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
-Fix: minor fixes
+improved automatic camera behavior switching
+fixed beamdebuginfo parser_warning

Modified Paths:
--------------
    
branches/20120601_Testing_v0.39.7/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    
branches/20120601_Testing_v0.39.7/source/main/physics/input_output/SerializedRig.cpp

Modified: 
branches/20120601_Testing_v0.39.7/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
===================================================================
--- 
branches/20120601_Testing_v0.39.7/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    2012-06-05 20:44:45 UTC (rev 2780)
+++ 
branches/20120601_Testing_v0.39.7/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    2012-06-05 22:21:15 UTC (rev 2781)
@@ -41,6 +41,12 @@
 
 void CameraBehaviorVehicleSpline::update(const CameraManager::cameraContext_t 
&ctx)
 {
+       if ( ctx.mCurrTruck->free_camerarail <= 0 )
+       {
+               CameraManager::getSingleton().switchToNextBehavior();
+               return;
+       }
+
        Vector3 dir = 
(ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodepos[0]].smoothpos
                - 
ctx.mCurrTruck->nodes[ctx.mCurrTruck->cameranodedir[0]].smoothpos).normalisedCopy();
 
@@ -51,43 +57,40 @@
                targetPitch = -asin(dir.dotProduct(Vector3::UNIT_Y));
        }
 
-       if ( ctx.mCurrTruck->free_camerarail > 0 )
+       if ( ctx.mCurrTruck->getAllLinkedBeams().size() != numLinkedBeams )
        {
-               if ( ctx.mCurrTruck->getAllLinkedBeams().size() != 
numLinkedBeams )
-               {
-                       createSpline(ctx);
-               }
-               updateSpline();
-               updateSplineDisplay();
+               createSpline(ctx);
+       }
+       updateSpline();
+       updateSplineDisplay();
 
-               camLookAt = spline->interpolate(splinePos);
+       camLookAt = spline->interpolate(splinePos);
 
-               if ( INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) && 
INPUTENGINE.isKeyDownValueBounce(OIS::KC_SPACE) )
+       if ( INPUTENGINE.isKeyDown(OIS::KC_LSHIFT) && 
INPUTENGINE.isKeyDownValueBounce(OIS::KC_SPACE) )
+       {
+               autoTracking = !autoTracking;
+#ifdef USE_MYGUI
+               if ( autoTracking )
                {
-                       autoTracking = !autoTracking;
-#ifdef USE_MYGUI
-                       if ( autoTracking )
-                       {
-                               
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("auto tracking") + U(" ") + _L("enabled"), 
"camera_go.png", 3000);
-                       } else
-                       {
-                               
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("auto tracking") + U(" ") + _L("disabled"), 
"camera_go.png", 3000);
-                       }
+                       
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("auto tracking") + U(" ") + _L("enabled"), 
"camera_go.png", 3000);
+               } else
+               {
+                       
Console::getSingleton().putMessage(Console::CONSOLE_MSGTYPE_INFO, 
Console::CONSOLE_SYSTEM_NOTICE, _L("auto tracking") + U(" ") + _L("disabled"), 
"camera_go.png", 3000);
+               }
 #endif // USE_MYGUI
-               }
+       }
 
-               if ( autoTracking )
+       if ( autoTracking )
+       {
+               Vector3 centerDir = ctx.mCurrTruck->getPosition() - camLookAt;
+               if ( centerDir.length() > 1.0f )
                {
-                       Vector3 centerDir = ctx.mCurrTruck->getPosition() - 
camLookAt;
-                       if ( centerDir.length() > 1.0f )
+                       centerDir.normalise();
+                       Radian oldTargetDirection = targetDirection;
+                       targetDirection = 
-atan2(centerDir.dotProduct(Vector3::UNIT_X), 
centerDir.dotProduct(-Vector3::UNIT_Z));
+                       if ( targetDirection.valueRadians() * 
oldTargetDirection.valueRadians() < 0.0f && centerDir.length() < camDistMin)
                        {
-                               centerDir.normalise();
-                               Radian oldTargetDirection = targetDirection;
-                               targetDirection = 
-atan2(centerDir.dotProduct(Vector3::UNIT_X), 
centerDir.dotProduct(-Vector3::UNIT_Z));
-                               if ( targetDirection.valueRadians() * 
oldTargetDirection.valueRadians() < 0.0f && centerDir.length() < camDistMin)
-                               {
-                                       camRotX = -camRotX;
-                               }
+                               camRotX = -camRotX;
                        }
                }
        }
@@ -169,6 +172,7 @@
        camDistMin = camDist = 
std::min(ctx.mCurrTruck->getMinimalCameraRadius(), 10.0f);
        camDist = camDistMin * 2.0f;
        
+       autoTracking = true;
        splinePos = 0.5f;
 }
 

Modified: 
branches/20120601_Testing_v0.39.7/source/main/physics/input_output/SerializedRig.cpp
===================================================================
--- 
branches/20120601_Testing_v0.39.7/source/main/physics/input_output/SerializedRig.cpp
        2012-06-05 20:44:45 UTC (rev 2780)
+++ 
branches/20120601_Testing_v0.39.7/source/main/physics/input_output/SerializedRig.cpp
        2012-06-05 22:21:15 UTC (rev 2781)
@@ -1939,7 +1939,7 @@
                                beams[pos].bounded=SHOCK2;
 
                                if (triggerdebug)
-                                       parser_warning(c, "Trigger added. 
BeamID " + TOSTRING(pos), PARSER_ERROR);
+                                       parser_warning(c, "Trigger added. 
BeamID " + TOSTRING(pos), PARSER_INFO);
                                beams[pos].shock = &shocks[free_shock];
                                shocks[free_shock].beamid = pos;
                                shocks[free_shock].trigger_switch_state = 0.0f; 
  // used as bool and countdowntimer, dont touch!

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to