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

Modified Paths:
--------------
    trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
    trunk/source/main/physics/input_output/SerializedRig.cpp

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-06-05 22:21:15 UTC (rev 2781)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleSpline.cpp        
2012-06-05 22:23:57 UTC (rev 2782)
@@ -40,6 +40,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();
 
@@ -50,43 +56,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;
                        }
                }
        }

Modified: trunk/source/main/physics/input_output/SerializedRig.cpp
===================================================================
--- trunk/source/main/physics/input_output/SerializedRig.cpp    2012-06-05 
22:21:15 UTC (rev 2781)
+++ trunk/source/main/physics/input_output/SerializedRig.cpp    2012-06-05 
22:23:57 UTC (rev 2782)
@@ -1937,7 +1937,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