Revision: 2611
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2611&view=rev
Author:   ulteq
Date:     2012-05-20 14:51:42 +0000 (Sun, 20 May 2012)
Log Message:
-----------
-Codechange: CameraSystem WIP (nearly done)
previous CameraBehaviorVehicle is now restored when re-entering a vehicle

Modified Paths:
--------------
    trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
    trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp
    trunk/source/main/gfx/camera/CameraManager.cpp

Modified: trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-20 
14:17:50 UTC (rev 2610)
+++ trunk/source/main/gfx/camera/CameraBehaviorCharacter.cpp    2012-05-20 
14:51:42 UTC (rev 2611)
@@ -69,6 +69,7 @@
        if ( ctx.mCurrTruck )
        {
                CameraManager::getSingleton().switchToNextBehavior();
+               return;
        } else if ( reset )
        {
                this->reset(ctx);

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-20 
14:17:50 UTC (rev 2610)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicle.cpp      2012-05-20 
14:51:42 UTC (rev 2611)
@@ -61,6 +61,7 @@
        if ( !ctx.mCurrTruck )
        {
                CameraManager::getSingleton().switchToNextBehavior();
+               return;
        } else if ( reset )
        {
                this->reset(ctx);

Modified: trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-20 14:17:50 UTC (rev 2610)
+++ trunk/source/main/gfx/camera/CameraBehaviorVehicleCineCam.cpp       
2012-05-20 14:51:42 UTC (rev 2611)
@@ -62,9 +62,7 @@
        {
                CameraManager::getSingleton().switchToNextBehavior();
                return;
-       }
-       
-       if ( reset )
+       } else if ( reset )
        {
                lastCineCam = 0;
                this->reset(ctx);
@@ -109,6 +107,7 @@
 
        currTruck->currentcamera = -1;
        currTruck->changedCamera();
+       currTruck = 0;
 }
 
 void CameraBehaviorVehicleCineCam::reset(const CameraManager::cameraContext_t 
&ctx)

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-20 14:17:50 UTC 
(rev 2610)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-20 14:51:42 UTC 
(rev 2611)
@@ -72,6 +72,8 @@
 
 void CameraManager::update(float dt)
 {
+       static std::stack<int> precedingBehaviors;
+
        if ( dt == 0 ) return;
 
        mTransScale = mTransSpeed  * dt;
@@ -102,10 +104,18 @@
 
        if ( !ctx.mCurrTruck && hasActiveVehicleBehavior() )
        {
+               precedingBehaviors.push(currentBehaviorID);
                switchBehavior(CAMERA_BEHAVIOR_CHARACTER);
        } else if ( ctx.mCurrTruck && hasActiveCharacterBehavior() )
        {
-               switchBehavior(CAMERA_BEHAVIOR_VEHICLE);
+               if ( !precedingBehaviors.empty() )
+               {
+                       switchBehavior(precedingBehaviors.top(), false);
+                       precedingBehaviors.pop();
+               } else
+               {
+                       switchBehavior(CAMERA_BEHAVIOR_VEHICLE);
+               }
        }
 
        if ( currentBehavior )

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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to